:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --paper: #fff;
  --ink: #211c32;
  --muted: #635d71;
  --line: #e8e4ec;
  --purple: #5934cc;
  --purple-dark: #4323a7;
  --lavender: #ece5ff;
  --lime: #d9f782;
  --radius: 22px;
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
  font-size: 100%;
  color: var(--ink);
  background: var(--bg);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
a, button, input, textarea, select { touch-action: manipulation; }
:focus-visible { outline: 3px solid #815df1; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; z-index: 9; margin: .5rem; padding: .75rem; background: white; }
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.header-inner, .shell, .site-footer > div { width: min(1100px, calc(100% - 64px)); margin-inline: auto; }
.header-inner { display: flex; justify-content: space-between; align-items: center; min-height: 72px; gap: 18px; }
.brand { display: flex; align-items: center; text-decoration: none; letter-spacing: -.065em; font-size: 1.65rem; font-weight: 850; white-space: nowrap; }
.brand > span:last-child { color: var(--purple); }
.brand-mark { width: 27px; height: 27px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; margin-right: 10px; transform: rotate(-9deg); }
.brand-mark i { border-radius: 3px; background: var(--purple); }
.brand-mark i:nth-child(2) { opacity: .7; }
.brand-mark i:nth-child(3) { opacity: .42; }
.brand-mark i:last-child { background: var(--lime); }
nav { display: flex; gap: 20px; align-items: center; }
.nav-link, .link-button { background: transparent; color: var(--muted); border: 0; font-weight: 650; padding: 8px 0; }
.nav-link:hover, .link-button:hover { color: var(--purple); }
.nav-link { white-space: nowrap; font-size: .93rem; display: flex; gap: 6px; align-items: center; }
.help-icon { display: grid; place-items: center; width: 18px; height: 18px; border: 1.5px solid currentColor; border-radius: 50%; font-size: .73rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 11px; padding: 10px 16px; min-height: 43px; background: #f3f0f7; color: var(--ink); font-weight: 730; text-decoration: none; }
.button:hover { background: #eae4f1; }
.button:disabled { opacity: .6; }
.header-account { background: var(--ink); color: #fff; max-width: 175px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-account:hover { background: #392e53; }
.primary { background: var(--purple); color: white; }
.primary:hover { background: var(--purple-dark); }

.shell { flex: 1; padding-block: 42px 48px; }
.hero { position: relative; margin-bottom: 31px; }
.eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; color: var(--muted); font-size: .78rem; font-weight: 760; letter-spacing: .10em; text-transform: uppercase; }
.live-dot { width: 8px; height: 8px; background: #7951ea; border-radius: 100%; }
.divider { width: 4px; height: 4px; background: #a8a0b1; border-radius: 100%; }
.hero h1 { margin: 9px 0 5px; font-size: clamp(2.8rem, 6.1vw, 4.8rem); line-height: .99; letter-spacing: -.078em; font-weight: 860; }
.hero h1 span { color: var(--purple); }
.hero > p { margin-top: 12px; color: var(--muted); font-size: 1.09rem; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.paper { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.board { padding: 26px; min-width: 0; min-height: 380px; box-shadow: 0 8px 24px #25203608; }
.board-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 21px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.board-top h2 { font-size: 1.33rem; letter-spacing: -.043em; }
.round-label { color: var(--muted); margin-top: 3px; font-size: .88rem; }
.badge { flex: none; font-size: .86rem; font-weight: 750; border-radius: 30px; padding: 7px 11px; color: #2b441d; background: #ecf7d7; }
.badge.medium { background: #fff1d1; color: #694500; }
.badge.hard { background: var(--lavender); color: #4d2696; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 0; margin: 0; list-style: none; }
.tile { position: relative; display: grid; place-items: center; padding: 35px 8px 15px; min-height: 117px; border: 1px solid var(--line); border-radius: 15px; background: #f8f7fa; text-align: center; overflow-wrap: anywhere; line-height: 1.15; font-size: clamp(.95rem, 2.3vw, 1.3rem); font-weight: 800; }
.tile-index { position: absolute; top: 10px; left: 11px; color: #696173; font: 700 .75rem ui-monospace, monospace; }
.tile.revealed { background: var(--lavender); border-color: #d8caff; }
.tile.revealed .tile-index { color: #5f40a3; }
.tile.locked { color: #665c76; border-style: dashed; }
.tile.answer { color: white; background: var(--purple); border-color: var(--purple); }
.tile.answer .tile-index { color: #e9dfff; }
.tile.solved { color: #213712; background: var(--lime); border-color: var(--lime); }
.tile.missed { color: #4c292d; background: #f6e3e6; border-color: #efcbd1; }
.tile.solved .tile-index, .tile.missed .tile-index { color: inherit; }
.tile-symbol { font-size: 1.8rem; font-weight: 750; line-height: 1; }
.tile.locked .tile-symbol { font-size: 1.35rem; color: #857b94; }
.guess-form { margin-top: 22px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 750; font-size: .95rem; }
.guess-row, .button-row { display: flex; gap: 8px; }
.guess-row input { flex: 1; min-width: 0; }
input:not([type=checkbox]), textarea { border: 1px solid #d8d2e0; background: #fff; color: var(--ink); padding: 11px 12px; border-radius: 10px; min-height: 44px; width: 100%; }
input::placeholder { color: #746d7f; opacity: 1; }
.guess-form .primary { min-width: 98px; }
.guess-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 7px; min-height: 36px; }
.hint, .status-note { font-size: .91rem; color: var(--muted); }
.hint strong { color: var(--purple-dark); }
.guess-footer .link-button { white-space: nowrap; }
.feedback { color: #5d3e88; margin-top: 7px; font-size: .92rem; }
.error { color: #943342; margin-top: 10px; font-size: .95rem; }
.round-result { margin-top: 20px; }
.round-result h3 { font-size: 1.17rem; letter-spacing: -.02em; }
.round-result p { margin-top: 4px; line-height: 1.4; color: var(--muted); }
.round-result .button-row { margin-top: 15px; flex-wrap: wrap; }
.copy-bar { margin-top: 10px; }
.share-text { width: 100%; resize: vertical; min-height: 140px; line-height: 1.48; }
.empty { padding: 29px 10px; max-width: 48ch; }
.empty h2 { letter-spacing: -.04em; font-size: 1.6rem; }
.empty p, .loading { margin-top: 8px; color: var(--muted); }
.empty .button { margin-top: 16px; }

.game-aside { display: grid; gap: 14px; min-width: 0; }
.scorecard { position: relative; isolation: isolate; overflow: hidden; background: #241b39; color: #fff; border-radius: var(--radius); padding: 23px; min-height: 250px; }
.scorecard::before { content: ""; position: absolute; z-index: -1; width: 148px; height: 148px; top: -49px; right: -49px; border: 1px solid #715f96; border-radius: 39px; box-shadow: 0 0 0 12px #34274e, 0 0 0 13px #665589, 0 0 0 25px #302345, 0 0 0 26px #594879; transform: rotate(-25deg); opacity: .74; }
.scorecard h2 { color: #d9ccec; font-size: .9rem; font-weight: 680; }
.score-total { display: flex; align-items: baseline; gap: 6px; margin: 5px 0 15px; color: var(--lime); }
.score-total strong { font-size: 3.15rem; font-weight: 830; letter-spacing: -.08em; line-height: 1; }
.score-total span { font-size: 1.05rem; font-weight: 700; color: #d9ccec; }
.score-rounds { display: grid; gap: 3px; }
.score-round { display: grid; grid-template-columns: 10px 1fr auto; gap: 9px; text-align: left; align-items: center; width: 100%; min-height: 34px; padding: 5px 3px; color: #fff; background: transparent; border: 0; border-top: 1px solid #ffffff1f; font-size: .93rem; }
.score-round.selected { font-weight: 760; }
.score-round:disabled { color: #ccbedc; }
.score-round:not(:disabled):hover { background: #ffffff12; }
.round-dot { width: 7px; height: 7px; border: 1px solid #b4a3ca; border-radius: 50%; }
.score-round.active .round-dot { background: #c6a9ff; border-color: #c6a9ff; }
.score-round.solved .round-dot { background: var(--lime); border-color: var(--lime); }
.score-round.missed .round-dot { background: #efabb6; border-color: #efabb6; }
.score-round small { color: #d9ccec; font-size: .8rem; }
.scorecard .button { width: 100%; margin-top: 13px; color: #263114; background: var(--lime); }
.scorecard .button:hover { background: #edffb7; }
.tip { display: grid; grid-template-columns: 32px 1fr; gap: 11px; padding: 16px; }
.tip-mark { display: grid; place-items: center; border-radius: 9px; width: 32px; height: 32px; background: var(--lavender); color: var(--purple-dark); font-weight: 850; }
.tip h2 { font-size: .94rem; }
.tip p { color: var(--muted); font-size: .89rem; line-height: 1.4; margin-top: 4px; }

.site-footer { background: #fff; border-top: 1px solid var(--line); }
.site-footer > div { min-height: 58px; display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: .85rem; color: var(--muted); }
.foot-brand { font-weight: 800; color: var(--ink); }

dialog { position: fixed; width: min(490px, calc(100% - 32px)); max-height: calc(100dvh - 32px); border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: white; padding: 28px; box-shadow: 0 24px 100px #1b102744; }
dialog::backdrop { background: #21183188; }
dialog h2 { margin: 0 40px 10px 0; font-size: 1.75rem; letter-spacing: -.055em; }
dialog p, dialog li { line-height: 1.47; color: var(--muted); }
dialog ol { padding-left: 22px; }
dialog li + li { margin-top: 7px; }
.dialog-close { position: absolute; right: 14px; top: 14px; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 100%; color: var(--ink); background: #f3eff6; font-size: 1.4rem; line-height: 1; }
.dialog-close:hover { background: #eae4f1; }
.auth-form, .admin-form { display: grid; gap: 13px; margin-top: 17px; }
.auth-form label, .admin-form label { display: grid; gap: 5px; font-weight: 680; font-size: .94rem; }
.auth-form .link-button { justify-self: start; }
dialog .button-row { flex-wrap: wrap; }
.setup-key { font-family: ui-monospace, monospace; }
.history-list { margin-top: 15px; display: grid; gap: 10px; }
.history-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; align-items: center; }
.history-item h3 { font-size: 1rem; }
.history-item span { font-size: .9rem; color: var(--muted); }
.history-item .button { grid-column: 2; grid-row: 1 / span 2; font-size: .88rem; }
.schedule { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 7px; }
.schedule .button { font-size: .88rem; }
.schedule small, .admin-form .status-note { color: var(--muted); }
.admin-header { margin-bottom: 24px; }
.admin-header h1 { margin: 7px 0; font-size: clamp(2.25rem, 5vw, 3.9rem); letter-spacing: -.07em; }
.admin-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.admin-toolbar input { width: auto; }
.admin-panel { padding: 23px; }
.editor-rounds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.editor-rounds fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 13px; padding: 14px; display: grid; gap: 11px; }
.editor-rounds legend { padding: 0 6px; }
.editor-rounds textarea { resize: vertical; }
.admin-form > .checkbox { display: flex; gap: 8px; align-items: center; }
.checkbox input { accent-color: var(--purple); width: 18px; height: 18px; }
.admin-form > .button { justify-self: start; }

@media (max-width: 850px) {
  .header-inner, .shell, .site-footer > div { width: calc(100% - 40px); }
  .game-layout { grid-template-columns: minmax(0, 1fr) 230px; gap: 14px; }
  .board, .scorecard { padding: 18px; }
  .tiles { gap: 6px; }
  .tile { min-height: 108px; }
}
@media (max-width: 675px) {
  .header-inner, .shell, .site-footer > div { width: calc(100% - 28px); }
  .header-inner { min-height: 61px; flex-wrap: wrap; padding-block: 8px; gap: 7px; }
  .brand { font-size: 1.38rem; }
  .brand-mark { width: 24px; height: 24px; margin-right: 7px; }
  nav { gap: 10px; }
  .nav-link { font-size: .87rem; min-height: 41px; }
  .button { padding-inline: 11px; }
  .header-account { max-width: 108px; min-height: 38px; font-size: .88rem; }
  .shell { padding-block: 29px; }
  .hero { margin-bottom: 21px; }
  .hero > p { font-size: 1rem; }
  .game-layout { grid-template-columns: minmax(0, 1fr); }
  .board { min-height: auto; }
  .board-top { padding-bottom: 13px; margin-bottom: 14px; }
  .tile { min-height: 99px; padding: 28px 5px 10px; border-radius: 10px; }
  .tile-index { top: 8px; left: 7px; }
  .guess-form { margin-top: 16px; }
  .guess-form .primary { min-width: 74px; }
  .scorecard { min-height: auto; }
  .editor-rounds { grid-template-columns: 1fr; }
}
@media (max-width: 390px) {
  nav { gap: 8px; }
  .board { padding: 13px; }
  .tile { font-size: .92rem; }
  .header-account { max-width: 84px; }
}
