:root {
  --bg-0: #07060b;
  --bg-1: #14111c;
  --bg-2: #1d1730;
  --ink: #f6f1ff;
  --muted: rgba(246, 241, 255, 0.62);
  --line: rgba(255, 255, 255, 0.1);
  --accent: #c084fc;
  --accent-2: #67e8f9;
  --card: rgba(18, 14, 28, 0.72);
  --ok: #4ade80;
  --bad: #fb7185;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  --radius: 28px;
  --cell: 64px;
}

* {
  box-sizing: border-box;
}

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  font-family: "Outfit", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 10% -10%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 55%),
    radial-gradient(900px 600px at 110% 0%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 50%),
    linear-gradient(165deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
  background-attachment: fixed;
}

body[data-theme="k-pop"] {
  --bg-0: #120617;
  --bg-1: #1c0b2e;
  --bg-2: #2a1050;
  --accent: #e879f9;
  --accent-2: #22d3ee;
}

body[data-theme="k-drama"] {
  --bg-0: #07110e;
  --bg-1: #10201b;
  --bg-2: #16302a;
  --accent: #fb7185;
  --accent-2: #4ade80;
}

button,
.tile,
.cell,
.theme-card,
.topic-card,
.clue {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

#app {
  flex: 1 0 auto;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 188px;
}

#app:has(#game:not([hidden])) {
  width: min(1760px, calc(100vw - 28px));
  padding: 16px 0 32px;
}

body:has(#game:not([hidden])) .site-footer {
  display: none;
}

.topbar,
.game-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

#lobby .topbar {
  flex-direction: column;
  gap: 14px;
}

.game-timer,
.hud-shuffle,
.play-clue,
.clues-close {
  display: none;
}

.clues-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.clues-head h2 {
  margin: 0;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand strong {
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
}

.brand h1,
.game-top h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 48px);
  letter-spacing: -0.04em;
}

#lobby .brand {
  width: 100%;
}

#lobby .brand h1 {
  font-size: clamp(26px, 3.6vw, 44px);
  white-space: nowrap;
}

#game .game-top h1 {
  font-size: clamp(22px, 2.6vw, 32px);
}

#game .topic-hangul {
  margin: 2px 0 0;
  font-size: 16px;
}

.lede,
.vibe,
.progress,
.clue-meta,
.topic-hangul {
  color: var(--muted);
}

.lede {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px 18px;
  width: 100%;
  max-width: none;
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.lede p {
  margin: 0;
}

.lede a {
  color: var(--accent-2);
}

.pill {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 16px;
  backdrop-filter: blur(16px);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 36px;
}

.theme-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: clamp(420px, 52vh, 540px);
  padding: 24px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 40%),
    var(--card);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 180ms ease, border-color 180ms ease;
}

.theme-mosaic {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 26%;
  z-index: 0;
  display: grid;
  grid-template-columns: 1.18fr 0.92fr;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
  pointer-events: none;
  opacity: 0.4;
  mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.55) 22%, #000 58%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.55) 22%, #000 58%);
  transition: opacity 220ms ease;
}

.theme-mosaic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.88) brightness(0.78);
}

.theme-mosaic img:first-child {
  grid-row: 1 / -1;
}

.theme-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(12, 10, 20, 0.08) 12%, transparent 42%, rgba(12, 10, 20, 0.42) 100%),
    radial-gradient(120% 70% at 50% 108%, color-mix(in srgb, var(--card-accent) 22%, transparent), transparent 58%);
}

.theme-card-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-height: 0;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.theme-card:hover,
.theme-card:focus-visible {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--card-accent) 70%, white);
}

.theme-card:hover .theme-mosaic,
.theme-card:focus-visible .theme-mosaic {
  opacity: 0.52;
}

.theme-card[data-key="k-drama"] .theme-mosaic {
  opacity: 0.46;
}

.theme-card[data-key="k-drama"]:hover .theme-mosaic,
.theme-card[data-key="k-drama"]:focus-visible .theme-mosaic {
  opacity: 0.58;
}

