:root {
  --bg: #14121c;
  --panel: #1e1b29;
  --line: #2f2a40;
  --text: #ece9f5;
  --muted: #9a94ad;
  --accent: #8b5cf6;
  --good: #34d399;
  --even: #fbbf24;
  --bad: #f87171;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  border-bottom: 1px solid var(--line);
}
.lanes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.lanes button {
  font: inherit; font-size: 13px; padding: 9px 0; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
}
.lanes button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.searchrow { display: flex; gap: 6px; margin-top: 8px; }
#q {
  flex: 1; min-width: 0; font-size: 16px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); outline: none;
}
#q:focus { border-color: var(--accent); }
.searchrow button {
  font: inherit; font-size: 13px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); padding: 0 10px; white-space: nowrap;
}
.searchrow .icon { font-size: 18px; width: 42px; padding: 0; }

main { padding: 8px 12px calc(env(safe-area-inset-bottom) + 24px); max-width: 900px; margin: 0 auto; }
.memo { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.memo summary { cursor: pointer; color: var(--muted); }
.memo ul { margin: 8px 0 2px; padding-left: 18px; line-height: 1.6; }
.good { color: var(--good); } .even { color: var(--even); } .bad { color: var(--bad); }
.status { color: var(--muted); font-size: 12px; margin: 10px 2px 4px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px 6px; }
.sec { grid-column: 1 / -1; margin: 10px 2px 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-decoration: none; color: var(--text); padding: 4px 2px; border-radius: 10px;
}
.tile:active { background: var(--panel); }
.tile img { width: 56px; height: 56px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.tile span { font-size: 11px; line-height: 1.2; text-align: center; word-break: break-all; }
@media (hover: hover) { .tile:hover img { border-color: var(--accent); } }

dialog {
  width: min(440px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--text); padding: 16px;
}
dialog::backdrop { background: rgb(0 0 0 / .6); }
dialog h2 { margin: 0 0 12px; font-size: 17px; }
dialog .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; }
dialog .col { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
dialog input, dialog textarea {
  font: inherit; font-size: 16px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
}
dialog input { width: 84px; }
.hint { color: var(--muted); font-size: 12px; }
.actions { display: flex; justify-content: space-between; gap: 8px; }
.actions button { font: inherit; font-size: 14px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.actions .primary { background: var(--accent); border-color: var(--accent); color: #fff; }
