:root {
  color-scheme: light;
  --bg: #fffaf0;
  --panel: #ffffff;
  --line: #eadfbe;
  --gold: #d99b18;
  --gold-strong: #a76808;
  --mint: #16b978;
  --red: #e5484d;
  --text: #2e2618;
  --muted: #796c55;
  --blue: #3b82f6;
  --shadow: 0 16px 38px rgba(103, 75, 24, 0.14);
}

@font-face {
  font-family: "Coolvetica Condensed";
  src: url("/fonts/CoolveticaRgCond.otf") format("opentype");
  font-display: swap;
}

* { box-sizing: border-box; }

html {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 211, 95, 0.42), transparent 22rem),
    radial-gradient(circle at 90% 12%, rgba(89, 207, 164, 0.18), transparent 18rem),
    linear-gradient(180deg, #fff6df 0%, #f3ead7 100%);
  color: var(--text);
  font-family: "Coolvetica Condensed", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button, input, textarea { font: inherit; }
button, input[type="submit"], a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.phone-shell {
  position: relative;
  width: min(100%, 430px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 211, 95, 0.34), transparent 19rem),
    linear-gradient(180deg, #fffdf6 0%, #fff8e9 54%, #f7eedb 100%);
  box-shadow: 0 22px 70px rgba(75, 55, 18, 0.18);
}

.auth-screen, .app-screen {
  height: 100%;
  animation: screen-in 360ms ease both;
}

.auth-screen {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(1.4rem, env(safe-area-inset-top)) 1.15rem max(1.25rem, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

.app-screen {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: max(1rem, env(safe-area-inset-top)) 1rem calc(5.85rem + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

.app-view {
  display: none;
  min-height: 100%;
}

.app-view.active {
  display: block;
}

.brand-block { padding-top: clamp(1rem, 8vh, 4rem); }

.brand-mark {
  display: grid;
  width: 5rem;
  height: 5rem;
  place-items: center;
  margin-bottom: 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 1.45rem;
  background:
    radial-gradient(circle at 32% 25%, #fff8c8 0 0.55rem, transparent 0.6rem),
    linear-gradient(145deg, #ffe071, #f2aa22 55%, #d77d19);
  box-shadow: 0 16px 34px rgba(207, 141, 25, 0.28);
  animation: float-mark 3.8s ease-in-out infinite;
}

.brand-mark span {
  color: #342405;
  font-size: 2.55rem;
  font-weight: 950;
}

.eyebrow, .panel-label {
  margin: 0;
  color: var(--gold-strong);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 8ch; margin-bottom: 0.8rem; font-size: clamp(2.6rem, 16vw, 4.15rem); line-height: 0.94; }
h2 { margin-bottom: 0; font-size: 1.95rem; }
h3 { margin-bottom: 0; font-size: 1.15rem; }

.subline, small, .rank-card em, .profile-card p, label, .form-message, .lesson-feedback, .flash, .word-item p {
  color: var(--muted);
  font-style: normal;
}

.subline { max-width: 23rem; font-size: 1rem; line-height: 1.5; }

.auth-card, .progress-panel, .shop-hero, .profile-card, .word-item, .stats-grid div, .mode-card, .shop-item, .rank-card, .badge-card {
  border: 1px solid rgba(199, 160, 75, 0.32);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.auth-card { padding: 0.9rem; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.95rem;
  padding: 0.25rem;
  border: 1px solid rgba(199, 160, 75, 0.34);
  border-radius: 8px;
  background: #fff3d1;
}

.segment {
  display: grid;
  min-height: 2.7rem;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 850;
}

.segment.active, .primary-action {
  background: linear-gradient(180deg, #ffdb62, #eda22a);
  color: #342405;
}

.auth-form { display: grid; gap: 0.8rem; }

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.83rem;
  font-weight: 750;
}

input:not([type="submit"]), textarea {
  width: 100%;
  min-height: 3.2rem;
  border: 1px solid rgba(199, 160, 75, 0.4);
  border-radius: 8px;
  outline: 0;
  background: #fffdf8;
  color: var(--text);
  padding: 0 0.95rem;
}

textarea {
  min-height: 9rem;
  padding-top: 0.85rem;
  line-height: 1.45;
  resize: vertical;
}

input:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 155, 24, 0.16);
}

.primary-action, .secondary-action {
  display: grid;
  width: 100%;
  min-height: 3.35rem;
  place-items: center;
  border: 0;
  border-radius: 8px;
  font-weight: 950;
}

.primary-action {
  box-shadow: 0 0.35rem 0 #b76f0b;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.primary-action:hover { filter: saturate(1.08); transform: translateY(-1px); }
.primary-action:active { transform: translateY(0.22rem) scale(0.99); box-shadow: 0 0.13rem 0 #b76f0b; }

.secondary-action {
  border: 1px solid rgba(199, 160, 75, 0.4);
  background: #fffdf8;
  color: var(--text);
}

.form-message, .lesson-feedback, .flash {
  min-height: 1.35rem;
  margin: 0.8rem 1rem 0;
  text-align: center;
}

.alert { color: var(--red); }

.topbar, .lesson-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 4.35rem;
  margin: calc(-1 * max(1rem, env(safe-area-inset-top))) -1rem 1rem;
  padding: max(1rem, env(safe-area-inset-top)) 1rem 0.75rem;
  background: rgba(255, 253, 246, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(199, 160, 75, 0.18);
}

.lesson-head {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: calc(-1 * max(1rem, env(safe-area-inset-top))) -1rem 0;
  padding: max(1rem, env(safe-area-inset-top)) 1rem 0.75rem;
  background: rgba(255, 253, 246, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(199, 160, 75, 0.18);
}

.streak-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 4.25rem;
  min-height: 2.65rem;
  border: 1px solid rgba(217, 155, 24, 0.34);
  border-radius: 999px;
  background: rgba(255, 217, 107, 0.32);
  color: var(--gold-strong);
}

.progress-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
}

.ring {
  display: grid;
  width: 4.1rem;
  height: 4.1rem;
  place-items: center;
  border: 0.45rem solid rgba(217, 155, 24, 0.18);
  border-top-color: var(--gold);
  border-radius: 50%;
  color: var(--gold-strong);
  font-size: 0.82rem;
  font-weight: 950;
}

.mode-list, .word-list { display: grid; gap: 0.75rem; }

.mode-card, .shop-item, .rank-card, .badge-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  min-height: 4.7rem;
  padding: 0.85rem;
  color: var(--text);
  text-align: left;
}

.mode-card, .shop-item, .rank-card, .badge-card, .word-item {
  transition: transform 170ms ease, box-shadow 170ms ease, border-color 170ms ease;
}

a.mode-card:hover, .word-item:hover, .rank-card:hover, .badge-card:hover, .shop-item:hover {
  border-color: rgba(217, 155, 24, 0.52);
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(103, 75, 24, 0.18);
}

.mode-card strong, .shop-item strong, .rank-card strong, .badge-card strong { display: block; margin-bottom: 0.18rem; }

.mode-icon {
  display: grid;
  flex: 0 0 2.7rem;
  width: 2.7rem;
  height: 2.7rem;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 218, 98, 0.48), rgba(255, 246, 221, 0.92));
  color: var(--gold-strong);
  font-size: 1.25rem;
  font-weight: 950;
}

.mode-card.disabled { opacity: 0.55; cursor: default; }

.icon-button {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border: 1px solid rgba(199, 160, 75, 0.4);
  border-radius: 50%;
  background: #fff8e8;
  color: var(--gold-strong);
  font-size: 2rem;
}

.lesson-progress {
  height: 0.7rem;
  margin: 1rem 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(211, 174, 92, 0.24);
}

.lesson-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f3b12f, #25c083, #3b82f6);
  transition: width 220ms ease;
}

.match-board { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.match-column { display: grid; gap: 0.55rem; }

.definition-card {
  margin-bottom: 0.75rem;
  padding: 1rem;
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.08), transparent 42%) padding-box,
    linear-gradient(135deg, rgba(255, 214, 139, 0.88), rgba(184, 92, 17, 0.44)) border-box;
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  clip-path: var(--cut);
}

.definition-card h3 {
  margin-top: 0.35rem;
  line-height: 1.25;
}

.choice-list {
  display: grid;
  gap: 0.6rem;
}

.match-tile {
  min-height: 4.05rem;
  padding: 0.65rem;
  border: 1px solid rgba(199, 160, 75, 0.36);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  text-align: center;
  font-size: clamp(0.75rem, 3.5vw, 0.9rem);
  font-weight: 850;
  line-height: 1.18;
  box-shadow: 0 8px 20px rgba(103, 75, 24, 0.08);
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.choice-tile {
  min-height: 3.85rem;
  padding: 0.75rem;
  border: 1px solid transparent;
  border-radius: 10px 10px 16px 10px;
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.045), transparent 42%) padding-box,
    linear-gradient(135deg, rgba(255, 214, 139, 0.85), rgba(184, 92, 17, 0.48)) border-box;
  background-color: #1b150f;
  color: var(--text);
  font-size: clamp(1.08rem, 4.5vw, 1.2rem);
  font-weight: 850;
  text-align: left;
  clip-path: var(--cut);
  transition: transform 150ms ease, background 150ms ease;
}

.choice-tile:hover {
  border-color: transparent;
  transform: translateY(-1px);
}

.choice-tile.correct {
  background:
    linear-gradient(135deg, rgba(85, 217, 154, 0.18), transparent 42%) padding-box,
    linear-gradient(135deg, rgba(85, 217, 154, 0.75), rgba(26, 119, 77, 0.45)) border-box;
  background-color: #102116;
}

.choice-tile.wrong {
  background:
    linear-gradient(135deg, rgba(255, 111, 97, 0.16), transparent 42%) padding-box,
    linear-gradient(135deg, rgba(255, 111, 97, 0.7), rgba(137, 47, 38, 0.45)) border-box;
  background-color: #24100d;
}

.match-tile[hidden] { display: none; }
.match-tile:hover { transform: translateY(-1px); }
.match-tile.selected { border-color: var(--blue); background: #eff6ff; animation: pop 180ms ease both; }
.match-tile.correct { border-color: var(--mint); background: #e9fff5; animation: correct-pop 340ms ease both; }
.match-tile.wrong { border-color: var(--red); background: #fff0f0; animation: shake 260ms ease both; }

.hidden { display: none !important; }
.word-search { margin-bottom: 0.8rem; }

.word-item {
  padding: 0.85rem;
}

.word-item strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--gold-strong);
}

.word-item p {
  margin: 0.55rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.shop-hero { padding: 1rem; margin-bottom: 0.8rem; }
.shop-item { justify-content: space-between; margin-bottom: 0.75rem; }
.shop-item div { flex: 1; }
.shop-item button {
  min-width: 3.8rem;
  height: 2.35rem;
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: #342405;
  font-weight: 950;
}

.rank-card { justify-content: space-between; margin-bottom: 0.65rem; }
.rank-card span {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 218, 98, 0.36);
  color: var(--gold-strong);
  font-weight: 950;
}
.rank-card.own { border-color: rgba(217, 155, 24, 0.78); }

.badge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.badge-card {
  display: grid;
  min-height: 9.4rem;
  align-content: start;
  gap: 0.4rem;
  padding: 0.85rem;
}

.badge-card span {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border-radius: 10px 10px 16px 10px;
  background: rgba(255, 218, 98, 0.36);
  color: var(--gold-strong);
  font-size: 1.35rem;
  font-weight: 950;
  clip-path: var(--cut);
}

.badge-card small {
  line-height: 1.28;
}

.badge-card em {
  align-self: end;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 850;
}

.badge-card.earned {
  border-color: rgba(217, 155, 24, 0.78);
}

.badge-card.earned em {
  color: var(--gold-strong);
}

.profile-card {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 1.2rem 1rem;
  text-align: center;
}

.avatar {
  display: grid;
  width: 4.7rem;
  height: 4.7rem;
  place-items: center;
  border-radius: 1.35rem;
  background: linear-gradient(145deg, #ffdf70, #df8e24);
  color: #342405;
  font-size: 2.2rem;
  font-weight: 950;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin: 0.8rem 0;
}

.stats-grid div {
  display: grid;
  gap: 0.15rem;
  min-height: 4.2rem;
  place-items: center;
}

.stats-grid strong { color: var(--gold-strong); font-size: 1.35rem; }
.stats-grid span { color: var(--muted); font-size: 0.75rem; font-weight: 850; }
.admin-link { margin-bottom: 0.75rem; }

.admin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0.8rem 0;
}

.admin-word {
  display: grid;
  gap: 0.8rem;
}

.admin-row-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.admin-row-actions form { margin: 0; }

.mini-action {
  display: grid;
  width: 100%;
  min-height: 2.6rem;
  place-items: center;
  border: 1px solid rgba(199, 160, 75, 0.4);
  border-radius: 8px;
  background: #fff8e8;
  color: var(--text);
  font-weight: 850;
}

.mini-action.danger {
  border-color: rgba(229, 72, 77, 0.28);
  background: #fff1f1;
  color: #b4232a;
}

.bottom-nav {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.15rem;
  width: 100%;
  margin: 0 auto;
  padding: 0.55rem 0.45rem max(0.55rem, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(199, 160, 75, 0.3);
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(16px);
}

.nav-item {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  min-height: 3.65rem;
  place-items: center;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: #8a7b60;
  font-size: clamp(0.62rem, 2.9vw, 0.72rem);
  font-weight: 850;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item span { color: inherit; font-size: 1.25rem; line-height: 1; }
.nav-item.active { background: rgba(255, 218, 98, 0.36); color: var(--gold-strong); transform: translateY(-1px); }

@media (min-width: 461px) {
  body {
    display: grid;
    height: 100vh;
    place-items: center;
    padding: 1rem 0;
  }

  .phone-shell {
    width: 390px;
    height: min(780px, calc(100vh - 2rem));
    border: 10px solid rgba(52, 36, 5, 0.08);
    border-radius: 34px;
  }

  .bottom-nav {
    right: 0;
    left: 0;
    width: 100%;
    transform: none;
    border-radius: 0 0 24px 24px;
  }
}

@media (max-height: 720px) {
  .phone-shell {
    width: min(100%, 370px);
  }

  .topbar,
  .lesson-head {
    min-height: 3.9rem;
  }

  h1 {
    font-size: clamp(2.25rem, 13vw, 3.4rem);
  }

  h2 {
    font-size: 1.65rem;
  }

  .brand-mark {
    width: 4.25rem;
    height: 4.25rem;
    margin-bottom: 0.85rem;
  }

  .mode-card,
  .shop-item,
  .rank-card {
    min-height: 4.15rem;
  }

  .match-tile {
    min-height: 3.35rem;
    padding: 0.5rem;
  }

  .bottom-nav {
    padding-top: 0.4rem;
  }

  .nav-item {
    min-height: 3.25rem;
  }
}

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

@keyframes float-mark {
  0%, 100% { transform: rotate(-6deg) translateY(0); }
  50% { transform: rotate(-3deg) translateY(-6px); }
}

@keyframes pop {
  from { transform: scale(0.98); }
  to { transform: scale(1); }
}

@keyframes correct-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.045); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-5px); }
  65% { transform: translateX(5px); }
}

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

