/* 2色＝墨と黄（no-ai-design.md「黒＋黄」）。影・大きい角丸は使わず、余白と細い線で区切る */
:root {
  --paper: #f3efe4; --ink: #1d1b16; --ink-2: #5b564b; --line: #d9d2c0;
  --accent: #f2c200; --accent-ink: #1d1b16; --dim: #8a8476; --err: #b3261e; --field: #fbf8f0;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1d1b16; --ink: #f3efe4; --ink-2: #b9b2a2; --line: #3a362d; --field: #26231d; --dim: #8a8476; --err: #ff8a80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { --paper: #1d1b16; --ink: #f3efe4; --ink-2: #b9b2a2; --line: #3a362d; --field: #26231d; --dim: #8a8476; --err: #ff8a80; color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 200 15px/1.7 'IBM Plex Sans JP', 'Hiragino Sans', sans-serif; -webkit-text-size-adjust: 100%; }
a { color: inherit; }
b, strong, h1, h2, h3, h4 { font-weight: 700; }
.price, .pv, output, .p { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.wrap { max-width: 980px; margin: 0 auto; padding: calc(16px + var(--sat)) 16px calc(40px + var(--sab)); }

/* 上の帯 */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.logo { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
.logo::before { content: ''; display: inline-block; width: 10px; height: 22px; background: var(--accent); margin-right: 8px; vertical-align: -4px; }
.tabs { display: flex; gap: 4px; }
.tabs button { font: inherit; font-weight: 700; font-size: 15px; color: var(--ink-2); background: none; border: 0; padding: 8px 14px; cursor: pointer; border-bottom: 3px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.stepper { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.stepper button { width: 34px; height: 34px; font: inherit; font-size: 18px; font-weight: 700; color: var(--ink); background: none; border: 1px solid var(--ink); border-radius: 2px; cursor: pointer; }
.stepper button:disabled { opacity: 0.3; cursor: default; }
.stepper output { font-weight: 800; min-width: 3em; text-align: center; }

/* 入力 */
.panel { padding-top: 18px; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.field { display: grid; gap: 4px; min-width: 0; flex: 1 1 180px; }
.field.grow { flex: 3 1 260px; }
.lab { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-2); }
input, select { width: 100%; min-width: 0; font: inherit; font-weight: 700; font-size: 16px; color: var(--ink); background: var(--field); border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; padding: 9px 10px; -webkit-appearance: none; appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
select:disabled { opacity: 0.5; }
input:focus, select:focus { outline: none; border-bottom-color: var(--accent); }
.swap { flex: 0 0 auto; font: inherit; font-size: 18px; font-weight: 700; color: var(--ink-2); background: none; border: 0; padding: 8px; cursor: pointer; }
.go { flex: 0 0 auto; font: inherit; font-weight: 700; font-size: 16px; color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 2px; padding: 12px 18px; cursor: pointer; }
.go:disabled { opacity: 0.5; cursor: default; }
.ghost { flex: 0 0 auto; font: inherit; font-weight: 700; font-size: 14px; color: var(--ink); background: none; border: 1px solid var(--ink); border-radius: 2px; padding: 9px 12px; cursor: pointer; }
.ghost:disabled { opacity: 0.35; cursor: default; }
.add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 12px; padding: 12px; background: var(--field); }
.token { padding-top: 12px; max-width: 320px; }
.err { color: var(--err); font-weight: 700; margin: 8px 0 0; }
.err:empty { display: none; }

/* カレンダー */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 8px; }
.cal-head strong { font-size: 20px; }
.nav { font: inherit; font-size: 26px; font-weight: 700; line-height: 1; color: var(--ink); background: none; border: 0; padding: 4px 14px; cursor: pointer; }
.nav:disabled { opacity: 0.2; cursor: default; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.wd { text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-2); padding: 2px 0; }
.wd.sun { color: var(--err); }
.cell { position: relative; min-height: 64px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 5px 6px; font: inherit; color: var(--ink); background: var(--field); border: 0; border-radius: 2px; cursor: pointer; text-align: left; }
.cell .dn { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.cell .pv { font-size: 15px; font-weight: 800; align-self: flex-end; letter-spacing: -0.02em; }
.cell .mk { position: absolute; top: 4px; right: 5px; font-size: 10px; font-weight: 700; background: var(--ink); color: var(--paper); padding: 0 4px; }
.cell.past { opacity: 0.3; cursor: default; }
.cell.loading .pv { color: var(--dim); }
.cell.low { background: var(--accent); color: var(--accent-ink); }
.cell.low .dn { color: var(--accent-ink); }
.cell.sel { outline: 2px solid var(--ink); outline-offset: -2px; }
.cell:hover:not(:disabled) { outline: 1px solid var(--ink-2); outline-offset: -1px; }
.cal-note { font-size: 12px; color: var(--ink-2); margin: 8px 0 0; }

/* その日の中身 */
.day { margin-top: 22px; }
.day h3 { font-size: 18px; margin: 0 0 10px; }
.opt { padding: 14px 0 16px; border-top: 1px solid var(--line); }
.opt.best { border-left: 6px solid var(--accent); padding-left: 12px; border-top: 0; }
.opt h4 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.kind { font-size: 13px; font-weight: 700; margin: 0; }
.price { font-size: 40px; font-weight: 800; line-height: 1.15; margin: 2px 0; letter-spacing: -0.02em; }
.tot { display: block; font-size: 14px; margin-bottom: 4px; }
.meta { margin: 2px 0 6px; font-weight: 700; overflow-wrap: anywhere; }
.legs { margin: 6px 0; padding-left: 1.3em; overflow-wrap: anywhere; }
.legs li { margin-bottom: 10px; }
.buy { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; margin-top: 4px; }
.buy .flt, .buy .dim { flex-basis: 100%; margin: 6px 0 0; }
.flt { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.caution { font-size: 13px; color: var(--ink-2); margin: 6px 0 0; }
.dim { color: var(--ink-2); font-size: 13px; margin: 4px 0; overflow-wrap: anywhere; }
.src { font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.btn { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; padding: 8px 16px; text-decoration: none; font-weight: 700; font-size: 15px; border: 1px solid var(--ink); border-radius: 2px; }
.btn.main { background: var(--ink); color: var(--paper); }
.btn:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.buses { list-style: none; margin: 0 0 8px; padding: 0; }
.bus { display: grid; grid-template-columns: auto 1fr; gap: 0 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.bus.best { border-left: 6px solid var(--accent); padding-left: 10px; }
.bus.full { opacity: 0.5; }
.bus .t { margin: 0; font-size: 16px; }
.bus .p { margin: 0; font-size: 20px; font-weight: 800; justify-self: end; text-align: right; }
.bus .pl { grid-column: 1 / -1; margin: 2px 0 0; font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.tag { font-size: 11px; font-weight: 700; background: var(--ink); color: var(--paper); padding: 0 5px; margin-left: 6px; }
.note18 { font-size: 13px; color: var(--ink-2); margin: 12px 0 0; }
.fail { font-weight: 700; }
.warn { color: var(--err); font-size: 13px; }
.wait { font-weight: 700; }
.wait .bar { display: block; height: 3px; margin-top: 10px; background: linear-gradient(90deg, var(--accent) 0 30%, var(--line) 30% 100%); background-size: 200% 100%; animation: slide 1.2s linear infinite; }
@keyframes slide { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .wait .bar { animation: none; } }

@media (max-width: 480px) {
  .cell { min-height: 52px; padding: 3px 4px; }
  .cell .pv { font-size: 10.5px; letter-spacing: -0.04em; }
  .cell .mk { font-size: 9px; padding: 0 2px; }
  .price { font-size: 34px; }
  .stepper { margin-left: 0; }
}

/* バス：見つかった路線 */
.routes { margin-top: 14px; }
.routes .lab { margin: 0 0 4px; }
.rt { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; font-weight: 700; padding: 6px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; cursor: pointer; }
.rt input { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 3px; accent-color: var(--accent); -webkit-appearance: auto; appearance: auto; padding: 0; border: 0; }

.field.small { flex: 0 1 140px; }
.pick { margin: 4px 6px 4px 0; }
#rl-pick { margin-top: 10px; }

/* どこでも */
.any-opts { margin-top: 10px; }
.chips { display: flex; gap: 6px; align-self: flex-end; }
.chips button { font: inherit; font-weight: 700; font-size: 14px; color: var(--ink); background: none; border: 1px solid var(--ink); border-radius: 2px; padding: 8px 12px; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.anylist { list-style: none; margin: 8px 0 0; padding: 0; counter-reset: a; }
.anylist li { padding: 12px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 0 12px; }
.anylist .a-h { font-size: 17px; }
.anylist .a-h .dim { margin-left: 8px; font-size: 12px; }
.anylist .p { margin: 0; font-size: 22px; font-weight: 800; text-align: right; }
.anylist .tot, .anylist .pl, .anylist .buy { grid-column: 1 / -1; }
.anylist .pl { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
button.btn { font: inherit; font-weight: 700; color: var(--ink); background: none; cursor: pointer; }
