/* ICU. A vermilion field, bone white controls shaped like an eye, ink type. Every picture is an eye. */
@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; }

:root {
  --ground: #ff3b1f; --deep: #c41f08; --deeper: #7d1002;
  --panel: #c41f08; --panel-2: #a81805;
  --ink: #fff8f0; --ink-dim: rgba(255,248,240,.82); --rule: rgba(255,255,255,.3); --rule-soft: rgba(255,255,255,.16);
  --accent: #fff8f0; --accent-ink: #2a0700; --good: #fff8f0; --warn: #2a0700; --dark: #2a0700;
  --display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --ui: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 0px; --rule-w: 2px; --shadow-hard: 0 6px 0 var(--deeper);
  color-scheme: dark;
}
:root[data-field="emerald"] { --ground: #00a85a; --deep: #007a40; --deeper: #004a26; --panel: #007a40; --panel-2: #006635; --accent-ink: #00270f; --dark: #00270f; --warn: #00270f; }
:root[data-field="ultramarine"] { --ground: #2440ff; --deep: #1226c4; --deeper: #08137a; --panel: #1226c4; --panel-2: #0e1fa6; --accent-ink: #030a45; --dark: #030a45; --warn: #030a45; }

/* the host's few leftovers (credits, toast) in this game's hand */
#stage { padding: 0; }
.btn, .icu-btn {
  font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: .1em; text-transform: uppercase;
  border: 0; border-radius: 50%; padding: 0 44px; height: 68px; min-width: 230px; width: auto; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 7px 0 var(--deeper);
  transition: transform .12s cubic-bezier(.3,1.6,.5,1), box-shadow .12s;
}
.btn:active, .icu-btn:active { transform: translateY(6px) scaleY(.9); box-shadow: 0 1px 0 var(--deeper); }
.btn:focus-visible, .icu-btn:focus-visible, .icu-play:focus-visible, .icu-tile:focus-visible, .icu-link:focus-visible { outline: 4px solid var(--dark); outline-offset: 4px; }
.btn.ghost { background: var(--deep); color: var(--ink); }
.screen.credits { padding: 24px 20px; margin: 0 auto; }
.screen.credits .big { font-weight: 700; font-size: 44px; }
.screen.credits a { color: var(--ink); }
#toast { background: var(--dark); color: var(--ink); font-weight: 500; }

.icu { position: absolute; inset: 0; max-width: none !important; color: var(--ink); font-family: var(--ui); overflow: hidden; }
.icu-link { background: none; border: 0; color: var(--ink); font: 700 14px var(--ui); letter-spacing: .14em; text-transform: uppercase; padding: 0 6px; min-height: 44px; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.icu-feet { display: flex; gap: 18px; justify-content: center; }
.icu-date { font-weight: 700; letter-spacing: .22em; text-transform: uppercase; font-size: 15px; }
canvas.eye { display: block; width: 100%; height: 100%; aspect-ratio: 1; background: var(--deep); }

/* ---- home: a wall of eyes, and a band of the field across the foot ------------------------- */
.icu-home { display: flex; flex-direction: column; }
.icu-wall { flex: 1 1 0; min-height: 0; min-width: 0; width: 100%; display: block; touch-action: manipulation; }
.icu-band { flex: 0 0 auto; background: var(--ground); padding: 6px 20px max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; border-top: 6px solid var(--dark); }
.icu-logo { margin: 0; font: 700 clamp(84px, 30vw, 150px)/.86 var(--display); letter-spacing: -.02em; color: var(--ink); text-shadow: 5px 5px 0 var(--dark); animation: icu-look 5.2s ease-in-out infinite; }
@keyframes icu-look { 0%, 62%, 100% { transform: none; } 70% { transform: translateX(-6px) skewX(3deg); } 80% { transform: translateX(6px) skewX(-3deg); } 90% { transform: scaleY(.82); } }
.icu-rule { margin: 0; font-weight: 500; font-size: 17px; line-height: 1.25; }
.icu-streak { font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 13px; }
.icu-play { position: relative; overflow: hidden; border: 0; cursor: pointer; margin-top: 6px; width: min(300px, 78vw); height: 92px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 0 var(--deeper); font: 700 24px var(--display); letter-spacing: .12em; text-transform: uppercase; transition: transform .12s cubic-bezier(.3,1.6,.5,1), box-shadow .12s; }
.icu-play:disabled { cursor: default; }
.icu-play.ready { animation: icu-pulse 1.5s ease-in-out infinite; }
.icu-play.ready:active { transform: translateY(7px) scaleY(.88); box-shadow: 0 1px 0 var(--deeper); animation: none; }
/* the pulse is a ring, not a transform: a button that moves is one a thumb (and ship-check) can miss */
@keyframes icu-pulse { 0% { box-shadow: 0 8px 0 var(--deeper), 0 0 0 0 var(--ink); } 70%, 100% { box-shadow: 0 8px 0 var(--deeper), 0 0 0 16px transparent; } }
.icu-lid { position: absolute; inset: 0; background: var(--dark); transition: transform .25s ease-out; }
.icu-playlabel { position: relative; z-index: 1; }
.icu-play:not(.ready) .icu-playlabel { color: var(--ink); mix-blend-mode: difference; }
.icu-tweaks { position: absolute; top: 8px; left: 8px; background: var(--dark); padding: 8px 10px; display: grid; gap: 6px; font-size: 13px; z-index: 5; }
.icu-tweakrow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.icu-tweakrow span { width: 100%; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 11px; }
.icu-tweakrow button { font: 500 13px var(--ui); background: none; color: var(--ink); border: 2px solid var(--rule); padding: 8px 10px; min-height: 40px; cursor: pointer; }
.icu-tweakrow button.on { background: var(--ink); color: var(--dark); border-color: var(--ink); }

/* ---- how to play ----------------------------------------------------------------------- */
.icu-how { position: absolute; inset: 0; z-index: 10; background: var(--ground); display: flex; flex-direction: column; align-items: center; gap: 14px; padding: max(18px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom)); }
.icu-howbody { flex: 1 1 0; min-height: 0; width: 100%; display: grid; place-items: center; container-type: size; }
.icu-howtext { margin: 0; font: 700 clamp(21px, 5.6vw, 30px)/1.15 var(--display); text-align: center; min-height: 2.3em; }
.icu-howdots { display: flex; gap: 10px; } .icu-howdots span { width: 12px; height: 12px; border-radius: 50%; background: var(--deep); } .icu-howdots span.on { background: var(--ink); }
.icu-framed { position: relative; aspect-ratio: 1; outline: 4px solid var(--dark); }
.icu-framed.ring, .icu-framed.was { outline: 6px solid var(--ink); z-index: 1; }
.icu-framed.wrong { outline: 6px solid var(--dark); }
.icu-tag { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ink); color: var(--dark); font: 700 11px/1.1 var(--ui); letter-spacing: .02em; text-transform: uppercase; padding: 4px 2px; text-align: center; }
.icu-framed.wrong .icu-tag { background: var(--dark); color: var(--ink); }
.icu-howone { width: min(100cqw, 100cqh); }
.icu-howgrid { width: min(100cqw, 100cqh); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px; }
.icu-howrows { width: min(100cqw, 440px); display: grid; gap: clamp(8px, 2.4cqh, 18px); }
.icu-howlabel { font: 700 13px var(--ui); letter-spacing: .18em; text-transform: uppercase; margin-bottom: 6px; }
.icu-howline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.icu-howline .icu-framed { max-height: 17cqh; }

/* ---- the run --------------------------------------------------------------------------- */
.icu-run { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; padding: max(10px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom)); gap: 10px; }
.icu-head { display: grid; gap: 4px; text-align: center; }
.icu-round { font: 700 14px var(--ui); letter-spacing: .24em; text-transform: uppercase; height: 18px; }
.icu-ask { font: 700 clamp(19px, 5.4vw, 30px)/1.1 var(--display); height: 1.2em; white-space: nowrap; }
.icu-timer { height: 14px; background: var(--deep); margin-top: 4px; overflow: hidden; }
.icu-timerfill { height: 100%; background: var(--ink); transform-origin: left center; transform: scaleX(0); will-change: transform; }
.icu-timer.low .icu-timerfill { background: var(--dark); }
.icu-board { min-height: 0; min-width: 0; display: grid; place-items: center; position: relative; }
.icu-foot { height: 16px; display: flex; gap: 6px; justify-content: center; align-items: center; }
.icu-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--deep); } .icu-dot.on { background: var(--ink); }
:root[data-dots="off"] .icu-dot { visibility: hidden; }
.icu-lead { text-align: center; animation: icu-pop .35s cubic-bezier(.3,1.5,.5,1); }
.icu-leadnum { font: 700 clamp(140px, 46vw, 300px)/.8 var(--display); text-shadow: 7px 7px 0 var(--dark); }
.icu-leadsub { margin-top: 18px; font: 700 18px var(--ui); letter-spacing: .2em; text-transform: uppercase; }
@keyframes icu-pop { from { transform: scale(.6); opacity: 0; } }
.icu-watch { display: block; outline: 6px solid var(--dark); background: var(--deep); }
.icu-watch.blank { outline-color: transparent; background: transparent; }
.icu-grid { display: grid; justify-content: center; align-content: center; }
.icu-tile { position: relative; padding: 0; border: 0; background: var(--deep); cursor: pointer; outline: 3px solid var(--dark); outline-offset: -3px; touch-action: none; }
.icu-tile canvas { pointer-events: none; }
.icu-grid.done .icu-tile { cursor: default; }
.icu-grid.done .icu-tile:not(.flash):not(.wrong):not(.was) { opacity: .28; }
.icu-tile.flash { outline: 7px solid var(--ink); outline-offset: -2px; z-index: 2; animation: icu-flash .4s ease-out; }
@keyframes icu-flash { 0% { transform: scale(1); filter: brightness(2.2); } 45% { transform: scale(1.12); } 100% { transform: scale(1); filter: none; } }
.icu-tile.was { outline: 7px solid var(--ink); outline-offset: -2px; z-index: 2; }
.icu-tile.wrong { outline: 7px solid var(--dark); outline-offset: -2px; z-index: 2; animation: icu-shake .35s; }
@keyframes icu-shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.icu-mark { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ink); color: var(--dark); font: 700 11px/1.1 var(--ui); letter-spacing: .02em; text-transform: uppercase; padding: 4px 2px; text-align: center; pointer-events: none; z-index: 3; }
.icu-tile.wrong .icu-mark { background: var(--dark); color: var(--ink); }

