/* Squad Goal: boss fight. The goal is the boss, the group is the raid party, every rep is a hit. */
:root {
  --bg: #0e0d12;
  --bg-2: #17151d;
  --line: #2b2833;
  --text: #f6f3ee;
  --muted: #8b8696;
  --boss: #ff3b1f;
  --p0: #ff4fa3; --p1: #3d8bff; --p2: #ffd23f; --p3: #2fe39a; --p4: #b06bff; --p5: #ff8a1f; --p6: #3ff0ff; --p7: #ffffff;
  --display: "Anton", Impact, "Arial Narrow Bold", sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
  --body: "Inter", -apple-system, system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; overscroll-behavior: none; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
main { max-width: 520px; margin: 0 auto; min-height: 100dvh; padding: calc(env(safe-area-inset-top) + 14px) 18px calc(env(safe-area-inset-bottom) + 28px); display: flex; flex-direction: column; }

.D { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: 0.01em; line-height: 0.9; }
.M { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px; }
.muted { color: var(--muted); }
.boss-c { color: var(--boss); }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; }

/* top bar */
.bar { display: flex; align-items: center; justify-content: space-between; min-height: 34px; margin-bottom: 18px; }
.logo { font-family: var(--display); font-size: 20px; text-transform: uppercase; display: flex; gap: 6px; align-items: center; }
.logo b { background: var(--boss); color: var(--bg); padding: 1px 6px 0; font-weight: 400; }
.back { font-family: var(--mono); font-size: 12px; text-transform: uppercase; color: var(--muted); }
.me { background: none; border: 0; padding: 0; cursor: pointer; }

.av {
  width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; overflow: hidden;
  font-family: var(--display); font-size: 19px; color: var(--bg); background: var(--pc, var(--muted));
}
.av img { width: 100%; height: 100%; object-fit: cover; }

/* buttons */
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 64px; border: 0; border-radius: 16px;
  background: var(--boss); color: var(--bg); cursor: pointer; font-family: var(--display); font-size: 28px; text-transform: uppercase;
  letter-spacing: 0.02em; transition: transform 0.08s; box-shadow: 0 6px 0 #a3200d;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #a3200d; }