/* Dark gold identity */
:root {
  color-scheme: dark;
  --bg: #060502;
  --panel: #151108;
  --panel-soft: #201807;
  --line: rgba(235, 187, 72, 0.34);
  --gold: #f0b936;
  --gold-strong: #ffd978;
  --gold-deep: #9b5f0d;
  --mint: #24d18a;
  --red: #ff6368;
  --text: #fff3d2;
  --muted: #b9a77a;
  --blue: #5aa7ff;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  --cut: polygon(0 0, 100% 0, 100% calc(100% - 0.9rem), calc(100% - 0.9rem) 100%, 0 100%);
}

body {
  background:
    radial-gradient(circle at 50% 0%, rgba(240, 185, 54, 0.28), transparent 24rem),
    radial-gradient(circle at 0% 80%, rgba(155, 95, 13, 0.22), transparent 18rem),
    linear-gradient(180deg, #0c0903 0%, #030201 100%);
  color: var(--text);
}

.phone-shell {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 217, 120, 0.15), transparent 18rem),
    radial-gradient(circle at 90% 35%, rgba(240, 185, 54, 0.11), transparent 12rem),
    linear-gradient(180deg, #111006 0%, #070602 50%, #030201 100%);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.56);
}

.auth-card,
.progress-panel,
.shop-hero,
.profile-card,
.word-item,
.stats-grid div,
.mode-card,
.shop-item,
.rank-card {
  border-color: var(--line);
  background:
    linear-gradient(135deg, rgba(255, 217, 120, 0.08), transparent 38%),
    rgba(18, 14, 6, 0.94);
  box-shadow: var(--shadow);
  clip-path: var(--cut);
}

