/* The RetroQuest Console (rqconsole.retroray.dev): the approved mockup's look.
   A warm workshop: parchment by day, forge-dark by night, iron and ember. */
:root{
  --bg:#ece2cf; --surface:#fbf6ec; --surface-2:#f3e9d6; --fg:#2a1f14; --muted:#6c5a43; --line:#d8c6a6;
  --accent:#a9491a; --accent-fg:#fff8ee; --accent-soft:#f3dcc4; --iron:#5b4f44; --ok:#2f7a3a; --warn:#9a6200; --bad:#a8322a;
  --chip:#ecdfc6; --focus:#d0661c; --shadow:0 1px 2px rgba(60,40,20,.07),0 8px 22px rgba(60,40,20,.07);
  --f-display:"Cinzel",Georgia,"Times New Roman",serif;
  --f-body:"Alegreya Sans",system-ui,"Segoe UI",sans-serif;
  --f-mono:"IBM Plex Mono",ui-monospace,Consolas,monospace;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --bg:#15110d; --surface:#1e1813; --surface-2:#261e17; --fg:#ece0c8; --muted:#a8967b; --line:#3a2f24;
  --accent:#e58a3c; --accent-fg:#1b120a; --accent-soft:#3a2617; --iron:#9a8b78; --ok:#72c47f; --warn:#e2b04a; --bad:#ef6f5f;
  --chip:#2b2219; --focus:#ffae5c; --shadow:0 1px 2px rgba(0,0,0,.4),0 10px 26px rgba(0,0,0,.35); color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#15110d; --surface:#1e1813; --surface-2:#261e17; --fg:#ece0c8; --muted:#a8967b; --line:#3a2f24;
  --accent:#e58a3c; --accent-fg:#1b120a; --accent-soft:#3a2617; --iron:#9a8b78; --ok:#72c47f; --warn:#e2b04a; --bad:#ef6f5f;
  --chip:#2b2219; --focus:#ffae5c; --shadow:0 1px 2px rgba(0,0,0,.4),0 10px 26px rgba(0,0,0,.35); color-scheme:dark}

*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;background:var(--bg);color:var(--fg);font:16px/1.5 var(--f-body);
  padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));
  padding-block:18px 64px;overflow-x:hidden}
.wrap{max-width:1320px;margin:0 auto;display:flex;flex-direction:column;gap:18px}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
a{color:var(--accent)}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.sprite{position:absolute;width:0;height:0;overflow:hidden}