.theme-card[data-key="k-drama"] .theme-mosaic img {
  filter: saturate(0.92) brightness(0.88);
}

.theme-card .emoji {
  font-size: 32px;
}

.theme-card h2 {
  margin: 18px 0 8px;
  font-size: 26px;
}

.theme-card p {
  margin: 0;
  color: var(--muted);
}

.theme-card[data-key="k-pop"] { --card-accent: #e879f9; }
.theme-card[data-key="k-drama"] { --card-accent: #fb7185; }

.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.topic-tools {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.topic-tools input {
  flex: 1;
  min-width: 220px;
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--ink);
  background: color-mix(in srgb, var(--card) 80%, black);
}

.topic-tools input::placeholder {
  color: var(--muted);
}

.topic-tools p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.topic-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 188px;
  padding: 20px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 40%),
    var(--card);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 180ms ease, border-color 180ms ease;
}

#topic-grid .topic-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

#topic-grid .topic-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.24;
  mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.5) 26%, #000 68%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.5) 26%, #000 68%);
  transition: opacity 220ms ease;
}

body[data-theme="k-drama"] #topic-grid .topic-art {
  opacity: 0.34;
}

#topic-grid .topic-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.88) brightness(0.74);
}

body[data-theme="k-drama"] #topic-grid .topic-art img {
  filter: saturate(0.92) brightness(0.82);
}

#topic-grid .topic-card:hover .topic-art,
#topic-grid .topic-card:focus-visible .topic-art {
  opacity: 0.32;
}

body[data-theme="k-drama"] #topic-grid .topic-card:hover .topic-art,
body[data-theme="k-drama"] #topic-grid .topic-card:focus-visible .topic-art {
  opacity: 0.44;
}

#topic-grid .topic-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(12, 10, 20, 0.22) 8%, transparent 42%, rgba(12, 10, 20, 0.5) 100%),
    radial-gradient(120% 70% at 50% 108%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 58%);
}

#topic-grid .topic-card-copy,
#topic-grid .topic-card-meta {
  position: relative;
  z-index: 2;
  text-shadow: 0 8px 22px rgba(0, 0, 0, 0.62);
}

.topic-card:hover,
.topic-card:focus-visible {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--accent) 70%, white);
}

.topic-card h2 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.topic-card .hangul {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: "Noto Sans KR", sans-serif;
  font-weight: 700;
  font-size: 15px;
}

.topic-card p {
  margin: 0;
  color: var(--muted);
}

.topic-card.random {
  border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 42%),
    var(--card);
}

.topic-grid.levels-grid,
#level-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#level-grid .topic-card[data-level="beginner"] { --level-accent: #4ade80; }
#level-grid .topic-card[data-level="intermediate"] { --level-accent: #fbbf24; }
#level-grid .topic-card[data-level="advanced"] { --level-accent: #fb7185; }

#level-grid .topic-card .hangul {
  color: var(--level-accent, var(--accent));
}

.topic-hangul {
  margin: 6px 0 0;
  font-family: "Noto Sans KR", sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--accent);
}

