:root {
  --stone: #14110f;
  --stone-2: #1c1714;
  --crack: #2a221c;
  --panel: #5b2d8e;
  --panel-2: #472070;
  --panel-edge: #7a45b0;
  --gold: #e8c547;
  --amber: #f0a830;
  --gold-dim: #c9a227;
  --text: #f5ecd8;
  --muted: #b8a88a;
  --ok: #6ecf8e;
  --warn: #f0a830;
  --bad: #e07070;
  --radius: 18px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(ellipse at 20% 0%, #2a1a3a 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, #1a2a1a 0%, transparent 45%),
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,0,0,.12) 3px, rgba(0,0,0,.12) 4px),
    linear-gradient(160deg, var(--stone) 0%, var(--stone-2) 40%, #0e0c0a 100%);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); text-decoration: none; }
a:hover, a:focus-visible { color: var(--amber); text-decoration: underline; outline: none; }
a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
header.hero {
  text-align: center;
  padding: 1.5rem 0 1rem;
}
.crown {
  width: min(220px, 55vw);
  height: auto;
  border-radius: 50%;
  box-shadow:
    0 0 0 3px var(--gold-dim),
    0 12px 40px rgba(0,0,0,.55),
    0 0 60px rgba(232,197,71,.25);
  display: block;
  margin: 0 auto 1rem;
  background: #0a0806;
}
h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  letter-spacing: .02em;
  margin: 0 0 .35rem;
  color: var(--gold);
  text-shadow: 0 2px 0 #3a2a08, 0 4px 18px rgba(0,0,0,.5);
}
.tagline {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 auto 1rem;
  max-width: 28em;
  font-weight: 600;
}
.panel {
  background: linear-gradient(165deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 2px solid var(--panel-edge);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  margin: 1rem 0;
  box-shadow: 0 8px 28px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08);
}
.panel h2 {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0 0 .65rem;
  color: var(--gold);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.panel p { margin: 0 0 .75rem; }
.panel p:last-child { margin-bottom: 0; }
.law {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--amber);
  border-left: 4px solid var(--gold);
  padding-left: .85rem;
  margin: .5rem 0 0;
}
.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(232,197,71,.35);
  font-size: .82rem;
  font-weight: 700;
  color: var(--gold);
}
.pill.wait { color: var(--warn); border-color: rgba(240,168,48,.5); }
.pill.held { color: var(--ok); border-color: rgba(110,207,142,.45); }
.pill.none { color: var(--muted); }
table.facts {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
table.facts th, table.facts td {
  text-align: left;
  padding: .55rem .4rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  vertical-align: top;
}
table.facts th {
  width: 34%;
  color: var(--gold);
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
table.facts td { word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; word-break: break-all; }
.live-box {
  background: rgba(0,0,0,.25);
  border-radius: 12px;
  padding: .85rem;
  margin-top: .5rem;
  font-size: .88rem;
}
.live-box .label { color: var(--gold); font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.live-box .val { margin: .2rem 0 .55rem; }
.live-status { font-weight: 700; }
.live-status.ok { color: var(--ok); }
.live-status.fallback { color: var(--warn); }
.live-status.err { color: var(--bad); }
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: center;
  margin: 1.25rem 0;
}
.btn {
  display: inline-block;
  padding: .7rem 1.15rem;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dim) 100%);
  color: #1a1208 !important;
  font-weight: 800;
  font-size: .92rem;
  text-decoration: none !important;
  border: none;
  box-shadow: 0 4px 0 #6a5010, 0 6px 16px rgba(0,0,0,.35);
  cursor: pointer;
}
.btn:hover, .btn:focus-visible {
  filter: brightness(1.08);
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}
.btn.ghost {
  background: transparent;
  color: var(--gold) !important;
  border: 2px solid var(--gold-dim);
  box-shadow: none;
}
footer {
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
@media (min-width: 640px) {
  .wrap { padding: 2rem 1.5rem 4rem; }
  .crown { width: 260px; }
}

.diagram {
  display: grid;
  gap: .75rem;
  margin: .75rem 0 0;
}
.diagram .node {
  background: rgba(0,0,0,.28);
  border: 2px dashed rgba(232,197,71,.4);
  border-radius: 14px;
  padding: .85rem 1rem;
  text-align: center;
  font-weight: 700;
  color: var(--gold);
}
.diagram .arrow {
  text-align: center;
  color: var(--amber);
  font-weight: 800;
  font-size: 1.2rem;
  line-height: 1;
}
@media (min-width: 560px) {
  .diagram {
    grid-template-columns: 1fr auto 1fr auto 1fr;
    align-items: center;
  }
  .diagram .arrow { transform: rotate(-90deg); }
  .diagram .arrow::before { content: "→"; }
  .diagram .arrow { font-size: 0; }
  .diagram .arrow::before { font-size: 1.4rem; }
}
.card {
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(232,197,71,.3);
  border-radius: 14px;
  padding: 1rem;
  margin: .75rem 0;
}
.card h3 { margin: 0 0 .5rem; color: var(--gold); font-size: 1rem; }
.bucket { margin: .5rem 0; }
.bucket strong { display: block; color: var(--amber); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .25rem; }
.bucket ul { margin: 0; padding-left: 1.1rem; color: var(--text); font-size: .88rem; }
.verdict {
  display: inline-block;
  margin-top: .5rem;
  padding: .4rem .8rem;
  border-radius: 999px;
  background: rgba(240,168,48,.2);
  border: 1px solid var(--warn);
  color: var(--amber);
  font-weight: 800;
  font-size: .85rem;
}
.empty-state {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--muted);
  font-weight: 600;
}
.banner {
  text-align: center;
  padding: .65rem 1rem;
  background: rgba(240,168,48,.15);
  border-bottom: 1px solid rgba(240,168,48,.4);
  color: var(--amber);
  font-weight: 800;
  font-size: .88rem;
  letter-spacing: .03em;
}

