/* The wall: numbers, not decoration.
   Tokens come from the kit stylesheet, so light/dark are both first class.
   The point of this sheet is negative space used on purpose — near-zero
   gutters, hairline separators, one line of header. */

html, body { height: 100%; margin: 0; }

body.wall-page {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- header ---------- */

.bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-bottom: var(--border-w) solid var(--border);
  background: var(--surface);
  min-height: 30px;
  flex: none;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.bar::-webkit-scrollbar { display: none; }
.grow { flex: 1 1 auto; }
.sep { width: 1px; align-self: stretch; background: var(--border); flex: none; }

.chips { display: flex; gap: 3px; align-items: center; flex: none; }

.chip {
  font: inherit;
  font-size: var(--fs-xs);
  line-height: 1.1;
  padding: 4px 7px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"], .chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.chip.icon { padding: 4px 8px; font-weight: var(--weight-bold); }
.chip .count { opacity: .7; margin-left: 3px; }

.zoom { display: flex; align-items: center; gap: 2px; flex: none; }
.zoom-label { font-size: var(--fs-xs); color: var(--muted); min-width: 26px; text-align: center; }

select.chip { padding: 4px 4px; }

.add { position: relative; display: flex; gap: 3px; flex: none; }
#add-input {
  font: inherit;
  font-size: var(--fs-xs);
  padding: 4px 6px;
  width: 128px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
}
#add-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.suggest {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 30;
  margin-top: 3px;
  min-width: 280px;
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.suggest button {
  display: flex;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  font: inherit;
  font-size: var(--fs-xs);
  background: none;
  border: 0;
  border-bottom: var(--border-w) solid var(--border);
  color: var(--fg);
  cursor: pointer;
}
.suggest button:hover, .suggest button:focus { background: var(--surface-2); outline: none; }
.suggest .t { font-family: var(--font-mono); font-weight: var(--weight-bold); min-width: 62px; }
.suggest .n { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- the wall ---------- */

.wall {
  flex: 1 1 auto;
  display: grid;
  gap: 1px;
  background: var(--border);
  overflow: hidden;
  min-height: 0;
}

.tile {
  position: relative;
  background: var(--surface);
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}
.tile canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.tile .ticker {
  position: absolute;
  top: 2px;
  left: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .02em;
  font-weight: var(--weight-bold);
  color: var(--fg);
  pointer-events: none;
  text-shadow: 0 0 3px var(--surface);
}
.tile.stale canvas { opacity: .35; }
.tile .stale-flag {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--red);
  background: var(--red-bg);
  padding: 0 3px;
  border-radius: 2px;
  pointer-events: none;
}
.tile.expanded { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 4; }
.tile .note-dot {
  position: absolute;
  bottom: 3px;
  right: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
  pointer-events: none;
}
.tile.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--surface-2), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ---------- panel ---------- */

.panel {
  position: fixed;
  top: 34px;
  right: 0;
  bottom: 0;
  width: min(340px, 92vw);
  background: var(--surface);
  border-left: var(--border-w) solid var(--border);
  box-shadow: var(--shadow);
  z-index: 40;
  display: flex;
  flex-direction: column;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: var(--border-w) solid var(--border);
}
.panel-body { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.panel-body h3 { margin: 0; font-size: var(--fs-xs); color: var(--muted); font-weight: var(--weight-medium); text-transform: uppercase; letter-spacing: .04em; }
.panel-body .meta { color: var(--muted); font-size: var(--fs-xs); }
.panel-body textarea {
  width: 100%;
  min-height: 64px;
  font: inherit;
  font-size: var(--fs-sm);
  padding: 6px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  resize: vertical;
}
.taglist { display: flex; flex-direction: column; gap: 4px; }
.taglist label { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.taglist input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.newtag { display: flex; gap: 4px; }
.newtag input {
  flex: 1;
  font: inherit;
  font-size: var(--fs-xs);
  padding: 4px 6px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
}
.danger { color: var(--red); border-color: var(--red); }
.hint { font-size: var(--fs-xs); color: var(--muted); margin: 0; }

/* ---------- menu + toast ---------- */

.menu {
  position: fixed;
  z-index: 50;
  min-width: 210px;
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px;
}
.menu button {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: var(--fs-sm);
  padding: 6px 8px;
  background: none;
  border: 0;
  border-radius: var(--radius);
  color: var(--fg);
  cursor: pointer;
}
.menu button:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: var(--border-w) solid var(--border); margin: 4px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--fg);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  max-width: 90vw;
  box-shadow: var(--shadow);
}

.empty-state {
  position: fixed;
  inset: 34px 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  pointer-events: none;
}
.empty-state p { margin: 0; }
.muted { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .tile.loading::after { animation: none; }
}
