:root {
  color-scheme: dark;
  --bg: #080c0f;
  --panel: #10171c;
  --panel-2: #151f25;
  --line: #26343c;
  --text: #f3f7f5;
  --muted: #93a3aa;
  --accent: #d8ff53;
  --accent-ink: #101500;
  --danger: #ff776d;
  --success: #70e1a1;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body, #root { width: 100%; min-width: 0; min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.app-route { overflow-x: hidden; overscroll-behavior: none; }
.app-shell { min-height: 100dvh; padding: max(18px, env(safe-area-inset-top)) 18px calc(92px + var(--safe-bottom)); }
.page { width: min(100%, 720px); margin: 0 auto; animation: reveal .22s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }

.eyebrow { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 7px 0 5px; font-size: clamp(30px, 10vw, 46px); line-height: .98; letter-spacing: -.045em; }
h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
h3 { margin: 0; font-size: 17px; }
p { color: var(--muted); line-height: 1.55; }
.subhead { margin: 0 0 24px; font-size: 15px; }
.spaced-title { margin-top: 8px; }
.compact-copy { margin: 0; }
.delete-action, .run-step-title { margin-top: 10px; }

.top-row, .section-head, .procedure-head, .step-row, .stat-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.top-row { align-items: flex-start; margin-bottom: 22px; }

.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(145deg, #121b20, #0e1418); box-shadow: 0 12px 32px rgb(0 0 0 / 18%); }
.card.hero { padding: 20px; background: radial-gradient(circle at 95% 5%, rgb(216 255 83 / 14%), transparent 42%), var(--panel); }
.metric { font-size: 30px; font-weight: 800; letter-spacing: -.04em; }
.metric-label, .meta, .empty, .hint { color: var(--muted); font-size: 13px; }
.empty { padding: 24px 10px; text-align: center; }
.notice { margin-bottom: 16px; padding: 12px 14px; border: 1px solid rgb(112 225 161 / 38%); border-radius: 14px; color: var(--success); background: rgb(112 225 161 / 7%); font-size: 13px; font-weight: 700; }
.section { margin-top: 25px; }
.section-head { margin-bottom: 12px; }

.button { min-height: 46px; border: 0; border-radius: 14px; padding: 11px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; font-weight: 760; background: var(--accent); color: var(--accent-ink); }
.button.secondary { color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.button.ghost { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.button.danger { color: #190000; background: var(--danger); }
.button.delete-data-button { color: var(--danger); border-color: rgb(255 119 109 / 45%); }
.button.icon { width: 46px; padding: 0; }
.button:disabled { opacity: .42; cursor: default; }
.button.full { width: 100%; }

.procedure { display: grid; gap: 13px; }
.procedure + .procedure { margin-top: 12px; }
.procedure-title { min-width: 0; }
.procedure-title h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { flex: 0 0 auto; border-radius: 999px; padding: 6px 9px; color: var(--accent); background: rgb(216 255 83 / 9%); font-size: 11px; font-weight: 800; }
.progress { height: 7px; border-radius: 99px; background: #263036; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.progress-1 { width: 10%; } .progress-2 { width: 20%; } .progress-3 { width: 30%; }
.progress-4 { width: 40%; } .progress-5 { width: 50%; } .progress-6 { width: 60%; }
.progress-7 { width: 70%; } .progress-8 { width: 80%; } .progress-9 { width: 90%; }
.progress-10 { width: 100%; }

.bottom-nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; min-height: calc(72px + var(--safe-bottom)); padding: 8px 10px calc(8px + var(--safe-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); background: rgb(8 12 15 / 92%); border-top: 1px solid var(--line); backdrop-filter: blur(20px); }
.nav-link { min-width: 0; min-height: 52px; border-radius: 13px; display: grid; place-items: center; align-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 10px; font-weight: 700; }
.nav-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-link.active { color: var(--accent); background: rgb(216 255 83 / 7%); }

.field { display: grid; gap: 7px; margin-top: 15px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 720; }
.field input, .field textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 13px; padding: 13px; color: var(--text); background: #0b1114; font-size: 16px; outline: none; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { min-height: 84px; resize: vertical; }
.form-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; margin-top: 18px; }

.sheet-backdrop { position: fixed; z-index: 40; inset: 0; display: flex; align-items: flex-end; justify-content: center; background: rgb(0 0 0 / 62%); padding: max(10px, env(safe-area-inset-top)) 10px 0; animation: backdrop-in .18s ease-out; }
.sheet { width: min(100%, 700px); max-height: min(86dvh, 720px); overflow: auto; overscroll-behavior: contain; padding: 12px 18px calc(24px + var(--safe-bottom)); border: 1px solid var(--line); border-bottom: 0; border-radius: 25px 25px 0 0; background: var(--panel); box-shadow: 0 -18px 60px rgb(0 0 0 / 45%); animation: sheet-in .24s cubic-bezier(.22, .8, .25, 1); }
.grabber { width: 42px; height: 5px; border-radius: 10px; background: #435159; margin: 2px auto 18px; }
.sheet-header { position: sticky; z-index: 2; top: -12px; min-height: 56px; margin: -8px -4px 0; padding: 12px 4px 8px; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: linear-gradient(var(--panel) 82%, transparent); }
.sheet-close { width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: var(--panel-2); font-size: 26px; line-height: 1; }
.confirm-sheet { max-width: 520px; }
@keyframes backdrop-in { from { opacity: 0; } }
@keyframes sheet-in { from { opacity: .6; transform: translateY(32px); } }

.run-page { display: grid; min-height: calc(100dvh - 120px); align-content: space-between; gap: 25px; }
.run-status { text-align: center; padding-top: 10px; }
.timer { margin: 20px 0 5px; color: var(--accent); font-size: clamp(58px, 22vw, 92px); font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: -.06em; }
.step-count { color: var(--muted); font-size: 13px; }
.run-step { padding: 25px 20px; text-align: center; }
.run-step h2 { font-size: 28px; }
.run-actions { display: grid; gap: 10px; }

.log-item { padding: 15px 0; border-bottom: 1px solid var(--line); }
.log-item:last-child { border-bottom: 0; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); }
.bar-chart { height: 118px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: 106px; align-items: end; gap: 7px; padding-top: 12px; }
.bar { width: 100%; min-height: 7px; border-radius: 6px 6px 2px 2px; background: linear-gradient(var(--accent), #6f851b); }
.bar-0 { height: 7px; } .bar-1 { height: 10px; } .bar-2 { height: 20px; }
.bar-3 { height: 30px; } .bar-4 { height: 40px; } .bar-5 { height: 50px; }
.bar-6 { height: 60px; } .bar-7 { height: 70px; } .bar-8 { height: 80px; }
.bar-9 { height: 90px; } .bar-10 { height: 100px; }

.setting-row { min-height: 58px; padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.setting-row:last-child { border-bottom: 0; }
.setting-link { width: 100%; color: var(--text); text-decoration: none; }
.settings-version { text-align: center; }
.setting-copy { min-width: 0; }
.setting-copy strong { display: block; }
.setting-copy small { color: var(--muted); }
.switch { width: 51px; height: 31px; flex: 0 0 auto; border: 0; border-radius: 99px; padding: 3px; background: #344148; }
.switch span { display: block; width: 25px; height: 25px; border-radius: 50%; background: white; transition: transform .2s; }
.switch.on { background: var(--accent); }
.switch.on span { transform: translateX(20px); }

.public-shell { min-height: 100vh; background: radial-gradient(circle at 70% 0%, rgb(216 255 83 / 14%), transparent 32%), var(--bg); }
.public-nav { width: min(100% - 36px, 1080px); margin: auto; padding: 22px 0; display: flex; justify-content: space-between; align-items: center; }
.brand { font-weight: 900; letter-spacing: -.03em; text-decoration: none; }
.public-links { display: flex; gap: 18px; color: var(--muted); font-size: 14px; }
.public-main { width: min(100% - 36px, 860px); margin: auto; padding: 70px 0; }
.public-main h1 { max-width: 700px; font-size: clamp(48px, 10vw, 88px); }
.public-main > p { max-width: 620px; font-size: 18px; }
.public-card { margin-top: 35px; }

.ad-slot { min-height: 58px; margin-top: 20px; border: 1px dashed #334149; border-radius: 14px; display: none; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }

@media (max-width: 360px) {
  .app-shell { padding-left: 14px; padding-right: 14px; }
  .grid.two { grid-template-columns: 1fr; }
  .public-links a:not(:last-child) { display: none; }
}

@media (max-height: 600px) {
  .sheet-backdrop { align-items: flex-start; }
  .sheet { max-height: 100%; border-radius: 20px 20px 0 0; }
  .grabber { margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
