@font-face{font-family:"Keyhole Stencil";src:url("../../assets/fonts/keyhole-stencil.woff?v=800712c751") format("woff");font-weight:100 900;font-style:normal;font-display:swap}

@font-face { font-family: 'KH Stencil'; src: url('fonts/BigShouldersStencilDisplay-Black.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'KH Courier'; src: url('fonts/CourierPrime-Bold.ttf') format('truetype'); font-display: swap; }

:root {
  --charcoal: #121314; --char-2: #191b1d; --char-3: #222529; --char-4: #2c3035;
  --brass: #e3a72f; --brass-light: #f8d06a; --brass-deep: #a86d10; --brass-ink: #2a1a02;
  --cream: #f1e6c9; --cream-dim: #c9bfa6; --muted: #9a917d; --light: #fffbe8; --cyan: #2ee6ff; --cyan-deep: #0b8fa3;
  --alert: #e0573e;
  --f-display: 'Keyhole Stencil', 'KH Stencil', 'Big Shoulders Stencil Display', Impact, 'Arial Narrow', sans-serif;
  --f-label: 'KH Courier', 'Courier Prime', 'Courier New', monospace;
  --f-body: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --brass-grad: linear-gradient(180deg, #ffe08a 0%, var(--brass-light) 12%, var(--brass) 48%, #c98a1c 78%, var(--brass-deep) 100%);
  --brass-edge: inset 0 1px 0 rgba(255, 246, 210, .75), inset 0 -2px 0 rgba(90, 52, 4, .55), 0 2px 0 rgba(0, 0, 0, .45);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--charcoal); color: var(--cream); }
body {
  font-family: var(--f-body); font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased;
  overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(227, 167, 47, .10), transparent 60%),
    radial-gradient(80% 50% at 50% 100%, rgba(227, 167, 47, .06), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .012) 0 1px, transparent 1px 3px),
    var(--charcoal);
}
button { font: inherit; color: inherit; }
a { color: var(--brass-light); }
:focus-visible { outline: 3px solid var(--light); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }


.kh-app { position: fixed; inset: 0; display: grid; grid-template-rows: auto 4px 1fr; padding-top: var(--safe-t); padding-bottom: var(--safe-b); }
.kh-top { height: 50px; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; padding: 0 4px; border-bottom: 1px solid rgba(227, 167, 47, .18);
  background: linear-gradient(180deg, rgba(34, 37, 41, .9), rgba(18, 19, 20, .9)); }
