/* Terminal skin. The old GM brief's look (monospace type, phosphor glow, prompts, dashed rules, faint scanlines,
   a blinking block cursor) applied to the whole UI in the current theme's colours. Loaded last. Card faces keep
   their own type so card text stays readable. */
:root{
  --term-font:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",monospace;
  --card-font:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  --glow:color-mix(in srgb,var(--cyan) 45%,transparent);
  --glow-soft:color-mix(in srgb,var(--cyan) 22%,transparent);
  --scan:repeating-linear-gradient(180deg,color-mix(in srgb,var(--cyan) 5%,transparent) 0 1px,transparent 1px 3px);
  --term-radius:.2rem;
}
:root[data-theme=verdant],:root[data-theme=redline]{--card-font:var(--term-font)}
body{font-family:var(--term-font)}
.card,.hover-preview,.hover-fallback,.catalogue-cards,.sheet-editor .sheet-preview{font-family:var(--card-font)}

/* Prompt-style headings with a phosphor glow. */
h1,h2,h3,.eyebrow{text-shadow:0 0 6px var(--glow-soft)}
.panel-heading h2::before,.profile-toolbar h2::before,.run-connection h2::before,.run-map-head h3::before,.run-panel>h3::before,
.nb-builder-head h2::before,.tracker-heading h3::before,.token-dropper h3::before,.room-preview h3::before,.run-room h3::before,
#netarch-panel .session-side>h3::before{content:"> ";color:var(--accent);text-shadow:none}
.eyebrow::before{content:"// ";opacity:.7}
.masthead h1::after,.room-preview h3::after{content:"\2588";margin-left:.12em;color:var(--cyan);animation:term-cursor 1.1s steps(1) infinite}
@keyframes term-cursor{50%{opacity:0}}

/* Panels: squared, ruled with faint scanlines. */
.panel{border-radius:var(--term-radius);background-image:var(--scan)}
.masthead{background-image:var(--scan),linear-gradient(110deg,var(--header-start),var(--header-end) 70%)}
dialog{border-radius:var(--term-radius)}

/* Controls: square keys; outlined keys read as [ bracketed ] commands. */
button,.import-label{border-radius:.15rem;letter-spacing:.03em}
button.secondary:not(.card-icon-button){color:var(--cyan);border-color:color-mix(in srgb,var(--cyan) 45%,var(--line))}
button.secondary:not(.card-icon-button)::before{content:"[ ";opacity:.6}
button.secondary:not(.card-icon-button)::after{content:" ]";opacity:.6}
button.secondary:not(:disabled):hover,button:not(.secondary):not(.quiet):not(:disabled):hover{box-shadow:0 0 0 1px var(--cyan),0 0 10px var(--glow);filter:none}
button.quiet{text-decoration:none;color:var(--muted)}
button.quiet::before{content:"$ ";color:var(--accent)}
button.quiet:not(:disabled):hover{color:var(--cyan);text-shadow:0 0 6px var(--glow)}
input,select,textarea{border-radius:.15rem;caret-color:var(--cyan)}
input:focus,select:focus,textarea:focus{border-color:var(--cyan);box-shadow:0 0 8px var(--glow-soft)}

/* Tabs: a row of terminal sessions; the open one is lit. */
.tabs button{border-radius:.15rem .15rem 0 0;background:transparent;border-bottom:2px dashed var(--line);color:var(--muted)}
.tabs button[aria-selected=true]{background:color-mix(in srgb,var(--cyan) 8%,transparent);border-bottom:2px solid var(--cyan);color:var(--cyan);text-shadow:0 0 6px var(--glow)}
.tabs button[aria-selected=true]::before{content:"> ";color:var(--accent)}

/* Trackers read like a status line. */
.track{border-radius:var(--term-radius)}
.track strong{color:var(--cyan);text-shadow:0 0 8px var(--glow)}

/* Run tab: the play field is the screen. */
#netarch-panel .session-board{border:1px solid color-mix(in srgb,var(--cyan) 35%,var(--line));border-radius:.3rem;padding:.5rem .6rem;
  background:var(--scan),radial-gradient(ellipse at 50% 40%,color-mix(in srgb,var(--cyan) 6%,transparent),transparent 70%),var(--field);
  box-shadow:inset 0 0 40px rgba(0,0,0,.55),0 0 14px var(--glow-soft)}
