/* Pit Board. Perfect Finish "Finish Line" system: graphite ground, crimson and oxblood, pearl type,
   Chakra Petch over Schibsted Grotesk, four-point glint, straight blade rules, 12 degree leaning plates. */
:root {
  color-scheme: dark;
  --ground: #0E0F11; --panel: #16181B; --raised: #1F2226; --line: #282B30;
  --pearl: #F2EFE9; --steel: #9BA0A6; --dim: #6C7178;
  --crimson: #B82033; --crimson-hot: #D22740; --oxblood: #7E1524; --plate: #4A0C16;
  --disp: 'Chakra Petch', 'Eurostile', 'Arial Narrow', sans-serif;
  --body: 'Schibsted Grotesk', 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--ground); color: var(--pearl); font-family: var(--body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
.defs { position: absolute; }
button, input { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--disp); font-weight: 700; text-transform: uppercase; letter-spacing: .02em; line-height: 1.1; }
h2 { font-size: 19px; }
h3 { font-size: 21px; }
.label { font-family: var(--disp); font-weight: 600; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); }
.blade { display: block; width: min(220px, 60%); height: 11px; fill: var(--crimson); }

/* leaning button on an oxblood plate */
.btn { display: inline-block; font-family: var(--disp); font-weight: 600; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; text-decoration: none; text-align: center;
  color: var(--pearl); background: var(--crimson); border: 0; padding: 12px 20px; cursor: pointer; transform: skewX(-12deg); position: relative; overflow: hidden; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(242,239,233,.2), inset 0 -2px 0 rgba(0,0,0,.28), 4px 4px 0 0 var(--plate); transition: transform .12s ease, box-shadow .12s ease, background .15s ease; }
.btn > span { display: inline-block; transform: skewX(12deg); position: relative; z-index: 1; }
.btn::after { content: ""; position: absolute; top: -25%; bottom: -25%; left: -85%; width: 55%; background: linear-gradient(100deg, transparent, rgba(242,239,233,.34), transparent); transform: skewX(-16deg); transition: left .45s ease; pointer-events: none; }
.btn:hover { background: var(--crimson-hot); transform: skewX(-12deg) translate(1px, 1px); box-shadow: inset 0 1px 0 rgba(242,239,233,.2), inset 0 -2px 0 rgba(0,0,0,.28), 3px 3px 0 0 var(--plate); }
.btn:hover::after { left: 130%; }
.btn:active { transform: skewX(-12deg) translate(4px, 4px); box-shadow: 0 0 0 0 var(--plate); }
.btn.ghost { background: var(--raised); box-shadow: inset 0 0 0 1px var(--line), 4px 4px 0 0 rgba(0,0,0,.4); }
.btn.ghost::after { content: none; }
.btn.small { padding: 9px 14px; font-size: 11.5px; box-shadow: inset 0 1px 0 rgba(242,239,233,.2), inset 0 -2px 0 rgba(0,0,0,.28), 3px 3px 0 0 var(--plate); }
.btn.small.ghost { box-shadow: inset 0 0 0 1px var(--line), 3px 3px 0 0 rgba(0,0,0,.4); }
.btn[disabled] { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--pearl); outline-offset: 3px; }