/* —— Mind app (rizal.pw root) —— */
.app-shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 0 env(safe-area-inset-bottom, 0);
}
.app-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(20,17,15,.97) 0%, rgba(20,17,15,.92) 70%, transparent 100%);
  padding: .75rem 1rem .5rem;
  backdrop-filter: blur(8px);
}
.app-top h1 {
  font-size: 1.55rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.app-top h1 .crown-mini {
  width: 36px; height: 36px; border-radius: 50%;
  box-shadow: 0 0 0 2px var(--gold-dim);
}
.tape-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .75rem;
  align-items: center;
  margin-top: .35rem;
  font-size: .78rem;
  color: var(--muted);
  font-weight: 700;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .28rem .65rem;
  border-radius: 999px;
  background: var(--panel);
  border: 2px solid var(--panel-edge);
  color: var(--gold);
  font-weight: 800;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.chip.talk { background: linear-gradient(180deg, #6b3aa0, #5b2d8e); }
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .55rem;
}
.tools button, .tools label.file-btn {
  appearance: none;
  border: 1px solid rgba(232,197,71,.4);
  background: rgba(0,0,0,.35);
  color: var(--gold);
  font-weight: 700;
  font-size: .72rem;
  padding: .4rem .65rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.tools button:hover, .tools label.file-btn:hover,
.tools button:focus-visible, .tools label.file-btn:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-color: var(--amber);
}
.tools input[type=file] { display: none; }
.search-row {
  margin-top: .55rem;
}
.search-row input {
  width: 100%;
  padding: .55rem .85rem;
  border-radius: 12px;
  border: 2px solid rgba(232,197,71,.3);
  background: rgba(0,0,0,.4);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
.search-row input:focus {
  outline: 2px solid var(--gold);
  border-color: var(--gold);
}
.transcript {
  flex: 1;
  padding: .5rem 1rem 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.entry {
  background: linear-gradient(165deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 2px solid var(--panel-edge);
  border-radius: 16px;
  padding: .75rem .9rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
}
.entry.note {
  background: linear-gradient(165deg, #3a2a1a 0%, #2a1e14 100%);
  border-color: #8a6a30;
}
.entry-head {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .6rem;
  align-items: baseline;
  margin-bottom: .35rem;
  font-size: .72rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: .03em;
}
.entry-head .when { color: var(--muted); font-weight: 600; }
.entry-head .kind-badge {
  background: rgba(0,0,0,.3);
  padding: .15rem .45rem;
  border-radius: 6px;
  text-transform: uppercase;
  font-size: .65rem;
}
.entry-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
}
.entry-amends {
  margin-top: .4rem;
  font-size: .7rem;
  color: var(--muted);
  font-weight: 600;
}
.composer {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: linear-gradient(0deg, rgba(14,12,10,.98) 60%, rgba(14,12,10,.85) 100%);
  padding: .65rem 1rem calc(.85rem + env(safe-area-inset-bottom, 0));
  border-top: 1px solid rgba(232,197,71,.2);
}
.mode-row, .lane-row, .speaker-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .45rem;
  align-items: center;
}
.mode-row label, .lane-row label, .speaker-row label {
  font-size: .7rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: .15rem;
}
.toggle {
  appearance: none;
  border: 2px solid rgba(232,197,71,.35);
  background: rgba(0,0,0,.35);
  color: var(--muted);
  font-weight: 800;
  font-size: .72rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.toggle.active {
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  color: #1a1208;
  border-color: var(--gold);
}
.input-bar {
  display: flex;
  gap: .45rem;
  align-items: stretch;
}
.input-bar input[type=text], .input-bar textarea {
  flex: 1;
  min-width: 0;
  padding: .7rem .85rem;
  border-radius: 14px;
  border: 2px solid var(--panel-edge);
  background: rgba(0,0,0,.45);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
}
.input-bar input:focus, .input-bar textarea:focus {
  outline: 2px solid var(--gold);
  border-color: var(--gold);
}
.btn-plus {
  width: 44px;
  flex-shrink: 0;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  color: #1a1208;
  font-size: 1.5rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 #6a5010;
  line-height: 1;
}
.btn-send {
  flex-shrink: 0;
  padding: 0 1rem;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, #6b3aa0, #5b2d8e);
  border: 2px solid var(--panel-edge);
  color: var(--gold);
  font-weight: 800;
  font-size: .95rem;
  cursor: pointer;
  letter-spacing: .04em;
}
.btn-plus:focus-visible, .btn-send:focus-visible, .toggle:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
.speaker-input {
  flex: 1;
  min-width: 100px;
  padding: .35rem .6rem;
  border-radius: 10px;
  border: 1px solid rgba(232,197,71,.3);
  background: rgba(0,0,0,.35);
  color: var(--text);
  font-size: .85rem;
  font-weight: 600;
  font-family: inherit;
}
.tiny-link {
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  padding: .35rem 1rem .15rem;
}
.tiny-link a { color: var(--gold-dim); }
.empty-mind {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-weight: 600;
}
.offline-pill {
  font-size: .68rem;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: rgba(110,207,142,.15);
  border: 1px solid rgba(110,207,142,.4);
  color: var(--ok);
  font-weight: 800;
}
.offline-pill.online {
  background: rgba(232,197,71,.12);
  border-color: rgba(232,197,71,.35);
  color: var(--gold);
}

.device-notice {
  margin: .45rem 0 0;
  font-size: .78rem;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: .02em;
}
.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.1rem;
  justify-content: center;
  padding: .35rem 1rem .15rem;
  font-size: .78rem;
  font-weight: 700;
}
.site-footer a { color: var(--gold-dim); }