.board-topic {
  margin: 0 0 4px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.ghost {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.ghost:hover,
.ghost:focus-visible {
  color: var(--ink);
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(440px, 0.8fr);
  grid-template-areas:
    "bank bank"
    "board clues";
  gap: 16px;
  margin-top: 18px;
  align-items: start;
}

.board-card,
.side-card,
.bank-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.bank-card {
  grid-area: bank;
  padding: 14px 18px 16px;
}

.board-card {
  grid-area: board;
  padding: 16px;
  overflow: visible;
}

.crossword {
  --gap: 3px;
  --cols: 8;
  container-type: inline-size;
  display: grid;
  gap: var(--gap);
  width: min(100%, calc(var(--cols) * var(--cell) + (var(--cols) - 1) * var(--gap)));
  margin: 12px auto 8px;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
}

.crossword[data-level="beginner"] {
  --gap: 4px;
}

.crossword[data-level="intermediate"] {
  --gap: 3px;
}

.crossword[data-level="advanced"] {
  --gap: 3px;
}

.cell {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  min-width: 0;
  border: 0;
  border-radius: 12px;
  position: relative;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font-family: "Noto Sans KR", sans-serif;
  font-size: clamp(11px, calc(44cqw / var(--cols)), 22px);
  font-weight: 700;
  padding: 10px 0 0;
  line-height: 1;
}

.cell.block {
  background: transparent;
  pointer-events: none;
  box-shadow: none;
}

.cell.selected,
.cell.in-word {
  outline: 3px solid color-mix(in srgb, var(--accent) 80%, white);
}

.cell.selected {
  background: color-mix(in srgb, var(--accent-2) 55%, white);
}

.cell.wrong {
  background: #fecdd3;
}

.cell.correct {
  background: #bbf7d0;
}

.cell .num {
  position: absolute;
  top: 4px;
  left: 6px;
  font-family: "Outfit", sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: #475569;
  line-height: 1;
}

.side-card {
  grid-area: clues;
  padding: 16px 18px 18px;
  max-height: none;
  overflow: visible;
}

.side-card h2,
.clues-head h2,
.bank-head {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.clues-head h2 {
  margin: 0;
}

.clue-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.clue-list.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-flow: column;
  grid-template-rows: repeat(var(--clue-rows, 10), auto);
  gap: 6px 10px;
}

.clue {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font-size: 13px;
  line-height: 1.35;
}

.clue.active {
  border-color: color-mix(in srgb, var(--accent) 65%, white);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.clue.correct {
  color: var(--ok);
}

.clue b {
  display: inline-block;
  min-width: 1.4em;
}

.clue em,
.clue .topic-tag {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.crossword.dense .cell {
  border-radius: 8px;
  padding: 8px 0 0;
}

.crossword.dense .cell .num {
  top: 2px;
  left: 4px;
  font-size: clamp(7px, calc(22cqw / var(--cols)), 10px);
}

.bank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
}

.bank {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tile {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 28%, #1b1428), #1b1428);
  color: white;
  font-family: "Noto Sans KR", sans-serif;
  font-size: 17px;
  font-weight: 700;
}

.tile:disabled {
  opacity: 0.28;
}

.shuffle {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
}

.status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
}

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 28px 24px calc(18px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, transparent 0%, rgba(7, 6, 11, 0.88) 28%, rgba(7, 6, 11, 0.96) 100%);
  text-align: center;
  pointer-events: none;
}

.site-footer > * {
  pointer-events: auto;
}

.site-footer p {
  margin: 0 auto;
  max-width: 52rem;
  font-size: 12px;
  line-height: 1.6;
  color: #888;
  text-align: center;
}

.site-footer-copy {
  letter-spacing: 0.02em;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 4px auto 0;
  font-size: 12px;
  line-height: 1.6;
  color: #888;
}

.site-footer-links a,
.site-footer-links button {
  margin: 0;
  border: 0;
  padding: 0 2px;
  background: transparent;
  color: #888;
  font: inherit;
  letter-spacing: inherit;
  text-decoration: none;
  cursor: pointer;
}

.site-footer-links a:hover,
.site-footer-links a:focus-visible,
.site-footer-links button:hover,
.site-footer-links button:focus-visible {
  color: #bbb;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer-sep {
  margin: 0 8px;
  color: #666;
}

body:has(.site-modal:target),
body:has(.site-modal:not([hidden]):not(.hidden)) {
  overflow: hidden;
}

.site-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(5, 4, 10, 0.78);
  backdrop-filter: blur(12px);
}

.site-modal:target,
.site-modal:not([hidden]):not(.hidden) {
  display: grid !important;
}

.site-modal-card {
  position: relative;
  width: min(420px, 100%);
  max-height: min(86vh, 640px);
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  padding: 22px 22px 20px;
  background: linear-gradient(180deg, rgba(28, 20, 44, 0.96), rgba(12, 10, 20, 0.98));
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  animation: win-pop 0.45s cubic-bezier(0.2, 1.2, 0.32, 1);
}

.site-modal-card--wide {
  width: min(560px, 100%);
  max-height: min(88vh, 720px);
}

.site-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.site-modal-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.site-modal-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.site-modal-close:hover,
.site-modal-close:focus-visible {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.site-modal-body {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.site-modal-body h3 {
  margin: 18px 0 6px;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.site-modal-body p,
.site-modal-body ul {
  margin: 0 0 10px;
}

.site-modal-body ul {
  padding-left: 1.15em;
}

.site-modal-body a {
  color: var(--accent-2);
}

.site-modal-updated {
  margin-bottom: 12px !important;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #888;
}

.contact-form {
  position: relative;
  display: grid;
  gap: 12px;
}

.info-contact-form {
  margin: 8px 0 24px;
  max-width: 420px;
}

.info-updated {
  margin: -8px 0 16px !important;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #888;
}

.topic-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 12px;
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
}

.topic-catalog li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
  line-height: 1.4;
}

.topic-catalog strong {
  color: var(--ink);
}

.topic-catalog span {
  color: var(--muted);
  font-family: "Noto Sans KR", sans-serif;
}

.contact-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.contact-field input,
.contact-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 14px;
  color: var(--ink);
  background: color-mix(in srgb, var(--card) 80%, black);
  font: inherit;
  font-weight: 400;
  letter-spacing: 0;
}

.contact-field textarea {
  resize: vertical;
  min-height: 112px;
  line-height: 1.5;
}

.contact-field input::placeholder,
.contact-field textarea::placeholder {
  color: rgba(246, 241, 255, 0.38);
}

.contact-field input:focus,
.contact-field textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 65%, var(--line));
}

