@font-face { font-family: "Space Grotesk"; src: url(fonts/space-grotesk-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url(fonts/space-grotesk-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url(fonts/space-grotesk-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }

/* two colours, set from the chosen palette by main.js */
:root { --d: #000; --l: #fff; }

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; background: var(--d); color: var(--l); overflow: hidden; overscroll-behavior: none; }
body { font: 500 17px/1.35 "Space Grotesk", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: none; }
#app { position: fixed; inset: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; display: block; touch-action: none; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); gap: 16px; }
.screen[hidden] { display: none; }
.top, .bottom { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.panel { background: var(--d); justify-content: center; }
.panel.full { justify-content: flex-start; padding-left: 0; padding-right: 0; }

h1 { font-weight: 700; font-size: clamp(44px, 14vw, 76px); line-height: 0.95; letter-spacing: -0.02em; text-transform: uppercase; }
h2 { font-weight: 700; font-size: 22px; }
.dim { opacity: 0.72; }
.small { font-size: 14px; }

/* the title sits on the course; its two blocks get solid ground so the words read */
#title .top, #title .bottom { background: var(--d); padding: 18px 14px; border: 2px solid var(--l); }
.rule { font-size: 18px; display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; }
.rule span { flex: none; width: 7.2em; text-align: center; padding: 2px 6px; font-weight: 700; border: 2px solid var(--l); }
.rule .d { background: var(--d); color: var(--l); }
.rule .l { background: var(--l); color: var(--d); }

button { font: inherit; font-weight: 700; color: var(--l); background: var(--d); border: 2px solid var(--l); min-height: 48px; padding: 10px 18px; cursor: pointer; touch-action: manipulation; }
button.primary { background: var(--l); color: var(--d); width: 100%; font-size: 20px; min-height: 56px; }
button.link { border: 0; background: none; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--l); outline-offset: 3px; }
button.primary:focus-visible { outline-color: var(--l); box-shadow: 0 0 0 3px var(--d); }
.row { display: flex; gap: 10px; width: 100%; }
.row > button { flex: 1; }

#swatches { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
#swatches button { width: 44px; height: 44px; min-height: 44px; padding: 0; position: relative; border: 2px solid var(--l); }
#swatches button i { position: absolute; inset: 4px; background: linear-gradient(135deg, var(--sd) 50%, var(--sl) 50%); }
#swatches button[aria-checked="true"] { outline: 3px solid var(--l); outline-offset: 3px; }
#swatches button.locked i { opacity: 0.25; }
#swatches button.locked::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 10px; margin: -2px 0 0 -6px; background: var(--l); border-radius: 2px; }
#swatches button.locked::before { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 7px; margin: -9px 0 0 -5px; border: 2px solid var(--l); border-bottom: 0; border-radius: 5px 5px 0 0; }
.keys:empty { display: none; }

#hint { position: absolute; left: 0; right: 0; bottom: 18%; text-align: center; font-weight: 700; font-size: 20px; pointer-events: none; }
#hint span { background: var(--d); color: var(--l); border: 2px solid var(--l); padding: 6px 14px; }

#over { background: var(--d); justify-content: center; }
#oDist { font-weight: 700; font-size: clamp(64px, 22vw, 120px); line-height: 1; }
#oStrip { width: 100%; height: 44px; border: 2px solid var(--l); image-rendering: pixelated; }
#oUnlock { border: 2px solid var(--l); padding: 6px 12px; }
#oPost { width: 100%; display: flex; flex-direction: column; gap: 4px; align-items: stretch; text-align: left; }
input { font: inherit; font-weight: 700; color: var(--l); background: var(--d); border: 2px solid var(--l); min-height: 48px; padding: 8px 12px; width: 100%; user-select: text; -webkit-user-select: text; }

header.bar { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 520px; padding: 0 16px 12px; border-bottom: 2px solid var(--l); }
header.bar h2 { flex: 1; text-align: left; }
header.bar button { min-width: 48px; padding: 0; font-size: 22px; }
.scroll { width: 100%; max-width: 520px; overflow-y: auto; padding: 12px 16px 24px; touch-action: pan-y; -webkit-overflow-scrolling: touch; flex: 1; }
#bList { list-style: none; padding: 0; }
#bList li { display: flex; gap: 12px; padding: 10px 4px; border-bottom: 1px solid color-mix(in srgb, var(--l) 30%, transparent); font-weight: 500; }
#bList li b { width: 3ch; text-align: right; }
#bList li span { flex: 1; text-align: left; overflow-wrap: anywhere; }
#bList li.me { background: var(--l); color: var(--d); }
#cList p { padding: 8px 0; border-bottom: 1px solid color-mix(in srgb, var(--l) 30%, transparent); }
#cList a { color: inherit; }

@media (min-height: 700px) { .screen { padding-top: max(40px, env(safe-area-inset-top)); padding-bottom: max(40px, env(safe-area-inset-bottom)); } }
@media (max-height: 700px) {
  h1 { font-size: clamp(40px, 12vw, 60px); }
  .rule { font-size: 16px; }
  #title .top, #title .bottom { padding: 12px 12px; gap: 8px; }
  button.primary { min-height: 52px; }
}
