/* ================================================================
   至元德语 · 练习造句 - 共享样式（前后端分离版）
   保持与原版一致的视觉效果
   ================================================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: #333;
  min-height: 100vh;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── 登录提示页 ──────────────────────────────────────── */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  width: 100%;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.login-card h1 {
  color: #2c3e50;
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.login-card p {
  color: #7f8c8d;
  margin-bottom: 24px;
  line-height: 1.6;
}

.login-card .login-btn {
  display: inline-block;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  text-decoration: none;
  padding: 14px 32px;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.login-card .login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

/* ── Hub主页 ──────────────────────────────────────── */
.hub-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

.hub-header {
  text-align: center;
  margin-bottom: 20px;
  padding: 12px 0;
}

.hub-header h1 {
  color: #2c3e50;
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.hub-header .user-info {
  color: #7f8c8d;
  font-size: 0.95rem;
}

.hub-header .logout-btn {
  display: inline-block;
  margin-left: 12px;
  color: #e74c3c;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: underline;
}

.level-section {
  margin-bottom: 30px;
}

.level-title {
  font-size: 1.4rem;
  color: #2c3e50;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 3px solid #3498db;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.feature-card {
  background: linear-gradient(145deg, #ffffff, #f8f9fa);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15);
}

.card-header {
  padding: 18px;
  background: linear-gradient(135deg, #3498db, #2c3e50);
  color: white;
  text-align: center;
}

.card-header h2 {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.card-header i {
  font-size: 2rem;
  margin-bottom: 8px;
}

.card-body {
  padding: 20px;
}

.card-description {
  color: #7f8c8d;
  margin-bottom: 16px;
  line-height: 1.5;
}

.stats-container {
  display: flex;
  justify-content: space-around;
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(46, 204, 113, 0.08);
  border-radius: 10px;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 1.6rem;
  font-weight: bold;
  color: #3498db;
  display: block;
}

.stat-label {
  font-size: 0.85rem;
  color: #7f8c8d;
}

.progress-bar {
  height: 6px;
  background: #ecf0f1;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ── 练习页面 ──────────────────────────────────────── */
.container {
  max-width: 500px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.header {
  text-align: center;
  width: 100%;
  position: relative;
}

.header-nav {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #27ae60, #229954);
  color: white;
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
  cursor: pointer;
  border: none;
}

.back-btn:hover {
  background: linear-gradient(135deg, #229954, #1e8449);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.header h1 {
  font-size: 1.8rem;
  color: #2c3e50;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
  margin-bottom: 2px;
}

.cards-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 4px;
  margin: 2px 0;
}

.card {
  height: 72px;
  perspective: 1000px;
  width: 100%;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 12px;
  padding: 15px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.card-back {
  transform: rotateY(180deg);
}

.card-1 .card-front::before,
.card-2 .card-front::before,
.card-3 .card-front::before,
.card-4 .card-front::before,
.card-5 .card-front::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 8px;
  background: linear-gradient(to bottom, #27ae60, #229954);
  border-radius: 12px 0 0 12px;
}

.card-front {
  background: white;
  color: #2c3e50;
  font-size: 1.4rem;
}

.card-back {
  background: #2c3e50;
  color: white;
}

.card-0 .card-front {
  background: white;
  color: #2c3e50;
}

.card-0 .card-front .card-content {
  border-bottom: 2px solid #27ae60;
  padding-bottom: 5px;
}

.card-0 .card-back {
  background: #2c3e50;
  color: white;
}

.card-0 .card-back .card-content {
  border-bottom: 2px solid white;
  padding-bottom: 5px;
}

.card-number {
  font-size: 2.5rem;
  font-weight: bold;
}

.card-title {
  font-size: 1.4rem;
  font-weight: bold;
  margin-bottom: 4px;
}

.card-content {
  font-size: 1.4rem;
  line-height: 1.4;
}

.model-part {
  font-size: 1.4rem;
  font-weight: 500;
}

.validation-prompt {
  position: absolute;
  right: 15px;
  color: rgba(0, 0, 0, 0.5);
  font-size: 1.25rem;
}

.watermark {
  position: absolute;
  font-size: 4rem;
  font-weight: bold;
  opacity: 0.25;
  right: 12px;
  bottom: 0;
  z-index: 0;
  color: white;
}

.card-0 .card-back .watermark {
  color: #2c3e50;
  opacity: 0.2;
}

.card-0 .card-front .watermark {
  color: white;
  opacity: 0.2;
}

.hint-btn {
  position: absolute;
  right: 15px;
  bottom: 10px;
  background-color: #27ae60;
  color: white;
  border: none;
  border-radius: 15px;
  padding: 5px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0.7;
}

.hint-btn:hover {
  opacity: 1;
}

.hint-message {
  position: absolute;
  right: 15px;
  bottom: 40px;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 16px;
  border-radius: 15px;
  font-size: 1.1rem;
  z-index: 10;
  display: none;
}

.btn-container {
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: 6px;
  margin-top: 1px;
}

.btn {
  flex: 1;
  padding: 12px 8px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 30%;
  color: white;
}

.btn-answer { background-color: #e74c3c; }
.btn-reset { background-color: #f39c12; }
.btn-switch { background-color: #27ae60; }
.btn-random { background-color: #9b59b6; }
.btn-audio-zh { background-color: #2980b9; }
.btn-audio-de { background-color: #e67e22; }

.btn-audio-zh i,
.btn-audio-de i {
  margin-right: 4px;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.example-indicator {
  font-size: 0.9rem;
  color: #7f8c8d;
  text-align: right;
  position: absolute;
  right: 15px;
  top: 10px;
}

.instructions {
  background: rgba(236, 240, 241, 0.7);
  border-radius: 12px;
  padding: 12px;
  margin-top: 4px;
  width: 100%;
  border: 1px solid rgba(127, 140, 141, 0.2);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.instructions h2 {
  margin-bottom: 10px;
  text-align: center;
  font-size: 1.1rem;
  color: #2c3e50;
}

.instructions ol {
  padding-left: 18px;
}

.instructions li {
  margin-bottom: 5px;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #34495e;
}

.copyright {
  text-align: center;
  margin-top: 4px;
  width: 100%;
  font-size: 0.8rem;
  color: #7f8c8d;
}

.copyright-line {
  display: block;
}

.copyright-line:not(:last-child)::after {
  content: "";
  display: block;
  width: 30%;
  height: 1px;
  background: #ddd;
  margin: 5px auto;
}

/* ── 加载状态 ──────────────────────────────────────── */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  color: #7f8c8d;
  font-size: 1.2rem;
}

.loading::after {
  content: '';
  width: 20px;
  height: 20px;
  margin-left: 10px;
  border: 3px solid #ecf0f1;
  border-top-color: #3498db;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── 禁用拖拽和选择 ────────────────────────────────── */
img, a, button {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

/* ── 响应式 ──────────────────────────────────────── */
@media (max-width: 768px) {
  .hub-header h1 { font-size: 1.8rem; }
  .cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .btn {
    padding: 10px 5px;
    font-size: 0.8rem;
    min-width: 30%;
  }
  .card { height: 70px; }
  .card-number, .card-title, .card-content, .model-part {
    font-size: 1.2rem;
  }
}