.contact-honey {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.contact-status {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  color: var(--accent-2);
}

.contact-status.is-error {
  color: var(--bad);
}

.contact-submit {
  width: 100%;
}

.contact-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.win {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5, 4, 10, 0.72);
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}

.fireworks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.win-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  border-radius: 28px;
  padding: 32px 28px 26px;
  background: linear-gradient(180deg, rgba(28, 20, 44, 0.96), rgba(12, 10, 20, 0.98));
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  text-align: center;
  max-height: min(92vh, 760px);
  overflow: auto;
  animation: win-pop 0.55s cubic-bezier(0.2, 1.2, 0.32, 1);
}

.win-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.win-card h2 {
  margin: 0 0 8px;
  font-size: clamp(32px, 6vw, 42px);
  letter-spacing: -0.04em;
  background: linear-gradient(90deg, #fff7d6, #ffd76a 40%, var(--accent) 80%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.win-card #win-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.win-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 22px 0 4px;
}

.win-stat {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 18px;
  padding: 14px 12px 12px;
}

.win-stat span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.win-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.win-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.primary,
.share {
  margin-top: 0;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #111;
}

.share {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.share[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.share-menu {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.share-menu button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 700;
}

.share-menu button svg {
  width: 16px;
  height: 16px;
}

.share-menu button[data-share="instagram"] {
  background: linear-gradient(90deg, #f58529, #dd2a7b 45%, #8134af);
  border-color: transparent;
  color: #fff;
}

.share-menu button[data-share="x"] {
  background: #111;
  border-color: rgba(255, 255, 255, 0.16);
}

.share-menu button[data-share="facebook"] {
  background: #1877f2;
  border-color: transparent;
  color: #fff;
}

.win-toast {
  margin: 12px 0 0;
  min-height: 20px;
  color: var(--accent-2);
  font-size: 13px;
}

@keyframes win-pop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .win-card {
    animation: none;
  }

  .fireworks {
    display: none;
  }

  .theme-card,
  .theme-mosaic,
  #topic-grid .topic-art {
    transition: none;
  }
}

@media (max-width: 1100px) {
  #app:has(#game:not([hidden])) {
    width: calc(100% - 20px);
  }

  .game-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "bank"
      "board"
      "clues";
  }

  .clue-list.split {
    grid-template-columns: 1fr;
    grid-auto-flow: row;
    grid-template-rows: none;
  }

  .side-card {
    max-height: none;
  }
}

