@font-face {
  font-family: Manrope; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('./assets/manrope-cyrillic.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: Manrope; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('./assets/manrope-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
:root {
  --paper: #f8f6f0; --card: #fffdf7; --ink: #17232e; --muted: #596368;
  --orange: #f36a43; --line: #c1c2b9; --mono: 'SFMono-Regular', Consolas, monospace;
  font-family: Manrope, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink); background: var(--paper); color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background-image: radial-gradient(#38454f24 .65px, transparent .8px); background-size: 7px 7px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button, input, dialog { border-radius: 0; }
button:focus-visible, input:focus-visible, .board:focus-visible { outline: 3px solid #1977a3; outline-offset: 3px; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
.sprite, .sr, .grid-radio { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.wrap { width: min(1016px, calc(100% - 72px)); margin-inline: auto; }
.masthead { color: #fffaf0; background: var(--ink); border-bottom: 3px solid var(--orange); padding-top: env(safe-area-inset-top); }
.mast-inner { height: 67px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; font-weight: 800; font-size: 29px; letter-spacing: -1.6px; line-height: 1; }
.brand-dot { color: var(--orange); }
.brand-mark { width: 29px; height: 28px; display: grid; grid-template-columns: repeat(2, 11px); grid-template-rows: repeat(2, 11px); gap: 3px; margin-right: 10px; transform: rotate(-6deg); }
.brand-mark i { background: var(--orange); border-radius: 1px; }
.brand-mark i:nth-child(2) { transform: translate(3px,-3px); background: #ffe4b2; }
.help-button { display: inline-flex; align-items: center; gap: 9px; color: #f5f4ed; background: transparent; padding: 9px 14px; border: 1px solid #748087; border-radius: 6px; font-size: .875rem; font-weight: 650; }
.help-button:hover { background: #35434c; }
.main-nav { align-self: stretch; display: flex; align-items: stretch; gap: 20px; margin: 0 auto 0 42px; }
.main-nav a { position: relative; display: flex; align-items: center; padding: 0 3px; color: #d3dadb; text-decoration: none; font-size: .94rem; font-weight: 700; }
.main-nav a:hover, .main-nav a[aria-current] { color: #fffaf0; }
.main-nav a[aria-current]::after { content: ''; position: absolute; bottom: 11px; left: 3px; right: 3px; height: 2px; background: #ff986e; }
a:focus-visible { outline: 3px solid #1977a3; outline-offset: 3px; }
.help-button .icon { width: 17px; height: 17px; }
main.wrap { padding-bottom: max(42px, env(safe-area-inset-bottom)); }
.intro { margin: 35px 0 25px; }
.category { display: flex; align-items: center; gap: 9px; font: 700 .77rem/1.3 var(--mono); letter-spacing: 1.5px; text-transform: uppercase; }
.category span { width: 25px; height: 3px; background: var(--orange); }
h1, h2, p { margin: 0; }
h1 { margin: 6px 0 5px -2px; font-size: clamp(2.65rem, 5vw, 4rem); line-height: 1.04; font-weight: 800; letter-spacing: -.067em; }
.intro p { font-size: 1rem; line-height: 1.6; color: #4a565e; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.43fr) minmax(305px, 1fr); gap: clamp(20px, 3.2vw, 36px); align-items: start; }
.console { background: var(--ink); padding: 0 14px; border: 1px solid var(--ink); border-radius: 12px; box-shadow: 0 4px 0 #14212c25; color: #f8f6ec; }
.console-head { display: flex; align-items: center; justify-content: space-between; min-height: 49px; padding: 0 4px; }
.console-head h2 { display: inline-flex; align-items: center; gap: 10px; font-size: .94rem; font-weight: 700; }
.console-head .icon { width: 17px; height: 17px; color: #f6936e; }
.board-tools { display: flex; align-items: center; gap: 9px; }
#hint { display: inline-flex; align-items: center; gap: 5px; background: #35444d; color: #fff3dc; border: 1px solid #738082; border-radius: 5px; padding: 5px 8px; min-height: 34px; font-size: .81rem; font-weight: 650; }
#hint:disabled { background: transparent; color: #a7b3b7; border-color: #50606a; }
#hint:not(:disabled):hover { background: #47575e; }
#hint b { font: 600 .78rem var(--mono); }
#hint-explanation { color: #ffdfb4; font-size: .86rem; line-height: 1.5; margin: 10px 5px 0; }
.tile[data-hint]::before { content: attr(data-hint); position: absolute; z-index: 1; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; background: #14232ef2; color: #fff0c8; border: 1px solid #ffe3a3; border-radius: 6px; padding: 4px 7px; font: 700 clamp(20px, 3vw, 32px)/1.1 system-ui, sans-serif; white-space: nowrap; }
.tile[data-hint="✓"]::before { color: #cdebbf; border-color: #b7cca9; }
.dimension { font: 600 .81rem/1.3 var(--mono); color: #f9e9cf; border: 1px solid #58636a; padding: 3px 8px; border-radius: 4px; }
.board { position: relative; aspect-ratio: 1; overflow: hidden; isolation: isolate; background: #293943; border-radius: 4px; touch-action: manipulation; }
.tile, .blank { position: absolute; top: 0; left: 0; width: calc(100% / var(--n)); height: calc(100% / var(--n)); transform: translate(calc(var(--col) * 100%), calc(var(--row) * 100%)); }
.tile { padding: 0; border: 0; appearance: none; background-color: #293943; background-image: var(--art-image); background-repeat: no-repeat; background-size: calc(100% * var(--n)) calc(100% * var(--n)); background-position: var(--sx) var(--sy); transition: transform 150ms ease-out; z-index: 1; }
.tile::after { content: ''; pointer-events: none; position: absolute; inset: 0; border: 1.5px solid var(--ink); }
.tile[aria-disabled=true] { cursor: default; }
.tile:focus-visible { outline: 0; }
.tile:focus-visible::after, .tile[aria-disabled=false]:active::after { border: 3px solid #fff3cc; }
@media (hover: hover) { .tile[aria-disabled=false]:hover::after { border: 2px solid #ffdcaa; } }
.blank { display: grid; place-items: center; background: repeating-linear-gradient(135deg,#25343d 0 2px,#2a3943 2px 6px); border: 2px solid var(--ink); }
.blank::after { content: ''; width: 27%; aspect-ratio: 1; border: 1.5px dashed #829192; border-radius: 4px; }
.complete-art { width: 100%; height: 100%; display: block; animation: reveal .35s ease-out; }
@keyframes reveal { from { opacity: .75; } to { opacity: 1; } }
.counters { min-height: 55px; display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
.counter { display: flex; align-items: center; gap: 9px; padding: 0 9px; font-size: .86rem; color: #d7dddc; }
.counter + .counter { border-left: 1px solid #526068; padding-left: 22px; }
.counter .icon { width: 17px; height: 17px; color: #ffad86; }
.counter strong { margin-left: auto; color: #faf6ea; font: 600 1.27rem/1.2 var(--mono); letter-spacing: .05em; }
.sidebar { display: grid; gap: 18px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.settings { padding: clamp(20px, 2.45vw, 30px); }
.card-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; padding-bottom: 17px; border-bottom: 1px solid #d6d5ca; }
.heading-mark { font-size: 27px; color: #d95430; line-height: 1; }
.card-heading h2, .dialog-head h2 { font-size: clamp(1.45rem, 2.2vw, 1.8rem); line-height: 1.2; letter-spacing: -.055em; font-weight: 800; }
label, legend, .small-label { font-weight: 750; font-size: .94rem; }
.input-wrap { margin-top: 8px; position: relative; }
.input-wrap .icon { position: absolute; left: 13px; top: 14px; width: 18px; height: 18px; color: #657079; }
input[type=text], input:not([type]) { width: 100%; height: 46px; border-radius: 5px; background: #fffefa; border: 1px solid #9fa5a2; padding: 0 12px 0 40px; font-size: 1rem; }
input::placeholder { color: #687275; }
.hint { color: var(--muted); font-size: .81rem; margin-top: 7px; line-height: 1.5; }
fieldset { margin: 24px 0; border: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.size-options { display: flex; gap: 10px; }
.size-choice { flex: 1; display: flex; align-items: center; justify-content: center; gap: 11px; border: 1px solid #b6bbb6; background: #faf9f2; border-radius: 5px; height: 56px; font: 700 1.13rem var(--mono); cursor: pointer; position: relative; }
.size-choice:has(:checked) { color: #882e17; background: #ffe2cc; border-color: #c9532e; box-shadow: inset 0 0 0 1px #c9532e; }
.size-choice:has(:focus-visible) { outline: 3px solid #1977a3; outline-offset: 2px; }
.mini-grid { width: 20px; height: 20px; display: grid; gap: 2px; grid-template-columns: repeat(var(--n),1fr); grid-template-rows: repeat(var(--n),1fr); }
.mini-grid i { background: currentColor; }
.mini-grid i:last-child { opacity: .23; }
.primary { width: 100%; display: inline-flex; justify-content: center; align-items: center; gap: 10px; min-height: 49px; padding: 10px; border-radius: 5px; border: 1.5px solid #372c25; background: var(--orange); box-shadow: 0 3px 0 #342d28; color: #1d2426; font-weight: 800; font-size: 1rem; }
.primary:hover { background: #ff805a; }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #342d28; }
.primary .icon { width: 17px; height: 17px; }
.storage-warning, .win-summary { margin-top: 14px; font-size: .88rem; line-height: 1.55; }
.player-name { display: flex; gap: 9px; align-items: center; margin-top: 7px; overflow-wrap: anywhere; }
.player-name .icon { color: #697477; width: 18px; }
.reference { display: flex; align-items: center; text-align: left; gap: 17px; padding: 13px 17px 13px 13px; width: 100%; }
.reference:hover { border-color: #68747b; background: #fffefa; }
.reference img { width: 77px; height: 77px; border: 1px solid #34414a; border-radius: 4px; }
.reference-info { display: grid; gap: 4px; }
.reference-info strong { font-size: 1.13rem; letter-spacing: -.04em; }
.reference-info span { font-size: .81rem; color: var(--muted); }
.reference > .icon { margin-left: auto; width: 18px; height: 18px; }
dialog { padding: 24px; border: 1.5px solid var(--ink); border-radius: 10px; color: var(--ink); background: var(--card); width: min(470px, calc(100% - 32px)); max-height: 90dvh; box-shadow: 0 8px 0 #101b2530; }
dialog::backdrop { background: #0e1929ad; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.close { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 5px; background: transparent; }
dialog p, dialog li { line-height: 1.6; }
dialog ol { padding-left: 23px; }
dialog li { margin: 8px 0; }
.keyboard-hint { color: var(--muted); font-size: .9rem; }
dialog:has(#art-detail:not([hidden])) { width: min(640px, 90vw, 80dvh); }
#art-detail { margin: 0; }
#art-detail figcaption { display: grid; gap: 5px; font-size: .85rem; line-height: 1.5; padding-top: 12px; }
#art-detail a { color: #23536a; text-underline-offset: 2px; }
#original { display: block; width: 100%; border-radius: 4px; }
.original-frame { position: relative; }
#goal-mark { position: absolute; width: calc(100% / var(--n)); height: calc(100% / var(--n)); left: calc(100% * var(--col) / var(--n)); top: calc(100% * var(--row) / var(--n)); border: 3px dashed #fff6db; box-shadow: inset 0 0 0 2px var(--ink); background: #17232e26; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.actions button { flex: 1; min-height: 46px; font-size: .87rem; }
#resume { background: transparent; border: 1px solid var(--line); border-radius: 5px; padding: 8px; }
.gallery-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.collection-progress { margin-bottom: 27px; padding: 12px 15px; background: var(--card); border: 1px solid var(--line); border-radius: 7px; min-width: 165px; }
.collection-progress > div { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: .9rem; }
.collection-progress .icon { width: 17px; height: 17px; color: #9e4428; }
.collection-progress b { margin-left: auto; font: 700 .9rem var(--mono); white-space: nowrap; }
.collection-progress progress { display: block; appearance: none; width: 100%; height: 5px; margin-top: 9px; border: 0; border-radius: 3px; background: #e4e1d8; overflow: hidden; }
progress::-webkit-progress-bar { background: #e4e1d8; }
progress::-webkit-progress-value { background: #c8512e; }
progress::-moz-progress-bar { background: #c8512e; }
.gallery-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 20px; }
.art-card { padding: 0; display: flex; flex-direction: column; min-width: 0; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; box-shadow: 0 2px 0 #17232e12; }
.art-card:is(:hover, :focus-visible) { border-color: #5f6b6d; box-shadow: 0 3px 0 #17232e2a; }
.art-cover { display: block; width: 100%; position: relative; aspect-ratio: 1; background: #e9e5db; }
.art-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-complete { position: absolute; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 4px; background: var(--ink); color: #fffaf0; padding: 4px 7px; border-radius: 4px; font-size: .77rem; font-weight: 650; }
.art-complete .icon { width: 14px; height: 14px; color: #ffae83; }
.art-info { display: flex; flex-direction: column; flex: 1; width: 100%; padding: 13px 15px; }
.art-theme { font: 600 .77rem/1.35 var(--mono); color: #83462f; }
.art-title { display: block; margin: 4px 0 12px; font-size: 1.12rem; line-height: 1.25; letter-spacing: -.035em; overflow-wrap: anywhere; }
.art-records { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-top: 1px solid #dcd9ce; padding-top: 10px; margin-top: auto; font-size: .86rem; }
.art-score { display: inline-flex; gap: 5px; align-items: center; color: #4a5559; }
.art-score b { color: var(--ink); font-family: var(--mono); }
@media (min-width: 721px) and (max-width: 900px) { .gallery-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 720px) {
  .wrap { width: min(530px, calc(100% - 32px)); }
  .mast-inner { height: 58px; }
  .brand { font-size: 25px; }
  .intro { margin: 24px 0 18px; }
  .intro p { font-size: .94rem; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .sidebar { display: contents; }
  body:not(.registered) .settings { grid-row: 1; }
  .settings { padding: 19px; }
  .card-heading { margin-bottom: 15px; padding-bottom: 12px; }
  fieldset { margin: 17px 0 19px; }
  .size-choice { height: 45px; }
  .console { padding: 0 9px; }
  .console-head { min-height: 41px; }
  .reference img { width: 64px; height: 64px; }
  .main-nav { gap: 13px; margin-left: auto; margin-right: 17px; }
  .help-button span { display: none; }
  .help-button { padding: 0; width: 40px; height: 40px; justify-content: center; }
  .gallery-head { display: block; }
  .collection-progress { width: fit-content; margin: 0 0 18px; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
  .art-info { padding: 10px; }
  .art-title { font-size: 1rem; }
}
@media (max-width: 355px) { .main-nav { gap: 8px; margin-right: 8px; } .art-records { gap: 6px; } }
@media (max-width: 420px) { .console-head h2 { gap: 4px; font-size: .84rem; } .console-head h2 .icon { display: none; } .board-tools { gap: 5px; } #hint { padding: 4px 6px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