/* ---- result ---------------------------------------------------------------------------- */
.icu-result { display: flex; flex-direction: column; align-items: center; gap: clamp(6px, 2svh, 22px); padding: max(14px, env(safe-area-inset-top)) 18px max(12px, env(safe-area-inset-bottom)); overflow-y: auto; text-align: center; }
.icu-resmain, .icu-resside { width: 100%; max-width: 480px; display: flex; flex-direction: column; align-items: center; gap: clamp(4px, 1.3svh, 14px); }
.icu-score { font: 700 clamp(64px, 15svh, 190px)/.82 var(--display); text-shadow: 6px 6px 0 var(--dark); }
.icu-score.perfect { font-size: clamp(64px, 19vw, 130px); }
.icu-scoresub { font: 700 16px var(--ui); letter-spacing: .2em; text-transform: uppercase; }
.icu-pair { display: flex; gap: 14px; justify-content: center; margin: 6px 0 12px; }
.icu-pair .icu-framed { width: clamp(80px, 15svh, 190px); }
.icu-why { font-weight: 700; font-size: 17px; }
.icu-rank { font-weight: 700; font-size: 16px; min-height: 20px; }
.icu-result .icu-btn { height: clamp(52px, 9svh, 68px); flex: 0 0 auto; }
.icu-trio { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; border-block: 3px solid var(--dark); }
.icu-stat { padding: clamp(4px, 1svh, 8px) 4px; display: grid; gap: 2px; } .icu-stat + .icu-stat { border-left: 3px solid var(--dark); }
.icu-stat b { font: 700 clamp(22px, 4svh, 30px)/1 var(--display); } .icu-stat span { font: 700 11px var(--ui); letter-spacing: .12em; text-transform: uppercase; }
.icu-distlabel { font: 700 11px var(--ui); letter-spacing: .14em; text-transform: uppercase; }
.icu-dist { display: grid; grid-template-columns: repeat(18, 1fr); gap: 3px; width: 100%; height: clamp(30px, 7svh, 90px); align-items: end; margin-bottom: 14px; }
.icu-col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.icu-col i { display: block; min-height: 3px; background: var(--deeper); } .icu-col.me i { background: var(--ink); }
.icu-col span { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font: 500 10px var(--ui); margin-top: 2px; }
.icu-next { font: 700 15px var(--ui); letter-spacing: .12em; text-transform: uppercase; font-variant-numeric: tabular-nums; }

