:root {
  --bg: #f6f7f5;
  --card: #ffffff;
  --text: #1d2420;
  --muted: #5d6a63;
  --line: #dde3df;
  --accent: #0b6b3a;
  --accent-soft: #e3f1e9;
  --sobu: #f5a200;
  --high: #0b6b3a;
  --mid: #a86a00;
  --low: #8a8f8c;
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614;
    --card: #1b211e;
    --text: #e6ece8;
    --muted: #9aa8a0;
    --line: #2d3631;
    --accent: #4cc283;
    --accent-soft: #1d3327;
    --high: #4cc283;
    --mid: #e0a43a;
    --low: #8e9591;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    'Hiragino Sans',
    'Noto Sans JP',
    sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

button,
input {
  font: inherit;
  color: inherit;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 4px solid var(--sobu);
  background: var(--card);
}

.header h1 {
  margin: 0;
  font-size: 1.1rem;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.clock {
  display: flex;
  align-items: center;
  gap: 8px;
}

.now {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chip {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}

.chip[aria-pressed='true'] {
  border-color: var(--mid);
  color: var(--mid);
}

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px 40px;
}

.controls {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 12px;
}

.label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.leave-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.leave-buttons button,
.locate {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.leave-buttons button[aria-pressed='true'],
.locate[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.at {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.at input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  background: var(--bg);
}

.link {
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.where-text {
  margin: 6px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.status:empty {
  display: none;
}

.status {
  color: #b3261e;
  font-size: 0.9rem;
}

.summary {
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--accent-soft);
  border-radius: var(--radius);
}

.summary p {
  margin: 0;
}

.summary-lead {
  font-size: 0.8rem;
  color: var(--muted);
}

.summary-main {
  font-size: 1.1rem;
}

.summary-sub {
  font-size: 0.85rem;
}

.diff {
  color: var(--muted);
  font-size: 0.85rem;
}

.routes {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.route {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 6px solid var(--low);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.route-shinagawa {
  border-left-color: var(--mid);
}

.route-tokyo {
  border-left-color: var(--high);
}

.route-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.route-head h2 {
  margin: 0;
  font-size: 1rem;
}

.seat {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.seat-high {
  color: var(--high);
}

.seat-mid {
  color: var(--mid);
}

.seat-low {
  color: var(--low);
}

.route-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.route-main p {
  margin: 0;
}

.arrive-time {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.deadline,
.waits,
.seat-text {
  margin: 2px 0;
  font-size: 0.9rem;
}

.waits,
.seat-text {
  color: var(--muted);
}

.steps {
  list-style: none;
  margin: 10px 0 0;
  padding: 8px 0 0;
  border-top: 1px dashed var(--line);
  font-size: 0.85rem;
}

.steps li {
  display: grid;
  grid-template-columns: 7.2em 1fr;
  gap: 8px;
  padding: 2px 0;
}

.step-time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.step-note {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.none {
  color: var(--muted);
}

.later {
  margin-top: 8px;
  font-size: 0.85rem;
}

.later summary {
  cursor: pointer;
  color: var(--accent);
}

.deps {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.deps li {
  display: grid;
  grid-template-columns: 5.5em 7em 1fr;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.dep-leave {
  font-weight: 700;
}

.dep-left {
  color: var(--muted);
}

.tag {
  margin-left: 6px;
  font-size: 0.7rem;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--high);
}

.settings {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.settings summary {
  cursor: pointer;
  font-weight: 700;
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
}

.settings-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.setting small {
  display: block;
  color: var(--muted);
}

.setting-input {
  white-space: nowrap;
}

.setting-input input {
  width: 4.5em;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  background: var(--bg);
  text-align: right;
}

.notes {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.78rem;
}

.notes ul {
  padding-left: 1.2em;
}

@media (max-width: 420px) {
  .deps li {
    grid-template-columns: 5em 1fr;
  }

  .dep-train {
    grid-column: 1 / -1;
  }
}

.via {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
}

.alt {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.85rem;
}

.alt summary {
  cursor: pointer;
}

.alt .waits {
  margin: 6px 0 0;
}
