/* The free weekly web lock. Colours, sizes, shadows and motion come from the approved boards:
   13-GameplayControls.html (the board, wheels, rings, controls and lamps), 11-UnlockSequence.html
   (the vault: dial, bolts, door, light, flash, stamp) and 17-ShareCard.html. Fonts are the app's,
   self-hosted and subset (web/tools/build-assets.sh). */

@font-face { font-family: Fraunces; src: url(fonts/Fraunces.woff2) format("woff2"); font-weight: 600 900; font-style: normal; font-display: swap; }
@font-face { font-family: Fraunces; src: url(fonts/Fraunces-Italic.woff2) format("woff2"); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: Manrope; src: url(fonts/Manrope.woff2) format("woff2"); font-weight: 600 800; font-style: normal; font-display: swap; }

:root {
  --ink: #F4EAD5;
  --ink-2: #E9DCC4;
  --muted: #C8B08A;
  --gold: #F0CF8E;
  --same: #E0B064;
  --opposite: #5CC2B4;
  --s: 1; /* the board's scale, set by play.js */
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #120C08; }
body {
  color: var(--ink);
  font-family: Manrope, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid #FFD27A; outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Wood grain and the lamp glow (board 13). */
.bg {
  position: fixed; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(92deg, rgba(255,210,150,.025) 0 2px, rgba(0,0,0,0) 2px 9px),
                    radial-gradient(ellipse at 50% 18%, rgba(255,190,110,.20), rgba(0,0,0,0) 60%);
}

/* The column: phone first, 17pt sides and 12pt gaps (board 13); fits 480 × 860 without scrolling. */
.column {
  position: relative; margin: 0 auto; max-width: 430px; min-height: 100%; height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) 17px max(14px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
}
@media (min-height: 940px) { .column { height: auto; min-height: 100dvh; padding-top: 32px; } }

.eyebrow { font-size: 10px; letter-spacing: .26em; font-weight: 800; color: var(--muted); }

/* Header: 48pt, the title in the middle, 44pt circles at the sides. */
.top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; height: 48px; flex: none; }
.title { grid-column: 2; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.number { font-family: Fraunces, serif; font-size: 22px; font-weight: 700; }
.circle {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(240,207,142,.35);
  background: rgba(255,230,180,.06); display: flex; align-items: center; justify-content: center; padding: 0;
}
#own-window { grid-column: 1; }
#sound { grid-column: 3; }
#sound .sound-on { display: none; }
#sound[aria-pressed="true"] .sound-on { display: inline; }
#sound[aria-pressed="true"] .sound-off { display: none; }

/* Horatio (board 24's medallion and bubble). */
.intro { display: flex; align-items: center; gap: 12px; flex: none; }
.medal {
  flex: none; width: 60px; height: 60px; border-radius: 50%; overflow: hidden; border: 3px solid #D9A857;
  background: radial-gradient(circle at 50% 35%, #4A3220, #1B130D);
  box-shadow: 0 0 0 2px #2A1D12, 0 8px 20px rgba(0,0,0,.6);
}
.bubble {
  margin: 0; flex: 1; padding: 9px 13px; border-radius: 14px; background: #F4EAD5; color: #2A1D12;
  font-family: Fraunces, serif; font-style: italic; font-weight: 600; font-size: 14px; line-height: 1.3;
  box-shadow: 0 10px 24px rgba(0,0,0,.5);
}
.howto { margin: 0; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); flex: none; }

/* Moves · clock · par (board 13). */
.stats { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; flex: none; }
.stat { display: flex; align-items: baseline; gap: 8px; }
.stat .eyebrow { letter-spacing: .22em; }
.value { font-family: Fraunces, serif; font-size: 22px; font-weight: 700; }
.value.gold { color: var(--gold); }
.clock { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

/* "Stuck?": the app's 30pt chip. */
.stuck {
  align-self: center; flex: none; display: flex; align-items: center; min-height: 30px; padding: 4px 14px; border-radius: 15px;
  border: 1px solid rgba(240,207,142,.45); background: rgba(255,230,180,.08); box-shadow: 0 0 20px rgba(255,180,80,.18);
  font-size: 12px; font-weight: 700; color: var(--gold); text-decoration: none; text-align: center;
  animation: fadeup .5s ease both;
}

/* The board: scaled into the room left (play.js sets --s), like the app's PuzzleBoard(scale:). */
.board-fit { flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.vault { position: relative; width: 360px; height: 512px; transform: scale(var(--s)); transform-origin: center; perspective: 900px; flex: none; }
.plate {
  position: absolute; inset: 0; padding: 12px; border-radius: 22px; border: 2px solid #8C6A3A;
  background-color: #1B130D; background-image: repeating-linear-gradient(88deg, rgba(255,210,150,.035) 0 3px, rgba(0,0,0,0) 3px 11px);
  box-shadow: inset 0 0 0 4px #120C08, inset 0 0 0 5px rgba(240,207,142,.22), 0 30px 60px rgba(0,0,0,.65), 0 0 80px rgba(255,170,80,.08);
  transform-origin: 0% 50%; z-index: 3;
}
.rivet { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #8C6A3A; box-shadow: inset 0 -1px 0 rgba(0,0,0,.5); }
.rivet.tl { left: 7px; top: 7px; } .rivet.tr { right: 7px; top: 7px; } .rivet.bl { left: 7px; bottom: 7px; } .rivet.br { right: 7px; bottom: 7px; }

.grid { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.cells { position: relative; display: flex; gap: 10px; }
.lamp { width: 12px; height: 12px; border-radius: 50%; background: #2A1F16; border: 1px solid #5A4430; transition: background .4s; flex: none; }
.lamp.on { background: #FFD27A; animation: lamp 2.2s ease-in-out infinite; }
@keyframes lamp { 0%,100% { box-shadow: 0 0 6px #FFC65A, 0 0 0 0 rgba(255,198,90,.4); } 50% { box-shadow: 0 0 14px #FFD27A, 0 0 0 4px rgba(255,198,90,0); } }
.col-lamps { display: flex; gap: 10px; padding-top: 2px; }
.col-lamps > span { width: 54px; display: flex; justify-content: center; }

/* A wheel: 54 × 84, a drum showing three letters (28pt rows), the bezel by lamp state. */
.wheel { position: relative; width: 54px; height: 84px; }
.drum {
  position: absolute; inset: 0; border-radius: 12px; overflow: hidden; background: #17100B; border: 2px solid #5A4430;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.6), 0 6px 14px rgba(0,0,0,.5); transition: border-color .4s, background .4s;
}
.wheel.lit .drum { border-color: #8C6A3A; }
.wheel.both .drum { border-color: #D9A857; background: #2A1D12; }
.strip { position: absolute; left: 0; right: 0; top: 0; color: var(--ink-2); transition: transform .45s cubic-bezier(.34,1.45,.64,1), color .4s; will-change: transform; }
.strip.jump { transition: none; }
.wheel.lit .strip { color: var(--ink); }
.wheel.both .strip { color: #FFE3A8; text-shadow: 0 0 10px rgba(255,200,110,.8); }
.strip > span { height: 28px; display: flex; align-items: center; justify-content: center; font-family: Fraunces, serif; font-size: 25px; font-weight: 700; line-height: 1; }
.shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(8,5,3,.92) 0%, rgba(8,5,3,.15) 33%, rgba(255,235,200,.06) 50%, rgba(8,5,3,.15) 67%, rgba(8,5,3,.92) 100%);
}
.rule { position: absolute; left: 4px; right: 4px; height: 1px; background: rgba(240,207,142,.25); pointer-events: none; }
.rule.a { top: 27px; } .rule.b { top: 55px; }
.ring { position: absolute; inset: -4px; border-radius: 15px; pointer-events: none; z-index: 2; }
.ring.sel { box-shadow: 0 0 0 3px #FFD27A, 0 0 22px rgba(255,200,110,.75); animation: ringp 1.4s ease-in-out infinite; }
@keyframes ringp { 0%,100% { box-shadow: 0 0 0 3px #FFD27A, 0 0 14px rgba(255,200,110,.5); } 50% { box-shadow: 0 0 0 4px #FFE3A8, 0 0 28px rgba(255,200,110,.9); } }
.ring.gold { border: 2px dashed var(--same); }
.ring.teal { border: 2px dashed var(--opposite); }
.pick { position: absolute; left: -5px; right: -5px; top: -5px; bottom: -5px; background: none; border: none; padding: 0; z-index: 3; border-radius: 14px; }
.badge {
  position: absolute; left: -6px; top: -6px; width: 22.67px; height: 22.67px; border-radius: 50%; background: #1B130D;
  border: 1.33px solid var(--gold); display: flex; align-items: center; justify-content: center; z-index: 4; pointer-events: none;
  animation: driver 2s ease-in-out infinite;
}
@keyframes driver { 0%,100% { box-shadow: 0 0 0 0 rgba(240,207,142,0); } 50% { box-shadow: 0 0 0 3px rgba(240,207,142,.35); } }
.badge svg { animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* A link: a 14pt rounded square in the gap, its colour by direction, a chevron from driver to driven. */
.link { position: absolute; width: 14px; height: 14px; border-radius: 4px; z-index: 2; pointer-events: none; }
.link.same { background: var(--same); box-shadow: 0 0 10px var(--same); }
.link.opposite { background: var(--opposite); box-shadow: 0 0 10px var(--opposite); }
.link svg { display: block; }
.sweep { position: absolute; inset: 0; border-radius: 12px; overflow: hidden; pointer-events: none; }
.sweep::after { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%; background: linear-gradient(90deg, transparent, rgba(255,226,160,.35), transparent); transform: skewX(-18deg); animation: sweep 3.4s ease-in-out infinite; }
@keyframes sweep { 0%,55% { left: -40%; } 100% { left: 130%; } }

/* Legend and the control row (board 13). */
.legend { display: flex; justify-content: center; gap: 18px; font-size: 12px; font-weight: 600; color: var(--muted); flex: none; }
.legend span { display: flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.swatch.same { background: var(--same); } .swatch.opposite { background: var(--opposite); }
#play-controls { display: flex; flex-direction: column; gap: 10px; flex: none; }
.controls { display: flex; gap: 10px; align-items: stretch; height: 72px; }
.side {
  width: 52px; flex-shrink: 0; border-radius: 16px; border: 1px solid rgba(240,207,142,.35); background: rgba(255,230,180,.06);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0;
  font-size: 9px; font-weight: 800; letter-spacing: .1em; color: var(--muted);
}
.big {
  flex: 1 1 0; border-radius: 18px; border: 1px solid rgba(240,207,142,.6);
  background: linear-gradient(180deg, rgba(255,230,180,.16), rgba(255,230,180,.05));
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0; box-shadow: 0 8px 20px rgba(0,0,0,.4);
  transition: opacity .25s, transform .08s;
}
.big:active, .side:active { transform: scale(.96); }
.big[aria-disabled="true"], .side[aria-disabled="true"] { opacity: .35; }
.big-label { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 22px; }
.big-letter { font-family: Fraunces, serif; font-size: 30px; font-weight: 700; line-height: 1; color: #FFE3A8; min-height: 30px; }
.big-word { font-size: 9px; letter-spacing: .2em; font-weight: 800; color: var(--muted); }
.help { margin: -4px 0 0; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }

/* The vault (board 11), simplified: the dial pops in and spins, the bolts slide home, the door
   swings open onto the light, a flash, the stamp. */
.vault-light {
  position: absolute; inset: 8px; border-radius: 20px; overflow: hidden; opacity: 0; z-index: 1;
  background: radial-gradient(circle at 50% 48%, #FFF1C8, #F0B85A 28%, #8C5A22 62%, #1B110A 100%);
}
.rays {
  position: absolute; left: -52px; top: -26px; width: 448px; height: 448px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255,250,230,.35) 0deg 4deg, rgba(255,250,230,0) 4deg 16deg);
  -webkit-mask-image: radial-gradient(circle, #000 10%, transparent 62%); mask-image: radial-gradient(circle, #000 10%, transparent 62%);
  animation: spin 20s linear infinite;
}
.coin {
  position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFF1C8, #E0B064 45%, #8C6A3A 100%); border: 3px solid #B98439;
  box-shadow: 0 0 40px rgba(255,220,140,.8); opacity: 0;
  display: flex; align-items: center; justify-content: center;
}
.coin svg { width: 70px; height: 70px; }
.dial { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px; z-index: 6; opacity: 0; pointer-events: none; }
.dial::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #FFF1C8, #E0B064 40%, #8C6A3A 100%);
  box-shadow: 0 10px 26px rgba(0,0,0,.6), inset 0 -4px 8px rgba(80,50,20,.5);
}
.dial svg { position: absolute; inset: 0; width: 120px; height: 120px; }
.bolt {
  position: absolute; width: 30px; height: 16px; border-radius: 4px; z-index: 1; opacity: 0;
  background: linear-gradient(180deg, #F6DCA0, #C9954C 60%, #8C6A3A); box-shadow: 0 2px 4px rgba(0,0,0,.5);
}
.bolt-l { left: -24px; } .bolt-r { right: -24px; }
.bolt.b1 { top: 150px; } .bolt.b2 { top: 350px; }
.flash {
  position: absolute; left: -60px; right: -60px; top: -80px; bottom: -80px; pointer-events: none; z-index: 5; opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255,240,200,.9), rgba(255,200,110,.25) 40%, rgba(0,0,0,0) 70%);
}

.unlocking .dial { animation: dialin .35s cubic-bezier(.34,1.56,.64,1) .55s both; }
.unlocking .dial svg { animation: dialspin .8s cubic-bezier(.5,0,.3,1.3) .75s both; }
@keyframes dialin { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes dialspin { 0% { transform: rotate(0deg); } 60% { transform: rotate(-300deg); } 100% { transform: rotate(-270deg); } }
.unlocking .bolt { opacity: 1; }
.unlocking .bolt-l.b1 { animation: boltl .32s cubic-bezier(.34,1.56,.64,1) 1.1s both; }
.unlocking .bolt-r.b1 { animation: boltr .32s cubic-bezier(.34,1.56,.64,1) 1.18s both; }
.unlocking .bolt-l.b2 { animation: boltl .32s cubic-bezier(.34,1.56,.64,1) 1.26s both; }
.unlocking .bolt-r.b2 { animation: boltr .32s cubic-bezier(.34,1.56,.64,1) 1.34s both; }
@keyframes boltl { from { transform: translateX(0); } to { transform: translateX(26px); } }
@keyframes boltr { from { transform: translateX(0); } to { transform: translateX(-26px); } }
.unlocking .plate { animation: door .85s cubic-bezier(.62,0,.38,1) 1.75s both; }
@keyframes door { 0% { transform: rotateY(0deg); opacity: 1; } 70% { opacity: 1; } 100% { transform: rotateY(-104deg); opacity: 0; } }
.unlocking .vault-light { animation: vlight 1s ease-out 1.9s both; }
@keyframes vlight { from { opacity: 0; } to { opacity: 1; } }
.unlocking .flash { animation: flash 1.1s ease-out 2.05s both; }
@keyframes flash { 0% { opacity: 0; } 25% { opacity: .75; } 100% { opacity: 0; } }
.unlocking .coin { animation: coinrise .9s cubic-bezier(.34,1.56,.64,1) 2.35s both; }
@keyframes coinrise { from { transform: scale(.55) translateY(20px); opacity: 0; } to { transform: scale(1.18) translateY(-6px); opacity: 1; } }
/* Opened (a return visit, or after the sequence): the door stays open on the light. */
/* (Board 11 keeps the swung door in view; here it fades as it opens, so it never overhangs the column.) */
.opened .plate { transform: rotateY(-104deg); opacity: 0; }
.opened .vault-light, .opened .coin { opacity: 1; }
.opened .coin { transform: scale(1.18) translateY(-6px); }

/* The result (boards 11 and 13): the stamp, stars, the verdict, Share and the App Store. */
.result { flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; animation: fadeup .5s ease both; }
.stamp {
  font-family: Fraunces, serif; font-size: 42px; font-weight: 900; letter-spacing: .08em; line-height: 1;
  background-image: linear-gradient(90deg, #B98439, #FFE8B0, #D9A857, #FFF4D6, #B98439); background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: stamp .45s cubic-bezier(.34,1.56,.64,1) both, shine 3s linear infinite;
}
@keyframes stamp { 0% { transform: scale(2.4) translateY(-10px); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes shine { from { background-position: 0 0; } to { background-position: 300% 0; } }
.stars { display: flex; gap: 8px; }
.stars svg { width: 30px; height: 30px; }
.verdict { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.next { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.actions { display: flex; gap: 12px; }
.secondary {
  height: 48px; padding: 0 21px; border-radius: 16px; border: 1px solid rgba(240,207,142,.35); background: rgba(255,230,180,.06);
  display: inline-flex; align-items: center; gap: 8px; font-family: Fraunces, serif; font-size: 16px; font-weight: 700; color: var(--ink);
}
.install { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cta { margin: 0; font-family: Fraunces, serif; font-size: 18px; font-weight: 700; color: #FFF1D6; }
.cta.other { font-size: 15px; font-family: Manrope, system-ui, sans-serif; font-weight: 700; color: var(--muted); max-width: 320px; }
#store-badge { display: block; line-height: 0; }
#store-badge img { display: block; }

@keyframes fadeup { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Once solved, the result takes the controls' place. */
.solved #play-controls, .solved .stuck { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
  .rays, .badge svg { animation: none !important; }
}