/* ---- a wide window is its own layout: the wall takes the window, the band is a column down the left ---- */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .icu-home { flex-direction: row-reverse; }
  .icu-band { width: clamp(380px, 34vw, 560px); justify-content: center; gap: 16px; border-top: 0; border-right: 8px solid var(--dark); padding: 30px; }
  .icu-logo { font-size: clamp(150px, 15vw, 260px); text-shadow: 8px 8px 0 var(--dark); }
  .icu-rule { font-size: 21px; } .icu-date { font-size: 18px; }
  .icu-wall { height: 100%; }
  .icu-run { padding: 22px 40px; gap: 16px; }
  .icu-head { max-width: 900px; width: 100%; margin: 0 auto; }
  .icu-result { flex-direction: row; justify-content: center; align-items: center; gap: 70px; padding: 40px; }
  .icu-resmain, .icu-resside { max-width: 460px; }
  .icu-score { font-size: clamp(150px, 26vh, 280px); }
  .icu-pair .icu-framed { width: clamp(140px, 22vh, 230px); }
  .icu-how { padding: 40px; gap: 20px; }
  .icu-howrows { width: min(100cqw, 760px); } .icu-howline .icu-framed { max-height: 22cqh; }
  .icu-howlabel { font-size: 16px; } .icu-tag, .icu-mark { font-size: 14px; padding: 6px 2px; }
  .icu-resside { gap: 18px; }
  .icu-stat b { font-size: 54px; } .icu-stat span { font-size: 14px; } .icu-stat { padding: 16px 6px; }
  .icu-distlabel { font-size: 14px; } .icu-dist { height: 150px; } .icu-col span { font-size: 13px; }
  .icu-next { font-size: 20px; } .icu-rank { font-size: 22px; } .icu-scoresub { font-size: 20px; }
  .icu-ask { font-size: 34px; } .icu-round { font-size: 17px; height: 22px; }
  .icu-howtext { font-size: 34px; }
}

/* a short phone: the result still fits without a scroll */
@media (max-height: 680px) and (max-width: 899px) {
  .icu-result { gap: 6px; padding-top: 10px; }
  .icu-score { font-size: 60px; } .icu-scoresub { font-size: 13px; }
  .icu-pair { margin: 2px 0 6px; } .icu-pair .icu-framed { width: 84px; }
  .icu-why, .icu-rank { font-size: 14px; min-height: 0; }
  .icu-distlabel { display: none; } .icu-dist { height: 28px; }
  .icu-result .icu-btn { height: 50px; font-size: 17px; }
  .icu-result .icu-link { min-height: 40px; }
}