.btn.alt { background: var(--bg-2); color: var(--text); box-shadow: 0 6px 0 #000; border: 1px solid var(--line); }
.btn.alt:active { box-shadow: 0 2px 0 #000; }
.btn:disabled { opacity: 0.3; transform: none; }
.btn + .btn { margin-top: 14px; }
.btn.small { height: 48px; font-size: 20px; border-radius: 12px; }
.textlink { background: none; border: 0; color: var(--muted); font-family: var(--mono); font-size: 12px; text-transform: uppercase; text-decoration: underline; cursor: pointer; padding: 10px; display: block; margin: 8px auto 0; }

/* sign in */
.title-xl { font-size: 92px; margin: 30px 0 16px; }
.title-xl em { font-style: normal; color: var(--boss); display: block; }
.lead { font-size: 18px; line-height: 1.45; color: #cdc8d4; margin: 0 0 28px; max-width: 32ch; }
#gsi { min-height: 44px; display: flex; justify-content: center; margin: 6px 0; }
.field { width: 100%; height: 58px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2); padding: 0 16px; font-size: 18px; outline: none; margin-bottom: 14px; }
.field:focus { border-color: var(--boss); }
.empty { font-family: var(--mono); font-size: 12px; text-transform: uppercase; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center; line-height: 1.6; }

/* home */
.raid-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.raid-row .t { font-family: var(--display); font-size: 24px; text-transform: uppercase; line-height: 1; }
.raid-row .s { font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.raid-row .state { font-family: var(--mono); font-size: 11px; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; background: var(--bg-2); white-space: nowrap; }
.raid-row .state.live { background: var(--boss); color: var(--bg); }
.raid-row .state.done { background: var(--p3); color: var(--bg); }
.section { font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.08em; margin: 30px 0 6px; }
.presets { display: flex; gap: 10px; overflow-x: auto; margin: 0 -18px; padding: 4px 18px 8px; scroll-snap-type: x mandatory; }
.preset { flex: 0 0 72%; scroll-snap-align: start; border-radius: 18px; padding: 18px; min-height: 150px; display: flex; flex-direction: column; justify-content: space-between; color: var(--bg); }
.preset .D { font-size: 34px; }
.preset .M { font-size: 11px; opacity: 0.75; }

/* create stepper */
.steps { display: flex; gap: 6px; margin-bottom: 26px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--boss); }
.q { font-size: 60px; margin: 0 0 22px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  height: 92px; border-radius: 16px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; text-align: left;
  padding: 14px; display: flex; flex-direction: column; justify-content: space-between; transition: transform 0.08s;
}
.tile .D { font-size: 26px; }
.tile .M { color: var(--muted); font-size: 10px; }
.tile.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.tile.on .M { color: #55505c; }
.tile:active { transform: scale(0.97); }
.amt { border-bottom: 1px solid var(--line); padding: 14px 0 18px; }
.amt .lbl { display: flex; justify-content: space-between; }
.amt .ctl { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.amt .ctl button { width: 56px; height: 56px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2); font-family: var(--display); font-size: 30px; cursor: pointer; flex: none; }
.amt .ctl button:active { background: var(--boss); color: var(--bg); }
.amt input { flex: 1; min-width: 0; width: 100%; background: none; border: 0; outline: none; text-align: center; font-family: var(--display); font-size: 64px; color: var(--text); padding: 0; }
.rules { display: grid; gap: 12px; }
.rule { border-radius: 18px; border: 1px solid var(--line); background: var(--bg-2); padding: 18px; text-align: left; cursor: pointer; }
.rule .D { font-size: 40px; }
.rule p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.rule.on { background: var(--boss); color: var(--bg); border-color: var(--boss); }
.rule.on p { color: #3a0d05; }
.wins { display: flex; gap: 8px; margin-top: 14px; }
.wins button { flex: 1; height: 50px; border-radius: 12px; border: 2px solid rgba(14,13,18,.3); background: transparent; font-family: var(--display); font-size: 22px; color: var(--bg); cursor: pointer; }
.wins button.on { background: var(--bg); color: var(--boss); border-color: var(--bg); }
.dock { margin-top: auto; padding-top: 24px; }

/* created */
.created { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.created .big { font-size: 100px; color: var(--boss); margin: 0; animation: slam 0.45s cubic-bezier(.2,1.5,.4,1); }
@keyframes slam { from { transform: scale(2.4) rotate(-6deg); opacity: 0; } }
.boss-card { margin: 24px 0; border-radius: 20px; padding: 18px; background: var(--bg-2); border: 1px solid var(--line); }
.boss-card .D { font-size: 34px; }

/* lobby */
.lobby-h { font-size: 52px; margin: 6px 0 8px; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0; }
.slot { border-radius: 16px; padding: 14px; min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; background: var(--pc); color: var(--bg); animation: drop 0.35s cubic-bezier(.2,1.4,.4,1); }
@keyframes drop { from { transform: translateY(-14px) scale(0.92); opacity: 0; } }
.slot .D { font-size: 28px; }
.slot .M { font-size: 10px; opacity: 0.7; }
.slot.open { background: transparent; border: 2px dashed var(--line); color: var(--muted); animation: breathe 2s ease-in-out infinite; cursor: pointer; }
@keyframes breathe { 50% { border-color: #4a4555; } }
.waiting { font-family: var(--mono); font-size: 12px; text-transform: uppercase; text-align: center; color: var(--muted); padding: 16px; }
.waiting i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--boss); margin-right: 8px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.15; } }

/* live HUD */
.hud { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.hud .clock { font-family: var(--display); font-size: 30px; }
.hud .clock small { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-left: 6px; vertical-align: middle; }
.party { display: flex; gap: 4px; }
.party .av { width: 28px; height: 28px; font-size: 15px; border-radius: 8px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; }
.tabs button { flex: none; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); font-family: var(--display); font-size: 17px; text-transform: uppercase; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.tabs button.dead { text-decoration: line-through; opacity: 0.5; }
.boss { position: relative; }
.boss .name { font-family: var(--mono); font-size: 12px; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; }
.boss .hp { font-family: var(--display); font-size: 116px; line-height: 0.85; margin: 6px 0 10px; color: var(--text); }
.boss .hp small { font-size: 28px; color: var(--muted); margin-left: 6px; }
.boss.hit .hp { animation: shake 0.25s; color: var(--boss); }
@keyframes shake { 20% { transform: translate(-5px, 2px); } 40% { transform: translate(4px, -2px); } 60% { transform: translate(-3px, 1px); } 80% { transform: translate(2px, 0); } }
.hpbar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: #2a1512; box-shadow: inset 0 0 0 2px #3b1d18; }
.hpbar > div { height: 100%; transition: width 0.4s; }
.hpbar .rest { flex: 1; background: repeating-linear-gradient(90deg, var(--boss) 0 9px, #c92a12 9px 10px); }
.ticker { font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--muted); margin-top: 10px; height: 16px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ticker b { color: var(--text); font-weight: 400; }

/* the pad */
.pad {
  margin-top: 16px; flex: 1; min-height: 300px; border-radius: 26px; background: var(--bg-2); border: 2px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; overflow: hidden;
  user-select: none; -webkit-user-select: none; touch-action: manipulation; cursor: pointer;
}
.pad .D { font-size: 74px; color: var(--pc, var(--text)); }
.pad .M { color: var(--muted); margin-top: 10px; text-align: center; line-height: 1.6; }
.pad.press { background: #1f1c26; border-color: var(--pc); }
.pad .pending { position: absolute; top: 14px; right: 16px; font-family: var(--display); font-size: 30px; color: var(--pc); }
.pad.hold.press { background: var(--pc); }
.pad.hold.press .D, .pad.hold.press .M { color: var(--bg); }
.pop { position: absolute; font-family: var(--display); font-size: 40px; color: var(--pc); pointer-events: none; animation: popup 0.7s ease-out forwards; }
@keyframes popup { to { transform: translateY(-90px); opacity: 0; } }
.padbar { display: flex; gap: 8px; margin-top: 10px; }
.padbar button { flex: 1; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); font-family: var(--display); font-size: 20px; cursor: pointer; }
.padbar button:active { background: var(--pc); color: var(--bg); }
.padbar .undo { flex: 0 0 auto; padding: 0 14px; color: var(--muted); font-family: var(--mono); font-size: 11px; text-transform: uppercase; }
.km { margin-top: 16px; display: flex; gap: 10px; }
.km input { flex: 1; min-width: 0; height: 84px; border-radius: 20px; border: 2px solid var(--line); background: var(--bg-2); text-align: center; font-family: var(--display); font-size: 52px; outline: none; }
.km input:focus { border-color: var(--pc); }
.km .btn { width: 110px; height: 84px; border-radius: 20px; }
.spectate { margin-top: 18px; }

/* finish */
.finish { flex: 1; display: flex; flex-direction: column; }
.finish .big { font-size: 112px; margin: 20px 0 6px; animation: slam 0.5s cubic-bezier(.2,1.5,.4,1); }
.finish .big.win { color: var(--p3); }
.finish .big.lose { color: var(--boss); }
.stat { display: flex; gap: 10px; margin: 18px 0; }
.stat > div { flex: 1; background: var(--bg-2); border-radius: 16px; padding: 14px; border: 1px solid var(--line); }
.stat .D { font-size: 34px; margin-top: 6px; }
.mvp { border-radius: 20px; padding: 18px; background: var(--pc); color: var(--bg); display: flex; align-items: center; gap: 14px; }
.mvp .av { width: 56px; height: 56px; font-size: 30px; background: var(--bg); color: var(--pc); }
.mvp .D { font-size: 40px; }
.dmg { margin-top: 12px; }
.dmg .r { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dmg .r .nm { flex: 1; font-weight: 600; }
.dmg .r .nm small { display: block; font-family: var(--mono); font-size: 10px; text-transform: uppercase; color: var(--muted); margin-top: 3px; font-weight: 400; }
.dmg .r .D { font-size: 26px; color: var(--pc); }
.board .r .D { color: var(--text); }
.board .r.mine .nm { color: var(--p2); }

#toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 14px); transform: translate(-50%, -20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-family: var(--display); font-size: 22px; text-transform: uppercase;
  opacity: 0; pointer-events: none; transition: all 0.2s; white-space: nowrap; z-index: 9;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* v4: created plan, lobby summary, start ceremony, overview graph, feed, workout mode */
.created .big { font-size: 84px; }
.plan { list-style: none; counter-reset: s; padding: 0; margin: 26px 0 28px; }
.plan li { counter-increment: s; font-family: var(--display); font-size: 30px; text-transform: uppercase; padding: 8px 0; display: flex; gap: 14px; align-items: baseline; color: var(--muted); }
.plan li:first-child, .plan li:nth-child(2) { color: var(--text); }
.plan li::before { content: counter(s) "."; font-family: var(--mono); font-size: 14px; color: var(--muted); width: 20px; }
.plan li.profit { color: var(--p3); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair .btn { height: 64px; font-size: 22px; line-height: 1; padding: 0 8px; text-align: center; }
.pair .btn + .btn { margin-top: 0; }

.summary { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 18px; padding: 16px; border-radius: 18px; background: var(--bg-2); border: 1px solid var(--line); }
.summary .D { font-size: 28px; }
.summary .edit { color: var(--boss); border: 1px solid var(--boss); padding: 4px 8px; border-radius: 6px; }
.slot { min-height: 72px; justify-content: flex-end; }
.slot.open { justify-content: center; align-items: center; }

.modal { position: fixed; inset: 0; background: rgba(6,5,9,.8); backdrop-filter: blur(4px); display: flex; align-items: flex-end; justify-content: center; z-index: 8; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 520px; background: var(--bg-2); border-top: 2px solid var(--boss); border-radius: 26px 26px 0 0; padding: 26px 22px calc(env(safe-area-inset-bottom) + 22px); animation: up .3s cubic-bezier(.2,1.2,.4,1); }
@keyframes up { from { transform: translateY(100%); } }
.sheet h2 { font-size: 72px; margin: 0 0 12px; color: var(--boss); }
.sheet p { font-size: 17px; line-height: 1.45; margin: 0 0 8px; color: #d5d0dc; }
.sheet .binding { font-family: var(--mono); font-size: 12px; text-transform: uppercase; color: var(--muted); margin-top: 14px; }
.sigs { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 22px; border-top: 1px dashed var(--line); padding-top: 14px; }
.sigs span { font-family: "Brush Script MT", "Snell Roundhand", cursive; font-size: 30px; color: var(--pc); transform: rotate(-4deg); }

.overview { min-height: 58dvh; display: flex; flex-direction: column; }
.ov-name { font-size: 40px; margin: 4px 0 12px; }
.graph { width: 100%; flex: 1; min-height: 210px; overflow: visible; }
.graph .goal { stroke: var(--boss); stroke-width: 1.4; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.graph .axis { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.graph .pace { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; opacity: .6; vector-effect: non-scaling-stroke; }
.graph .now { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.graph .ln { fill: none; stroke: currentColor; stroke-width: 3; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.graph circle { fill: currentColor; }
.graph text { font-family: var(--mono); font-size: 9px; fill: var(--muted); }
.graph .gl { fill: var(--boss); font-weight: 700; }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin-top: 12px; }
.legend > div { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--ec); margin-right: 6px; }
.legend .M { font-size: 10px; color: var(--muted); }
.legend b { display: block; font-family: var(--display); font-weight: 400; font-size: 26px; margin-top: 4px; color: var(--ec); }
.legend b small { font-size: 15px; color: var(--muted); }

.feed { padding-bottom: 90px; }
.post { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.post b { font-weight: 700; }
.post .muted { font-size: 13px; }
.post .what { font-size: 26px; margin-top: 4px; }
.fab {
  position: fixed; right: max(18px, calc(50vw - 242px)); bottom: calc(env(safe-area-inset-bottom) + 20px); width: 72px; height: 72px; border-radius: 22px;
  border: 0; background: var(--boss); color: var(--bg); font-family: var(--display); font-size: 48px; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 0 #a3200d, 0 10px 30px rgba(255,59,31,.35); z-index: 5;
}
.fab:active { transform: translateY(4px); box-shadow: 0 2px 0 #a3200d; }
.boss .hp { margin-top: 4px; }

/* v5: taps are a draft until logged */
.commit { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 12px; }
.commit .btn { width: 100%; }
.commit .btn:disabled { opacity: .35; }
.fab { overflow: visible; }
.fab .badge { position: absolute; top: -8px; right: -8px; min-width: 26px; height: 26px; border-radius: 13px; background: var(--p3); color: var(--bg); font-family: var(--mono); font-size: 14px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; box-shadow: 0 0 0 3px var(--bg); }
.tabs .drafted::after { content: "•"; color: var(--p3); margin-left: 6px; }