@media (max-width: 860px) {
  .theme-grid,
  .topic-grid,
  .topbar,
  .game-top {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
  }

  #lobby .brand h1 {
    white-space: normal;
  }

  .lede {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .theme-card {
    min-height: 360px;
  }

  :root {
    --cell: 52px;
  }

  .tile {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    font-size: 18px;
  }
}

@media (max-width: 768px) {
  #app {
    padding-bottom: 220px;
  }

  html:has(#game:not([hidden])),
  body:has(#game:not([hidden])) {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body:has(#game:not([hidden])) {
    background-attachment: scroll;
  }

  #app:has(#game:not([hidden])) {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  body:has(#game:not([hidden])) .site-footer {
    display: none;
  }

  #game {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    padding:
      calc(6px + env(safe-area-inset-top, 0px))
      8px
      calc(8px + env(safe-area-inset-bottom, 0px));
    overflow: hidden;
  }

  #game .game-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "back timer shuffle";
    align-items: center;
    gap: 8px;
    flex-direction: unset;
    flex-shrink: 0;
    padding: 2px 2px 8px;
  }

  #game .game-top-main {
    display: contents;
  }

  #game #back-btn {
    grid-area: back;
    min-height: 36px;
    padding: 6px 4px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
  }

  #game .game-top h1,
  #game .topic-hangul,
  #game .vibe,
  #game #progress {
    display: none;
  }

  #game .game-timer {
    display: block;
    grid-area: timer;
    justify-self: center;
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
  }

  #game .hud-shuffle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    grid-area: shuffle;
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
  }

  #game .game-shell {
    position: relative;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas:
      "board"
      "bank";
    gap: 8px;
    margin-top: 0;
    align-items: stretch;
    overflow: hidden;
  }

  #game .board-card,
  #game .bank-card,
  #game .side-card {
    border-radius: 18px;
  }

  #game .board-card {
    grid-area: board;
    min-height: 0;
    padding: 8px 8px 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #game .board-topic,
  #game .status {
    display: none;
  }

  #game .crossword {
    --gap: 2px;
    flex: 1 1 auto;
    align-self: center;
    min-height: 0;
    min-width: 0;
    width: min(100%, calc(var(--cols) * var(--cell) + (var(--cols) - 1) * var(--gap)));
    max-height: 100%;
    margin: 0 auto;
    align-content: center;
    justify-content: center;
    overflow: hidden;
  }

  #game .crossword[data-level="beginner"],
  #game .crossword[data-level="intermediate"],
  #game .crossword[data-level="advanced"] {
    --gap: 2px;
  }

  #game .cell {
    border-radius: 6px;
    padding: 7px 0 0;
    font-size: clamp(9px, calc(42cqw / var(--cols)), 16px);
  }

  #game .cell.selected,
  #game .cell.in-word {
    outline-width: 2px;
  }

  #game .cell .num {
    top: 2px;
    left: 3px;
    font-size: 8px;
  }

  #game .crossword.dense .cell {
    border-radius: 5px;
    padding: 6px 0 0;
  }

  #game .play-clue {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    align-items: stretch;
    flex-shrink: 0;
    margin-top: 8px;
  }

  #game .active-clue {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 8px;
    row-gap: 2px;
    align-items: start;
    min-height: 44px;
    max-height: 4.6em;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
    border-radius: 14px;
    padding: 7px 10px;
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    font-size: 12px;
    line-height: 1.35;
  }

  #game .active-clue-meta {
    grid-column: 1;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-2);
    white-space: nowrap;
  }

  #game .active-clue-meta b {
    font-size: 13px;
    letter-spacing: 0;
    color: var(--ink);
  }

  #game .active-clue .topic-tag {
    grid-column: 1 / -1;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-2);
  }

  #game .active-clue-text {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
  }

  #game .active-clue.prompt .active-clue-text,
  #game .active-clue.message .active-clue-text {
    grid-column: 1 / -1;
  }

  #game .active-clue.correct {
    border-color: color-mix(in srgb, var(--ok) 55%, var(--line));
    color: var(--ok);
  }

  #game .clues-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 52px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.2;
    text-align: center;
  }

  #game .clues-toggle[aria-expanded="true"] {
    border-color: color-mix(in srgb, var(--accent) 65%, white);
    background: color-mix(in srgb, var(--accent) 16%, transparent);
  }

  #game .bank-card {
    grid-area: bank;
    padding: 8px 8px 6px;
    flex-shrink: 0;
  }

  #game .bank-head {
    display: none;
  }

  #game .bank {
    justify-content: center;
    gap: 4px;
    max-height: 112px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  #game .tile {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 8px;
    font-size: 15px;
    touch-action: manipulation;
  }

  #game .side-card {
    display: none;
    grid-area: board;
    position: absolute;
    left: 8px;
    right: 8px;
    top: 8px;
    bottom: 8px;
    z-index: 12;
    max-height: none;
    padding: 12px;
    overflow: hidden;
    flex-direction: column;
    box-shadow: var(--shadow);
  }

  #game .side-card.is-open {
    display: flex;
  }

  #game .clues-head {
    flex-shrink: 0;
    margin: 0 0 8px;
  }

  #game .clues-close {
    display: inline-flex;
    font-size: 13px;
  }

  #game .clue-list,
  #game .clue-list.split {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    grid-auto-flow: row;
    grid-template-rows: none;
    gap: 4px;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  #game .clue {
    padding: 8px 10px;
    font-size: 12px;
  }

  #game .cell,
  #game .tile,
  #game .clue,
  #game .clues-toggle,
  #game .hud-shuffle,
  #game #back-btn {
    touch-action: manipulation;
  }
}