#netarch-panel .session-side>h3{text-shadow:0 0 8px currentColor}
.run-splash{border:1px solid color-mix(in srgb,var(--cyan) 35%,var(--line));border-radius:.3rem;background:var(--scan),var(--field);box-shadow:inset 0 0 40px rgba(0,0,0,.55)}
.run-splash-hint::after{content:"\2588";margin-left:.15em;color:var(--cyan);animation:term-cursor 1.1s steps(1) infinite}
.run-connection,.run-map{border-radius:var(--term-radius);background-image:var(--scan)}

/* Room preview, tiles and the room's button container. */
.room-preview{border-radius:var(--term-radius);background:var(--scan),color-mix(in srgb,var(--field) 90%,transparent)}
.room-preview h3,.run-room h3{color:var(--cyan);text-shadow:0 0 8px var(--glow)}
.room-tile{border-radius:.15rem;background:transparent}
.room-tile.cleared{border-style:dashed}
.run-room{border-radius:var(--term-radius)}
.run-room .run-guard{list-style:none;padding-left:0}
.run-room .run-guard li::before{content:"- ";color:var(--accent)}
.run-room-actions,.run-room .run-abilities{padding-top:.4rem;border-top:1px dashed var(--line)}
.run-content{border-left-style:dashed}

/* Map: floors as terminal blocks; badges as [bracketed] flags. */
.run-floor{border-radius:.15rem;background:var(--scan),var(--field)}
.run-floor.here{box-shadow:0 0 0 1px var(--cyan),0 0 14px var(--glow)}
.run-floor strong{text-shadow:0 0 6px var(--glow-soft)}
.run-badge{border:0;border-radius:0;padding:0}
.run-badge::before{content:"[";opacity:.7}.run-badge::after{content:"]";opacity:.7}
.run-icon{border-radius:.1rem}

/* Actor list and run log: terminal output. */
.run-actor{border-radius:.15rem}
.run-actor.current{box-shadow:inset 3px 0 0 var(--cyan),0 0 10px var(--glow-soft)}
.run-log{list-style:none;padding-left:0}
.run-log li::before{content:"$ ";color:var(--accent)}
.run-log li:first-child{color:var(--text);text-shadow:0 0 6px var(--glow-soft)}

/* Errors print as terminal faults. */
.netarch-toast{font-family:var(--term-font);border-radius:var(--term-radius)}
.netarch-toast::before{content:"ERR> ";font-weight:800}

