/* Токио 11–18.08 — дизайн: бумага/чернила/киноварь, таймлайн как схема линии метро */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --paper: #ffffff;
  --paper-dim: #f4f3ef;
  --ink: #1b1b1f;
  --ink-60: #5a5b63;
  --ink-30: #b9bac0;
  --hair: #e6e5e0;
  --shu: #d0342c;            /* киноварь ханко */
  --shu-soft: #fbe9e7;
  --tint-m: #f1f6f2;         /* утро */
  --tint-h: #faf1ea;         /* пекло */
  --tint-e: #eff1f7;         /* вечер */
  --line-w: 2px;
  --dot-x: 32px;             /* ось маршрутной нити */
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16161b; --paper-dim: #101014;
    --ink: #ececef; --ink-60: #a0a1ab; --ink-30: #5a5b63; --hair: #2b2b33;
    --shu: #e0524a; --shu-soft: #3a221f;
    --tint-m: #1a201c; --tint-h: #241d18; --tint-e: #1a1d26;
  }
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Hiragino Sans", "Noto Sans CJK JP", "Noto Sans JP", sans-serif;
  background: var(--paper-dim);
  color: var(--ink);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  font-feature-settings: "tnum";
}
.hidden { display: none !important; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; }

/* ---------- вход: станционная табличка ---------- */
.login { position: fixed; inset: 0; background: var(--paper-dim); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.login-box { width: min(360px, 92vw); background: var(--paper); border: 1px solid var(--hair); border-radius: 14px; padding: 28px 24px 24px; text-align: center; box-shadow: 0 10px 40px rgba(20,20,30,.08); }
.login-box::after { content: ''; display: block; height: 6px; border-radius: 3px; background: var(--shu); margin: 18px -24px -24px; border-radius: 0 0 13px 13px; }
.login-emoji { font-size: 44px; margin-bottom: 4px; }
.login-box h1 { font-size: 20px; font-weight: 800; letter-spacing: .2px; margin-bottom: 4px; }
.login-box h1::before { content: '東京'; display: block; font-size: 34px; letter-spacing: 8px; margin-bottom: 2px; }
.login-box p.who-hint { font-size: 13.5px; color: var(--ink-60); margin: 2px 0 14px; }
.login-box input { width: 100%; padding: 13px; border-radius: var(--r); border: 1.5px solid var(--hair); background: var(--paper-dim); color: var(--ink); font-size: 18px; text-align: center; margin: 14px 0 10px; }
.login-box input:focus { outline: 2px solid var(--shu); outline-offset: 1px; border-color: transparent; }
.login-box button { width: 100%; padding: 13px; border-radius: var(--r); font-size: 16px; font-weight: 700; background: var(--ink); color: var(--paper); }
.login-err { margin-top: 10px; color: var(--shu); min-height: 20px; font-size: 14px; }

/* ---------- шапка ---------- */
header { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--hair); padding: 8px 12px 0; }
.hdr-top { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 6px; max-width: 600px; margin: 0 auto; }
.hdr-title { font-weight: 800; font-size: 16px; letter-spacing: .3px; }
.hdr-title::before { content: '東京 '; color: var(--shu); letter-spacing: 2px; }
#syncDot { font-size: 10px; color: #3d9e63; vertical-align: 2px; margin-left: 2px; }
#syncDot.off { color: #d99a2b; }
.hdr-clock { font-size: 13px; color: var(--ink-60); }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 0 8px; scrollbar-width: none; max-width: 600px; margin: 0 auto; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; min-width: 52px; padding: 6px 8px 7px; border-radius: 9px; color: var(--ink-60); text-align: center; border: 1px solid transparent; }
.tab .k { display: block; font-size: 19px; font-weight: 700; line-height: 1.15; color: var(--ink); }
.tab .dw { display: block; font-size: 10.5px; margin-top: 1px; letter-spacing: .3px; }
.tab.active { background: var(--ink); border-color: var(--ink); }
.tab.active .k { color: var(--paper); }
.tab.active .dw { color: var(--paper); opacity: .75; }
.tab.today:not(.active) { border-color: var(--shu); }
.tab.today .dw::after { content: ' ●'; color: var(--shu); font-size: 8px; }
.tab:focus-visible { outline: 2px solid var(--shu); outline-offset: 1px; }

/* ---------- полотно ---------- */
main { max-width: 600px; margin: 0 auto; padding: 16px 12px; }

/* табличка дня — как станционный указатель */
.day-head { background: var(--paper); border: 1px solid var(--hair); border-radius: 12px; padding: 14px 16px 12px; margin-bottom: 14px; position: relative; overflow: hidden; }
.day-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--dc, var(--shu)); }
.day-head h2 { font-size: 21px; font-weight: 800; letter-spacing: .2px; }
.day-head .sub { color: var(--ink-60); font-size: 13.5px; margin-top: 3px; line-height: 1.4; }

.draft-banner { background: var(--tint-h); color: #8a5a1a; border-radius: var(--r); padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }

/* слоты дня */
.slot { position: relative; border-radius: 12px; padding: 6px 6px 2px; margin-bottom: 14px; }
.slot.morning { background: var(--tint-m); }
.slot.heat { background: var(--tint-h); }
.slot.evening { background: var(--tint-e); }
.slot-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .9px; color: var(--ink-60); padding: 6px 12px 6px calc(var(--dot-x) + 18px); }

/* маршрутная нить */
.slot::before { content: ''; position: absolute; left: var(--dot-x); top: 14px; bottom: 12px; width: var(--line-w); background: var(--ink-30); opacity: .55; }
.slot > * { position: relative; }

