/* =======================================================================
   Vocabulary Quiz — warm study-paper theme · amber focus (light)
   ======================================================================= */

:root {
  --bg:          #FBF5E8;
  --bg-soft:     #F2E9D4;
  --surface:     #FFFFFF;
  --surface-2:   #F6EFDF;
  --surface-3:   #EADFC6;

  --line:        rgba(43, 35, 24, 0.11);
  --line-2:      rgba(43, 35, 24, 0.20);

  --text:        #2C2418;
  --text-dim:    #6F6553;
  --text-faint:  #978C72;

  --amber:       #F2A30C;
  --orange:      #E0590A;
  --orange-deep: #C44E06;
  --accent:      linear-gradient(132deg, #FBB615 0%, #E0590A 100%);
  --on-accent:   #FFFFFF;
  --highlight:   rgba(255, 198, 64, 0.68);

  --good:        #0E9A63;
  --good-dim:    rgba(14, 154, 99, 0.13);
  --bad:         #DD3F44;
  --bad-dim:     rgba(221, 63, 68, 0.11);

  --radius:      20px;

  --display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --body:    "Hanken Grotesk", "Segoe UI", sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--body);
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* warm ambient light in the corners */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
}
body::before {
  top: -280px;
  left: -220px;
  width: 640px;
  height: 640px;
  background: radial-gradient(circle, rgba(255, 190, 70, 0.5), transparent 70%);
  animation: drift-a 26s ease-in-out infinite;
}
body::after {
  bottom: -320px;
  right: -240px;
  width: 660px;
  height: 660px;
  background: radial-gradient(circle, rgba(255, 138, 56, 0.36), transparent 70%);
  animation: drift-b 32s ease-in-out infinite;
}

@keyframes drift-a {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(60px, 50px); }
}
@keyframes drift-b {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(-50px, -40px); }
}

/* faint paper grain */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: relative;
  z-index: 3;
  max-width: 860px;
  margin: 0 auto;
  padding: 26px 26px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 11px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--orange);
  border-radius: 9px;
  font-size: 0.95rem;
  color: #fff;
  box-shadow: 0 6px 18px -6px rgba(224, 89, 10, 0.65);
}

.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: 0.2px;
}

/* ---------------------------------------------------------------- stage */
.stage {
  position: relative;
  z-index: 2;
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 26px 90px;
}

.screen { animation: screen-in 0.5s cubic-bezier(0.22, 0.7, 0.25, 1) both; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------- shared */
.kicker {
  font-family: var(--body);
  font-weight: 800;
  font-size: 0.74rem;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--orange);
}

/* ---------------------------------------------------------------- home */
.home-head { margin: 26px 0 34px; }

.title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.3rem, 6.4vw, 3.5rem);
  line-height: 1.18;
  letter-spacing: -1.4px;
  margin-top: 14px;
}

.title em {
  font-style: normal;
  background: var(--highlight);
  box-shadow: 0 0 0 0.06em var(--highlight);
  border-radius: 4px;
}

.subtitle {
  max-width: 32rem;
  margin-top: 18px;
  font-size: 1.04rem;
  line-height: 1.55;
  color: var(--text-dim);
}

.home-progress {
  display: inline-block;
  margin-top: 20px;
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--text-dim);
  padding: 7px 15px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
}

/* ---------------------------------------------------------------- set grid */
.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 16px;
}

.set-tile {
  position: relative;
  text-align: left;
  font-family: var(--body);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 16px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 22px -18px rgba(74, 48, 12, 0.5);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: tile-in 0.5s cubic-bezier(0.22, 0.7, 0.25, 1) both;
}

.set-tile:nth-child(1)  { animation-delay: 0.02s; }
.set-tile:nth-child(2)  { animation-delay: 0.05s; }
.set-tile:nth-child(3)  { animation-delay: 0.08s; }
.set-tile:nth-child(4)  { animation-delay: 0.11s; }
.set-tile:nth-child(5)  { animation-delay: 0.14s; }
.set-tile:nth-child(6)  { animation-delay: 0.17s; }
.set-tile:nth-child(7)  { animation-delay: 0.20s; }
.set-tile:nth-child(8)  { animation-delay: 0.23s; }
.set-tile:nth-child(n+9) { animation-delay: 0.26s; }