.brand-mark {
  border-color: rgba(255, 221, 133, 0.85);
  border-radius: 1.1rem 1.1rem 1.55rem 1.1rem;
  background:
    radial-gradient(circle at 33% 24%, #fff1a9 0 0.55rem, transparent 0.6rem),
    linear-gradient(145deg, #ffe28a, #e1a021 55%, #81500b);
  box-shadow: 0 0 42px rgba(240, 185, 54, 0.28);
  clip-path: polygon(0 0, 100% 0, 100% 72%, 74% 100%, 0 100%);
}

.brand-mark span {
  color: #171005;
}

.eyebrow,
.panel-label,
.word-item strong,
.stats-grid strong,
.nav-item.active,
.streak-badge,
.icon-button,
.mode-icon,
.ring {
  color: var(--gold-strong);
}

.subline,
small,
.rank-card em,
.profile-card p,
label,
.form-message,
.lesson-feedback,
.flash,
.word-item p {
  color: var(--muted);
}

.segmented {
  border-color: rgba(240, 185, 54, 0.28);
  background: rgba(4, 3, 1, 0.72);
  clip-path: var(--cut);
}

.segment {
  border-radius: 7px;
}

.segment.active,
.primary-action {
  background:
    linear-gradient(135deg, rgba(255, 244, 184, 0.65), transparent 28%),
    linear-gradient(180deg, #ffd978, #e2a126 54%, #a6660d);
  color: #1a1204;
}

input:not([type="submit"]),
textarea {
  border-color: rgba(240, 185, 54, 0.32);
  border-radius: 10px 10px 16px 10px;
  background:
    linear-gradient(135deg, rgba(255, 217, 120, 0.06), transparent 38%),
    #0a0803;
  color: var(--text);
  clip-path: var(--cut);
}

input:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(240, 185, 54, 0.14), 0 0 22px rgba(240, 185, 54, 0.12);
}

.primary-action,
.secondary-action,
.mini-action,
.shop-item button {
  border-radius: 10px 10px 18px 10px;
  clip-path: var(--cut);
}

.primary-action {
  box-shadow: 0 0.33rem 0 #6f4308, 0 0 22px rgba(240, 185, 54, 0.18);
}

.primary-action:hover {
  filter: saturate(1.12) brightness(1.03);
}

.primary-action:active {
  box-shadow: 0 0.13rem 0 #6f4308;
}

.secondary-action,
.mini-action {
  border-color: rgba(240, 185, 54, 0.34);
  background:
    linear-gradient(135deg, rgba(255, 217, 120, 0.08), transparent 35%),
    #0d0a04;
  color: var(--text);
}

.topbar,
.lesson-head {
  background: rgba(7, 6, 2, 0.9);
  border-bottom-color: rgba(240, 185, 54, 0.16);
}

.streak-badge {
  border-color: rgba(240, 185, 54, 0.38);
  background: rgba(240, 185, 54, 0.12);
  clip-path: polygon(0.6rem 0, 100% 0, 100% calc(100% - 0.75rem), calc(100% - 0.75rem) 100%, 0 100%, 0 0.6rem);
}

.ring {
  border-color: rgba(240, 185, 54, 0.16);
  border-top-color: var(--gold);
}

.mode-icon {
  border: 1px solid rgba(240, 185, 54, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 236, 155, 0.18), transparent 42%),
    rgba(240, 185, 54, 0.11);
  clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%);
}

