@font-face { font-family: "Grenze Gotisch"; src: url(fonts/grenze-gotisch-latin-800-normal.woff2) format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Grenze"; src: url(fonts/grenze-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Grenze"; src: url(fonts/grenze-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --night: #0f1645; --dusk: #27327f; --sheet: #f3f4fb; --sheet-shade: #d6d9ec; --ink: #171f52;
  --glaze-red: #d62f25; --glaze-blue: #1f5fc4; --glaze-gold: #f2c531; --peg: #c58a4b; --lamp: #fff0a8; --leaf: #2c6b44;
  --display: "Grenze Gotisch", Georgia, "Noto Serif", "Times New Roman", serif;
  --body: "Grenze", Georgia, "Noto Serif", "Segoe UI", system-ui, sans-serif;
  --gut: max(12px, env(safe-area-inset-left));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--sheet); font-family: var(--body); font-weight: 500; overflow: hidden; overscroll-behavior: none; }
[hidden] { display: none !important; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--glaze-gold); outline-offset: 2px; }

/* HUD: the score is socks pegged on a line */
#hud { position: fixed; left: 0; right: 0; top: 0; padding: max(8px, env(safe-area-inset-top)) 56px 0 var(--gut); display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
#btnPause { pointer-events: auto; position: fixed; top: max(8px, env(safe-area-inset-top)); right: var(--gut); }
#btnMute { position: fixed; top: calc(max(8px, env(safe-area-inset-top)) + 50px); right: var(--gut); }
.icon { width: 42px; height: 42px; display: grid; place-items: center; background: rgba(15, 22, 69, .62); border: 2px solid rgba(243, 244, 251, .5); border-radius: 50% 50% 46% 46%; color: var(--sheet); padding: 0; }
.icon svg { width: 22px; height: 22px; fill: currentColor; }
#btnMute .off { display: none; } #btnMute.muted .on { display: none; } #btnMute.muted .off { display: block; }
#tally { display: grid; gap: 2px; }
.trow { display: flex; align-items: center; gap: 6px; min-height: 26px; }
.trow .who { min-width: 4.4em; font-weight: 700; font-size: 15px; line-height: 1; text-shadow: 0 1px 2px var(--night); }
.trow.active .who { color: var(--lamp); }
.socks { display: flex; gap: 3px; padding-top: 2px; border-top: 1.5px solid rgba(243, 244, 251, .75); }
.sock { width: 15px; height: 21px; }
.sock path { fill: none; stroke: rgba(243, 244, 251, .4); stroke-width: 1.5; }
.sock.goal path { fill: var(--glaze-gold); stroke: var(--sheet); }
.sock.miss path { stroke: rgba(214, 47, 37, .95); stroke-dasharray: 2 2; }
.sock.red.goal path { fill: #e8483c; } .sock.blue.goal path { fill: #4b8bea; }

#banner { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(92vw, 560px); padding: 6px 12px; background: rgba(15, 22, 69, .72); text-align: center; font-size: 17px; line-height: 1.15; pointer-events: none; }
#banner.secret { background: var(--lamp); color: var(--ink); font-weight: 700; top: 76px; bottom: auto; }

#chips { position: fixed; left: var(--gut); right: var(--gut); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 44px); display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.chipgroup { display: flex; gap: 2px; pointer-events: auto; }
.chip { min-width: 44px; height: 44px; padding: 0 8px; background: rgba(15, 22, 69, .72); border: 2px solid rgba(243, 244, 251, .55); color: var(--sheet); font-weight: 700; font-size: 15px; pointer-events: auto; display: grid; place-items: center; }
.chip svg { width: 18px; height: 18px; }
.chip[aria-pressed="true"] { background: var(--sheet); color: var(--ink); border-color: var(--sheet); }
.chip.wide { padding: 0 12px; }

#powerBar { position: fixed; left: 50%; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 96px); transform: translateX(-50%); width: min(52vw, 240px); height: 12px; background: rgba(15, 22, 69, .72); border: 2px solid var(--sheet); }
#powerFill { height: 100%; width: 0; background: var(--glaze-gold); }

/* The huge word when something happens. */
#shout { position: fixed; left: 0; right: 0; top: 14%; text-align: center; pointer-events: none; opacity: 0; }
#shout.on { opacity: 1; animation: stamp .24s cubic-bezier(.2, 1.5, .4, 1); }
#shoutMain { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(54px, 17vmin, 136px); line-height: .95; color: var(--sheet); text-shadow: 0 .04em 0 var(--glaze-red), 0 .08em 0 var(--night); padding: 0 12px; overflow-wrap: anywhere; }
#shout.bad #shoutMain { text-shadow: 0 .04em 0 var(--dusk), 0 .08em 0 var(--night); }
#shoutSub { display: block; margin-top: 2px; font-size: clamp(18px, 4.2vmin, 28px); font-weight: 700; text-shadow: 0 2px 2px var(--night); }
@keyframes stamp { from { transform: scale(1.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#freezeLine { position: fixed; left: 0; right: 0; bottom: max(40px, 6%); text-align: center; font-family: var(--display); font-weight: 800; font-size: clamp(26px, 7vmin, 56px); color: var(--ink); background: var(--lamp); padding: 2px 12px; opacity: 0; pointer-events: none; }
#freezeLine.on { opacity: 1; }
#skipHint { position: fixed; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom)); text-align: center; font-size: 15px; opacity: 0; pointer-events: none; text-shadow: 0 1px 2px var(--night); }
#skipHint.on { opacity: .85; }
.reduced #shout.on { animation: none; }

/* Main menu: everything hangs on a washing line */
#menu { position: fixed; inset: 0; display: flex; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) var(--gut) max(10px, env(safe-area-inset-bottom)); overflow-y: auto; }
.menu-head { padding-right: 52px; }
#logo { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(58px, 19vmin, 124px); line-height: .88; color: var(--sheet); text-shadow: 0 .035em 0 var(--glaze-red), 0 .07em 0 #0a0f33; overflow-wrap: anywhere; }
#tagline { margin: 6px 0 0; max-width: 28em; font-size: clamp(17px, 2.6vmin, 22px); line-height: 1.12; text-shadow: 0 1px 3px var(--night), 0 0 8px var(--night), 0 0 2px var(--night); }
.menu-line { position: relative; margin-top: auto; padding-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.menu-line::before { content: ""; position: absolute; left: calc(var(--gut) * -1); right: calc(var(--gut) * -1); top: 14px; border-top: 2px solid var(--sheet-shade); }
.cloth { position: relative; flex: 1 1 200px; min-height: 76px; padding: 18px 12px 18px; text-align: left; border: 0; color: var(--ink); background: var(--sheet);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), 94% 100%, 88% calc(100% - 8px), 82% 100%, 76% calc(100% - 8px), 70% 100%, 64% calc(100% - 8px), 58% 100%, 52% calc(100% - 8px), 46% 100%, 40% calc(100% - 8px), 34% 100%, 28% calc(100% - 8px), 22% 100%, 16% calc(100% - 8px), 10% 100%, 5% calc(100% - 8px), 0 100%); }
.cloth::before, .cloth::after { content: ""; position: absolute; top: 0; width: 8px; height: 15px; background: var(--peg); }
.cloth::before { left: 14px; } .cloth::after { right: 14px; }
.cloth .t { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(30px, 5.8vmin, 42px); line-height: .95; }
.cloth .s { display: block; margin-top: 2px; font-size: 16px; line-height: 1.08; }
.cloth.main { background: var(--glaze-red); color: var(--sheet); flex-basis: 100%; }
.cloth.check { background-color: var(--sheet); background-image: repeating-linear-gradient(0deg, rgba(31, 95, 196, .13) 0 10px, transparent 10px 20px), repeating-linear-gradient(90deg, rgba(31, 95, 196, .13) 0 10px, transparent 10px 20px); }
.cloth.stripe { background-image: repeating-linear-gradient(90deg, transparent 0 22px, rgba(242, 197, 49, .34) 22px 30px); }
.cloth:hover { filter: brightness(1.06); } .cloth:active { transform: translateY(2px); }
.menu-foot { margin-top: 8px; }
#menuLinks { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.link { background: none; border: 0; padding: 6px 0; font-size: 18px; font-weight: 700; color: var(--sheet); text-decoration: underline; text-underline-offset: 3px; min-height: 36px; }
#stats, #byline { margin: 2px 0 0; font-size: 15px; line-height: 1.12; }
#byline { opacity: .8; }

/* Panels: a clean sheet, pegged at the top */
#panel { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: max(8px, env(safe-area-inset-top)) var(--gut) max(8px, env(safe-area-inset-bottom)); background: rgba(10, 15, 51, .55); overflow-y: auto; }
.card { position: relative; width: min(100%, 540px); max-height: 100%; overflow-y: auto; background: var(--sheet); color: var(--ink); padding: 22px 18px 18px; border-top: 3px solid var(--sheet-shade); box-shadow: 4px 6px 0 rgba(10, 15, 51, .5); }
.card.wide { width: min(100%, 720px); }
.card h2 { margin: 0 0 6px; font-family: var(--display); font-weight: 800; font-size: clamp(36px, 9vmin, 58px); line-height: .95; overflow-wrap: anywhere; }
#pBody { font-size: 18px; line-height: 1.18; }
#pBody p { margin: 6px 0; max-width: 40em; }
.big { font-family: var(--display); font-weight: 800; font-size: clamp(44px, 12vmin, 72px); line-height: 1; margin: 2px 0; }
.note { font-size: 16px; opacity: .85; }
#pBtns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn { flex: 1 1 140px; min-height: 48px; padding: 8px 12px; border: 2px solid var(--ink); background: var(--sheet); color: var(--ink); font-weight: 700; font-size: 19px; line-height: 1.05; }
.btn.go { background: var(--glaze-red); border-color: var(--glaze-red); color: var(--sheet); font-family: var(--display); font-weight: 800; font-size: 28px; }
.btn:hover { filter: brightness(.96); }
#pToast { margin: 8px 0 0; min-height: 1.1em; font-weight: 700; }
#pToast:empty { display: none; }
textarea#shareBox { width: 100%; height: 5.2em; margin-top: 6px; font: inherit; border: 2px solid var(--ink); background: #fff; color: var(--ink); }

/* Ladder */
.rungs { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.rung { display: grid; grid-template-columns: 54px 1fr; gap: 8px; align-items: center; width: 100%; padding: 4px 6px; text-align: left; background: transparent; border: 0; border-bottom: 1.5px dashed var(--sheet-shade); color: var(--ink); min-height: 62px; }
.rung canvas { width: 54px; height: 54px; }
.rung b { display: block; font-size: 20px; line-height: 1; }
.rung span { display: block; font-size: 15.5px; line-height: 1.08; margin-top: 2px; }
.rung[disabled] { opacity: .55; cursor: default; }
.rung:not([disabled]):hover { background: var(--sheet-shade); }
.rung.beaten b::after { content: " \2713"; color: var(--leaf); }

/* Looks */
.looks h3 { margin: 10px 0 2px; font-size: 20px; }
.lookgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.look { display: grid; grid-template-columns: 44px 1fr; gap: 6px; align-items: center; text-align: left; padding: 4px 6px; border: 2px solid var(--sheet-shade); background: transparent; color: var(--ink); min-height: 58px; }
.look canvas { width: 44px; height: 44px; }
.look b { display: block; font-size: 16.5px; line-height: 1; }
.look span { display: block; font-size: 14.5px; line-height: 1.05; margin-top: 2px; }
.look[disabled] { opacity: .62; cursor: default; }
.look.using { border-color: var(--ink); background: var(--sheet-shade); }

@media (min-aspect-ratio: 1/1) {
  #logo { font-size: clamp(46px, 19vh, 104px); }
  .cloth.main { flex-basis: 200px; }
  .menu-line { flex-wrap: nowrap; }
  #tagline { font-size: clamp(15px, 4.2vh, 21px); }
  .cloth { min-height: 64px; padding: 16px 10px 16px; }
  .cloth .t { font-size: clamp(24px, 7.5vh, 40px); }
  .cloth .s { font-size: 15px; }
  #shout { top: 4%; }
  #banner.secret { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); }
  #chips { left: calc(var(--gut) + 0px); right: auto; flex-direction: column; bottom: 56px; align-items: flex-start; }
}
@media (max-height: 420px) {
  #menu { padding-top: 4px; }
  #logo { font-size: 46px; }
  #tagline { margin-top: 2px; font-size: 15px; }
  .menu-line { padding-top: 6px; } .menu-line::before { top: 6px; }
  .cloth { min-height: 56px; padding: 13px 8px 12px; }
  .cloth .t { font-size: 24px; } .cloth .s { font-size: 13.5px; }
  #stats { display: none; } #byline { font-size: 13px; }
  .link { min-height: 30px; padding: 2px 0; font-size: 16px; }
  .card { padding: 10px 14px; }
  .card h2 { font-size: 30px; }
  #pBody { font-size: 16px; }
  .btn { min-height: 40px; font-size: 16px; }
  .btn.go { font-size: 22px; }
  #chips { bottom: 40px; }
  .chip { height: 40px; min-width: 40px; }
  #banner { font-size: 15px; bottom: 4px; padding: 3px 8px; }
  .trow { min-height: 22px; } .sock { width: 12px; height: 17px; } .trow .who { font-size: 13px; }
}