body.info-page #app {
  width: min(760px, calc(100% - 32px));
  padding: 28px 0 40px;
}

body.info-page .site-footer {
  position: static;
  z-index: 1;
  padding-top: 36px;
  background: linear-gradient(180deg, transparent 0%, rgba(7, 6, 11, 0.55) 22%, rgba(7, 6, 11, 0.92) 100%);
}

.info-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 32px;
}

.info-brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}

.info-brand:hover,
.info-brand:focus-visible {
  color: var(--ink);
}

.info-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-size: 13px;
}

.info-nav a {
  color: var(--muted);
  text-decoration: none;
}

.info-nav a:hover,
.info-nav a:focus-visible {
  color: var(--ink);
}

.info-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.info-nav .info-play {
  color: var(--accent-2);
}

.info-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.info-article h1 {
  margin: 0 0 16px;
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: -0.04em;
}

.info-article h2 {
  margin: 32px 0 10px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.info-article h3 {
  margin: 0 0 6px;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.info-article p,
.info-article li {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.info-article p {
  margin: 0 0 14px;
}

.info-article ul {
  margin: 0 0 16px;
  padding-left: 1.2em;
}

.info-article a {
  color: var(--accent-2);
}

.info-article strong {
  color: var(--ink);
  font-weight: 600;
}

.info-steps {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  counter-reset: info-step;
}

.info-steps li {
  counter-increment: info-step;
  position: relative;
  margin: 0 0 14px;
  padding: 16px 18px 16px 58px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.info-steps li::before {
  content: counter(info-step);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.info-steps p {
  margin: 0;
}

@media (max-width: 768px) {
  body.info-page #app {
    padding-bottom: 28px;
  }

  .info-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .info-steps li {
    padding: 14px 14px 14px 52px;
  }
}