a.mode-card:hover,
.mode-card:hover,
.word-item:hover,
.rank-card:hover,
.shop-item:hover {
  border-color: rgba(255, 217, 120, 0.62);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.38), 0 0 24px rgba(240, 185, 54, 0.1);
}

.icon-button {
  border-color: rgba(240, 185, 54, 0.34);
  background: #0d0a04;
  clip-path: polygon(0 0, 100% 0, 100% 68%, 68% 100%, 0 100%);
}

.lesson-progress {
  background: rgba(240, 185, 54, 0.13);
}

.lesson-progress span {
  background: linear-gradient(90deg, #9b5f0d, #f0b936, #ffe08a);
}

.match-tile {
  border-color: rgba(240, 185, 54, 0.28);
  border-radius: 10px 10px 16px 10px;
  background:
    linear-gradient(135deg, rgba(255, 217, 120, 0.07), transparent 38%),
    #100c05;
  color: var(--text);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  clip-path: var(--cut);
}

.match-tile.selected {
  border-color: var(--gold);
  background:
    linear-gradient(135deg, rgba(255, 232, 146, 0.2), transparent 42%),
    #171005;
}

.match-tile.correct {
  border-color: var(--mint);
  background:
    linear-gradient(135deg, rgba(36, 209, 138, 0.14), transparent 42%),
    #07150f;
}

.match-tile.wrong {
  border-color: var(--red);
  background:
    linear-gradient(135deg, rgba(255, 99, 104, 0.14), transparent 42%),
    #180807;
}

.shop-item button {
  background: linear-gradient(180deg, #ffd978, #b86f0c);
  color: #1a1204;
}

.rank-card span {
  background: rgba(240, 185, 54, 0.14);
  color: var(--gold-strong);
}

.rank-card.own {
  border-color: rgba(255, 217, 120, 0.74);
}

.avatar {
  border: 1px solid rgba(255, 217, 120, 0.6);
  background: linear-gradient(145deg, #ffe08a, #d8941c 55%, #76500b);
  color: #171005;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%);
}

.mini-action.danger {
  border-color: rgba(255, 99, 104, 0.36);
  background: #170807;
  color: #ff9a9d;
}

.bottom-nav {
  border-top-color: rgba(240, 185, 54, 0.22);
  background: rgba(5, 4, 2, 0.94);
}

.nav-item {
  border-radius: 10px 10px 15px 10px;
  color: #9d8b5f;
}

.nav-item.active {
  background:
    linear-gradient(135deg, rgba(255, 217, 120, 0.17), transparent 44%),
    rgba(240, 185, 54, 0.1);
  color: var(--gold-strong);
  clip-path: var(--cut);
}

@media (min-width: 461px) {
  .phone-shell {
    border-color: rgba(255, 217, 120, 0.12);
  }
}

/* Refined dark app theme */
:root {
  --bg: #07090d;
  --panel: #11151d;
  --panel-soft: #171c26;
  --line: rgba(135, 154, 180, 0.2);
  --gold: #5eead4;
  --gold-strong: #8cf4df;
  --gold-deep: #0f766e;
  --mint: #5eead4;
  --red: #fb7185;
  --text: #edf5f7;
  --muted: #91a1b5;
  --blue: #7dd3fc;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  --cut: polygon(0 0, 100% 0, 100% calc(100% - 0.65rem), calc(100% - 0.65rem) 100%, 0 100%);
}

body {
  background:
    radial-gradient(circle at 18% 0%, rgba(94, 234, 212, 0.13), transparent 23rem),
    radial-gradient(circle at 92% 18%, rgba(125, 211, 252, 0.1), transparent 18rem),
    linear-gradient(180deg, #0b0f16 0%, #05070b 100%);
}

.phone-shell {
  background:
    radial-gradient(circle at 18% 0%, rgba(94, 234, 212, 0.1), transparent 18rem),
    linear-gradient(180deg, #10151e 0%, #090d13 48%, #06080d 100%);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
}

.auth-card,
.progress-panel,
.shop-hero,
.profile-card,
.word-item,
.stats-grid div,
.mode-card,
.shop-item,
.rank-card {
  border-color: var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 38%),
    rgba(17, 21, 29, 0.94);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
  clip-path: var(--cut);
}

.brand-mark {
  border-color: rgba(140, 244, 223, 0.55);
  background:
    radial-gradient(circle at 33% 24%, rgba(237, 245, 247, 0.9) 0 0.5rem, transparent 0.55rem),
    linear-gradient(145deg, #8cf4df, #35b8a6 58%, #145c56);
  box-shadow: 0 0 34px rgba(94, 234, 212, 0.2);
}

.segment.active,
.primary-action {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 28%),
    linear-gradient(180deg, #8cf4df, #32b8a6 58%, #12746b);
  color: #031110;
}

.primary-action {
  box-shadow: 0 0.28rem 0 #0b4f49, 0 0 18px rgba(94, 234, 212, 0.12);
}

.primary-action:active {
  box-shadow: 0 0.12rem 0 #0b4f49;
}

.secondary-action,
.mini-action,
input:not([type="submit"]),
textarea,
.match-tile,
.icon-button {
  border-color: rgba(135, 154, 180, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.025), transparent 42%),
    #0d121a;
  color: var(--text);
}

input:focus,
textarea:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.12);
}

.topbar,
.lesson-head,
.bottom-nav {
  background: rgba(7, 10, 15, 0.9);
  border-color: rgba(135, 154, 180, 0.16);
}

.streak-badge {
  border-color: rgba(94, 234, 212, 0.28);
  background: rgba(94, 234, 212, 0.08);
}

.mode-icon,
.rank-card span,
.nav-item.active {
  background:
    linear-gradient(135deg, rgba(94, 234, 212, 0.13), transparent 44%),
    rgba(94, 234, 212, 0.07);
}

a.mode-card:hover,
.mode-card:hover,
.word-item:hover,
.rank-card:hover,
.shop-item:hover {
  border-color: rgba(94, 234, 212, 0.38);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.38);
}

.lesson-progress {
  background: rgba(135, 154, 180, 0.14);
}

.lesson-progress span {
  background: linear-gradient(90deg, #0f766e, #5eead4, #7dd3fc);
}

.match-tile.selected {
  border-color: var(--blue);
  background:
    linear-gradient(135deg, rgba(125, 211, 252, 0.12), transparent 42%),
    #0d1721;
}

.shop-item button {
  background: linear-gradient(180deg, #8cf4df, #12746b);
  color: #031110;
}

.avatar {
  border-color: rgba(94, 234, 212, 0.45);
  background: linear-gradient(145deg, #8cf4df, #2da898 58%, #145c56);
  color: #031110;
}

.nav-item {
  color: #7e8da2;
}

@media (min-width: 461px) {
  .phone-shell {
    border-color: rgba(135, 154, 180, 0.14);
  }
}

/* Warm dark gold/orange theme */
:root {
  --bg: #16120d;
  --panel: #211a12;
  --panel-soft: #2a2116;
  --line: rgba(242, 177, 70, 0.34);
  --gold: #f2a93b;
  --gold-strong: #ffd08a;
  --gold-deep: #b86a1c;
  --mint: #55d99a;
  --red: #ff6f61;
  --text: #fff1dc;
  --muted: #c7ae88;
  --blue: #f6bf6a;
  --shadow: 0 18px 42px rgba(54, 32, 11, 0.34);
  --cut: polygon(0 0, 100% 0, 100% calc(100% - 0.72rem), calc(100% - 0.72rem) 100%, 0 100%);
}

body {
  background:
    radial-gradient(circle at 20% 0%, rgba(242, 169, 59, 0.22), transparent 24rem),
    radial-gradient(circle at 95% 30%, rgba(255, 123, 54, 0.13), transparent 18rem),
    linear-gradient(180deg, #2a2118 0%, #18130e 55%, #0d0a07 100%);
}

.phone-shell {
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 208, 138, 0.18), transparent 17rem),
    radial-gradient(circle at 90% 65%, rgba(242, 118, 42, 0.1), transparent 16rem),
    linear-gradient(180deg, #2a2118 0%, #18130e 48%, #0f0c08 100%);
  box-shadow: 0 26px 78px rgba(0, 0, 0, 0.48);
}

.auth-card,
.progress-panel,
.shop-hero,
.profile-card,
.word-item,
.stats-grid div,
.mode-card,
.shop-item,
.rank-card,
.badge-card,
.match-tile,
.primary-action,
.secondary-action,
.mini-action,
input:not([type="submit"]),
textarea,
.segment.active,
.nav-item.active {
  position: relative;
}

.auth-card,
.progress-panel,
.shop-hero,
.profile-card,
.word-item,
.stats-grid div,
.mode-card,
.shop-item,
.rank-card,
.badge-card {
  border-color: var(--line);
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.08), transparent 42%),
    rgba(33, 26, 18, 0.92);
  box-shadow: var(--shadow);
}

.auth-card::after,
.progress-panel::after,
.shop-hero::after,
.profile-card::after,
.word-item::after,
.stats-grid div::after,
.mode-card::after,
.shop-item::after,
.rank-card::after,
.badge-card::after,
.match-tile::after,
.primary-action::after,
.secondary-action::after,
.mini-action::after,
.nav-item.active::after {
  content: "";
  position: absolute;
  right: 0.16rem;
  bottom: 0.16rem;
  width: 0.82rem;
  height: 0.82rem;
  pointer-events: none;
  border-right: 1px solid rgba(255, 208, 138, 0.72);
  border-bottom: 1px solid rgba(255, 208, 138, 0.72);
  transform: skew(-6deg);
}

.brand-mark {
  border-color: rgba(255, 208, 138, 0.78);
  background:
    radial-gradient(circle at 33% 24%, rgba(255, 245, 214, 0.9) 0 0.5rem, transparent 0.55rem),
    linear-gradient(145deg, #ffd08a, #f2a93b 56%, #b86a1c);
  box-shadow: 0 0 34px rgba(242, 169, 59, 0.26);
}

.segment.active,
.primary-action {
  background:
    linear-gradient(135deg, rgba(255, 241, 220, 0.36), transparent 30%),
    linear-gradient(180deg, #ffd08a, #f2a93b 56%, #b86a1c);
  color: #251405;
}

.primary-action {
  box-shadow: 0 0.28rem 0 #7a3e0d, 0 0 20px rgba(242, 169, 59, 0.14);
}

.primary-action:active {
  box-shadow: 0 0.12rem 0 #7a3e0d;
}

.secondary-action,
.mini-action,
input:not([type="submit"]),
textarea,
.match-tile,
.icon-button {
  border-color: rgba(242, 177, 70, 0.3);
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.045), transparent 42%),
    #1b150f;
  color: var(--text);
}

input:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 169, 59, 0.13);
}