/* sign in */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 20px; position: relative; overflow: hidden; }
.gate::before { content: ""; position: absolute; inset: 0 0 0 40%; background: conic-gradient(var(--pearl) 0 25%, transparent 0 50%, var(--pearl) 0 75%, transparent 0) 0 0 / 22px 22px; opacity: .04; -webkit-mask-image: linear-gradient(90deg, transparent, #000 75%); mask-image: linear-gradient(90deg, transparent, #000 75%); pointer-events: none; }
.gate-card { position: relative; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; }
.gate-logo { width: 230px; max-width: 80%; height: auto; margin-bottom: 14px; }
.gate h1 { font-size: 40px; margin-top: 10px; }
.gate-sub { color: var(--steel); margin-bottom: 12px; }
.gate label { font-family: var(--disp); font-weight: 600; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); margin-top: 6px; }
.gate input { background: var(--panel); border: 1px solid var(--line); padding: 13px 14px; font-size: 16px; border-radius: 0; width: 100%; }
.gate input:focus { outline: 2px solid var(--pearl); outline-offset: 1px; }
.gate-err, .sheet-err { color: #F0A3AE; font-size: 14px; min-height: 1.4em; }
.gate .btn { align-self: flex-start; margin: 6px 0 0 6px; }

/* shell */
.app { max-width: 1120px; margin-inline: auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.logo { height: 40px; width: auto; display: block; }
.plate { background: var(--oxblood); border: 1px solid #5d1420; padding: 7px 14px; transform: skewX(-12deg); cursor: pointer; box-shadow: inset 0 1px 0 rgba(242,239,233,.14), 3px 3px 0 0 rgba(0,0,0,.4); transition: transform .12s ease, box-shadow .12s ease; max-width: 56%; }
.plate:hover { transform: skewX(-12deg) translate(1px, 1px); box-shadow: inset 0 1px 0 rgba(242,239,233,.14), 2px 2px 0 0 rgba(0,0,0,.4); }
.plate > span { display: flex; align-items: baseline; gap: 9px; transform: skewX(12deg); font-family: var(--disp); text-transform: uppercase; white-space: nowrap; }
.plate b { font-weight: 700; font-size: 14px; letter-spacing: .06em; overflow: hidden; text-overflow: ellipsis; }
.plate i { font-style: normal; font-weight: 600; font-size: 11px; letter-spacing: .14em; color: #E8C9CE; }

.cols { flex: 1 1 auto; display: block; padding-bottom: 84px; }
.col { min-width: 0; }
.screen { display: none; padding: 16px 16px 8px; }
.screen.active { display: block; }
.wide-only { display: none; }
.head-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 22px 0 4px; }
.screen > .head-row:first-child, .screen > .blade + .head-row { margin-top: 6px; }
.count { font-family: var(--disp); font-weight: 600; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--steel); font-variant-numeric: tabular-nums; text-align: right; }
.hint { color: var(--steel); font-size: 14px; margin-bottom: 14px; }

/* hero */
.hero { background: linear-gradient(135deg, #23262B 0%, #17191C 60%), var(--raised); border: 1px solid var(--line); padding: 20px 18px 18px; position: relative; overflow: hidden; }
.hero .flag { position: absolute; top: 0; bottom: 0; right: 0; left: 52%; background: conic-gradient(var(--pearl) 0 25%, transparent 0 50%, var(--pearl) 0 75%, transparent 0) 0 0 / 22px 22px; opacity: .05; -webkit-mask-image: linear-gradient(90deg, transparent, #000 70%); mask-image: linear-gradient(90deg, transparent, #000 70%); pointer-events: none; }
.hero-glint { position: absolute; right: -34px; top: -40px; width: 150px; height: 160px; fill: var(--crimson-hot); opacity: .12; }
.hero-num { font-family: var(--disp); font-weight: 700; font-size: 64px; line-height: 1.05; font-variant-numeric: tabular-nums; position: relative; }
.hero-num small { font-size: 16px; color: var(--steel); font-weight: 600; letter-spacing: .1em; }
.track { height: 6px; background: var(--line); margin: 16px 8px 10px 0; position: relative; }
.fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--oxblood), var(--crimson-hot)); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.cap { position: absolute; top: 50%; left: 0; width: 20px; height: 20px; transform: translate(-50%, -50%); fill: var(--pearl); transition: left .8s cubic-bezier(.2,.8,.2,1); }
.hero-cap { font-size: 14px; color: var(--steel); position: relative; }
.hero-cap strong { color: var(--pearl); font-weight: 600; }
.burst { position: absolute; left: 60px; top: 62px; width: 0; height: 0; pointer-events: none; }
.burst svg { position: absolute; width: 26px; height: 28px; left: -13px; top: -14px; fill: var(--pearl); opacity: 0; animation: fly .9s ease-out forwards; }
@keyframes fly { 0% { opacity: 0; transform: translate(0, 0) scale(.3); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.25); } }
.bump { animation: bump .5s ease; }
@keyframes bump { 30% { transform: scale(1.08); color: #fff; } }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat { background: var(--raised); border: 1px solid var(--line); padding: 13px 14px; }
.stat .v { font-family: var(--disp); font-weight: 700; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.stat .v svg { width: 12px; height: 13px; flex: none; fill: var(--crimson-hot); }
.stat .l { font-family: var(--disp); font-weight: 600; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--steel); margin-top: 4px; }

/* board */
.lanes { display: flex; flex-direction: column; }
.lane { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); align-items: start; }
.lane:last-child { border-bottom: 1px solid var(--line); }
.lane-name { font-family: var(--disp); font-weight: 600; font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; line-height: 1.25; }
.lane-name small { display: block; color: var(--steel); font-size: 12px; letter-spacing: .06em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.squares { display: flex; flex-wrap: wrap; gap: 6px; }
.sq { width: 22px; height: 22px; display: inline-block; border: 0; padding: 0; background: transparent; position: relative; flex: none; }
button.sq { cursor: pointer; transition: transform .12s ease, filter .12s ease; }
button.sq:hover { transform: translateY(-2px); filter: brightness(1.25); }
.sq.none { box-shadow: inset 0 0 0 2px var(--pearl); }
.sq.over { background: var(--crimson-hot); }
.sq.sched { background: #3A3F46; }
.sq.mine { background: var(--pearl); box-shadow: none; }
.sq.held { opacity: .45; }
.sq.pop { animation: pop .7s ease; }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.7) rotate(8deg); background: var(--pearl); } 100% { transform: scale(1); } }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--steel); margin-top: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend .sq { width: 13px; height: 13px; }

/* rows */
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.row:last-child { border-bottom: 1px solid var(--line); }
.row .who { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .who span { color: var(--steel); font-weight: 400; }
.row .why { font-size: 13.5px; color: var(--steel); }
.row .why b { color: #F0A3AE; font-weight: 500; }
.row .acts { display: flex; gap: 12px; align-items: center; padding-right: 5px; }
.row .amt { font-family: var(--disp); font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.row .amt.me { color: var(--crimson-hot); }
.empty { color: var(--steel); font-size: 14.5px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* goals */
.goal { padding: 15px 0; border-top: 1px solid var(--line); }
.goal:last-child { border-bottom: 1px solid var(--line); }
.goal-top { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
.goal-top .t { font-family: var(--disp); font-weight: 700; font-size: 15px; letter-spacing: .05em; text-transform: uppercase; }
.goal-top .n { font-family: var(--disp); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.goal-top .n small { font-size: 12px; color: var(--steel); letter-spacing: .08em; font-weight: 600; }
.goal p { font-size: 13.5px; color: var(--steel); margin-top: 2px; max-width: 52ch; }
.goal .track { margin: 12px 8px 2px 0; height: 5px; }
.goal .cap { width: 16px; height: 16px; }
.goal.done .t::after { content: " Done"; color: var(--crimson-hot); }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--raised); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 2; }
.tab { flex: 1; background: none; border: 0; color: var(--steel); font-family: var(--disp); font-weight: 600; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: 11px 2px 12px; cursor: pointer; display: grid; justify-items: center; gap: 5px; }
.tab svg { width: 17px; height: 17px; fill: var(--steel); }
.tab.active { color: var(--pearl); }
.tab.active svg { fill: var(--crimson-hot); }
.tab:focus-visible { outline-offset: -3px; }

/* sheets and toast */
.veil { position: fixed; inset: 0; background: rgba(8,9,10,.66); z-index: 3; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 520px; margin-inline: auto; background: var(--raised); border: 1px solid var(--line); border-bottom: 0; padding: 22px 20px calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 4; animation: rise .22s ease; max-height: 88vh; overflow-y: auto; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet h3 { margin: 4px 0 6px; }
.sheet-sub { color: var(--steel); font-size: 14.5px; margin-bottom: 8px; }
.sheet-btns { display: flex; flex-wrap: wrap; gap: 14px 16px; margin: 14px 0 0 6px; }
.rules { margin-top: 10px; }
.rules-head { margin: 18px 0 2px; }
.rule { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.rule b { font-family: var(--disp); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rule.here { color: var(--pearl); }
.rule.here span::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--crimson-hot); margin-right: 9px; }
.rule:not(.here).tier { color: var(--steel); }
.toast { position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -140%); width: min(460px, calc(100% - 28px)); background: var(--oxblood); border: 1px solid #5d1420; padding: 12px 16px; font-size: 14.5px; font-weight: 500; display: flex; align-items: center; gap: 11px; z-index: 6; transition: transform .3s cubic-bezier(.2,.9,.3,1.2); box-shadow: 0 14px 40px rgba(0,0,0,.5); }
.toast.show { transform: translate(-50%, 0); }
.toast svg { width: 15px; height: 16px; flex: none; fill: var(--pearl); }

/* counter screen: everything visible, two columns */
@media (min-width: 980px) {
  .top { padding: 20px 28px; }
  .logo { height: 52px; }
  .cols { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 0 44px; padding: 12px 28px 72px; }
  .screen { display: block; padding: 16px 0 8px; }
  .tabbar { display: none; }
  .wide-only { display: block; margin: 26px 0 16px; }
  #scr-next .wide-only { display: none; }
  .hero { padding: 28px 28px 24px; }
  .hero-num { font-size: 92px; }
  .burst { left: 100px; top: 96px; }
  .sq { width: 26px; height: 26px; }
  .lane { grid-template-columns: 130px minmax(0, 1fr); }
  .sheet { bottom: auto; top: 50%; transform: translateY(-50%); border-bottom: 1px solid var(--line); animation: none; }
}
