/* Ask a Judge — quiet courtroom: dark slate and parchment. */
:root {
  --bg: #141118; --panel: #1e1a26; --panel-2: #262130; --line: #3a3348;
  --ink: #ece7f2; --dim: #9a90ab; --accent: #c9a3ff; --gavel: #e8c66a;
  --sans: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; background: radial-gradient(ellipse 120% 60% at 50% -10%, #221c2e, var(--bg) 70%); color: var(--ink); font: 16px/1.55 var(--sans); min-height: 100vh; }

.topbar {
  display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem;
  position: sticky; top: 0; z-index: 50;
  background: rgba(20, 17, 24, .92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.hub-link { color: var(--dim); text-decoration: none; font-size: .78rem; font-weight: 700; }
.app-title { font-weight: 800; letter-spacing: -.02em; }
.chip {
  margin-left: auto; border: 1px solid var(--line); background: var(--panel-2); color: var(--dim);
  border-radius: 999px; font: inherit; font-weight: 700; font-size: .78rem; padding: .35rem .8rem;
  cursor: pointer; min-height: 36px; touch-action: manipulation;
}
.chip:active { border-color: var(--accent); color: var(--accent); }

main { max-width: 680px; margin: 0 auto; padding: 0 .9rem calc(3.5rem + env(safe-area-inset-bottom)); }
.hint { color: var(--dim); font-size: .84rem; }
.intro code { background: var(--panel-2); border-radius: 5px; padding: .05rem .3rem; font-family: var(--mono); font-size: .8em; color: var(--accent); }

.chat { display: flex; flex-direction: column; gap: .6rem; min-height: 30vh; padding: .3rem 0 1rem; }
.chat:empty::before {
  content: "The court is in session. Ask anything — stack timing, layers, combat, weird corner cases.";
  color: var(--dim); font-size: .86rem; font-style: italic; padding: 1.2rem .4rem;
}
.chat-msg { border-radius: 14px; padding: .65rem .9rem; max-width: 92%; overflow-wrap: anywhere; }
.chat-msg.user { align-self: flex-end; background: #2c2440; border: 1px solid #443a5c; white-space: pre-wrap; }
.chat-msg.judge { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.chat-msg.judge > :first-child { margin-top: 0; }
.chat-msg.judge > :last-child { margin-bottom: 0; }
.chat-msg.judge strong { color: var(--gavel); }
.chat-msg.judge code { background: var(--panel-2); border-radius: 5px; padding: .05rem .3rem; font-family: var(--mono); font-size: .85em; }
.chat-msg.judge ul, .chat-msg.judge ol { padding-left: 1.2rem; }
.issue-error { color: #e88a7a; }

.input-row { display: flex; flex-direction: column; gap: .5rem; }
#judge-input {
  width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  color: var(--ink); font: inherit; font-size: 16px; padding: .7rem .85rem; resize: vertical; min-height: 64px;
}
#judge-input:focus { outline: none; border-color: var(--accent); }
.primary {
  align-self: flex-end; border: none; background: var(--accent); color: #1c1226;
  border-radius: 999px; font: inherit; font-weight: 800; font-size: .92rem; padding: .55rem 1.3rem;
  cursor: pointer; min-height: 42px; touch-action: manipulation;
}
.primary:disabled { opacity: .5; }
.disclaimer { margin-top: 1.6rem; }

/* ---- Exhibits: the bracketed cards, laid on the bench ---- */
.exhibits { display: flex; gap: .5rem; flex-wrap: wrap; align-self: flex-start; max-width: 92%; }
.exhibit {
  border: 1px solid var(--line); background: none; padding: 0; border-radius: 4.5%/3.2%;
  overflow: hidden; cursor: zoom-in; width: clamp(96px, 26vw, 150px); touch-action: manipulation;
}
.exhibit img { width: 100%; display: block; border-radius: inherit; -webkit-touch-callout: none; }
.exhibit:active { border-color: var(--accent); }
.card-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(10, 7, 14, .87); display: grid; place-items: center; padding: 1rem; cursor: zoom-out; }
.card-overlay img { max-width: min(92vw, 340px); max-height: 86vh; border-radius: 4.5%/3.5%; box-shadow: 0 14px 40px rgba(0, 0, 0, .6); }
