/* Chapel: GodOnChain Desktop's phosphor look (Assets/iq_theme.tres). */
@font-face {
  font-family: "Plex Mono";
  src: url("IBMPlexMono-Light.ttf") format("truetype");
  font-weight: 300;
  font-display: swap;
}

:root {
  --bg: #000;
  --panel: #050505;
  --panel-2: #0b0b0b;
  --line: rgba(0, 160, 0, 0.55);
  --line-dim: rgba(0, 102, 0, 0.5);
  --green: #00ff00;
  --green-2: #00cc00;
  --dim: rgba(153, 255, 153, 0.75);
  --muted: rgba(153, 255, 153, 0.5);
  --sel: #003a00;
  --sel-strong: #00cc00;
  --gold: #ffd94d;
  --danger: #ff6b6b;
  --radius: 2px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--green);
  font: 15px/1.45 "Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--green); }
[hidden] { display: none !important; }

#app { display: flex; flex-direction: column; height: 100vh; padding: 8px; gap: 8px; }

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--green); padding: 4px 4px 8px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { border: 1px solid var(--line); border-radius: 6px; image-rendering: pixelated; }
.top h1 { margin: 0; font-size: 26px; font-weight: 300; letter-spacing: 2px; white-space: nowrap; }
.chapel { color: var(--gold); }
.tagline { margin: 0; font-size: 11px; color: var(--green-2); letter-spacing: 0.5px; }
.status { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.read { font-size: 12px; color: var(--dim); display: flex; gap: 8px; align-items: center; }
.read .dot { font-size: 12px; }
.read .dot.ok { color: var(--green); }
.read .dot.bad { color: var(--danger); }
.read .dot.wait { color: var(--muted); }

.btn {
  background: var(--panel-2); border: 1px solid var(--line-dim); color: var(--green);
  padding: 6px 12px; border-radius: var(--radius); cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--sel); border-color: var(--green); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: #004400; border-color: var(--green); }
.btn.primary:hover:not(:disabled) { background: var(--sel-strong); color: #000; }
.btn.big { font-size: 18px; padding: 10px 28px; }
a.btn, .actions .btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.icon-btn { padding: 6px 10px; }

/* Body: rail | list | detail */
.body { flex: 1; min-height: 0; display: grid; grid-template-columns: 230px minmax(320px, 1fr) minmax(360px, 1.15fr); gap: 8px; }
.rail, .list-pane, .detail { background: var(--panel); border: 1px solid #0d1f0d; min-height: 0; }

.rail { overflow: auto; padding: 4px 0; }
.rail-group { margin-bottom: 4px; }
.rail-item {
  display: flex; justify-content: space-between; width: 100%; text-align: left;
  background: none; border: 0; border-bottom: 1px solid #0d1f0d; padding: 6px 10px; cursor: pointer;
  color: var(--green);
}
.rail-item.head { text-transform: uppercase; }
.rail-item.sub { padding-left: 26px; color: var(--green-2); }
.rail-item:hover { background: #001a00; }
.rail-item.active { background: var(--sel-strong); color: #000; }
.rail-item .count { opacity: 0.8; }

.list-pane { display: flex; flex-direction: column; padding: 6px; }
.list-head h2 { margin: 2px 2px 6px; font-weight: 300; font-size: 17px; }
.filters { display: flex; gap: 6px; }
.filters input { flex: 1; min-width: 0; }
.filters input, .filters select, .settings-form input {
  background: #0d0d0d; border: 1px solid var(--line-dim); border-radius: var(--radius); padding: 5px 8px; color: var(--green);
}
.filters input::placeholder, .settings-form input::placeholder { color: var(--muted); }
.list { flex: 1; overflow: auto; margin-top: 6px; border-top: 1px solid #0d1f0d; }
.list-section { color: var(--green-2); font-size: 13px; padding: 8px 6px 4px; border-bottom: 1px solid #0d1f0d; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(70px, 150px) 44px 82px; gap: 8px; align-items: center;
  padding: 7px 8px; cursor: pointer; border-bottom: 1px solid #0a160a;
}
.row:hover { background: #001a00; }
.row.active { background: var(--sel); outline: 1px solid var(--green); }
.row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .c { color: var(--dim); font-size: 13px; }
.row .p { color: #8cd9ff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .p.mine { color: var(--gold); }
.row .p.none { color: var(--muted); }
.list-kind { color: var(--gold); font-size: 14px; letter-spacing: 1px; padding: 12px 6px 4px; border-bottom: 1px solid var(--line-dim); }
.list-kind:not(:first-child) { margin-top: 10px; }
.list-section.sub { padding-left: 16px; }
.list-kind.publisher { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; letter-spacing: 0; }
.list-kind .linkish { background: none; border: 0; padding: 0; font: inherit; color: #8cd9ff; cursor: pointer; }
.list-kind .linkish:hover { text-decoration: underline; }
.list-kind .addr { font-size: 12px; color: var(--muted); }
.publisher-note { margin: 8px 6px; font-size: 12px; color: var(--muted); }
.publisher-note code { color: var(--dim); overflow-wrap: anywhere; }
.list-section.gated { color: var(--gold); }
.published-by { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin: 6px 0 2px; }
.published-by .caption { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.published-by .linkish { background: none; border: 0; padding: 0; font: inherit; font-size: 18px; color: #8cd9ff; cursor: pointer; }
.published-by .linkish:hover { text-decoration: underline; }
.published-by .linkish.mine, .published-by .you { color: var(--gold); }
.published-by .addr { font-size: 12px; color: var(--muted); }
.row .s { color: var(--dim); font-size: 13px; text-align: right; }
.badge { font-size: 11px; border: 1px solid var(--line-dim); border-radius: 3px; padding: 0 4px; margin-left: 6px; color: var(--dim); }
.badge.web { border-color: var(--green-2); color: var(--green); }
.list-foot { margin: 6px 2px 0; font-size: 12px; color: var(--muted); min-height: 1em; }
.empty { color: var(--muted); padding: 14px 10px; }

/* Detail */
.detail { overflow: auto; padding: 12px; }
.detail-head { display: flex; gap: 14px; align-items: flex-start; }
.detail-icon { width: 96px; height: 96px; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; background: #0d0d0d; flex-shrink: 0; image-rendering: auto; }
.detail h2 { margin: 0; font-size: 26px; font-weight: 300; }
.meta { color: var(--dim); font-size: 14px; margin: 2px 0; }
.meta b { color: var(--green); font-weight: 400; }
.gate-line { color: var(--gold); margin: 12px 0 4px; }
.gate-line .ok { color: var(--green); }
.gate-line .no { color: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.note { font-size: 13px; color: var(--dim); border-left: 2px solid var(--line-dim); padding: 2px 10px; margin: 8px 0; }
.note.warn { border-color: var(--gold); color: var(--gold); }
.desc { white-space: pre-wrap; margin: 14px 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; border: 1px solid var(--line-dim); border-radius: 3px; padding: 1px 6px; color: var(--dim); }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-top: 14px; }
.shots img { width: 100%; border: 1px solid var(--line-dim); border-radius: 3px; }
.versions { margin-top: 12px; border-top: 1px solid #0d1f0d; }
.version-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #0a160a; font-size: 14px; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1em; }
.welcome h2 { color: var(--gold); }
.welcome p { color: var(--dim); }

/* Player */
.player { position: fixed; inset: 0; background: #000; z-index: 10; display: flex; flex-direction: column; }
.player-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--green); }
.player-title { font-size: 17px; }
.player-status { flex: 1; color: var(--dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-stage { position: relative; flex: 1; min-height: 0; }
.player-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.player-progress { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--dim); text-align: center; padding: 16px; }
.player-progress progress { width: min(420px, 80vw); accent-color: var(--green); }
.player-progress.failed { color: var(--danger); }
.player-steps { list-style: none; margin: 4px 0 0; padding: 0; width: min(420px, 80vw); text-align: left; font-size: 13px; }
.player-steps li { display: flex; gap: 8px; padding: 3px 0; color: var(--dim); }
.player-steps li .mark { width: 1.2em; flex: none; text-align: center; }
.player-steps li .what { flex: 1; min-width: 0; }
.player-steps li .detail { display: block; font-size: 12px; opacity: 0.8; overflow-wrap: anywhere; }
.player-steps li.active { color: var(--green); }
.player-steps li.done .mark { color: var(--green); }
.player-steps li.wait { opacity: 0.55; }
.player-log { height: 30vh; margin: 0; overflow: auto; border-top: 1px solid var(--line-dim); padding: 6px 8px; font-size: 12px; color: var(--dim); white-space: pre-wrap; }
.spinner { width: 34px; height: 34px; border: 3px solid #003300; border-top-color: var(--green); border-radius: 50%; animation: spin 0.9s linear infinite; }
.player-progress.failed .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Settings */
dialog { background: var(--panel); color: var(--green); border: 1px solid var(--green); border-radius: 4px; width: min(560px, calc(100vw - 32px)); padding: 0; }
dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
.settings-form { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.settings-form h2 { margin: 0; font-weight: 300; }
fieldset { border: 1px solid var(--line-dim); border-radius: 3px; display: flex; flex-direction: column; gap: 8px; }
.rpc-row { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: center; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 1000px) {
  .body { grid-template-columns: 1fr; grid-auto-rows: minmax(0, auto); overflow: auto; }
  #app { height: auto; min-height: 100vh; }
  .rail { display: flex; flex-wrap: wrap; overflow: visible; }
  .rail-group { flex: 1 1 160px; }
  .list { max-height: 50vh; }
  .top h1 { font-size: 18px; }
  .tagline { display: none; }
}
@media (max-width: 560px) {
  #app { padding: 6px 16px; }
  .top { flex-wrap: wrap; }
  .status { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .read { display: none; }
  .filters { flex-wrap: wrap; }
}

/* Write approval: the count of wallet prompts is the headline. */
.approve .approve-count { font-size: 40px; line-height: 1.1; color: var(--green); }
.approve .approve-count small { display: block; font-size: 14px; color: var(--dim); }
.approve-facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 0; font-size: 14px; }
.approve-facts dt { color: var(--muted); }
.approve-facts dd { margin: 0; word-break: break-all; }
.approve-line { margin: 4px 0; }
.approve-ack { display: flex; gap: 8px; align-items: flex-start; }
.approve.warn { border-color: var(--gold); }
.approve.warn .approve-count, .approve.warn .approve-line { color: var(--gold); }
.approve.severe { border: 3px solid var(--danger); box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.25); }
.approve.severe h2, .approve.severe .approve-count, .approve.severe .approve-line { color: var(--danger); }
.approve.severe .approve-count { font-size: 56px; }
dialog.approve { z-index: 30; }
.reveal { display: flex; gap: 6px; align-items: center; color: var(--dim); font-size: 14px; }
/* BUY $IQ: Desktop's bright button. */
.btn.buy { background: #00cc00; color: #000; border: 2px solid var(--green); font-weight: 400; box-shadow: 0 0 10px rgba(0, 255, 0, 0.45); }
.btn.buy:hover { background: var(--green); color: #000; }
.status a.btn { display: inline-flex; align-items: center; text-decoration: none; }
/* Long titles and facts wrap rather than run off narrow screens. */
.detail-head > div { min-width: 0; }
.detail h2, .meta, .gate-line, .desc { overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .filters input { flex: 1 1 100%; }
  .detail-icon { width: 72px; height: 72px; }
  .detail h2 { font-size: 21px; }
}

/* Narrow screens: no room for the Publisher column (the detail shows it). */
@media (max-width: 560px) {
  .row { grid-template-columns: minmax(0, 1fr) 44px 82px; }
  .row .p { display: none; }
}
