/* DTRH 2026 planner — mobile-first, light by default with a night view.
   Crisp square edges (no rounded corners), dependency-free. */
:root {
  --bg: #f3f1ea;        /* warm paper */
  --bg2: #ffffff;
  --card: #ffffff;
  --line: #d9d5c8;
  --line-strong: #bcb6a4;
  --text: #1b1b22;
  --muted: #6c6a60;
  --accent: #e60a5a;
  --accent-ink: #ffffff;
  --grid-gap: #efece2;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 60px;
  --topbar-h: 52px;
}
:root[data-theme="night"] {
  --bg: #20222e;        /* softer than pitch black */
  --bg2: #2a2d3c;
  --card: #2f3242;
  --line: #3d4154;
  --line-strong: #51566c;
  --text: #eef0f8;
  --muted: #a3a7bd;
  --accent: #ff3d77;
  --accent-ink: #1b1b22;
  --grid-gap: #262936;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

#app { display: flex; flex-direction: column; min-height: 100%; }

/* --- Top bar --- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h); display: flex; align-items: center; gap: 8px;
  padding: 0 12px; background: var(--bg2); border-bottom: 2px solid var(--text);
}
.topbar-title { font-weight: 800; font-size: 17px; letter-spacing: -0.2px; flex: 1;
  text-transform: uppercase; }
.icon-btn, .me {
  width: 38px; height: 38px; background: var(--bg2); border: 2px solid var(--line-strong);
  font-size: 18px; display: grid; place-items: center;
}
.me { font-size: 20px; }

/* --- View + tab bar --- */
.view { flex: 1; padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; background: var(--bg2); border-top: 2px solid var(--text);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); font-size: 11px; font-weight: 600; border-right: 1px solid var(--line);
}
.tab:last-child { border-right: none; }
.tab-icon { font-size: 21px; line-height: 1; filter: grayscale(0.5); }
.tab--on { color: var(--text); background: var(--bg); }
.tab--on .tab-icon { filter: none; }

/* --- First-run setup --- */
.setup { padding: 28px 22px; max-width: 460px; margin: 0 auto; text-align: center; }
.setup-title { font-size: 34px; margin: 12px 0 4px; letter-spacing: -0.5px; font-weight: 900;
  text-transform: uppercase; }