input:not([type="submit"]),
textarea {
  box-shadow: inset -1px -1px 0 rgba(255, 208, 138, 0.48);
}

.topbar,
.lesson-head,
.bottom-nav {
  background: rgba(22, 17, 12, 0.92);
  border-color: rgba(242, 177, 70, 0.18);
}

.streak-badge {
  border-color: rgba(242, 177, 70, 0.38);
  background: rgba(242, 169, 59, 0.12);
}

.mode-icon,
.rank-card span,
.badge-card span,
.nav-item.active {
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.18), transparent 44%),
    rgba(242, 169, 59, 0.1);
}

a.mode-card:hover,
.mode-card:hover,
.word-item:hover,
.rank-card:hover,
.badge-card:hover,
.shop-item:hover {
  border-color: rgba(255, 208, 138, 0.52);
  box-shadow: 0 18px 38px rgba(54, 32, 11, 0.36), 0 0 18px rgba(242, 169, 59, 0.08);
}

.lesson-progress {
  background: rgba(242, 177, 70, 0.14);
}

.lesson-progress span {
  background: linear-gradient(90deg, #9f5617, #f2a93b, #ffd08a);
}

.match-tile.selected {
  border-color: var(--gold);
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.14), transparent 42%),
    #24180d;
}

.shop-item button {
  background: linear-gradient(180deg, #ffd08a, #b86a1c);
  color: #251405;
}

.avatar {
  border-color: rgba(255, 208, 138, 0.58);
  background: linear-gradient(145deg, #ffd08a, #f2a93b 58%, #9f5617);
  color: #251405;
}

.nav-item {
  color: #b49b75;
}

@media (min-width: 461px) {
  .phone-shell {
    border-color: rgba(255, 208, 138, 0.14);
  }
}

/* Readability and cleaner cut-corner border */
body {
  font-size: 18px;
}

h1 {
  font-size: clamp(3rem, 17vw, 4.55rem);
}

h2 {
  font-size: 2.22rem;
}

h3 {
  font-size: 1.35rem;
}

.subline {
  font-size: 1.12rem;
}

.eyebrow,
.panel-label {
  font-size: 0.9rem;
}

label,
small,
.badge-card em,
.stats-grid span {
  font-size: 0.92rem;
}

input:not([type="submit"]),
textarea {
  font-size: 1.08rem;
}

.primary-action,
.secondary-action,
.mini-action,
.mode-card,
.shop-item,
.rank-card,
.badge-card,
.nav-item {
  font-size: 1.05rem;
}

.nav-item {
  font-size: clamp(0.78rem, 3.25vw, 0.9rem);
}

.nav-item span {
  font-size: 1.42rem;
}

.match-tile {
  font-size: clamp(0.98rem, 4.1vw, 1.08rem);
}

.word-item p,
.badge-card small {
  font-size: 1rem;
}

.auth-card::after,
.progress-panel::after,
.shop-hero::after,
.profile-card::after,
.word-item::after,
.stats-grid div::after,
.mode-card::after,
.shop-item::after,
.rank-card::after,
.badge-card::after,
.match-tile::after,
.primary-action::after,
.secondary-action::after,
.mini-action::after,
.nav-item.active::after {
  right: 0;
  bottom: 0;
  width: 1.08rem;
  height: 1.08rem;
  border: 0;
  transform: none;
  background: linear-gradient(
    135deg,
    transparent calc(50% - 0.8px),
    rgba(255, 208, 138, 0.78) 50%,
    transparent calc(50% + 0.8px)
  );
}

input:not([type="submit"]),
textarea {
  background:
    linear-gradient(135deg, transparent calc(100% - 1.05rem), rgba(255, 208, 138, 0.5) calc(100% - 1rem), transparent calc(100% - 0.94rem)),
    linear-gradient(135deg, rgba(255, 208, 138, 0.045), transparent 42%),
    #1b150f;
  box-shadow: none;
}

@media (max-height: 720px) {
  body {
    font-size: 17px;
  }

  h1 {
    font-size: clamp(2.55rem, 14vw, 3.65rem);
  }

  h2 {
    font-size: 1.9rem;
  }

  .match-tile {
    font-size: clamp(0.9rem, 3.7vw, 1rem);
  }
}

/* Light readable theme with unified cut borders */
:root {
  color-scheme: light;
  --bg: #fff7e8;
  --panel: #fffdf8;
  --panel-soft: #fff4df;
  --line: rgba(190, 122, 34, 0.42);
  --gold: #d8791f;
  --gold-strong: #9d4f12;
  --gold-deep: #7d3c0d;
  --mint: #168a5f;
  --red: #d93d35;
  --text: #28180b;
  --muted: #755f43;
  --blue: #b8661b;
  --shadow: 0 16px 34px rgba(91, 50, 12, 0.14);
  --cut: polygon(0 0, 100% 0, 100% calc(100% - 0.72rem), calc(100% - 0.72rem) 100%, 0 100%);
}

body {
  font-size: 20px;
  background:
    radial-gradient(circle at 18% 0%, rgba(242, 169, 59, 0.24), transparent 24rem),
    radial-gradient(circle at 90% 22%, rgba(255, 143, 67, 0.14), transparent 18rem),
    linear-gradient(180deg, #fff2d9 0%, #f7dfbd 100%);
  color: var(--text);
}

.phone-shell {
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 196, 94, 0.28), transparent 17rem),
    linear-gradient(180deg, #fff9ed 0%, #ffefd4 48%, #f7dcb4 100%);
  box-shadow: 0 26px 68px rgba(91, 50, 12, 0.22);
}

h1 {
  font-size: clamp(3.25rem, 18vw, 4.9rem);
}

h2 {
  font-size: 2.45rem;
}

h3 {
  font-size: 1.55rem;
}

.subline {
  font-size: 1.24rem;
}

.eyebrow,
.panel-label {
  font-size: 1rem;
}

label,
small,
.badge-card em,
.stats-grid span {
  font-size: 1.02rem;
}

input:not([type="submit"]),
textarea,
.word-item p,
.badge-card small {
  font-size: 1.14rem;
}

.primary-action,
.secondary-action,
.mini-action,
.mode-card,
.shop-item,
.rank-card,
.badge-card {
  font-size: 1.18rem;
}

.nav-item {
  font-size: clamp(0.9rem, 3.55vw, 1rem);
}

.nav-item span {
  font-size: 1.55rem;
}

.match-tile {
  font-size: clamp(1.08rem, 4.5vw, 1.2rem);
}

.auth-card,
.progress-panel,
.shop-hero,
.profile-card,
.word-item,
.stats-grid div,
.mode-card,
.shop-item,
.rank-card,
.badge-card,
.match-tile,
.primary-action,
.secondary-action,
.mini-action,
input:not([type="submit"]),
textarea,
.segment.active,
.nav-item.active {
  border: 1px solid transparent;
  clip-path: var(--cut);
}

.auth-card,
.progress-panel,
.shop-hero,
.profile-card,
.word-item,
.stats-grid div,
.mode-card,
.shop-item,
.rank-card,
.badge-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 247, 232, 0.94)) padding-box,
    linear-gradient(135deg, rgba(255, 214, 139, 0.95), rgba(184, 92, 17, 0.42)) border-box;
  box-shadow: var(--shadow);
}

