:root {
  --bg: #fff5e8;
  --card: #ffffff;
  --ink: #2f1c12;
  --muted: #7b6458;
  --red: #ef4444;
  --green: #22c55e;
  --gold: #f59e0b;
  --purple: #8b5cf6;
  --shadow: 0 24px 70px rgba(74, 45, 20, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(251, 191, 36, 0.35), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(248, 113, 113, 0.25), transparent 28rem),
    var(--bg);
}

button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 32px;
  box-shadow: var(--shadow);
}

.screen {
  min-height: 440px;
  padding: 40px;
  text-align: center;
}

.hidden {
  display: none;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.8rem, 8vw, 5.25rem);
}

h2 {
  font-size: clamp(2.1rem, 5vw, 4rem);
}

.intro,
.celebration-message {
  max-width: 640px;
  margin: 24px auto;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1.6;
}

.muted {
  color: var(--muted);
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, #f97316, #ec4899);
  box-shadow: 0 14px 30px rgba(236, 72, 153, 0.25);
}

.primary-button {
  margin-top: 12px;
  padding: 18px 34px;
  font-size: 1.2rem;
}

.level-picker {
  display: grid;
  max-width: 360px;
  margin: 0 auto 8px;
  gap: 10px;
  color: var(--muted);
  font-weight: 900;
}

.level-picker select {
  width: 100%;
  padding: 14px 18px;
  color: var(--ink);
  background: #fffaf0;
  border: 2px solid rgba(245, 158, 11, 0.35);
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
}

.top-row,
.history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.progress-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
}

.progress-current {
  display: inline-grid;
  width: 64px;
  height: 64px;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--gold), #ef4444);
  border-radius: 22px;
  box-shadow: 0 12px 24px rgba(245, 158, 11, 0.26);
  font-size: 2.3rem;
  line-height: 1;
}

.progress-context {
  display: grid;
  gap: 2px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.score-pill {
  margin: 0;
  padding: 8px 16px;
  color: white;
  background: var(--purple);
  border-radius: 999px;
  font-weight: 900;
}

.word-card {
  display: grid;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 230px;
  margin: 34px 0;
  padding: 58px 70px;
  place-items: center;
  border: 0;
  border-radius: 28px;
  background: #fffaf0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-size: clamp(6rem, 18vw, 12rem);
  font-weight: 900;
  line-height: 1;
}

.word-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: inherit;
  background-image:
    url("data:image/svg+xml,%3Csvg width='38' height='38' viewBox='0 0 38 38' xmlns='http://www.w3.org/2000/svg'%3E%3Ctext x='19' y='28' text-anchor='middle' font-size='25'%3E%F0%9F%92%A9%3C/text%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg width='38' height='38' viewBox='0 0 38 38' xmlns='http://www.w3.org/2000/svg'%3E%3Ctext x='19' y='28' text-anchor='middle' font-size='25'%3E%F0%9F%92%A9%3C/text%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg width='38' height='38' viewBox='0 0 38 38' xmlns='http://www.w3.org/2000/svg'%3E%3Ctext x='19' y='28' text-anchor='middle' font-size='25'%3E%F0%9F%92%A9%3C/text%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg width='38' height='38' viewBox='0 0 38 38' xmlns='http://www.w3.org/2000/svg'%3E%3Ctext x='19' y='28' text-anchor='middle' font-size='25'%3E%F0%9F%92%A9%3C/text%3E%3C/svg%3E");
  background-position:
    18px top,
    18px bottom,
    left 18px,
    right 18px;
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  background-size: 38px 38px;
  pointer-events: none;
}

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

.answer-button {
  min-height: 96px;
  color: white;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  box-shadow: 0 16px 28px rgba(47, 28, 18, 0.18);
}

