
:root {
  --bg: #fff8df;
  --card: #ffffff;
  --ink: #252525;
  --muted: #666;
  --primary: #ff7a3d;
  --green: #24a148;
  --yellow: #ffd35a;
  --red: #e5484d;
  --line: #f0dfbd;
  --shadow: 0 12px 28px rgba(88, 60, 20, 0.12);
  --radius: 24px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", Arial, sans-serif;
  background: radial-gradient(circle at top left, #fff3b7, var(--bg) 42%, #fff 100%);
  color: var(--ink);
}

.app {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.menu-tools {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 0 12px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 17px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  background: #f2eee5;
  color: var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}

button:active { transform: translateY(0); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

button.primary, .primary { background: var(--primary); color: #fff; }
button.ghost { background: rgba(255,255,255,0.78); border: 1px solid var(--line); }

.yellow-btn {
  background: linear-gradient(180deg, #ffe48a, var(--yellow));
  color: #6d4300;
  border: 1px solid #f0bd2f;
}

.settings-btn { background: #fff; border: 1px solid var(--line); }

button.danger, .danger {
  background: #ffe9ea;
  color: var(--red);
  border: 1px solid #ffc8cb;
}

.wide { width: min(520px, 100%); }

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 0 0 18px;
}

.tab {
  background: #fff;
  border: 1px solid var(--line);
  min-height: 50px;
}

.tab.active { background: var(--primary); color: white; }

.content { min-height: 520px; }

.loading, .empty {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px;
  text-align: center;
  color: var(--muted);
  box-shadow: var(--shadow);
}

.word-card {
  width: 100%;
  min-height: 560px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: clamp(22px, 4vw, 42px);
  box-shadow: var(--shadow);
  text-align: center;
}

.kid-progress {
  background: linear-gradient(135deg, #fff0fb, #f3ecff 45%, #eaf8ff);
  border: 1px solid #ead6ff;
  border-radius: 26px;
  padding: 16px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.55);
}

.quest-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: #7b3fc7;
  font-size: 18px;
  font-weight: 950;
}

.status-pill {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  color: #7b3fc7;
  font-weight: 900;
  border: 1px solid #e5d4ff;
  white-space: nowrap;
}

.star-trail {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 7px;
  margin: 14px 0 10px;
}

.trail-star {
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(255,255,255,0.62);
  border: 1px dashed #dfc8ff;
  font-size: 22px;
  filter: grayscale(.35);
}

.trail-star.filled {
  background: linear-gradient(135deg, #fff3a8, #ffd6f5, #d8c2ff);
  border-style: solid;
  border-color: #d6b6ff;
  filter: none;
  box-shadow: 0 6px 12px rgba(123,63,199,.14);
}

.trail-star.active {
  background: linear-gradient(135deg, #ffffff, #f4e9ff);
  border: 2px solid #a85cff;
  filter: none;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 16px rgba(168,92,255,.18);
}

.progress-rainbow {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  overflow: hidden;
  border: 1px solid #e7d4ff;
}

.progress-rainbow .progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff7ab6, #ffcf5a, #7ee081, #69c7ff, #b07cff);
  transition: width .25s ease;
}

.progress-message {
  margin-top: 9px;
  color: #8a45d6;
  font-weight: 850;
  font-size: 15px;
}

.word-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 34px 0 40px;
}

.word {
  font-size: clamp(58px, 11vw, 116px);
  margin: 0;
  letter-spacing: -1px;
}

.speaker-btn {
  width: 54px;
  height: 54px;
  padding: 0;
  font-size: 30px;
  background: #fff5d6;
  border: 1px solid #f5d070;
}

.speaker-btn.missing { opacity: 0.45; }

.meaning-toggle {
  display: block;
  margin: 0 auto 30px;
  min-height: 56px;
  font-size: 20px;
}

.meaning {
  margin: 32px auto 24px;
  padding: 24px;
  border-radius: 24px;
  background: #fff9ec;
  border: 1px solid #f2ddb2;
  text-align: left;
  width: min(820px, 100%);
}

.meaning-title {
  margin: 0 0 18px;
  line-height: 1.35;
}

.meaning .ko {
  font-size: 30px;
  font-weight: 900;
}

.meaning .en-wrap,
.meaning .en {
  color: #444;
  font-size: 20px;
  font-weight: 600;
}

.examples {
  display: grid;
  gap: 8px;
}

.meaning .ex {
  margin: 0;
  padding: 11px 14px;
  border-radius: 14px;
  background: #fff;
  font-size: 17px;
  line-height: 1.45;
}

.hidden { display: none !important; }

.memory-buttons {
  margin-top: 28px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.memory-buttons .known { background: #e6f6ea; color: var(--green); }
.memory-buttons .unsure { background: #fff3ca; color: #9a6b00; }
.memory-buttons .unknown { background: #ffe9ea; color: var(--red); }

.nav-row {
  margin-top: 26px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.quiz-card {
  width: 100%;
  margin: 0 auto;
  background: var(--card);
  border-radius: 32px;
  border: 1px solid var(--line);
  padding: clamp(22px, 4vw, 42px);
  box-shadow: var(--shadow);
  min-height: 560px;
}

.quiz-heading-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.quiz-title {
  margin: 0;
  font-size: clamp(24px, 4vw, 36px);
}

.quiz-sub {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.quiz-question {
  font-size: clamp(32px, 6vw, 62px);
  font-weight: 900;
  margin: 24px 0 36px;
  line-height: 1.15;
}

.options { display: grid; gap: 12px; }

.option {
  width: 100%;
  text-align: left;
  padding: 20px 22px;
  border-radius: 18px;
  background: #fff9ec;
  border: 1px solid #f2ddb2;
  font-size: 20px;
}

.option.correct { background: #e6f6ea; border-color: #9ed5aa; color: var(--green); }
.option.wrong { background: #ffe9ea; border-color: #ffb8bc; color: var(--red); }

.quiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
  gap: 12px;
}

.feedback { font-weight: 900; font-size: 18px; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  padding: 16px;
  overflow: auto;
  z-index: 50;
}

.settings-panel {
  width: min(1120px, 100%);
  margin: 20px auto;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.18);
  padding: 22px;
}

.settings-header, .preview-header, .progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.settings-header h2 { margin: 0; font-size: 28px; }

.round-close {
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 26px;
  background: #f5f2eb;
}

.password-box {
  width: min(420px, 100%);
  margin: 30px auto;
  text-align: center;
}

.password-box input {
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  font-size: 22px;
  text-align: center;
  margin-bottom: 12px;
}

.error-text { color: var(--red); font-weight: 800; }

.setting-actions, .button-row.left, .preview-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.setting-section, .progress-panel {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fffdf7;
}

.setting-section h3 { margin: 0 0 8px; }
.hint { color: var(--muted); font-size: 14px; }

.progress-panel {
  background: #fff8df;
}

.progress-bar {
  width: 100%;
  height: 18px;
  background: #f2e5c8;
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0;
}

#progressFill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ffb13d, #ff7a3d);
  border-radius: 999px;
  transition: width .2s ease;
}

#progressCurrent {
  font-weight: 900;
  margin: 8px 0;
}

.search-box {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  font-size: 18px;
  margin-bottom: 14px;
}

.preview-list {
  display: grid;
  gap: 8px;
  max-height: 380px;
  overflow: auto;
}

.preview-row {
  display: grid;
  grid-template-columns: 170px 160px 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.preview-row strong {
  font-size: 18px;
}

.preview-row .preview-ex {
  color: var(--muted);
  font-size: 14px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.admin-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.admin-word-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
}

.admin-word {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.7fr 140px;
  gap: 8px;
  align-items: start;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.admin-word textarea, .admin-word input {
  width: 100%;
  border: 1px solid #e6d7b9;
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
}

.admin-word-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tts-ok { color: var(--green); font-weight: 800; }
.tts-missing { color: var(--red); font-weight: 800; }

@media (max-width: 780px) {
  .app { padding: 10px; }
  .tabs { grid-template-columns: 1fr 1fr; }
  .word-row { margin: 24px 0 32px; }
  .nav-row { justify-content: center; flex-wrap: wrap; }
  .quiz-footer { flex-direction: column; align-items: stretch; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .admin-word, .preview-row { grid-template-columns: 1fr; }
  .preview-header { align-items: stretch; flex-direction: column; }
}

.complete-card {
  width: 100%;
  min-height: 560px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: clamp(28px, 5vw, 56px);
  box-shadow: var(--shadow);
  text-align: center;
  display: grid;
  place-content: center;
}

.complete-icon {
  font-size: 72px;
  margin-bottom: 12px;
}

.complete-card h2 {
  font-size: clamp(34px, 6vw, 60px);
  margin: 0 0 12px;
}

.complete-card p {
  font-size: 20px;
  color: var(--muted);
}

.complete-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.result-score {
  font-size: 34px !important;
  font-weight: 900;
  color: var(--primary) !important;
  margin: 8px 0;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 24px auto;
  width: min(760px, 100%);
}

.result-grid > div {
  background: #fff9ec;
  border: 1px solid #f2ddb2;
  border-radius: 18px;
  padding: 16px;
  font-size: 18px;
}

.wrong-review {
  width: min(820px, 100%);
  margin: 20px auto 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fffdf7;
}

.wrong-review h3 {
  margin: 0 0 12px;
}

.wrong-chip {
  display: inline-block;
  margin: 5px;
  padding: 9px 13px;
  border-radius: 999px;
  background: #ffe9ea;
  color: var(--red);
  font-weight: 800;
}

.perfect {
  color: var(--green) !important;
  font-weight: 900;
}

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

@media (max-width: 780px) {
  .quest-title {
    flex-direction: column;
    align-items: flex-start;
    font-size: 16px;
  }

  .star-trail {
    gap: 5px;
  }

  .trail-star {
    min-height: 34px;
    border-radius: 12px;
    font-size: 18px;
  }

  .progress-message {
    font-size: 14px;
  }
}

/* v9 purple-unicorn theme refinement */
:root {
  --bg: #fbf4ff;
  --card: #ffffff;
  --ink: #2f2440;
  --muted: #7a6b8d;
  --primary: #9b5cff;
  --primary-dark: #7b3fc7;
  --green: #28a86b;
  --yellow: #ffe06d;
  --red: #e6567a;
  --line: #eadcff;
  --shadow: 0 18px 38px rgba(104, 64, 160, 0.14);
}

body {
  background:
    radial-gradient(circle at 12% 5%, rgba(255, 214, 245, .95), transparent 30%),
    radial-gradient(circle at 88% 10%, rgba(199, 230, 255, .9), transparent 28%),
    linear-gradient(135deg, #fff7fb 0%, #f6edff 46%, #f0fbff 100%);
}

.app {
  width: min(1320px, 100%);
}

.menu-tools {
  margin-bottom: 14px;
}

.tabs {
  gap: 12px;
}

.tab {
  border-color: #eadcff;
  background: rgba(255,255,255,.78);
  color: #6d3fa1;
  box-shadow: 0 6px 16px rgba(104,64,160,.08);
}

.tab.active {
  background: linear-gradient(135deg, #a96dff, #ff82c8);
  color: #fff;
  border-color: transparent;
}

.yellow-btn {
  background: linear-gradient(135deg, #fff2a6, #ffd2f0);
  color: #704200;
  border: 1px solid #f0c85e;
}

.settings-btn {
  background: rgba(255,255,255,.82);
  color: #7b3fc7;
  border-color: #eadcff;
}

button.primary,
.primary {
  background: linear-gradient(135deg, #9b5cff, #ff7ac3);
}

.word-card {
  min-height: 540px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,255,255,.88)),
    radial-gradient(circle at 95% 10%, rgba(255, 210, 240, .55), transparent 25%),
    radial-gradient(circle at 5% 95%, rgba(213, 196, 255, .55), transparent 28%);
  border-color: #eadcff;
  padding: clamp(18px, 3vw, 34px);
}

.card-layout {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: clamp(12px, 2vw, 24px);
  align-items: stretch;
}

.card-main {
  min-width: 0;
}

.side-progress {
  min-height: 430px;
  border-radius: 28px;
  padding: 12px 8px;
  background: linear-gradient(180deg, #fff5fd, #f2e8ff 48%, #edfaff);
  border: 1px solid #ead6ff;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.55);
}

.side-unicorn {
  font-size: 30px;
  margin: 4px 0 8px;
}

.side-track {
  display: grid;
  grid-template-rows: repeat(10, 1fr);
  gap: 6px;
  width: 100%;
  align-items: center;
}

.side-dot {
  width: 44px;
  min-height: 32px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border-radius: 16px;
  background: rgba(255,255,255,.68);
  border: 1px dashed #dac2ff;
  color: #b79ad9;
  font-size: 18px;
  line-height: 1;
}

.side-dot.filled {
  background: linear-gradient(135deg, #fff2a6, #ffd2f0, #d9c2ff);
  border: 1px solid #cdaeff;
  color: #7b3fc7;
  box-shadow: 0 5px 10px rgba(123,63,199,.13);
}

.side-dot.active {
  background: #fff;
  border: 2px solid #a75cff;
  color: #7b3fc7;
  transform: scale(1.08);
  box-shadow: 0 8px 16px rgba(123,63,199,.18);
}

.side-message {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  color: #8a45d6;
  font-weight: 900;
  font-size: 13px;
  margin-top: 8px;
  max-height: 86px;
}

.mini-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 38px;
}

.daily-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #7b3fc7;
  font-weight: 950;
  font-size: 16px;
}

.daily-label::before {
  content: "🌈";
}

.status-pill {
  background: linear-gradient(135deg, #fff, #f7efff);
  color: #7b3fc7;
  border: 1px solid #e3ccff;
}

.word-row {
  margin: 22px 0 42px !important;
}

.word {
  color: #36244d;
  text-shadow: 0 4px 0 rgba(232, 216, 255, .75);
}

.speaker-btn {
  background: linear-gradient(135deg, #fff3c7, #ffd8f4);
  border-color: #e8c8ff;
}

.meaning {
  background: linear-gradient(180deg, #fff9ff, #fff);
  border-color: #eadcff;
}

.meaning .ex {
  border: 1px solid #f0e3ff;
}

.memory-buttons .known {
  background: #e8fff3;
}
.memory-buttons .unsure {
  background: #fff5cf;
}
.memory-buttons .unknown {
  background: #ffeaf2;
}

.complete-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.9)),
    radial-gradient(circle at 15% 20%, rgba(255,210,240,.72), transparent 30%),
    radial-gradient(circle at 85% 85%, rgba(213,196,255,.72), transparent 28%);
  border-color: #eadcff;
}

/* disable old large progress block if cached markup appears */
.kid-progress {
  display: none !important;
}

@media (max-width: 780px) {
  .card-layout {
    grid-template-columns: 1fr;
  }

  .side-progress {
    min-height: unset;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto;
    align-items: center;
    padding: 8px 10px;
  }

  .side-track {
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: auto;
    gap: 4px;
  }

  .side-dot {
    width: auto;
    min-height: 28px;
    border-radius: 12px;
    font-size: 15px;
  }

  .side-message {
    writing-mode: horizontal-tb;
    max-height: none;
    font-size: 12px;
    margin-top: 0;
    margin-left: 8px;
    white-space: nowrap;
  }

  .side-unicorn {
    font-size: 24px;
    margin: 0 8px 0 0;
  }

  .mini-card-top {
    margin-top: 14px;
  }

  .word-row {
    margin: 28px 0 34px !important;
  }
}

/* v10 layout: fixed side progress + right action buttons */
.word-card {
  min-height: 540px;
}

.card-layout {
  grid-template-columns: 74px minmax(0, 1fr) 178px !important;
  align-items: start !important;
}

.side-progress {
  min-height: 430px;
  max-height: 430px;
  position: sticky;
  top: 16px;
}

.card-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 430px;
}

.word-row {
  gap: 34px !important;
  margin: 30px 0 42px !important;
}

.speaker-btn {
  margin-left: 6px;
  flex: 0 0 auto;
}

.meaning {
  width: min(760px, 100%);
  max-height: 230px;
  overflow: auto;
  margin: 24px auto 0;
}

.action-panel {
  min-height: 430px;
  max-height: 430px;
  border-radius: 28px;
  padding: 18px 14px;
  background: linear-gradient(180deg, #fff7fd, #f5edff 50%, #effbff);
  border: 1px solid #ead6ff;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.55);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  position: sticky;
  top: 16px;
}

.action-title {
  color: #7b3fc7;
  font-weight: 950;
  font-size: 17px;
  text-align: center;
}

.action-panel .memory-buttons {
  margin-top: 0;
  display: grid;
  gap: 12px;
}

.action-panel .memory-buttons button {
  width: 100%;
  min-height: 58px;
  border-radius: 20px;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  text-align: left;
  gap: 8px;
  padding: 12px 14px;
  font-size: 16px;
}

.action-panel .memory-buttons button span {
  display: inline-block;
}

.action-panel .nav-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.action-panel .nav-row button {
  width: 100%;
  padding: 10px 12px;
}

@media (max-width: 900px) {
  .card-layout {
    grid-template-columns: 1fr !important;
  }

  .side-progress {
    min-height: unset;
    max-height: unset;
    position: static;
  }

  .card-main {
    min-height: unset;
  }

  .action-panel {
    min-height: unset;
    max-height: unset;
    position: static;
    padding: 12px;
  }

  .action-panel .memory-buttons {
    grid-template-columns: repeat(3, 1fr);
  }

  .action-panel .memory-buttons button {
    grid-template-columns: 1fr;
    text-align: center;
    min-height: 64px;
    gap: 4px;
  }

  .action-panel .nav-row {
    grid-template-columns: 1fr 1fr;
  }

  .meaning {
    max-height: none;
  }
}

@media (max-width: 520px) {
  .action-panel .memory-buttons {
    grid-template-columns: 1fr;
  }

  .word-row {
    gap: 22px !important;
  }
}

/* v11 refine progress/nav/action buttons */
.side-progress {
  grid-template-rows: auto 1fr !important;
  justify-content: start;
}

.side-message {
  display: none !important;
}

.top-nav-row {
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-bottom: 8px;
}

.top-nav-row .mini-card-top {
  min-height: 42px;
}

.top-prev,
.top-next {
  width: 54px;
  height: 54px;
  padding: 0;
  border-radius: 18px;
  font-size: 28px;
  color: #7b3fc7;
  background: linear-gradient(135deg, #ffffff, #f5edff);
  border: 1px solid #e0c8ff;
  box-shadow: 0 8px 16px rgba(123,63,199,.10);
}

.top-prev {
  justify-self: start;
}

.top-next {
  justify-self: end;
}

.action-panel {
  justify-content: center;
  padding: 20px 16px;
}

.action-title {
  font-size: 20px;
  margin-bottom: 4px;
}

.action-panel .memory-buttons {
  gap: 16px;
}

.action-panel .memory-buttons button {
  min-height: 82px;
  border-radius: 26px;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 18px 18px;
  font-size: 21px;
  box-shadow: 0 10px 20px rgba(104,64,160,.10);
}

.action-panel .memory-buttons button::first-letter {
  font-size: 26px;
}

.action-panel .memory-buttons button span {
  font-size: 21px;
  font-weight: 950;
}

.word-row {
  margin-top: 26px !important;
}

@media (max-width: 900px) {
  .top-nav-row {
    grid-template-columns: 48px 1fr 48px;
    gap: 8px;
  }

  .top-prev,
  .top-next {
    width: 48px;
    height: 48px;
    font-size: 25px;
    border-radius: 16px;
  }

  .action-panel .memory-buttons button {
    min-height: 76px;
    font-size: 18px;
    padding: 14px 10px;
  }

  .action-panel .memory-buttons button span {
    font-size: 18px;
  }
}

@media (max-width: 520px) {
  .top-nav-row {
    grid-template-columns: 44px 1fr 44px;
  }

  .top-prev,
  .top-next {
    width: 44px;
    height: 44px;
    font-size: 23px;
  }

  .action-panel .memory-buttons button {
    min-height: 72px;
    grid-template-columns: 1fr;
    text-align: center;
  }
}

/* v13 fix: prevent clipped buttons and remove meaning inner scroll */
.word-card {
  min-height: auto !important;
  padding: clamp(18px, 2.4vw, 30px) !important;
}

.card-layout {
  grid-template-columns: 68px minmax(0, 1fr) 150px !important;
  align-items: start !important;
  gap: clamp(10px, 1.6vw, 18px) !important;
}

.side-progress {
  min-height: 360px !important;
  max-height: 360px !important;
  padding: 10px 6px !important;
}

.side-dot {
  width: 38px !important;
  min-height: 27px !important;
  border-radius: 13px !important;
  font-size: 16px !important;
}

.card-main {
  min-height: auto !important;
}

.top-nav-row {
  grid-template-columns: 48px 1fr 48px !important;
  gap: 10px !important;
}

.top-prev,
.top-next {
  width: 48px !important;
  height: 48px !important;
  border-radius: 16px !important;
  font-size: 24px !important;
}

.mini-card-top {
  min-height: 38px !important;
}

.daily-label {
  font-size: 15px !important;
}

.status-pill {
  font-size: 13px !important;
  padding: 6px 10px !important;
}

.word-row {
  margin: 24px 0 32px !important;
  gap: 38px !important;
}

.word {
  font-size: clamp(52px, 8.8vw, 102px) !important;
}

.speaker-btn {
  width: 50px !important;
  height: 50px !important;
  font-size: 27px !important;
}

.meaning-toggle {
  min-height: 52px !important;
  font-size: 19px !important;
  margin-bottom: 20px !important;
}

.meaning {
  max-height: none !important;
  overflow: visible !important;
  width: min(860px, 100%) !important;
  margin: 22px auto 0 !important;
  padding: 20px !important;
}

.meaning-title {
  margin-bottom: 14px !important;
}

.meaning .ko {
  font-size: clamp(26px, 3.2vw, 38px) !important;
  line-height: 1.25 !important;
}

.meaning .en-wrap,
.meaning .en {
  font-size: clamp(17px, 2.1vw, 24px) !important;
  line-height: 1.35 !important;
}

.meaning .ex {
  font-size: clamp(16px, 1.8vw, 22px) !important;
  line-height: 1.35 !important;
  padding: 11px 14px !important;
  overflow-wrap: anywhere;
}

.action-panel {
  min-height: 360px !important;
  max-height: 360px !important;
  padding: 14px 10px !important;
  gap: 10px !important;
  justify-content: center !important;
}

.action-title {
  font-size: 17px !important;
  margin-bottom: 2px !important;
}

.action-panel .memory-buttons {
  gap: 11px !important;
}

.action-panel .memory-buttons button {
  min-height: 68px !important;
  border-radius: 22px !important;
  grid-template-columns: 34px 1fr !important;
  gap: 8px !important;
  padding: 12px 12px !important;
  font-size: 18px !important;
  line-height: 1.15 !important;
  overflow: visible !important;
}

.action-panel .memory-buttons button span {
  font-size: 18px !important;
  line-height: 1.12 !important;
  font-weight: 950 !important;
  word-break: keep-all;
}

@media (max-width: 900px) {
  .card-layout {
    grid-template-columns: 1fr !important;
  }

  .side-progress {
    min-height: unset !important;
    max-height: unset !important;
  }

  .action-panel {
    min-height: unset !important;
    max-height: unset !important;
  }

  .action-panel .memory-buttons {
    grid-template-columns: repeat(3, 1fr) !important;
    display: grid !important;
  }

  .action-panel .memory-buttons button {
    min-height: 64px !important;
    grid-template-columns: 1fr !important;
    text-align: center !important;
    padding: 10px 8px !important;
  }

  .action-panel .memory-buttons button span {
    font-size: 16px !important;
  }
}

@media (max-width: 520px) {
  .action-panel .memory-buttons {
    grid-template-columns: 1fr !important;
  }

  .action-panel .memory-buttons button {
    min-height: 58px !important;
    grid-template-columns: 28px 1fr !important;
    text-align: left !important;
  }

  .word {
    font-size: clamp(44px, 14vw, 70px) !important;
  }

  .word-row {
    gap: 24px !important;
  }
}

/* v14 fix: center unicorn progress and prevent bottom clipping */
.side-progress {
  width: 68px !important;
  min-height: 392px !important;
  max-height: 392px !important;
  padding: 10px 8px !important;
  display: grid !important;
  grid-template-rows: 38px 1fr !important;
  justify-items: center !important;
  align-items: center !important;
  overflow: hidden !important;
}

.side-unicorn {
  width: 100% !important;
  height: 34px !important;
  display: grid !important;
  place-items: center !important;
  margin: 0 !important;
  font-size: 28px !important;
  line-height: 1 !important;
  text-align: center !important;
}

.side-track {
  width: 100% !important;
  height: 332px !important;
  display: grid !important;
  grid-template-rows: repeat(10, 1fr) !important;
  gap: 4px !important;
  justify-items: center !important;
  align-items: center !important;
  overflow: hidden !important;
}

.side-dot {
  width: 42px !important;
  height: 27px !important;
  min-height: 27px !important;
  max-height: 27px !important;
  margin: 0 auto !important;
  display: grid !important;
  place-items: center !important;
  border-radius: 14px !important;
  font-size: 15px !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
}

.side-dot.active {
  transform: scale(1.04) !important;
}

.card-layout {
  grid-template-columns: 68px minmax(0, 1fr) 150px !important;
  align-items: start !important;
}

@media (max-width: 900px) {
  .side-progress {
    width: 100% !important;
    min-height: unset !important;
    max-height: unset !important;
    grid-template-columns: 34px 1fr !important;
    grid-template-rows: auto !important;
    padding: 8px 10px !important;
    overflow: visible !important;
  }

  .side-unicorn {
    width: 30px !important;
    height: 30px !important;
    font-size: 24px !important;
  }

  .side-track {
    width: 100% !important;
    height: auto !important;
    grid-template-columns: repeat(10, 1fr) !important;
    grid-template-rows: auto !important;
    gap: 4px !important;
    overflow: visible !important;
  }

  .side-dot {
    width: 100% !important;
    max-width: 42px !important;
    height: 26px !important;
    min-height: 26px !important;
    font-size: 14px !important;
  }
}

/* v15 require check before moving to a new word */
.next-btn.locked {
  opacity: 0.55 !important;
  filter: grayscale(.25);
}

.need-check-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, #9b5cff, #ff7ac3);
  color: #fff;
  padding: 14px 22px;
  border-radius: 999px;
  font-weight: 950;
  font-size: 18px;
  box-shadow: 0 14px 32px rgba(123,63,199,.28);
  opacity: 0;
  z-index: 9999;
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
  text-align: center;
  max-width: calc(100vw - 32px);
}

.need-check-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 520px) {
  .need-check-toast {
    font-size: 15px;
    padding: 12px 16px;
  }
}

/* v16 quiz lock + horizontal unicorn quiz progress */
.quiz-heading-row {
  display: grid !important;
  grid-template-columns: auto 1fr !important;
  align-items: center !important;
  gap: 18px !important;
}

.quiz-heading-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  min-width: 0;
}

.quiz-unicorn-progress {
  justify-self: end;
  display: grid;
  grid-template-columns: repeat(10, 32px);
  gap: 7px;
  padding: 8px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff7fd, #f2e8ff 60%, #effbff);
  border: 1px solid #ead6ff;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.58), 0 8px 18px rgba(123,63,199,.09);
}

.quiz-unicorn-dot {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  border: 1px dashed #dac2ff;
  color: #b79ad9;
  font-size: 16px;
  line-height: 1;
}

.quiz-unicorn-dot.complete {
  background: linear-gradient(135deg, #fff2a6, #ffd2f0, #d9c2ff);
  border: 1px solid #cdaeff;
  color: #7b3fc7;
  box-shadow: 0 5px 10px rgba(123,63,199,.13);
}

.quiz-unicorn-dot.active {
  background: #fff;
  border: 2px solid #a75cff;
  color: #7b3fc7;
  transform: scale(1.08);
  box-shadow: 0 8px 16px rgba(123,63,199,.16);
}

@media (max-width: 900px) {
  .quiz-heading-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .quiz-unicorn-progress {
    justify-self: stretch;
    grid-template-columns: repeat(10, 1fr);
    gap: 5px;
    border-radius: 22px;
  }

  .quiz-unicorn-dot {
    width: 100%;
    height: 30px;
  }
}

/* v17 calmer app frame + sturdier card controls */
.app {
  padding: 18px;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 16px;
}

.app-kicker {
  margin: 0 0 4px;
  color: #8a45d6;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
}

.app-header h1 {
  margin: 0;
  color: #44275f;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}

.menu-tools {
  flex: 0 0 auto;
  align-items: center;
  margin: 0;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px 0 10px;
  backdrop-filter: blur(10px);
}

.tab {
  min-height: 48px;
  padding: 10px 14px;
  line-height: 1.15;
}

.word-card,
.quiz-card,
.complete-card {
  border-radius: 28px;
}

.card-layout {
  grid-template-columns: 68px minmax(0, 1fr) 172px !important;
  gap: 18px !important;
}

.card-main {
  min-width: 0;
  width: 100%;
}

.top-nav-row {
  margin-bottom: 10px;
}

.mini-card-top {
  justify-content: center !important;
  flex-wrap: wrap;
}

.word-row {
  width: 100%;
  display: flex !important;
  gap: 28px !important;
  margin: 24px 0 30px !important;
  flex-wrap: wrap;
}

.word {
  max-width: min(760px, 100%);
  overflow-wrap: anywhere;
  letter-spacing: 0 !important;
  line-height: .98;
}

.speaker-btn {
  align-self: center;
  box-shadow: 0 8px 18px rgba(123,63,199,.12);
}

.meaning-toggle {
  width: min(420px, 100%) !important;
  margin-bottom: 0 !important;
}

.meaning {
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.62);
}

.meaning-title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
}

.examples {
  gap: 10px;
}

.action-panel {
  width: 100%;
  min-height: 392px !important;
  max-height: none !important;
}

.action-panel .memory-buttons button {
  min-height: 76px !important;
  border: 2px solid transparent;
}

.action-panel .memory-buttons button.selected {
  border-color: #9b5cff;
  box-shadow: 0 0 0 4px rgba(155,92,255,.14), 0 12px 22px rgba(104,64,160,.14);
}

.quiz-heading-row {
  align-items: start !important;
}

.quiz-question {
  overflow-wrap: anywhere;
  letter-spacing: 0;
}

.option {
  line-height: 1.25;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .menu-tools {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .card-layout {
    grid-template-columns: 1fr !important;
  }

  .side-progress,
  .action-panel {
    position: static !important;
  }

  .action-panel .memory-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 620px) {
  .app {
    padding: 10px;
  }

  .app-header h1 {
    font-size: 28px;
  }

  .menu-tools button {
    flex: 1 1 150px;
  }

  .tabs {
    gap: 8px;
  }

  .tab {
    min-height: 44px;
    padding: 9px 10px;
    font-size: 14px;
  }

  .word-card,
  .quiz-card,
  .complete-card {
    padding: 16px !important;
    border-radius: 22px;
  }

  .top-nav-row {
    grid-template-columns: 42px 1fr 42px !important;
    gap: 6px !important;
  }

  .top-prev,
  .top-next {
    width: 42px !important;
    height: 42px !important;
    font-size: 22px !important;
  }

  .daily-label {
    font-size: 13px !important;
  }

  .status-pill {
    white-space: normal;
    text-align: center;
  }

  .word-row {
    gap: 18px !important;
    margin: 22px 0 24px !important;
  }

  .speaker-btn {
    width: 46px !important;
    height: 46px !important;
    font-size: 24px !important;
  }

  .meaning-toggle {
    min-height: 50px !important;
    font-size: 18px !important;
  }

  .meaning {
    padding: 16px !important;
  }

  .meaning .ko {
    font-size: 26px !important;
  }

  .meaning .en-wrap,
  .meaning .en {
    font-size: 17px !important;
  }

  .meaning .ex {
    font-size: 16px !important;
  }

  .action-panel .memory-buttons {
    grid-template-columns: 1fr !important;
  }

  .action-panel .memory-buttons button {
    grid-template-columns: 34px 1fr !important;
    min-height: 58px !important;
    text-align: left !important;
  }

  .quiz-unicorn-progress {
    padding: 7px;
  }

  .quiz-unicorn-dot {
    height: 27px;
    font-size: 14px;
  }
}

/* v17.1 settings and tiny-screen polish */
.settings-panel {
  max-height: calc(100dvh - 32px);
  overflow: auto;
}

.setting-actions button,
.preview-actions button,
.button-row.left button,
.complete-actions button {
  min-height: 46px;
  white-space: normal;
  line-height: 1.15;
}

.admin-word label {
  display: block;
  margin-bottom: 6px;
  color: #6d3fa1;
  font-size: 13px;
  font-weight: 900;
}

.admin-word textarea {
  resize: vertical;
  min-height: 108px;
}

.preview-row,
.admin-word {
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .settings-panel {
    margin: 0 auto;
    border-radius: 22px;
    padding: 16px;
  }

  .settings-header,
  .progress-header {
    align-items: start;
  }

  .setting-actions,
  .button-row.left,
  .preview-actions,
  .complete-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .setting-actions button,
  .button-row.left button,
  .preview-actions button,
  .complete-actions button {
    width: 100%;
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .admin-stat {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 380px) {
  .tab {
    font-size: 13px;
    padding-inline: 8px;
  }

  .word {
    font-size: clamp(40px, 13vw, 58px) !important;
  }

  .side-track {
    gap: 3px !important;
  }

  .side-dot {
    height: 24px !important;
    min-height: 24px !important;
    font-size: 13px !important;
  }
}