.setup-sub { color: var(--muted); margin: 0 0 20px; }
.setup-emoji { font-size: 56px; margin: 8px 0 14px; }
.gate-error { color: var(--accent); font-size: 13.5px; font-weight: 600; min-height: 18px; margin: 4px 0 0; }
.emoji-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 16px 0 22px; }
.emoji-pick { aspect-ratio: 1; font-size: 24px; background: var(--bg2); border: 2px solid var(--line-strong); }
.emoji-pick--on { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.emoji-pick--taken { opacity: 0.32; filter: grayscale(0.7); }
.confirm-name { font-size: 24px; font-weight: 800; margin: 2px 0 0; }
.ghost-block { width: 100%; margin-top: 10px; display: block; }
.primary-btn {
  width: 100%; padding: 15px; background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 16px; text-transform: uppercase; letter-spacing: 0.5px;
  border: 2px solid var(--accent);
}
.search-input {
  width: 100%; padding: 13px 14px; background: var(--bg2); border: 2px solid var(--line-strong);
  color: var(--text); margin: 6px 0;
}
.search-input::placeholder { color: var(--muted); }

/* --- Artist list (search) --- */
.search-bar { position: sticky; top: var(--topbar-h); z-index: 10;
  padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
.list { padding: 8px 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.empty { color: var(--muted); text-align: center; padding: 30px; }
.row {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 9px 10px; background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
}
.row--must_see { border-left-color: var(--accent); }
.row--interested { border-left-color: #f5a300; }
.row--seen { border-left-color: #2f6fed; }
.row--avoid { border-left-color: var(--muted); opacity: 0.65; }
.row-dot { display: none; }
.row-main { flex: 1; min-width: 0; }
.row-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { color: var(--muted); font-size: 12.5px; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-tags { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.pill { font-size: 10px; font-weight: 800; color: #fff; padding: 2px 6px; text-transform: uppercase; }
.faces { font-size: 14px; letter-spacing: -2px; }

/* --- Bottom sheet (artist detail) --- */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end; opacity: 0; transition: opacity .18s; }
.sheet--open { opacity: 1; }
.sheet-card {
  position: relative;
  width: 100%; max-height: 88vh; overflow-y: auto; background: var(--bg2);
  padding: 0 18px 26px; transform: translateY(100%); transition: transform .2s ease;
  border-top: 3px solid var(--text);
}
.sheet--open .sheet-card { transform: translateY(0); }
.sheet-grab { width: 44px; height: 4px; background: var(--line-strong); margin: 10px auto 14px; }
.sheet-close {
  position: absolute; top: 12px; right: 12px; width: 40px; height: 40px;
  display: grid; place-items: center; font-size: 19px; line-height: 1;
  background: var(--bg); border: 2px solid var(--line-strong); color: var(--text);
}
.sheet-name { margin: 8px 0 4px; font-size: 23px; font-weight: 800; letter-spacing: -0.3px; }
.sheet-meta { color: var(--muted); text-transform: capitalize; margin-bottom: 16px; }
.level-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.level-btn {
  padding: 11px 4px; background: var(--bg2); border: 2px solid var(--line-strong);
  color: var(--text); font-size: 12px; font-weight: 700; text-transform: uppercase;
}
.level-btn--on { color: #fff; }
.others { margin: 18px 0; padding: 12px; background: var(--bg); border: 1px solid var(--line); }
.others--empty { color: var(--muted); font-size: 13.5px; }
.others-title { font-weight: 700; margin-bottom: 9px; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.4px; }
.others-list { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { background: var(--bg2); border: 1px solid var(--line-strong);
  padding: 5px 9px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.chip-tag { font-style: normal; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.sheet-desc { color: var(--text); white-space: pre-line; margin: 16px 0; }
.sheet-actions { display: flex; gap: 8px; }
.ghost-btn {
  flex: 1; text-align: center; text-decoration: none; padding: 13px;
  background: var(--bg2); border: 2px solid var(--line-strong); color: var(--text);
  font-weight: 700; text-transform: uppercase; font-size: 13px;
}

/* --- Timeline --- */
.day-tabs { display: flex; gap: 0; padding: 10px 12px 0; position: sticky;
  top: var(--topbar-h); background: var(--bg); z-index: 10; }
.day-tab { flex: 1; padding: 10px; background: var(--bg2); border: 2px solid var(--line-strong);
  border-right-width: 0; color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 13px; }
.day-tab:last-child { border-right-width: 2px; }
.day-tab--on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.grid-wrap { padding: 8px 0 0; }
/* Own scroll viewport (both axes) so the hour header (sticky top) and the stage
   labels (sticky left) stay pinned while you scroll the grid. Height is capped
   to the space under the top bar + day tabs and above the bottom tab bar. */
.grid-scroll {
  overflow: auto; -webkit-overflow-scrolling: touch;
  max-height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - var(--safe-b) - 60px);
}
.grid-empty { color: var(--muted); text-align: center; padding: 44px 24px; line-height: 1.5; }
.grid { position: relative; }
.grid-head { position: sticky; top: 0; z-index: 6; background: var(--bg); }
.tick { position: absolute; top: 4px; font-size: 11px; font-weight: 600; color: var(--muted);
  transform: translateX(-50%); white-space: nowrap; }
.tick::before { content: ""; position: absolute; top: 16px; left: 50%; width: 1px;
  height: 9999px; background: var(--line); }
.gap { position: absolute; width: 26px; background: repeating-linear-gradient(
  45deg, var(--grid-gap), var(--grid-gap) 5px, transparent 5px, transparent 10px); }
.stage-label {
  position: sticky; left: 0; z-index: 5; display: flex; align-items: center;
  padding: 0 8px; font-size: 11px; font-weight: 800; color: var(--text);
  background: var(--bg2); border-right: 2px solid var(--text);
  border-bottom: 1px solid var(--line); line-height: 1.1; text-transform: uppercase; }
.row-line { position: absolute; height: 1px; background: var(--line); }
.block {
  position: absolute; overflow: hidden; text-align: left; padding: 4px 6px;
  background: var(--card); border: 1px solid var(--line-strong);
  border-left: 3px solid var(--line-strong);
  display: flex; flex-direction: column; gap: 1px;
}
.block--must_see { border-left-color: var(--accent); }
.block--interested { border-left-color: #f5a300; }
.block--seen { border-left-color: #2f6fed; }
.block--avoid { border-left-color: var(--muted); opacity: 0.6; }
.block-name { font-size: 11.5px; font-weight: 700; line-height: 1.1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.block-time { font-size: 9.5px; color: var(--muted); }
.block-faces { margin-top: auto; font-size: 12px; letter-spacing: -2px; line-height: 1; }

/* --- Toast / offline --- */
.toast {
  position: fixed; bottom: calc(var(--tabbar-h) + 20px); left: 50%;
  transform: translateX(-50%) translateY(10px); background: var(--text); color: var(--bg);
  padding: 10px 18px; font-weight: 700; font-size: 14px; opacity: 0; transition: all .2s; z-index: 60; }
.toast--on { opacity: 1; transform: translateX(-50%) translateY(0); }
.offline-banner {
  position: fixed; bottom: calc(var(--tabbar-h) + var(--safe-b)); left: 0; right: 0;
  background: var(--text); color: var(--bg); text-align: center; font-size: 12px; font-weight: 600;
  padding: 5px; z-index: 25; display: none; }
body.is-offline .offline-banner { display: block; }

.update-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 80;
  background: var(--accent); color: var(--accent-ink); border: none;
  font-weight: 700; font-size: 13.5px; padding: 11px 14px;
  text-align: center; width: 100%;
  padding-top: calc(11px + env(safe-area-inset-top, 0px));
}
.setup-rule { border: none; border-top: 1px solid var(--line); margin: 22px 0 4px; width: 100%; }
.app-version { color: var(--muted); font-size: 12px; text-align: center; margin: 10px 0 0; }

/* --- Settings: show / hide timeline stages --- */
.stage-toggles { display: flex; flex-direction: column; border: 1px solid var(--line);
  margin: 10px 0 4px; text-align: left; }
.stage-toggle { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 12px; background: var(--bg2); border: none; border-bottom: 1px solid var(--line); }
.stage-toggle:last-child { border-bottom: none; }
.stage-toggle-name { flex: 1; font-weight: 600; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-toggle-size { font-size: 10px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.4px; flex: none; }
.stage-toggle-box { width: 22px; height: 22px; flex: none; display: grid; place-items: center;
  border: 2px solid var(--line-strong); font-size: 13px; font-weight: 800; line-height: 1; }
.stage-toggle--on .stage-toggle-box { background: var(--accent); border-color: var(--accent);
  color: var(--accent-ink); }
.stage-toggle--off .stage-toggle-name, .stage-toggle--off .stage-toggle-size { color: var(--muted); opacity: 0.7; }
