﻿* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background:
    linear-gradient(180deg, rgba(219, 234, 254, 0.86), rgba(247, 251, 255, 0.92) 42%, #f8fafc 100%),
    radial-gradient(circle at 16% 12%, rgba(56, 189, 248, 0.18), transparent 28%),
    radial-gradient(circle at 84% 6%, rgba(99, 102, 241, 0.14), transparent 24%);
  color: #172033;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

#app {
  min-height: 100vh;
}

.shell {
  width: min(100%, 860px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-header,
.card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(30, 64, 175, 0.08);
  backdrop-filter: blur(14px);
}

.game-header {
  padding: 18px 20px;
}

.game-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.game-title {
  color: #2563eb;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.1;
}

.game-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.level-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-bar-track {
  width: 72px;
  height: 10px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 4px;
  background: #f3f4f6;
}

.progress-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 0.2s ease;
}

.progress-count {
  color: #2563eb;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary,
.btn-upload {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #0891b2);
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.32);
}

.btn-upload {
  min-width: 96px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.86rem;
}

.btn-hint,
.btn-outline {
  color: #1e40af;
  background: #dbeafe;
  border: 1.5px solid #93c5fd;
}

.btn-restart,
.btn-neutral {
  color: #374151;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.btn-danger {
  color: #dc2626;
  background: #fee2e2;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(6px, 1.5vw, 12px);
  padding: clamp(10px, 2vw, 18px);
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(219, 234, 254, 0.82), rgba(224, 242, 254, 0.92));
  box-shadow: 0 20px 54px rgba(30, 64, 175, 0.12);
}