/* the frame */
.con{display:flex;flex-direction:column;gap:16px}
.con-head{display:flex;flex-wrap:wrap;gap:12px 20px;align-items:center;justify-content:space-between;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:12px 16px;box-shadow:var(--shadow)}
.brand{display:flex;align-items:center;gap:12px;min-width:0;color:var(--fg);text-decoration:none}
.brand svg{flex:0 0 40px}
.brand b{display:block;font:700 19px/1.1 var(--f-display);letter-spacing:.03em}
.brand .host{display:block;font:500 12.5px var(--f-mono);color:var(--muted)}
.who{display:flex;flex-wrap:wrap;gap:10px 14px;align-items:center}
.viewas{display:flex;align-items:center;gap:8px;font-size:14px;color:var(--muted)}
.viewas select,.con select,.con input[type=text],.con textarea{background:var(--surface-2);border:1px solid var(--line);border-radius:7px;padding:6px 9px;color:var(--fg)}
.seg3{display:inline-flex;border:1px solid var(--line);border-radius:8px;overflow:hidden}
.seg3 button{background:none;border:0;padding:5px 10px;cursor:pointer;font-size:13px;color:var(--muted)}
.seg3 button[aria-pressed="true"]{background:var(--accent-soft);color:var(--fg);font-weight:700}
.me{display:flex;align-items:center;gap:10px}
.avatar{position:relative;width:40px;height:40px;border-radius:50%;flex:0 0 40px;display:grid;place-items:center;font:700 18px var(--f-display);color:#fff4df;
  background:radial-gradient(circle at 30% 25%,#e89a4a,#9a3a12 60%,#4a1606);box-shadow:0 0 0 2px var(--surface),0 0 0 3px var(--accent);overflow:hidden}
.avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}
.avatar i{position:absolute;right:-5px;bottom:-4px;font:700 8.5px var(--f-mono);font-style:normal;background:var(--fg);color:var(--bg);border-radius:4px;padding:1px 3px;letter-spacing:.04em}
.me b{display:block;font-size:14.5px;line-height:1.2}
.me small{display:block;font-size:12.5px;color:var(--muted)}
.me .linkish{font-size:12.5px;font-weight:500}
.asbar{display:flex;flex-wrap:wrap;gap:8px 14px;align-items:center;justify-content:space-between;background:var(--accent-soft);border:1px dashed var(--accent);border-radius:10px;padding:10px 14px;font-size:14.5px}
.cnav{display:flex;gap:6px;flex-wrap:wrap}
.cnav a{border:1px solid transparent;border-radius:8px;padding:7px 12px;font-weight:700;color:var(--muted);display:inline-flex;gap:6px;align-items:center;text-decoration:none}
.cnav a[aria-current="page"]{background:var(--surface);border-color:var(--line);color:var(--fg);box-shadow:var(--shadow)}
.cnav a:hover{color:var(--fg)}
.cnav svg{width:16px;height:16px}
.pill{font:500 11px var(--f-mono);padding:1px 6px;border-radius:10px;background:var(--chip);color:var(--muted);letter-spacing:.02em}
.pages{display:flex;flex-direction:column;gap:16px}

/* the tools */
.search{position:relative;display:flex;align-items:center}
.search svg{position:absolute;left:14px;width:20px;height:20px;color:var(--muted);pointer-events:none}
.con .search input{width:100%;font-size:18px;padding:13px 92px 13px 44px;border-radius:12px;background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow);color:var(--fg)}
.search input::placeholder{color:var(--muted)}
.search kbd{position:absolute;right:12px;font:500 12px var(--f-mono);color:var(--muted);border:1px solid var(--line);border-bottom-width:2px;border-radius:5px;padding:2px 6px;background:var(--surface-2)}
.quick{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:14px;align-items:start}
@media (max-width:760px){.quick{grid-template-columns:minmax(0,1fr)}}
.qbox{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:12px 14px;display:flex;flex-direction:column;gap:8px;min-width:0}
.qbox h3,.sec h3{margin:0;font:600 13px var(--f-mono);letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.favs{display:flex;flex-wrap:wrap;gap:8px}
.fav{display:inline-flex;align-items:center;gap:8px;background:var(--surface-2);border:1px solid var(--line);border-radius:9px;padding:6px 11px 6px 8px;cursor:pointer;font-weight:500}
.fav:hover{border-color:var(--accent)}
.fav svg{width:18px;height:18px;color:var(--accent)}
.fav.locked{opacity:.5}
.recent{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.recent li{display:flex;justify-content:space-between;gap:10px;padding:5px 0;border-bottom:1px solid var(--line);font-size:14.5px}
.recent li:last-child{border-bottom:0}
.recent button{background:none;border:0;padding:0;cursor:pointer;color:var(--fg);font-weight:500;text-align:left}
.recent button:hover{color:var(--accent);text-decoration:underline}
.recent span{color:var(--muted);font-size:13px;white-space:nowrap}
.empty-q{color:var(--muted);font-size:14px;margin:0}
.chips{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.chip{background:var(--surface);border:1px solid var(--line);border-radius:20px;padding:5px 12px;cursor:pointer;font-size:14px;font-weight:500;color:var(--fg)}
.chip[aria-pressed="true"]{background:var(--fg);color:var(--bg);border-color:var(--fg)}
.chip .n{font:500 11px var(--f-mono);opacity:.7;margin-left:4px}
.lockopt{display:inline-flex;gap:7px;align-items:center;font-size:14px;color:var(--muted);margin-left:auto;cursor:pointer}
.cats{display:flex;flex-direction:column;gap:22px}
.sec{display:flex;flex-direction:column;gap:10px}
.sec h3{display:flex;gap:8px;align-items:baseline;flex-wrap:wrap}
.sec h3 em{font-style:normal;text-transform:none;letter-spacing:0;font-family:var(--f-body);font-size:13.5px}
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,250px),1fr));gap:10px}
.tile{position:relative;display:grid;grid-template-columns:42px minmax(0,1fr);grid-template-rows:auto 1fr auto;gap:2px 12px;text-align:left;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:13px 13px 11px;cursor:pointer;color:var(--fg);min-height:118px;transition:border-color .15s,transform .15s}
.tile:hover{border-color:var(--accent);transform:translateY(-1px)}
.tile .ic{grid-row:1/3;width:42px;height:42px;border-radius:10px;display:grid;place-items:center;background:var(--surface-2);border:1px solid var(--line);color:var(--accent)}
.tile .ic svg{width:22px;height:22px}
.tile .nm{font-weight:700;font-size:16.5px;line-height:1.25;padding-right:26px}
.tile .ds{font-size:14px;color:var(--muted);line-height:1.35}
.tile .ft{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:8px;padding-top:8px;border-top:1px dashed var(--line)}
.lock{display:inline-flex;align-items:center;gap:4px;font:500 12px var(--f-mono);color:var(--muted);white-space:nowrap}
.lock svg{width:13px;height:13px}
.where{display:inline-flex;gap:4px;align-items:center;font:12px var(--f-mono);color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.where svg{width:12px;height:12px;flex:0 0 12px}
.star{position:absolute;top:8px;right:8px;width:30px;height:30px;border-radius:7px;border:0;background:none;cursor:pointer;color:var(--muted);display:grid;place-items:center}
.star:hover{background:var(--surface-2);color:var(--accent)}
.star[aria-pressed="true"]{color:var(--accent)}
.star[aria-pressed="true"] svg{fill:currentColor}
.star svg{width:18px;height:18px}
.tile.view .lock{color:var(--warn)}
.tile.no,.tile.planned{cursor:not-allowed}
.tile.no{opacity:.45;filter:grayscale(.8)}
.tile.no:hover,.tile.planned:hover{transform:none;border-color:var(--line)}
.tile.planned .ic{color:var(--muted)}
.tile .tag{font:500 11px var(--f-mono);color:var(--warn);background:var(--chip);border-radius:6px;padding:1px 6px;margin-left:6px;vertical-align:2px;white-space:nowrap}
.nores{padding:24px;text-align:center;color:var(--muted);background:var(--surface);border:1px dashed var(--line);border-radius:12px}

/* cards, the matrix, exceptions, the log */
.card{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:14px 16px;display:flex;flex-direction:column;gap:10px;min-width:0}
.card h1,.card h2{margin:0;font:600 20px var(--f-display);letter-spacing:.02em}
.card h1{font-size:24px}
.card p{margin:0;color:var(--muted);max-width:75ch}
.card.narrow{max-width:560px;margin:48px auto}
.legend{display:flex;flex-wrap:wrap;gap:12px;font-size:13.5px;color:var(--muted);align-items:center}
.legend .cell{cursor:default}
.mx-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:10px;background:var(--surface)}
table.mx{border-collapse:collapse;width:100%;min-width:820px;font-size:14px}
.mx th,.mx td{padding:6px 6px;border-bottom:1px solid var(--line);text-align:center}
.mx thead th{font-weight:700;font-size:12.5px;line-height:1.2;vertical-align:bottom;background:var(--surface-2);position:sticky;top:0}
.mx thead th small{display:block;font:500 11px var(--f-mono);color:var(--muted)}
.mx th.tn{text-align:left;font-weight:500;padding-left:12px;white-space:nowrap}
.mx th.tn .pill{margin-left:6px}
.mx tr.cat th{text-align:left;font:600 11.5px var(--f-mono);letter-spacing:.08em;text-transform:uppercase;color:var(--muted);background:var(--bg);padding:6px 12px}
.cell{min-width:58px;border-radius:6px;padding:4px 6px;font:600 12.5px var(--f-body);cursor:pointer;border:1px solid var(--line);background:none;color:var(--muted)}
.cell.use{background:var(--accent);border-color:var(--accent);color:var(--accent-fg)}
.cell.view{background:var(--accent-soft);border-color:var(--accent);color:var(--fg)}
.cell.dirty{box-shadow:0 0 0 2px var(--warn)}
.cell.owner{display:inline-block;cursor:default;background:var(--fg);color:var(--bg);border-color:var(--fg)}
.cell:disabled{cursor:not-allowed;opacity:.55}
.savebar{display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between}
.savebar .btns{display:flex;gap:8px;flex-wrap:wrap}
.pbtn{background:var(--accent);color:var(--accent-fg);border:1px solid var(--accent);border-radius:8px;padding:8px 16px;font-weight:700;cursor:pointer;text-decoration:none;display:inline-block}
.pbtn:hover{filter:brightness(1.08)}
.pbtn:disabled{opacity:.45;cursor:not-allowed;filter:none}
.gbtn{background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:7px 14px;font-weight:500;cursor:pointer;color:var(--fg)}
.gbtn:hover{border-color:var(--accent)}
.gbtn:disabled{opacity:.45;cursor:not-allowed}
.twocol{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:14px}
@media (max-width:860px){.twocol{grid-template-columns:minmax(0,1fr)}}
.exl{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.exl li{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 10px;padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:var(--surface-2)}
.exl li b{font-weight:700}
.exl li .d{grid-column:1;font-size:13.5px;color:var(--muted)}
.exl li .exrm{grid-row:1/3;grid-column:2;align-self:center}
.allow{color:var(--ok);font-weight:700}.deny{color:var(--bad);font-weight:700}
.exform{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,150px),1fr));gap:8px;align-items:end}
.exform label{display:flex;flex-direction:column;gap:3px;font-size:13px;color:var(--muted)}
.audit{list-style:none;margin:0;padding:0;font-size:13.5px;display:flex;flex-direction:column;gap:6px}
.audit li{display:flex;flex-direction:column;border-left:3px solid var(--line);padding-left:10px}
.audit li span{color:var(--muted);font:12px var(--f-mono)}
.locked-page{display:flex;gap:14px;align-items:flex-start}
.locked-page svg{flex:0 0 34px;width:34px;height:34px;color:var(--muted)}

