@font-face { font-family: "Unbounded"; font-weight: 200 900; font-display: swap; src: url("./fonts/unbounded-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-weight: 200 900; font-display: swap; src: url("./fonts/unbounded-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
:root { --ink: #1b1a17; --wall: #10202c; --cream: #f3e2b3; --yellow: #f2c23e; --red: #d9482b; --mute: #b9c6c2; }
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; min-height: 100dvh; display: grid; place-items: center; padding: clamp(10px, 2vw, 26px);
  color: var(--cream); font: 15px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background:
    radial-gradient(rgba(243, 226, 179, .07) 1.2px, transparent 1.7px) 0 0 / 9px 9px,
    radial-gradient(120% 90% at 50% 40%, #1c3646 0%, var(--wall) 60%, #0a141c 100%) fixed;
}
.work { width: min(100%, max(640px, calc((100dvh - 330px) * 1.4134))); min-width: min(100%, 300px); }
.frame { position: relative; border: 3px solid var(--ink); outline: 3px solid var(--cream); background: var(--cream); padding: clamp(5px, .8vw, 11px); box-shadow: clamp(6px, 1vw, 14px) clamp(6px, 1vw, 14px) 0 var(--red), clamp(12px, 2vw, 28px) clamp(12px, 2vw, 28px) 0 var(--yellow); }
canvas { display: block; width: 100%; aspect-ratio: 1600 / 1132; border: 2px solid var(--ink); background: #7fb8b0; cursor: pointer; touch-action: manipulation; }
/* табличка: по умолчанию под картиной, на широких экранах — колонкой справа */
.plate { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "titles langs" "board board" "score score" "tools tools"; align-items: center; gap: 16px 28px; margin-top: clamp(26px, 3.4vw, 44px); }
.titles { grid-area: titles; } .langs { grid-area: langs; justify-self: end; } .board { grid-area: board; justify-self: start; } .score { grid-area: score; } .tools { grid-area: tools; }
h1 { margin: 0; font: 900 clamp(20px, 3vw, 31px)/1.04 "Unbounded", "Arial Black", Impact, system-ui, sans-serif; letter-spacing: -.02em; text-transform: uppercase; }
h1 .h1a { display: block; }
h1 .h1b { display: inline-block; margin-top: .3em; padding: .12em .4em .16em; background: var(--yellow); color: var(--ink); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--red); transform: rotate(-1.2deg); font-size: .56em; letter-spacing: 0; }
.meta { margin: 12px 0 0; color: var(--mute); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.langs { display: inline-flex; border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--red); transform: rotate(1deg); }
.langs button { flex: 1; height: 44px; min-width: 66px; border: 0; box-shadow: none; background: var(--cream); font-size: 13.5px; letter-spacing: .04em; }
.langs button + button { border-left: 3px solid var(--ink); }
.langs button:hover, .langs button:active { transform: none; box-shadow: none; background: #fff3cf; }
.langs button[aria-pressed="true"] { background: var(--yellow); box-shadow: inset 0 -6px 0 var(--red); }
.board { display: grid; grid-template-columns: auto auto auto; grid-template-areas: "now best goal" "bar bar bar"; gap: 10px; align-items: stretch; }
.cell { display: grid; align-content: center; min-width: 108px; padding: 7px 12px 8px; border: 2px dashed rgba(243, 226, 179, .7); text-align: center; }
.cell b { display: block; font: 900 26px/1.05 "Unbounded", "Arial Black", system-ui, sans-serif; font-variant-numeric: tabular-nums; color: var(--cream); }
.cell span { display: block; margin-top: 4px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.cell-now { grid-area: now; border: 3px solid var(--ink); background: var(--yellow); box-shadow: 5px 5px 0 var(--red); transform: rotate(-1.5deg); }
.cell-now b, .cell-now span { color: var(--ink); }
.cell-goal { grid-area: goal; cursor: help; } .cell-goal b { color: var(--yellow); }
.bar { grid-area: bar; position: relative; height: 14px; border: 2px solid var(--cream); background: repeating-linear-gradient(-45deg, transparent 0 5px, rgba(243, 226, 179, .16) 5px 7px); }
.bar i { display: block; height: 100%; width: 0; min-width: 6px; background: var(--yellow); border-right: 2px solid var(--ink); }
.bar::after { content: ""; position: absolute; right: -2px; top: -7px; bottom: -7px; width: 4px; background: var(--red); }
.score { margin: 0; max-width: 62em; color: var(--yellow); font-size: 13.5px; line-height: 1.5; min-height: 3em; white-space: pre-line; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.state { order: 9; min-width: 11.5em; padding: 9px 10px; border: 2px dashed var(--cream); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; text-align: center; }
button:disabled { opacity: .45; cursor: default; transform: none; box-shadow: 4px 4px 0 var(--yellow); }
button { font: inherit; color: var(--ink); cursor: pointer; display: inline-grid; place-items: center; height: 46px; min-width: 46px; padding: 0 14px; background: var(--cream); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--yellow); font: 800 12.5px/1 "Unbounded", "Arial Black", system-ui, sans-serif; text-transform: uppercase; transition: transform .15s, box-shadow .15s; }
button:hover { transform: translate(-2px, -2px) rotate(-1.5deg); box-shadow: 6px 6px 0 var(--yellow); }
button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--yellow); }
button:focus-visible, canvas:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
button.go { background: var(--red); color: #fff7e0; }
button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.frame:fullscreen { display: grid; place-items: center; padding: 0; border: 0; outline: 0; box-shadow: none; background: #0c1a2a; }
.frame:fullscreen canvas { width: min(100vw, calc(100vh * 1.4134)); border: 0; }
@media (max-width: 640px) {
  .work { width: 100%; }
  .plate { grid-template-columns: minmax(0, 1fr); grid-template-areas: "titles" "langs" "board" "score" "tools"; gap: 14px; }
  .langs { justify-self: stretch; } .board { justify-self: stretch; grid-template-columns: 1.15fr 1fr 1fr; } .cell { min-width: 0; padding-inline: 6px; } .cell b { font-size: 22px; }
  .state { display: none; } .tools .go { flex: 1 1 100%; height: 54px; font-size: 15px; } #flip { flex: 1; }
}
/* широкий экран: картина слева во всю высоту, табличка — афишной колонкой справа */
@media (min-width: 1080px) and (min-aspect-ratio: 4/3) {
  .work { display: grid; grid-template-columns: minmax(0, 1fr) 336px; column-gap: 56px; align-items: center; width: min(100%, calc((100dvh - 96px) * 1.4134 + 392px)); }
  .plate { margin: 0; grid-template-columns: minmax(0, 1fr); grid-template-areas: "langs" "titles" "board" "score" "tools"; gap: 20px; }
  .langs { justify-self: stretch; }
  h1 { font-size: 33px; } h1 .h1b { font-size: .47em; white-space: nowrap; }
  .board { justify-self: stretch; grid-template-columns: 1fr 1fr; grid-template-areas: "now now" "bar bar" "best goal"; gap: 12px; }
  .cell { min-width: 0; } .cell-now { padding-block: 10px 11px; } .cell-now b { font-size: 46px; } .cell-now span { font-size: 12px; }
  .score { min-height: 9em; }
  .tools .go { flex: 1 1 100%; height: 56px; font-size: 16px; } #flip { flex: 1; padding-inline: 8px; }
  .state { flex: 1 1 100%; }
}
@media (min-width: 1080px) and (min-aspect-ratio: 4/3) and (max-height: 800px) { .plate { gap: 13px; } .meta, .state { display: none; } h1 { font-size: 28px; } .cell-now b { font-size: 36px; } .score { min-height: 9em; font-size: 12.5px; } .tools .go { height: 48px; } }
