:root {
  color-scheme: dark;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  --bg: #0a1020;
  --panel: rgba(20, 31, 52, 0.88);
  --panel-strong: #16233a;
  --line: rgba(255, 255, 255, 0.11);
  --text: #f5f7fb;
  --muted: #aab6cc;
  --accent: #f0b968;
  --safe: #87d9ae;
  --warn: #f2c36d;
  --danger: #ff9d91;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -10%, #2a3857 0, transparent 42%),
    linear-gradient(180deg, #0d1528 0%, var(--bg) 55%, #070b14 100%);
  color: var(--text);
}

button, input, select { font: inherit; }

button { touch-action: manipulation; }

.shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 18px max(42px, env(safe-area-inset-bottom));
}

.hero {
  padding: 20px 4px 28px;
}

.eyebrow, .section-kicker {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1 {
  margin: 0;
  font-size: clamp(2.25rem, 10vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.lead {
  margin: 15px 0 18px;
  color: #d9e0ee;
  font-size: 1.03rem;
  line-height: 1.75;
}

.route-badge {
  display: inline-flex;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.04);
  font-size: .84rem;
}

.panel {
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.clock {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: #dce3ef;
  font-size: .9rem;
  font-weight: 700;
}

input, select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: #0e1728;
  color: var(--text);
}

input:focus, select:focus {
  border-color: rgba(240, 185, 104, .7);
  box-shadow: 0 0 0 3px rgba(240, 185, 104, .12);
}

.input-unit {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 9px;
}

.input-unit span {
  color: var(--muted);
  font-weight: 500;
}

.primary, .secondary {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
}

.primary {
  margin-top: 18px;
  background: linear-gradient(135deg, #f3c175, #dc9d50);
  color: #1c140a;
}

.primary:disabled {
  opacity: .55;
  cursor: wait;
}

.secondary {
  background: #253653;
  color: var(--text);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 12px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 18px;
}

.hint, .privacy-mini, .fineprint, footer {
  color: var(--muted);
  line-height: 1.6;
}

.hint { margin: 9px 0 0; font-size: .8rem; }
.privacy-mini { margin: 10px 0 0; font-size: .75rem; }
.fineprint { font-size: .76rem; }
.status { margin-top: 12px; min-height: 1.5em; color: var(--muted); font-size: .86rem; }

.results {
  margin: 28px 0 16px;
}

.hidden { display: none; }

.card-grid {
  display: grid;
  gap: 12px;
}

.result-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.result-card.warning {
  border-color: rgba(242, 195, 109, .48);
}

.result-card.taxi {
  border-color: rgba(255, 157, 145, .42);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.offset-label {
  font-size: 1.05rem;
  font-weight: 900;
}

.mode {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
}

.mode.train { color: var(--safe); background: rgba(135,217,174,.11); }
.mode.walk { color: var(--safe); background: rgba(135,217,174,.11); }
.mode.taxi { color: var(--danger); background: rgba(255,157,145,.11); }

.main-result {
  margin: 15px 0 4px;
  font-size: 1.3rem;
  font-weight: 900;
}

.sub-result {
  margin: 5px 0;
  color: #c8d2e3;
  font-size: .88rem;
  line-height: 1.55;
}

.sleep-line {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: #dde6f5;
  font-size: .87rem;
}

.sleep-value {
  color: var(--accent);
  font-weight: 900;
}

.settings-grid {
  display: grid;
  gap: 4px;
}

.info-panel ul {
  margin: 14px 0 0;
  padding-left: 1.25rem;
  color: #ced8e8;
  line-height: 1.8;
  font-size: .88rem;
}

footer {
  padding: 22px 2px 0;
  text-align: center;
  font-size: .72rem;
}

@media (min-width: 620px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