/* the ticker */
.tk-form{display:flex;flex-direction:column;gap:10px}
.tk-form label{display:flex;flex-direction:column;gap:4px;font-size:14px;font-weight:500}
.tk-form textarea{min-height:110px;resize:vertical;font-size:16px;line-height:1.4}
.tk-meta{display:flex;justify-content:space-between;gap:10px;font-size:13px;color:var(--muted);flex-wrap:wrap}
.tk-meta .over{color:var(--bad);font-weight:700}
.tk-btns{display:flex;gap:8px;flex-wrap:wrap}
.tk-prev{position:relative;height:96px;border-radius:10px;overflow:hidden;border:1px solid var(--line);
  background:radial-gradient(ellipse at 30% 120%,#6a2c10 0,transparent 55%),radial-gradient(ellipse at 80% -20%,#3a2414 0,transparent 60%),linear-gradient(#1a0f09,#0d0806)}
.tk-prev .tf{position:absolute;left:5%;right:5%;top:50%;height:40px;margin-top:-20px;overflow:hidden;border-radius:3px;
  background:linear-gradient(#0e0907,#1b120c);border:2px solid #7a5a36;box-shadow:inset 0 0 0 1px #2a1c10,inset 0 2px 6px rgba(0,0,0,.7),0 0 0 1px #20150c}
.tk-prev .tf span{position:absolute;left:0;top:50%;transform:translate(0,-50%);white-space:nowrap;font:700 19px "IM Fell English",Georgia,serif;color:#ffe9a8;will-change:transform}
.who-edit{display:flex;gap:10px;align-items:flex-start;padding:10px 12px;border-radius:9px;background:var(--surface-2);border:1px solid var(--line);font-size:14.5px}
.who-edit svg{flex:0 0 18px;width:18px;height:18px;margin-top:2px;color:var(--accent)}
.linkish{background:none;border:0;padding:0;color:var(--accent);font-weight:700;cursor:pointer;text-decoration:underline;text-underline-offset:2px}
.hist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px;font-size:14px}
.hist li{padding:8px 10px;border-radius:8px;border:1px solid var(--line);background:var(--surface-2);overflow-wrap:anywhere}
.hist li span{display:block;font:12px var(--f-mono);color:var(--muted);margin-top:2px}
.hist li em{color:var(--muted)}
.live{display:flex;flex-direction:column;gap:6px;font-size:14px}
.live div{padding:6px 10px;border-radius:8px;border:1px dashed var(--line);overflow-wrap:anywhere}
.live b{font:500 12px var(--f-mono);color:var(--muted);display:block}

/* signing in */
.signin{display:flex;flex-direction:column;gap:12px;align-items:flex-start}
.signin form{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.signin input{width:12ch;font:500 20px var(--f-mono);letter-spacing:.2em;text-align:center}
.err{color:var(--bad);font-weight:700;margin:0}

.toasts{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(16px + env(safe-area-inset-bottom,0px));z-index:100;display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none;width:min(560px,calc(100% - 32px))}
.toast{background:var(--fg);color:var(--bg);padding:10px 16px;border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.3);font-size:15px;text-align:center;animation:tin .2s ease-out}
.toast.bad{background:var(--bad);color:#fff}
@keyframes tin{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@media (max-width:560px){
  .con-head{padding:10px 12px}
  .who{width:100%;justify-content:space-between}
  .con .search input{font-size:16px;padding-right:16px}
  .search kbd{display:none}
}
@media (prefers-reduced-motion:reduce){
  .con *,.toast{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}
}
body.plain{display:block}
