/* PlankRace in the browser. Same colours and layout as the iPhone app. */
:root {
  --ground: #0E1912; --card: #15241A; --card-border: #23362A; --track: #1E3025; --line: #2A3D30;
  --orange: #F2852B; --orange-soft: #FFC9A1; --green: #5BD08A; --hold-band: #1F4A2E; --pause-band: #4A3220;
  --text: #F3F1EA; --text-soft: #D5DDD7; --muted: #A8BCAE; --ink: #1A0E04;
  --display: "Avenir Next Condensed", "Bahnschrift Condensed", "Bahnschrift", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--ground); color: var(--text); font: 16px/1.45 var(--body); }
body { min-height: 100vh; min-height: 100dvh; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .45; }
input { font: inherit; color: var(--text); }
a { color: var(--orange); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  padding: calc(8px + env(safe-area-inset-top)) 24px calc(12px + env(safe-area-inset-bottom)); }
.screen { flex: 1; display: flex; flex-direction: column; }
.stack > * + * { margin-top: 16px; }
.stack-s > * + * { margin-top: 10px; }
.grow { flex: 1 1 10px; min-height: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row > .fill { flex: 1; }
.between { justify-content: space-between; }
.center { text-align: center; }

/* Type */
.display { font-family: var(--display); font-weight: 800; font-stretch: condensed; font-variant-numeric: tabular-nums; line-height: 1.02; letter-spacing: .01em; }
.h1 { font-size: 34px; }
.h2 { font-size: 30px; }
.cap { font-size: 12px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.cap2 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.soft { color: var(--text-soft); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.foot { font-size: 13px; }
.tiny { font-size: 12px; }
.green { color: var(--green); }
.orange { color: var(--orange); }
.semi { font-weight: 600; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .02em; }

/* Brand */
.brand { display: inline-block; font-family: var(--display); font-weight: 900; font-stretch: condensed; font-size: 38px; line-height: 1;
  transform: skewX(-12deg); transform-origin: bottom left; white-space: nowrap; letter-spacing: .01em; }
.brand .p { color: var(--orange); } .brand .r { color: var(--green); }

/* Cards */
.card { background: var(--card); border-radius: 16px; padding: 16px; }
.card.bordered { border: 1px solid var(--card-border); }
.card.tight { padding: 12px 14px; }
.card.green-edge { border: 1px solid rgba(91, 208, 138, .5); }

/* Buttons */
.big { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 58px; border-radius: 18px;
  background: var(--orange); color: var(--ink); font-family: var(--display); font-weight: 800; font-stretch: condensed; font-size: clamp(18px, 6vw, 24px); letter-spacing: .08em; text-transform: uppercase; line-height: 1.1; padding: 0 10px; text-align: center; }
.big:active { opacity: .85; }
.big.green { background: var(--green); } .big.light { background: var(--text); } .big.soft { background: var(--orange-soft); }
.big.dark { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.outline { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 46px; padding: 0 10px; border-radius: 14px;
  border: 1px solid var(--line); color: var(--text-soft); font-size: 15px; font-weight: 600; text-align: center; }
.outline.on-orange { border-color: var(--orange); color: var(--orange); background: rgba(242, 133, 43, .12); }
.outline.on-green { border-color: var(--green); color: var(--green); background: rgba(91, 208, 138, .12); }
.link { font-size: 15px; font-weight: 600; color: var(--orange); width: 100%; padding: 8px 0; }
.link.inline { width: auto; padding: 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.square { width: 58px; height: 58px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); color: var(--text-soft);
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.step-btn { width: 44px; height: 44px; border-radius: 12px; background: var(--ground); border: 1px solid var(--line); color: var(--text-soft);
  display: inline-flex; align-items: center; justify-content: center; font-size: 22px; }
svg.i { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.top .icons { display: flex; gap: 8px; flex: none; }
.top .brand { min-width: 0; }
.bar { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 8px; }
.bar .title { flex: 1; font-weight: 700; font-size: 17px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .done { font-weight: 600; color: var(--orange); min-width: 44px; text-align: right; }

/* Timer */
.target-card { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 16px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--card-border); }
.gauge { position: relative; width: 240px; height: 231px; margin: 0 auto; }
.gauge svg { position: absolute; left: 0; top: 9px; width: 240px; height: 240px; overflow: visible; }
.gauge .inner { position: absolute; left: 0; right: 0; top: 9px; height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.gauge .status { font-size: 12px; letter-spacing: .13em; color: var(--muted); max-width: 170px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gauge .status.hot { color: var(--orange); }
.gauge .time { font-size: 84px; }
.gauge .sub { font-size: 13px; font-weight: 600; color: var(--green); max-width: 150px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pips { display: flex; gap: 6px; padding-top: 4px; }
.pips i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.pips i.done { background: var(--green); } .pips i.now { background: var(--orange); }
.tiles { display: flex; gap: 10px; }
.tile { flex: 1; background: var(--card); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.tile .v { font-size: 22px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px; }

/* Switch */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--line); transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:disabled + span { opacity: .5; }

/* Fields */
.field { width: 100%; padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); outline: none; font-size: 16px; }
.field:focus { border-color: var(--orange); }
.field.on-ground { background: var(--ground); padding: 12px; border-radius: 12px; }

/* Setup */
.progress { display: flex; gap: 6px; justify-content: center; }
.progress i { width: 6px; height: 6px; border-radius: 3px; background: var(--line); transition: width .2s; }
.progress i.on { background: var(--orange); } .progress i.cur { width: 22px; }
.rule { display: flex; gap: 12px; align-items: flex-start; }
.rule .n { font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--orange); width: 22px; line-height: 1.1; }
.option { display: flex; gap: 14px; align-items: flex-start; text-align: left; width: 100%; border: 2px solid var(--card-border); }
.option.sel { border-color: var(--green); }
.ring { position: relative; width: 230px; height: 230px; margin: 0 auto; }
.ring svg { width: 230px; height: 230px; transform: rotate(-90deg); }
.ring .inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.marks .m { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--card-border); }
.marks .m:first-child { border-top: 0; }

/* Lists */
.list-row { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 11px 14px; width: 100%; text-align: left; }
.list-row.me { box-shadow: inset 0 0 0 1px var(--orange); }
.rank { font-family: var(--display); font-weight: 800; font-size: 26px; width: 30px; color: var(--muted); }
.rank.first { color: var(--orange); }
.chev { color: var(--muted); }
.legend { display: flex; gap: 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend b { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart { width: 100%; height: 220px; display: block; }
.code-box { border: 1px dashed var(--orange); border-radius: 14px; padding: 16px; text-align: center; font-size: 22px; user-select: all; }
.privacy li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-soft); }
.privacy { list-style: none; margin: 0; padding: 0; }
.privacy li + li { margin-top: 8px; }
.privacy svg { color: var(--green); flex: none; margin-top: 1px; }
.msg-err { font-size: 13px; color: var(--orange); }
.msg-ok { font-size: 13px; color: var(--green); }

/* Day done */
.overlay { position: fixed; inset: 0; z-index: 40; background: var(--ground); display: flex; justify-content: center; }
.overlay > .inner { width: 100%; max-width: 480px; display: flex; flex-direction: column; padding: calc(24px + env(safe-area-inset-top)) 24px calc(12px + env(safe-area-inset-bottom)); }
.dim { position: fixed; inset: 0; background: #000; opacity: 0; transition: opacity 1.2s; pointer-events: none; z-index: 41; }
.dim.on { opacity: .65; pointer-events: auto; }

/* Dialogs */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
.modal { width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; background: var(--ground); border-radius: 22px 22px 0 0; border: 1px solid var(--line); border-bottom: 0;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { .modal-back { align-items: center; } .modal { border-radius: 22px; border-bottom: 1px solid var(--line); } }
.dlg-btn { display: block; width: 100%; padding: 14px; border-radius: 14px; background: var(--card); font-weight: 600; font-size: 16px; }
.dlg-btn.danger { color: #FF6B5B; }
.dlg-btn.cancel { color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; max-width: 440px; width: calc(100% - 32px);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.notice-bar { background: rgba(242, 133, 43, .12); border: 1px solid rgba(242, 133, 43, .5); color: var(--orange-soft); border-radius: 12px; padding: 10px 12px; font-size: 13px; }

@media (max-height: 700px) { .gauge .time { font-size: 72px; } }
@media (max-width: 360px) { #app { padding-left: 16px; padding-right: 16px; } .icon-btn { width: 40px; height: 40px; } .tile { padding: 8px 9px; } .tile .v { font-size: 20px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