/* карточка-станция */
.card { background: var(--paper); border: 1px solid var(--hair); border-radius: var(--r); padding: 12px 14px 12px 10px; margin: 0 2px 8px; }
.card.done { opacity: .62; }
.card.now { border-color: var(--shu); box-shadow: 0 0 0 1px var(--shu); }
.card-row { display: flex; gap: 10px; align-items: flex-start; }

/* станция-чекбокс: точка на линии / штамп 済 */
.chk { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid var(--ink-60); background: var(--paper); margin-top: 1px; position: relative; display: flex; align-items: center; justify-content: center; transition: border-color .15s; }
.chk::after { content: ''; position: absolute; inset: -9px; } /* тач-зона ~48px */
.chk:focus-visible { outline: 2px solid var(--shu); outline-offset: 2px; }
.card.done > .card-row > .chk { border-color: transparent; }
.stamp { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--shu); color: var(--shu); font-size: 15px; font-weight: 700; transform: rotate(-8deg); background: var(--paper); }
@media (prefers-reduced-motion: no-preference) {
  .stamp { animation: stamp-in .22s cubic-bezier(.2, 1.6, .4, 1); }
  @keyframes stamp-in { from { transform: rotate(-8deg) scale(1.7); opacity: 0; } to { transform: rotate(-8deg) scale(1); opacity: 1; } }
}

.card-main { flex: 1; min-width: 0; }
.card-time { font-size: 12.5px; font-weight: 800; color: var(--ink-60); letter-spacing: .4px; }
.card.now .card-time { color: var(--shu); }
.card-title { font-size: 16.5px; font-weight: 750; line-height: 1.25; margin-top: 1px; }
.card-jp { font-size: 12.5px; color: var(--ink-60); margin-top: 2px; letter-spacing: .4px; }
.card-desc { font-size: 14px; margin-top: 7px; line-height: 1.5; color: var(--ink); }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 13px; color: var(--ink-60); }
.card-meta b { color: var(--ink); font-weight: 650; }
.warn { background: var(--shu-soft); color: var(--shu); border-radius: 8px; padding: 8px 11px; font-size: 13.5px; margin-top: 9px; line-height: 1.45; }
.unverified { color: #a07414; font-size: 12.5px; margin-top: 6px; }

/* действия: компактные чипы вместо блоков 50/50 */
.card-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.act { display: inline-flex; align-items: center; gap: 5px; padding: 8px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 650; text-decoration: none; border: 1.5px solid var(--hair); color: var(--ink); min-height: 38px; }
.act.primary { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.act.photo { border-color: var(--shu); color: var(--shu); padding: 8px 12px; margin-left: auto; }

.tasks { margin-top: 9px; border-top: 1px dashed var(--hair); padding-top: 7px; }
.task { display: flex; gap: 9px; align-items: center; padding: 5px 0; font-size: 14px; }
.task .chk { width: 20px; height: 20px; border-radius: 6px; border-width: 2px; margin: 0; }
.task .chk .stamp { display: none; }
.task.done .chk { background: var(--shu); border-color: var(--shu); }
.task.done .chk::before { content: '✓'; color: #fff; font-size: 12px; font-weight: 800; }
.task.done span { text-decoration: line-through; color: var(--ink-60); }

.thumbs { display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; }
.thumbs img { width: 62px; height: 62px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; border: 1px solid var(--hair); }

/* перегон между станциями */
.transit { display: flex; align-items: baseline; gap: 8px; margin: 0 8px 8px calc(var(--dot-x) + 14px); font-size: 12.5px; color: var(--ink-60); line-height: 1.45; }
.transit .tdot { color: var(--ink-30); }
.line-pill { flex: 0 0 auto; padding: 1.5px 9px; border-radius: 999px; color: #fff; font-size: 11.5px; font-weight: 750; white-space: nowrap; letter-spacing: .2px; }
.transit .walk { font-weight: 650; color: var(--ink); }

.planb { background: var(--paper); border: 1.5px dashed var(--ink-30); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-top: 4px; line-height: 1.5; }
.planb b { display: block; margin-bottom: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .9px; color: var(--ink-60); }

/* справка и галерея */
.info-block { background: var(--paper); border: 1px solid var(--hair); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; font-size: 14.5px; line-height: 1.55; }
.info-block h3 { font-size: 15px; margin-bottom: 7px; font-weight: 750; }
.info-block .jp-copy { background: var(--paper-dim); padding: 9px 11px; border-radius: 8px; margin-top: 8px; font-size: 15px; line-height: 1.5; }
.gallery-group { margin-bottom: 18px; }
.gallery-group h3 { font-size: 14.5px; margin-bottom: 8px; font-weight: 700; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gallery-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--hair); }

.now-btn { position: fixed; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 15; padding: 12px 18px; border-radius: 999px; background: var(--shu); color: #fff; font-size: 14px; font-weight: 750; box-shadow: 0 4px 16px rgba(120,20,10,.35); }

.overlay { position: fixed; inset: 0; background: rgba(12,12,16,.96); z-index: 60; display: flex; flex-direction: column; }
.overlay-bar { display: flex; justify-content: space-between; padding: 12px 16px; }
.overlay-bar button { background: #2a2a33; color: #fff; border-radius: 10px; padding: 9px 16px; font-size: 14px; }
#ovImg { flex: 1; object-fit: contain; min-height: 0; width: 100%; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 80px; background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 40; opacity: 0; transition: opacity .25s; pointer-events: none; }
.toast.show { opacity: 1; }

/* режим наблюдателя */
body.ro .chk { pointer-events: none; border-style: dashed; }
body.ro .act.photo { display: none; }
body.ro #ovDel { display: none; }