.answer-button.incorrect {
  background: linear-gradient(135deg, #fb7185, var(--red));
}

.answer-button.correct {
  background: linear-gradient(135deg, #4ade80, var(--green));
}

.final-score {
  display: inline-grid;
  width: 170px;
  height: 170px;
  margin: 14px 0;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--gold), #ef4444, var(--purple));
  border-radius: 50%;
  box-shadow: 0 18px 45px rgba(239, 68, 68, 0.28);
  font-size: 3rem;
  font-weight: 900;
}

.result-super {
  background:
    radial-gradient(circle at 10% 20%, rgba(250, 204, 21, 0.5), transparent 10rem),
    radial-gradient(circle at 90% 25%, rgba(236, 72, 153, 0.45), transparent 12rem),
    radial-gradient(circle at 55% 85%, rgba(34, 197, 94, 0.35), transparent 14rem),
    rgba(255, 255, 255, 0.94);
}

.result-strong {
  background:
    radial-gradient(circle at 20% 15%, rgba(139, 92, 246, 0.35), transparent 12rem),
    radial-gradient(circle at 85% 80%, rgba(34, 197, 94, 0.3), transparent 14rem),
    rgba(255, 255, 255, 0.94);
}

.result-good {
  background:
    radial-gradient(circle at 30% 20%, rgba(245, 158, 11, 0.35), transparent 12rem),
    rgba(255, 255, 255, 0.94);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.history-card,
.practice-card {
  margin-top: 0;
  padding: 20px;
}

.history-heading h2 {
  font-size: 1.35rem;
}

.history-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.score-count-badge {
  padding: 5px 10px;
  color: var(--ink);
  background: #fffaf0;
  border: 2px solid rgba(245, 158, 11, 0.28);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.score-history {
  display: grid;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.score-empty {
  padding: 18px 14px;
  text-align: center;
  background: #fffaf0;
  border: 2px dashed rgba(245, 158, 11, 0.28);
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 700;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: #fffaf0;
  border: 1px solid rgba(47, 28, 18, 0.06);
  border-left-width: 4px;
  border-radius: 12px;
}

.score-rank {
  display: grid;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 900;
}

.score-percentage {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.score-percent-sign {
  font-size: 0.72rem;
  opacity: 0.72;
}

.score-level-badge {
  padding: 2px 7px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(47, 28, 18, 0.08);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
}

.score-fraction {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.score-tier-label {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.score-when {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.score-tier-super {
  border-left-color: var(--gold);
  background: linear-gradient(90deg, rgba(250, 204, 21, 0.12), rgba(255, 250, 240, 0.95));
}

.score-tier-super .score-rank {
  color: white;
  background: linear-gradient(135deg, var(--gold), #ef4444);
}

.score-tier-super .score-tier-label {
  color: #92400e;
  background: rgba(250, 204, 21, 0.35);
}

.score-tier-strong {
  border-left-color: var(--purple);
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.1), rgba(255, 250, 240, 0.95));
}

.score-tier-strong .score-rank {
  color: white;
  background: linear-gradient(135deg, var(--purple), var(--green));
}

.score-tier-strong .score-tier-label {
  color: #5b21b6;
  background: rgba(139, 92, 246, 0.2);
}

.score-tier-good {
  border-left-color: #fbbf24;
}

.score-tier-good .score-rank {
  color: white;
  background: linear-gradient(135deg, #fbbf24, var(--gold));
}

.score-tier-good .score-tier-label {
  color: #92400e;
  background: rgba(245, 158, 11, 0.22);
}

.score-tier-fair {
  border-left-color: #fb923c;
}

.score-tier-fair .score-tier-label {
  color: #9a3412;
  background: rgba(251, 146, 60, 0.22);
}

.score-tier-low {
  border-left-color: var(--red);
}

.score-tier-low .score-tier-label {
  color: #991b1b;
  background: rgba(239, 68, 68, 0.16);
}

.dashboard-grid .unknown-words {
  gap: 10px;
  margin: 14px 0 0;
}

.dashboard-grid .unknown-word-button {
  padding: 10px 14px;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.1);
}

.unknown-words {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.unknown-words li {
  display: flex;
}

.unknown-word-button {
  padding: 18px 26px;
  color: var(--ink);
  background: #fff1f2;
  border: 2px solid rgba(239, 68, 68, 0.22);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.12);
  font-size: clamp(3rem, 9vw, 4.5rem);
  font-weight: 900;
  line-height: 1;
}

.unknown-word-button:focus-visible {
  outline: 4px solid rgba(239, 68, 68, 0.32);
  outline-offset: 4px;
}

.unknown-words .muted {
  color: var(--muted);
  background: transparent;
  border: 0;
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .screen {
    min-height: 380px;
    padding: 28px 20px;
  }

  .top-row,
  .history-heading,
  .answer-buttons {
    grid-template-columns: 1fr;
  }

  .top-row,
  .history-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .score-row {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .score-when {
    margin-left: 0;
    width: 100%;
    padding-left: 30px;
    font-size: 0.68rem;
  }
}