@keyframes tile-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.set-tile:not(.locked):hover {
  transform: translateY(-4px);
  border-color: var(--line-2);
  box-shadow: 0 22px 34px -22px rgba(74, 48, 12, 0.55);
}
.set-tile:not(.locked):active { transform: translateY(-1px); }

.set-tile .set-no {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.7rem;
  letter-spacing: -0.6px;
}

.set-tile .set-count {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-faint);
}

.set-tile .set-status {
  display: block;
  margin-top: 16px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
}

.set-tile .tile-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 19px;
  height: 19px;
  color: var(--text-faint);
}
.set-tile .tile-icon svg { width: 100%; height: 100%; display: block; }

/* current = next playable set */
.set-tile.current {
  border-color: transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--accent) border-box;
  border: 1.5px solid transparent;
  box-shadow: 0 20px 36px -22px rgba(224, 89, 10, 0.6);
}
.set-tile.current::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 100% 0%, rgba(255, 170, 50, 0.16), transparent 60%);
  pointer-events: none;
}
.set-tile.current .set-status { color: var(--orange); }
.set-tile.current .tile-icon { color: var(--orange); }

/* completed */
.set-tile.done .set-no { color: var(--text-dim); }
.set-tile.done .tile-icon { color: var(--good); }
.set-tile.done .set-status { color: var(--good); }

/* locked */
.set-tile.locked {
  cursor: not-allowed;
  opacity: 0.4;
  background: transparent;
  border-color: var(--line);
  box-shadow: none;
}
.set-tile.locked .set-no { color: var(--text-faint); }
.set-tile.locked:hover { transform: none; }

/* ---------------------------------------------------------------- cards */
.quiz-card,
.result-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 28px 56px -34px rgba(74, 48, 12, 0.5);
  padding: 28px clamp(20px, 5vw, 42px) 34px;
  max-width: 540px;
  margin: 14px auto 0;
}

/* quiz header */
.quiz-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.text-btn {
  margin-right: auto;
  font-family: var(--body);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  transition: color 0.15s ease;
}
.text-btn:hover { color: var(--text); }

.badge {
  font-family: var(--body);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--text-dim);
  background: var(--surface-2);
}

.badge-retry {
  border-color: transparent;
  color: var(--on-accent);
  background: var(--orange);
  animation: fade-in 0.3s ease both;
}

/* progress */
.progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 30px;
}

.progress-track {
  flex: 1;
  height: 8px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.55s cubic-bezier(0.22, 0.7, 0.25, 1);
}

.progress-label {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* the word */
.prompt-label {
  text-align: center;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--text-faint);
}

.word-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 12px 0 30px;
}

.word {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.4rem, 9vw, 3.5rem);
  line-height: 1.06;
  letter-spacing: -1.6px;
  text-align: center;
  word-break: break-word;
  animation: word-in 0.42s cubic-bezier(0.22, 0.7, 0.25, 1) both;
}