.auth-card::after,
.progress-panel::after,
.shop-hero::after,
.profile-card::after,
.word-item::after,
.stats-grid div::after,
.mode-card::after,
.shop-item::after,
.rank-card::after,
.badge-card::after,
.match-tile::after,
.primary-action::after,
.secondary-action::after,
.mini-action::after,
.nav-item.active::after {
  display: none;
}

.secondary-action,
.mini-action,
input:not([type="submit"]),
textarea,
.match-tile,
.icon-button {
  background:
    linear-gradient(135deg, #fffdf8, #fff2dc) padding-box,
    linear-gradient(135deg, rgba(255, 214, 139, 0.95), rgba(184, 92, 17, 0.5)) border-box;
  color: var(--text);
  box-shadow: none;
}

.segment.active,
.primary-action,
.shop-item button {
  background:
    linear-gradient(135deg, rgba(255, 247, 219, 0.75), transparent 34%),
    linear-gradient(180deg, #ffc765, #e48628 58%, #a64f13);
  color: #2a1404;
}

.primary-action {
  box-shadow: 0 0.24rem 0 #8b3f0d, 0 12px 24px rgba(168, 83, 17, 0.18);
}

.topbar,
.lesson-head,
.bottom-nav {
  background: rgba(255, 246, 230, 0.92);
  border-color: rgba(190, 122, 34, 0.2);
}

.brand-mark,
.avatar {
  background: linear-gradient(145deg, #ffd895, #ee9633 58%, #b45a17);
  color: #2a1404;
  border-color: rgba(184, 92, 17, 0.36);
}

.streak-badge,
.mode-icon,
.rank-card span,
.badge-card span,
.nav-item.active {
  background:
    linear-gradient(135deg, rgba(255, 214, 139, 0.42), transparent 44%),
    rgba(216, 121, 31, 0.12);
  color: var(--gold-strong);
}

.nav-item {
  color: #8a7050;
}

.match-tile.selected {
  background:
    linear-gradient(135deg, rgba(255, 214, 139, 0.34), transparent 42%),
    #fff4df;
  border-color: transparent;
}

@media (max-height: 720px) {
  body {
    font-size: 18.5px;
  }

  h1 {
    font-size: clamp(2.8rem, 15vw, 3.95rem);
  }

  h2 {
    font-size: 2.08rem;
  }
}

/* Dark surface with bright text, keeping the unified cut border */
:root {
  color-scheme: dark;
  --bg: #16120d;
  --panel: #211a12;
  --panel-soft: #2a2116;
  --line: rgba(242, 177, 70, 0.42);
  --gold: #f2a93b;
  --gold-strong: #ffd79a;
  --gold-deep: #b86a1c;
  --mint: #55d99a;
  --red: #ff6f61;
  --text: #fff8ec;
  --muted: #ead6b8;
  --blue: #f6bf6a;
  --shadow: 0 18px 42px rgba(54, 32, 11, 0.34);
}

body {
  background:
    radial-gradient(circle at 20% 0%, rgba(242, 169, 59, 0.22), transparent 24rem),
    radial-gradient(circle at 95% 30%, rgba(255, 123, 54, 0.13), transparent 18rem),
    linear-gradient(180deg, #2a2118 0%, #18130e 55%, #0d0a07 100%);
  color: var(--text);
}

.phone-shell {
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 208, 138, 0.18), transparent 17rem),
    radial-gradient(circle at 90% 65%, rgba(242, 118, 42, 0.1), transparent 16rem),
    linear-gradient(180deg, #2a2118 0%, #18130e 48%, #0f0c08 100%);
  box-shadow: 0 26px 78px rgba(0, 0, 0, 0.48);
}

.auth-card,
.progress-panel,
.shop-hero,
.profile-card,
.word-item,
.stats-grid div,
.mode-card,
.shop-item,
.rank-card,
.badge-card {
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.08), transparent 42%) padding-box,
    linear-gradient(135deg, rgba(255, 214, 139, 0.88), rgba(184, 92, 17, 0.44)) border-box;
  color: var(--text);
}

.secondary-action,
.mini-action,
input:not([type="submit"]),
textarea,
.match-tile,
.icon-button {
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.045), transparent 42%) padding-box,
    linear-gradient(135deg, rgba(255, 214, 139, 0.85), rgba(184, 92, 17, 0.48)) border-box,
    #1b150f;
  color: var(--text);
}

