body.page-log {
  height: auto;
  min-height: 100%;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
}

.brand:hover { color: var(--accent); }

.is-off { display: none !important; }

html.log-open #gate { display: none !important; }
html.log-open #board.is-off { display: flex !important; }

.gate-wrap {
  min-height: calc(100dvh - 72px);
  display: grid;
  place-items: center;
  padding: 24px 16px 8px;
}

.gate { width: min(420px, 100%); }

.gate-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gate-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  letter-spacing: 0.08em;
  font-size: 10px;
}

.gate label,
.ledger-note,
.hint,
.pile,
.miss,
.looking {
  color: var(--muted);
}

.gate-body > label[for="pass"] { font-size: 10px; letter-spacing: 0.08em; }

.gate input,
.rekey input,
.add-form input,
.find,
.time-edit input,
.title-edit {
  font: inherit;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line);
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
}

.gate button,
.rekey button,
.add-form button,
.session,
.filters button,
.time-line button,
.entry-foot button,
.io button,
.file,
.alts button,
.confirm-row button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--line);
  min-height: 44px;
  padding: 8px 12px;
}

.gate button[type="submit"] { border-color: var(--fg); }

.gate button[type="submit"]:hover,
.session:hover,
.add-form button:hover {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.gate-msg {
  min-height: 1.45em;
  margin: 0;
  color: var(--accent);
}

.keep {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--muted);
}

.board {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 22px 12px;
  max-width: 1180px;
}

.rekey { display: flex; flex-wrap: wrap; gap: 8px; }
.rekey input { flex: 1 1 160px; width: auto; min-width: 0; }
.rekey button { flex: 0 0 auto; border-color: var(--fg); }
.rekey .gate-msg { flex-basis: 100%; }

.add-form { display: flex; gap: 8px; }
.add-form input { flex: 1; min-width: 0; }
.add-form button { flex: 0 0 auto; border-color: var(--fg); }

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.filters { display: flex; flex-wrap: wrap; border: 1px solid var(--line); }

.filters button {
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  min-height: 44px;
}

.filters button:last-child { border-right: 0; }
.filters button[aria-pressed="true"] { color: var(--bg); background: var(--accent); }

.find { max-width: 180px; width: auto; flex: 1 1 140px; }

.pile { margin: 0; font-size: 12px; }

.io { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

.io button,
.file {
  color: var(--muted);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.io button:hover,
.file:hover { color: var(--fg); border-color: var(--fg); }

.file { position: relative; overflow: hidden; padding: 0 12px; }
.file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ledger-note,
.hint {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.hint { padding: 8px 22px 22px; }

.group { display: flex; flex-direction: column; gap: 8px; }
.group + .group { margin-top: 8px; }

.group h3 {
  margin: 0;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.entry {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.entry.is-live { border-color: var(--accent); }

.cover {
  height: 240px;
  border-bottom: 1px solid var(--line);
  background-color: var(--panel);
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 22px 22px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mono {
  font-size: 28px;
  letter-spacing: -0.06em;
  color: var(--muted);
}

.looking,
.miss {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-size: 10px;
  letter-spacing: 0.06em;
}

.entry-main {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entry h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.title-hit {
  text-align: left;
  border: 0;
  padding: 0;
  min-height: 32px;
  width: 100%;
  color: inherit;
}

.title-hit:hover { color: var(--accent); }

.state-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}

.state-toggle button {
  min-height: 44px;
  border: 1px solid var(--line);
  margin: 0 -1px -1px 0;
  color: var(--muted);
  padding: 6px 4px;
  font-size: 11px;
}

.state-toggle button[aria-pressed="true"] {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  position: relative;
  z-index: 1;
}

.time-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.time-read {
  border: 0;
  padding: 0 4px;
  min-height: 44px;
  color: var(--fg);
}

.time-line button[data-act="bump"] {
  min-width: 44px;
  padding: 6px 8px;
  color: var(--muted);
}

.time-edit {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.time-edit input { width: 64px; min-height: 44px; padding: 6px; }
.time-edit input::-webkit-outer-spin-button,
.time-edit input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.time-edit input { -moz-appearance: textfield; appearance: textfield; }
.time-edit span { color: var(--muted); }

.session.is-live {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.live-pip {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  background: var(--bg);
  animation: blink 1.1s steps(1) infinite;
}

.entry-foot,
.confirm-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.entry-foot button,
.confirm-row button {
  color: var(--muted);
  min-height: 36px;
  padding: 4px 8px;
}

.confirm-row p { margin: 0; color: var(--fg); }

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

.alts button {
  width: 44px;
  height: 58px;
  padding: 0;
  overflow: hidden;
}

.alts button[aria-pressed="true"] { border-color: var(--accent); }
.alts img { width: 100%; height: 100%; object-fit: cover; display: block; }

.empty {
  margin: 8px 0 0;
  color: var(--muted);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 860px) {
  .board { padding: 14px 14px 8px; }
  .hint { padding: 8px 14px 28px; }
  .grid { grid-template-columns: 1fr; }
  .io { margin-left: 0; }
  .find { max-width: none; }
  .entry-foot button,
  .confirm-row button { min-height: 44px; }
}

.sync {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

@media (prefers-reduced-motion: reduce) {
  .live-pip { animation: none; }
}

html.page-hidden .live-pip { animation-play-state: paused; }