.kh-icon { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; border-radius: 10px; cursor: pointer; color: var(--cream-dim); text-decoration: none; }
.kh-icon:hover { color: var(--brass-light); background: rgba(227, 167, 47, .08); }
.kh-icon svg { width: 22px; height: 22px; }
.kh-title { text-align: center; line-height: 1.05; min-width: 0; }
.kh-title b { display: block; font-family: var(--f-display); font-weight: 900; font-size: 19px; letter-spacing: .04em; text-transform: uppercase; color: var(--brass-light);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kh-title span { display: block; font-family: var(--f-label); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.kh-prog { background: rgba(255, 255, 255, .06); position: relative; overflow: hidden; }
.kh-prog i { position: absolute; inset: 0 auto 0 0; width: 8%; background: linear-gradient(90deg, var(--brass-deep), var(--brass-light)); transition: width .5s var(--ease); }
.kh-prog.win i { background: linear-gradient(90deg, var(--cyan-deep), var(--cyan)); }


.kh-stage { position: relative; overflow: hidden; }
.face { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 12px 16px 14px; opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: opacity .28s var(--ease), transform .34s var(--ease), visibility 0s .34s; }
.face.on { opacity: 1; visibility: visible; transform: none; transition: opacity .28s var(--ease), transform .34s var(--ease), visibility 0s; }
[data-calm=on] .face { transform: none; transition: opacity .3s linear, visibility 0s .3s; }
[data-calm=on] .face.on { transition: opacity .3s linear, visibility 0s; }


.kh-btn { min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 0; cursor: pointer; font-family: var(--f-label); font-size: 15px; letter-spacing: .08em; text-transform: uppercase;
  background: var(--brass-grad); color: var(--brass-ink); box-shadow: var(--brass-edge); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s, filter .15s; }
.kh-btn:hover { filter: brightness(1.06); }
.kh-btn:active { transform: translateY(1px); }
.kh-btn.ghost { background: rgba(255, 255, 255, .04); color: var(--cream); box-shadow: inset 0 0 0 1.5px rgba(227, 167, 47, .45); }
.kh-btn.ghost:hover { background: rgba(227, 167, 47, .1); }
.kh-btn.big { min-height: 54px; font-size: 16px; }
.kh-btn[disabled] { opacity: .45; cursor: default; }
.kh-btn svg { width: 18px; height: 18px; flex: none; }


.kh-tile { width: 72px; height: 72px; border-radius: 23%; background: var(--brass-grad); box-shadow: var(--brass-edge), 0 10px 30px rgba(227, 167, 47, .25); position: relative; flex: none; }
.kh-tile::before { content: ''; position: absolute; left: 50%; top: 24%; width: 26%; height: 26%; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, var(--light), #ffe7a3 60%, var(--brass-light)); box-shadow: 0 0 14px 4px rgba(255, 243, 196, .55); }
.kh-tile::after { content: ''; position: absolute; left: 50%; top: 42%; width: 22%; height: 40%; transform: translateX(-50%); clip-path: polygon(30% 0, 70% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, #fff3c4, var(--brass-light)); filter: drop-shadow(0 0 8px rgba(255, 243, 196, .6)); }
.kh-tile.sm { width: 30px; height: 30px; box-shadow: var(--brass-edge); }
.kh-tile.win::before, .kh-tile.win::after { background: radial-gradient(circle, #eaffff, var(--cyan)); box-shadow: 0 0 16px 6px rgba(46, 230, 255, .6); }


.ls { margin: 0; font-size: 16px; color: var(--cream); }
.ls q { quotes: '\201C' '\201D'; font-style: italic; }
.ls cite { display: block; font-style: normal; font-family: var(--f-label); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--brass); margin-top: 3px; }
.ls cite::before { content: ''; display: inline-block; width: 13px; height: 8px; margin-right: 6px; vertical-align: 1px;
  background: linear-gradient(90deg, var(--brass) 0 45%, transparent 45% 55%, var(--brass) 55%); border-radius: 4px 1px 1px 4px; }

.kh-label { font-family: var(--f-label); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--brass); margin: 0; }
.kh-stencil { font-family: var(--f-display); font-weight: 900; text-transform: uppercase; letter-spacing: .03em; line-height: .95; margin: 0; color: var(--brass-light); }


.kh-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-family: var(--f-label); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  background: rgba(227, 167, 47, .1); color: var(--brass-light); box-shadow: inset 0 0 0 1px rgba(227, 167, 47, .35); }
.kh-chip svg { width: 14px; height: 14px; }


.kh-pop { position: absolute; right: 8px; top: calc(54px + var(--safe-t)); z-index: 30; width: min(320px, calc(100vw - 16px)); padding: 14px; border-radius: 14px;
  background: var(--char-3); box-shadow: 0 18px 50px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(227, 167, 47, .3); }
.kh-pop[hidden] { display: none; }
.kh-pop h2 { font-family: var(--f-label); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--brass); margin: 0 0 8px; }
.kh-pop p { margin: 10px 0 0; font-size: 14px; color: var(--cream-dim); }
.kh-switch { width: 100%; min-height: 48px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; background: none; padding: 6px 2px; cursor: pointer; text-align: left; }
.kh-switch .knob { width: 50px; height: 28px; border-radius: 99px; background: var(--char-4); box-shadow: inset 0 0 0 1.5px rgba(227, 167, 47, .5); position: relative; flex: none; transition: background .2s; }
.kh-switch .knob::after { content: 'OFF'; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--cream-dim); transition: left .2s var(--ease);
  font: 700 0/0 var(--f-label); }
.kh-switch[aria-checked=true] .knob { background: var(--brass-deep); }
.kh-switch[aria-checked=true] .knob::after { left: 25px; background: var(--brass-light); }
.kh-switch .st { font-family: var(--f-label); font-size: 11px; color: var(--muted); margin-left: auto; margin-right: 8px; }


.kh-streak { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .03); box-shadow: inset 0 0 0 1px rgba(227, 167, 47, .2); }
.kh-streak .n { font-family: var(--f-display); font-weight: 900; font-size: 34px; line-height: 1; color: var(--brass-light); min-width: 34px; text-align: center; }
.kh-streak .lbl { font-family: var(--f-label); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--cream-dim); line-height: 1.25; }
.kh-days { display: flex; gap: 5px; margin-left: auto; }
.kh-day { width: 22px; display: grid; justify-items: center; gap: 2px; font-family: var(--f-label); font-size: 9px; color: var(--muted); }
.kh-day i { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(241, 230, 201, .3); display: grid; place-items: center; font-style: normal; font-size: 11px; }
.kh-day.done i { background: var(--brass); box-shadow: none; color: var(--brass-ink); }
.kh-day.done i::after { content: '\2713'; font-weight: 700; }
.kh-day.spare i { box-shadow: inset 0 0 0 1.5px var(--brass); }
.kh-day.spare i::after { content: 'K'; font: 700 10px var(--f-label); color: var(--brass-light); }
.kh-day.today { color: var(--cream); }


.kh-card { border-radius: 18px; padding: 18px; position: relative; overflow: hidden;
  background: radial-gradient(90% 70% at 50% 0%, rgba(227, 167, 47, .22), transparent 70%), linear-gradient(180deg, var(--char-3), var(--charcoal));
  box-shadow: inset 0 0 0 1.5px rgba(227, 167, 47, .5), 0 18px 40px rgba(0, 0, 0, .5); }
.kh-card .brand { display: flex; align-items: center; gap: 8px; font-family: var(--f-label); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--cream-dim); }


.kh-promo { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(90deg, rgba(227, 167, 47, .12), rgba(227, 167, 47, .03));
  box-shadow: inset 0 0 0 1px rgba(227, 167, 47, .3); }
.kh-promo p { margin: 0; font-size: 14px; flex: 1; }
.kh-promo .kh-btn { min-height: 44px; padding: 8px 12px; font-size: 13px; white-space: nowrap; }


.kh-toast { position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); z-index: 40; padding: 10px 16px; border-radius: 12px; background: var(--char-4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(227, 167, 47, .4); font-size: 14px; max-width: calc(100vw - 32px); }
.kh-toast[hidden] { display: none; }
.kh-toast button { margin-left: 10px; }


.kh-light { position: absolute; inset: 0; pointer-events: none; z-index: 20; opacity: 0; background: radial-gradient(circle at 50% 45%, rgba(46, 230, 255, .55), rgba(46, 230, 255, .12) 35%, transparent 65%); }
.kh-light.go { animation: khLight 1.4s ease-out forwards; }
@keyframes khLight { 0% { opacity: 0; transform: scale(.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.4); } }
[data-calm=on] .kh-light.go { animation: khLightCalm 1.2s linear forwards; }
@keyframes khLightCalm { 0% { opacity: 0; } 40% { opacity: .5; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