input:not([type="submit"]),
textarea,
.match-tile {
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.045), transparent 42%) padding-box,
    linear-gradient(135deg, rgba(255, 214, 139, 0.85), rgba(184, 92, 17, 0.48)) border-box;
  background-color: #1b150f;
}

.topbar,
.lesson-head,
.bottom-nav {
  background: rgba(22, 17, 12, 0.92);
  border-color: rgba(242, 177, 70, 0.22);
}

.nav-item {
  color: #d8c09b;
}

.subline,
small,
.rank-card em,
.profile-card p,
label,
.form-message,
.lesson-feedback,
.flash,
.word-item p,
.badge-card em {
  color: var(--muted);
}

.word-item strong,
.stats-grid strong,
.eyebrow,
.panel-label,
.ring,
.nav-item.active {
  color: var(--gold-strong);
}

.match-tile.selected {
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.14), transparent 42%) padding-box,
    linear-gradient(135deg, rgba(255, 214, 139, 0.9), rgba(184, 92, 17, 0.5)) border-box;
  background-color: #24180d;
}

/* Header polish and readability */
body,
button,
input,
textarea {
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.38);
}

.primary-action,
.segment.active,
.shop-item button,
.brand-mark span,
.avatar {
  text-shadow: 0 1px 0 rgba(255, 242, 210, 0.28);
}