/* Profile buttons: New blank and Duplicate share one row (no brackets, to fit the sidebar); Delete sits below. */
.profile-buttons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.4rem}
.profile-buttons button{width:100%;min-width:0;margin:0;padding:.4rem .3rem;font-size:.72rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.profile-buttons button.secondary::before,.profile-buttons button.secondary::after{content:none}
.profile-buttons button.quiet{grid-column:1/-1;justify-self:start;width:auto}
/* Phones: no room for the tab prompt. */
@media(max-width:720px){.tabs button[aria-selected=true]::before{content:none}
/* Five tabs share a phone's width: tighter type and padding so none of them pushes the page sideways. */
.tabs{gap:.15rem}.tabs button{flex:1 1 auto;min-width:0;padding:.3rem .2rem;font-size:.68rem;letter-spacing:0}}
@media(prefers-reduced-motion:reduce){.masthead h1::after,.room-preview h3::after,.run-splash-hint::after{animation:none}}

/* Runner profiles use the build sidebar and the shared character-sheet controls. */
#runner-toolbar{display:none;gap:.6rem;margin:0 0 1rem;padding:0;border:0;background:none}
body[data-tab=runner] #runner-toolbar{display:grid}
body[data-tab=runner] #catalogue-drop>:not(#runner-toolbar){display:none!important}
body[data-tab=runner] .instruction{display:none}
.runner-section{padding:1rem;margin-bottom:.8rem;min-width:0}
.runner-section>h2{font-size:1.1rem;color:var(--cyan)}
.runner-section>h2::before{content:"> ";color:var(--accent)}
.runner-sheet-form{max-width:100%;min-width:0}
.runner-sheet-form .sheet-block{border-radius:var(--term-radius)}
.runner-sheet-form .sheet-vital-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
.runner-sheet-form>.sheet-field.wide{grid-column:auto}
.runner-sheet-form textarea{width:100%;font:inherit}
dialog:has(.runner-sheet-form){width:min(96vw,850px)}
.runner-portrait{width:120px;max-height:170px;object-fit:cover;border:1px solid var(--line);grid-row:span 3}
/* Identity: the portrait sits right of the two input rows and spans both (it never sets their height). */
.runner-sheet-form .runner-identity{grid-template-columns:repeat(3,minmax(0,1fr)) 7.5rem}
.runner-sheet-form .runner-identity:has(>.runner-portrait[hidden]){grid-template-columns:repeat(3,minmax(0,1fr))}
.runner-sheet-form .runner-identity>.runner-portrait{grid-column:4;grid-row:1/span 2;align-self:stretch;width:100%;height:0;min-height:100%;max-height:none}
@media(max-width:760px){.runner-sheet-form .runner-identity{grid-template-columns:repeat(2,minmax(0,1fr)) 5.5rem}.runner-sheet-form .runner-identity>.runner-portrait{grid-column:3}}
.runner-skills{width:100%;border-collapse:collapse;font-size:.8rem}
.runner-skills th{text-align:left;color:var(--muted)}
.runner-skills td{padding:.3rem .2rem;border-bottom:1px dashed var(--line)}
.runner-skills input,.runner-skills select{width:100%;min-width:0}
.runner-skills td:first-child{width:40%}
.runner-skill-base{color:var(--cyan);font-weight:800}
.runner-wallet-controls{display:flex;flex-wrap:wrap;align-items:end;gap:.5rem}
#runner-eb-balance{color:var(--cyan);font-size:1.2rem;margin-right:1rem}
.runner-ledger{max-height:16rem;overflow:auto;font-size:.8rem;padding-left:1.5rem}
.runner-ledger li{margin:.4rem 0}
.runner-inventory-row{display:flex;flex-wrap:wrap;align-items:center;gap:.6rem;padding:.7rem 0;border-top:1px dashed var(--line)}
.runner-inventory-row input[type=number]{max-width:5rem}
.runner-inventory-row textarea{width:100%;min-width:10rem}
.shop-header,.shop-controls,.shop-custom-form{display:flex;flex-wrap:wrap;align-items:end;gap:.7rem;margin-bottom:1rem}
#shop-balance{width:100%;color:var(--cyan);font-size:1.1rem}
.shop-header .sheet-field,.shop-controls .sheet-field,.shop-custom-form .sheet-field{min-width:0;max-width:100%}
.shop-header input[type=file]{max-width:100%;font:inherit}
#shop input[type=checkbox]{width:auto;min-height:0;justify-self:start}
.shop-pack-list{width:100%;padding:0;list-style:none;margin:0}
.shop-pack-row,.runner-owned-card-row{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;padding:.5rem 0;border-bottom:1px dashed var(--line)}
/* Shop results tile three to a row (two on phones). */
.shop-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.8rem;margin:.6rem 0}
@media(max-width:560px){.shop-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
.shop-row.shop-tile{display:flex;flex-direction:column;gap:.35rem;min-width:0;padding:.7rem;border:1px solid var(--line);border-radius:var(--term-radius);background:color-mix(in srgb,var(--field) 88%,transparent);overflow-wrap:anywhere}
.shop-row.shop-tile p{margin:0;font-size:.78rem;white-space:normal}
.shop-tile h4{font-size:.95rem}
.shop-tile-price strong{color:var(--text)}
.shop-tile-price span,.shop-tile-source,.shop-tile-owned{color:var(--muted);font-size:.72rem}
.shop-tile-notes{color:var(--muted);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.shop-tile-foot{margin-top:auto;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.4rem;padding-top:.45rem;border-top:1px dashed var(--line)}
.shop-tile .shop-tile-foot button{margin:0}
.shop-tile-actions{display:flex;flex-wrap:wrap;gap:.35rem}
/* RED gear: each item type has its own colour band, icon and label. */
.shop-red-tile{--cat:#9aa5b1;border-top:3px solid var(--cat)!important;background:linear-gradient(180deg,color-mix(in srgb,var(--cat) 14%,transparent),transparent 5rem),color-mix(in srgb,var(--field) 88%,transparent)!important}
.shop-red-tile[data-category=weapon]{--cat:#ff5c7a}
.shop-red-tile[data-category=armor]{--cat:#8fb0d8}
.shop-red-tile[data-category=cyberware]{--cat:#d77bff}
.shop-red-tile[data-category=gear]{--cat:#5fd4e8}
.shop-red-tile[data-category=cyberdeck]{--cat:#4ee08a}
.shop-red-tile[data-category=deck-hardware]{--cat:#2fc4a8}
.shop-red-tile[data-category=program]{--cat:#7aa2ff}
.shop-red-tile[data-category=vehicle]{--cat:#ffb347}
.shop-red-tile[data-category=drug]{--cat:#c5e85a}
.shop-red-tile h4::before{color:var(--cat)}
.shop-tile-type{display:flex;align-items:center;gap:.45rem;color:var(--cat);font-size:.68rem!important;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
.shop-tile-icon{display:inline-grid;place-items:center;flex:none;width:1.9rem;height:1.9rem;border:1px solid var(--cat);border-radius:var(--term-radius);background:color-mix(in srgb,var(--cat) 12%,transparent)}
.shop-tile-icon svg{width:1.15rem;height:1.15rem}
/* TCG cards: the card face leads the tile; hover magnifies, click opens Inspect. */
.shop-row .shop-card-face{display:block;width:100%;max-width:210px;margin:0 auto .35rem;padding:0;border:0;border-radius:.45rem;background:var(--image-bg);aspect-ratio:63/88;overflow:hidden;cursor:zoom-in;min-height:0;box-shadow:none}
.shop-card-face:hover,.shop-card-face:focus-visible{box-shadow:0 0 0 1px var(--cyan),0 0 12px var(--glow)}
.shop-card-face img,.shop-card-face>*{display:block;width:100%;height:100%;object-fit:cover}
.shop-card-fallback{display:flex!important;flex-direction:column;justify-content:space-between;padding:.8rem;text-align:left;background:linear-gradient(140deg,var(--face-a),var(--face-b));color:var(--text)}
.shop-tile-type-line{color:var(--muted)}
.shop-row h4{margin:0;color:var(--cyan)}
.shop-row h4::before{content:"> ";color:var(--accent)}
.shop-row p{margin:.4rem 0;font-size:.85rem;white-space:pre-wrap}
.shop-row button{margin:.25rem .4rem .25rem 0}
.shop-item-detail{color:var(--muted)}
.shop-price-editor:not([hidden]){display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;margin:.5rem 0}
.shop-price-input{max-width:12rem}
.shop-custom{border-top:1px dashed var(--line);padding-top:1rem;margin-top:1rem}
.shop-custom summary{color:var(--cyan);cursor:pointer;margin-bottom:.7rem}
.shop-custom-form textarea{font:inherit;max-width:100%}
.runner-owned-card-list{list-style:none;padding:0}
@media(max-width:720px){.runner-section{padding:.6rem}.runner-skills{font-size:.7rem}.runner-skills button{font-size:.65rem;padding:.3rem}.runner-skills input,.runner-skills select{padding:.3rem}.runner-portrait{width:80px}}
body[data-tab=rig] #catalogue-drop>:not(#rig-toolbar){display:none!important}
/* A slim card-height strip where the next card lands; the empty single-card Cyberdeck slot shows a full ghost card. */
.add-card-slot{width:max(4.5rem,calc(var(--mat-card-w) * .4));height:var(--mat-card-h);max-width:100%;flex:0 0 auto;display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:.4rem;padding:.4rem;border:1px dashed var(--cyan);background:transparent;color:var(--cyan);font:inherit;font-size:.75rem;letter-spacing:.04em;line-height:1.2;text-align:center;border-radius:0}
.add-card-plus{font-size:1.6rem;line-height:1}
.single-slot .add-card-slot{width:var(--mat-card-w)}
.add-card-slot:hover,.add-card-slot:focus-visible{border-color:var(--accent);color:var(--accent);background:var(--panel)}
.rig-picker-entry{border-top:1px dashed var(--line);padding:.8rem 0;overflow-wrap:anywhere}
.rig-picker-entry strong{color:var(--cyan)}
.rig-picker-entry p{margin:.35rem 0}
.rig-picker-add{margin-left:.7rem}
.rig-picker-reason,.rig-unowned-hint{white-space:normal}
.rig-slot-use{color:var(--cyan);white-space:nowrap}
#rig-panel [data-zone=console] .zone-head{flex-wrap:wrap}
@media print{.add-card-slot{display:none}}