@keyframes word-in {
  from { opacity: 0; transform: translateY(10px); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* input */
.answer-input {
  width: 100%;
  font-family: var(--body);
  font-weight: 600;
  font-size: 1.04rem;
  color: var(--text);
  padding: 15px 17px;
  background: var(--surface-2);
  border: 1.5px solid var(--line-2);
  border-radius: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.answer-input::placeholder { color: var(--text-faint); font-weight: 500; }
.answer-input:focus {
  background: var(--surface);
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.25);
}
.answer-input:disabled { opacity: 0.75; }
.answer-input.shake { animation: shake 0.4s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-7px); }
  40%      { transform: translateX(7px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

/* buttons */
.btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.04rem;
  letter-spacing: 0.1px;
  padding: 15px;
  border: none;
  border-radius: 13px;
  cursor: pointer;
  transition: transform 0.13s ease, filter 0.13s ease, box-shadow 0.13s ease;
}

.btn-primary {
  color: var(--on-accent);
  background: var(--orange);
  box-shadow: 0 12px 26px -12px rgba(224, 89, 10, 0.7);
  animation: fade-in 0.32s ease both;
}
.btn-primary:hover { background: var(--orange-deep); transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  color: var(--text-dim);
  background: transparent;
  border: 1.5px solid var(--line-2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-faint); }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* feedback */
.feedback {
  margin-top: 18px;
  padding: 15px 17px;
  border-radius: 13px;
  border: 1px solid;
  animation: fade-in 0.28s ease both;
}
.feedback.good { background: var(--good-dim); border-color: rgba(14, 154, 99, 0.4); }
.feedback.bad  { background: var(--bad-dim);  border-color: rgba(221, 63, 68, 0.4); }

.feedback-headline {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.08rem;
}
.feedback.good .feedback-headline { color: var(--good); }

.feedback-correct {
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--text);
}
.feedback-headline + .feedback-correct { margin-top: 6px; }
.feedback-correct .label {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.feedback.bad .feedback-correct .label  { color: var(--bad); }
.feedback.good .feedback-correct .label { color: var(--good); }

/* ---------------------------------------------------------------- result */
.result-card { text-align: center; }

.result-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 2.1rem;
  letter-spacing: -0.8px;
  margin-top: 8px;
}

.score-ring {
  --deg: 0deg;
  width: 184px;
  height: 184px;
  margin: 24px auto 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(from -90deg,
    #FBB615 0deg, #E0590A var(--deg), var(--surface-3) var(--deg));
  box-shadow: 0 14px 34px -16px rgba(224, 89, 10, 0.5);
  transition: background 0.9s cubic-bezier(0.22, 0.7, 0.25, 1);
}

.score-ring-inner {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number {
  font-family: var(--display);
  font-weight: 800;
  font-size: 3rem;
  line-height: 1;
  letter-spacing: -1.5px;
  color: var(--orange);
}

.score-caption {
  margin-top: 5px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-faint);
}

.result-detail {
  font-weight: 500;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--text-dim);
  max-width: 24rem;
  margin: 0 auto;
}

.result-unlock {
  margin: 18px auto 0;
  display: inline-block;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 9px 16px;
  color: var(--good);
  background: var(--good-dim);
  border: 1px solid rgba(14, 154, 99, 0.4);
  border-radius: 999px;
}

.result-actions { margin-top: 26px; }
.result-actions .btn:first-child { margin-top: 0; }

/* ---------------------------------------------------------------- study */
.study-card { max-width: 600px; }

.study-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.9rem;
  letter-spacing: -0.8px;
  margin-top: 4px;
}

.study-intro {
  margin-top: 4px;
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--text-dim);
}

.study-list {
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.study-row {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}

.study-index {
  flex-shrink: 0;
  width: 22px;
  padding-top: 2px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--text-faint);
}

.study-word {
  flex-shrink: 0;
  width: 36%;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.04rem;
  word-break: break-word;
}

.study-meaning {
  flex: 1;
  padding-top: 1px;
  font-size: 0.96rem;
  line-height: 1.42;
  color: var(--text-dim);
}

.study-say {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  background: none;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.study-say:hover { opacity: 1; background: var(--surface-2); }

.study-quiz-btn { margin-top: 24px; }

/* ---------------------------------------------------------------- icon btn */
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  font-size: 1.05rem;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.13s ease;
}
.icon-btn:hover { border-color: var(--text-faint); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.small { width: 36px; height: 36px; font-size: 0.95rem; }
.icon-btn.muted { opacity: 0.5; }

/* ---------------------------------------------------------------- confetti */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}

.confetti-bit {
  position: absolute;
  top: -20px;
  width: 7px;
  height: 16px;
  border-radius: 1px;
  will-change: transform, opacity;
  animation: fall linear forwards;
}

@keyframes fall {
  to { transform: translateY(110vh) rotate(620deg); opacity: 0; }
}

/* ---------------------------------------------------------------- misc */
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 480px) {
  .stage { padding: 14px 16px 70px; }
  .quiz-card, .result-card { padding: 24px 18px 28px; }
  .set-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