.app-screen {
  padding-top: 0;
}

.topbar,
.lesson-head {
  min-height: 4rem;
  margin: 0 -1rem 1rem;
  padding: max(0.5rem, env(safe-area-inset-top)) 1rem 0.65rem;
}

.topbar h2,
.lesson-head h3 {
  line-height: 1;
}

.topbar h2 {
  font-size: 2.32rem;
}

.status-pills {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.28rem;
  min-width: 0;
}

.status-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  min-height: 2.3rem;
  min-width: 2.8rem;
  padding: 0 0.45rem;
  border: 1px solid rgba(242, 177, 70, 0.34);
  border-radius: 8px;
  background: rgba(242, 169, 59, 0.11);
  color: var(--gold-strong);
  font-size: 0.95rem;
  clip-path: var(--cut);
}

.status-pill span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.status-pill strong {
  font-size: 1.08rem;
}

.nav-item.active {
  background: rgba(242, 169, 59, 0.16);
  border: 1px solid rgba(242, 177, 70, 0.18);
  clip-path: none;
  transform: none;
}

.nav-item.active::after {
  display: none;
}

.nav-item {
  border-radius: 8px;
}

@media (max-width: 380px) {
  .topbar h2 {
    font-size: 2.05rem;
  }

  .status-pill {
    min-width: 2.35rem;
    padding: 0 0.34rem;
    font-size: 0.86rem;
  }

  .status-pill span {
    font-size: 0.76rem;
  }
}

/* Keep default shape, avoid hover outlines */
a.mode-card:hover,
.mode-card:hover,
.word-item:hover,
.rank-card:hover,
.badge-card:hover,
.shop-item:hover,
.match-tile:hover {
  border-color: transparent;
}

.badge-card,
.badge-card.earned,
.badge-card:hover,
.nav-item.active,
.nav-item.active:hover,
.status-pill {
  border-color: transparent;
}

.badge-card {
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.09), transparent 42%),
    rgba(33, 26, 18, 0.92);
}

.nav-item.active {
  background: rgba(242, 169, 59, 0.12);
}

.status-pill {
  background: rgba(242, 169, 59, 0.1);
}

.status-pills {
  gap: 0.22rem;
}

.definition-card,
.choice-tile {
  border-color: transparent;
  color: var(--text);
}

.definition-card {
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.09), transparent 42%),
    rgba(33, 26, 18, 0.92);
}

.choice-tile {
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.055), transparent 42%),
    #1b150f;
}

.choice-tile:hover {
  border-color: transparent;
}

/* Lesson runtime layout */
.phone-shell.lesson-mode .bottom-nav {
  display: none;
}

.phone-shell.lesson-mode .app-screen {
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.lesson-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 1rem -1rem calc(-1 * max(1rem, env(safe-area-inset-bottom)));
  padding: 0.75rem 1rem max(0.75rem, env(safe-area-inset-bottom));
  background: rgba(22, 17, 12, 0.94);
  backdrop-filter: blur(16px);
}

.lesson-actions form {
  display: block;
  margin: 0;
}

.lesson-actions form.hidden {
  display: none;
}

.lesson-actions .primary-action,
.lesson-actions .secondary-action {
  min-height: 3.2rem;
}

.result-card {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 1rem;
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.09), transparent 42%),
    rgba(33, 26, 18, 0.92);
  clip-path: var(--cut);
  box-shadow: var(--shadow);
}

.result-card p {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  color: var(--muted);
}

.result-card strong {
  color: var(--gold-strong);
}

/* Daily lesson panel */
.progress-panel {
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.07), transparent 42%),
    rgba(24, 18, 12, 0.96);
  color: var(--text);
}

.progress-panel small {
  display: block;
  max-width: 13.5rem;
  margin-top: 0.35rem;
  color: var(--muted);
  line-height: 1.22;
}

.daily-count {
  display: grid;
  flex: 0 0 4.4rem;
  width: 4.4rem;
  height: 4.4rem;
  place-items: center;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.16), transparent 44%),
    rgba(242, 169, 59, 0.1);
  color: var(--gold-strong);
  font-size: 1.25rem;
  font-weight: 950;
  clip-path: var(--cut);
}

.mode-card:not(.disabled) {
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.08), transparent 42%) padding-box,
    linear-gradient(135deg, rgba(255, 214, 139, 0.88), rgba(184, 92, 17, 0.44)) border-box;
  color: var(--text);
}

.mode-card:not(.disabled) small,
.mode-card:not(.disabled) strong {
  color: inherit;
}

.mode-card:not(.disabled) .mode-icon {
  background:
    linear-gradient(135deg, rgba(255, 208, 138, 0.18), transparent 44%),
    rgba(242, 169, 59, 0.1);
  color: var(--gold-strong);
}

.mode-card.disabled {
  opacity: 1;
  background:
    linear-gradient(135deg, rgba(221, 168, 93, 0.12), transparent 42%) padding-box,
    linear-gradient(135deg, rgba(202, 143, 61, 0.72), rgba(122, 66, 19, 0.38)) border-box;
  color: var(--text);
}

.mode-card.disabled small,
.mode-card.disabled strong {
  color: inherit;
}

.mode-card.disabled .mode-icon {
  background:
    linear-gradient(135deg, rgba(221, 168, 93, 0.16), transparent 44%),
    rgba(150, 84, 23, 0.09);
  color: var(--gold-strong);
}

.mode-card.disabled:hover {
  transform: none;
  box-shadow: var(--shadow);
}