.cell {
  aspect-ratio: 1;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 10px 22px rgba(30, 64, 175, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  color: #172033;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(20px, 6vw, 30px);
  font-weight: 800;
  line-height: 1;
  user-select: none;
}

.cell:hover:not(.empty) {
  background: linear-gradient(180deg, #ffffff, #eff6ff);
  transform: translateY(-2px);
}

.cell.selected {
  border-color: #2563eb;
  background: linear-gradient(180deg, #eff6ff, #dbeafe);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.24), 0 6px 16px rgba(37, 99, 235, 0.18);
  transform: translateY(-2px);
}

.cell.hint {
  border-color: #22c55e;
  background: #f0fdf4;
  animation: hint-pulse 0.6s ease-in-out infinite alternate;
}

.cell.empty {
  pointer-events: none;
  color: transparent;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

@keyframes hint-pulse {
  from {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
  }
  to {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.15);
  }
}

.game-controls {
  display: flex;
  gap: 10px;
}

.game-controls .btn {
  flex: 1;
  min-height: 52px;
  border-radius: 18px;
  padding: 8px;
  font-size: 0.95rem;
}

.wordbook-entry {
  width: 100%;
  min-height: 54px;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 18px;
}

.wordbook-entry::after {
  content: "›";
  color: #9ca3af;
  font-size: 1.35rem;
  line-height: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  z-index: 80;
  max-width: calc(100vw - 48px);
  transform: translateX(-50%);
  border-radius: 24px;
  background: rgba(31, 41, 55, 0.88);
  color: #fff;
  padding: 10px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  animation: toast-in 0.18s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.milestone {
  margin: 0 16px -2px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.32);
  color: #fff;
  font-weight: 800;
  padding: 10px 20px;
  text-align: center;
}

.level-screen,
.wordbook-screen {
  width: min(100%, 860px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 16px 36px;
}

.screen-header {
  margin-bottom: 20px;
  text-align: center;
}

.screen-title {
  color: #2563eb;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0;
}

.screen-subtitle {
  margin-top: 4px;
  color: #9ca3af;
  font-size: 0.95rem;
}

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  padding: 4px;
}

.tab-btn {
  flex: 1;
  min-height: 38px;
  border-radius: 14px;
  color: #6b7280;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 700;
}

.tab-btn.active {
  color: #2563eb;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.tab-btn.custom {
  color: #2563eb;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1.5px solid #93c5fd;
}

.tab-btn.custom.active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  border-color: transparent;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.level-card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  padding: 20px 16px 16px;
  box-shadow: 0 14px 34px rgba(30, 64, 175, 0.08);
  text-align: left;
}

.level-card.locked {
  opacity: 0.5;
}

.level-card.completed {
  border-color: #86efac;
}

.level-card-band {
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
}

.grade-1 {
  background: linear-gradient(90deg, #38bdf8, #06b6d4);
}

.grade-2 {
  background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.grade-3 {
  background: linear-gradient(90deg, #1d4ed8, #7c3aed);
}

.level-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.level-number,
.level-card-sub,
.custom-meta {
  color: #9ca3af;
  font-size: 0.82rem;
}

.level-card-title {
  color: #1f2937;
  font-size: 1.08rem;
  font-weight: 800;
}

.custom-list {
  display: grid;
  gap: 10px;
}

.custom-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 34px rgba(30, 64, 175, 0.08);
  padding: 14px 16px;
}

.custom-card-top {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.custom-title {
  color: #1f2937;
  font-weight: 800;
}

.custom-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.custom-actions .btn {
  flex: 1;
  min-height: 40px;
  padding: 7px 10px;
  font-size: 0.9rem;
}

.empty-state {
  border: 2px dashed #38bdf8;
  border-radius: 22px;
  background: #eff6ff;
  color: #1e40af;
  padding: 32px 16px;
  text-align: center;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.back-btn {
  color: #2563eb;
  background: transparent;
  font-weight: 800;
  padding: 6px 0;
}

.wordbook-hero {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
  border-radius: 24px;
  background: linear-gradient(135deg, #2563eb, #0891b2);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.30);
  padding: 20px 24px;
}

.wordbook-num {
  color: #fff;
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}

.wordbook-label {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 800;
}

.word-section {
  margin-bottom: 12px;
  border: 1.5px solid #93c5fd;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  padding: 14px 16px;
}

.word-section.locked {
  border-color: #e5e7eb;
  background: #f9fafb;
}

.word-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.word-section-title {
  color: #1e40af;
  font-size: 0.95rem;
  font-weight: 800;
}

.word-section.locked .word-section-title {
  color: #9ca3af;
}

.word-section-badge {
  flex-shrink: 0;
  border: 1px solid #93c5fd;
  border-radius: 12px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 10px;
}

.word-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-chip {
  border: 1.5px solid #93c5fd;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 4px 12px;
}

.muted {
  color: #9ca3af;
  font-size: 0.9rem;
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 20px;
}

.modal-content {
  width: min(100%, 420px);
  max-height: min(84vh, 720px);
  overflow: auto;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
}

.modal-body {
  padding: 22px 20px;
}

.modal-title {
  color: #1f2937;
  font-size: 1.35rem;
  font-weight: 900;
}

.modal-sub {
  margin-top: 4px;
  color: #6b7280;
  font-size: 0.95rem;
}

.modal-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.input-panel {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  border: 2px dashed #38bdf8;
  border-radius: 22px;
  background: #eff6ff;
  padding: 16px;
}

.input-mode-tabs {
  display: flex;
  gap: 6px;
}

.input-mode-btn {
  flex: 1;
  min-height: 40px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #6b7280;
  font-size: 0.88rem;
  font-weight: 800;
}

.input-mode-btn.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #2563eb;
}

.upload-zone {
  border: 2px dashed #38bdf8;
  border-radius: 18px;
  background: #eff6ff;
  color: #1e40af;
  padding: 28px 16px;
  text-align: center;
}

.upload-zone strong {
  display: block;
  margin-top: 8px;
  font-size: 1.1rem;
}

.upload-zone span {
  display: block;
  margin-top: 4px;
  color: #2563eb;
  font-size: 0.85rem;
}

.paste-title,
.paste-textarea {
  width: 100%;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #1f2937;
  outline: none;
}

.paste-title {
  height: 42px;
  padding: 0 12px;
}

.paste-textarea {
  min-height: 190px;
  padding: 10px 12px;
  line-height: 1.6;
  resize: vertical;
}

.preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.preview-chip {
  border: 1.5px solid #93c5fd;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  padding: 5px 12px;
}

.warning-box {
  margin-top: 12px;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e40af;
  padding: 10px 12px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.complete-hero {
  background: linear-gradient(135deg, #2563eb, #0891b2);
  padding: 28px 28px 20px;
  text-align: center;
}

.complete-emoji {
  font-size: 3rem;
}

.complete-stars {
  margin-top: 6px;
  font-size: 1.8rem;
}

.complete-body {
  padding: 20px 28px 28px;
  text-align: center;
}

.footer-note {
  margin-top: auto;
  padding-top: 24px;
  color: #d1d5db;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-align: center;
}

@media (min-width: 760px) {
  .shell,
  .level-screen,
  .wordbook-screen {
    padding-top: 28px;
  }
}

