/* Pyreforge / Workbench
   Neutral surfaces carry information. Ember marks action and selection.
   Card art and mechanic colours provide the remaining visual variety. */
:root {
  --surface-canvas:#141619; --surface-base:#1b1e22; --surface-raised:#23272c;
  --surface-hover:#2b3036; --border-subtle:#343a41; --border-strong:#505963;
  --text-primary:#edf0f2; --text-secondary:#b5bdc6; --text-muted:#959fa9;
  --accent:#ee9a58; --accent-hover:#ffb475; --accent-soft:rgba(238,154,88,.12);
  --radius-control:5px; --radius-panel:8px;
  --elevation-overlay:0 12px 36px rgba(0,0,0,.4);
  --felt-hi:var(--surface-base); --felt:var(--surface-canvas); --felt-lo:var(--surface-canvas);
  --leather:var(--surface-canvas); --leather-2:var(--surface-base);
  --cream:var(--text-primary); --cream-dim:var(--text-secondary); --muted:var(--text-muted);
  --gold:var(--accent); --gold-hi:var(--accent-hover); --gold-dk:#b76c35;
  --line-soft:var(--border-subtle); --workspace-border:var(--border-subtle);
  --r-sm:4px; --r-md:5px; --r-lg:8px; --h-sm:30px; --h-md:34px;
  --noise:none; --ambient-effects:off; --card-shadow:0 2px 6px rgba(0,0,0,.28); --lift-shadow:0 4px 12px rgba(0,0,0,.3);
}
body { background:var(--surface-canvas); color:var(--text-primary); font-size:13px; }
header { background:var(--surface-base); border-bottom:1px solid var(--border-subtle); box-shadow:none; min-height:54px; }
header::after { display:none; }
header h1 { font-size:16px; text-shadow:none; color:var(--accent); }
header .steps { color:var(--text-muted); }
.steps span.on { background:transparent; color:var(--text-secondary); box-shadow:none; font-weight:500; }
input, select, textarea, button { border-color:var(--border-subtle); border-radius:var(--radius-control); background:var(--surface-raised); box-shadow:none; }
input, textarea { background:var(--surface-canvas); }
input::placeholder, textarea::placeholder { color:var(--text-muted); opacity:1; }
button:hover { background:var(--surface-hover); border-color:var(--border-strong); }
button.primary, button.primary:hover { background:var(--accent); border-color:var(--accent); color:#1c1712; box-shadow:none; filter:none; }
button.primary:hover { background:var(--accent-hover); }
input:focus, select:focus, textarea:focus { border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-soft); }
.modeSwitch { border-color:var(--border-subtle); background:var(--surface-canvas); border-radius:6px; }
.modeSwitch button { border-radius:4px; }
.modeSwitch button.on { background:var(--surface-hover); color:var(--text-primary); }
.felt { background:var(--surface-canvas); box-shadow:none; }
.sparks { display:none; }
#treeArea { background-color:var(--surface-canvas); background-image:radial-gradient(#33383e .7px,transparent .7px); background-size:24px 24px; }
.workbenchHeading { flex:0 0 auto; display:flex; align-items:center; gap:16px; padding:14px 18px 10px; background:var(--surface-canvas); }
.workbenchHeading h2 { font:600 13px Inter,system-ui,sans-serif; margin:0; letter-spacing:0; }
.workbenchHeading p { margin:0; color:var(--text-muted); font-size:12px; }
.workbenchHeading .workspaceLegend { margin-left:auto; display:flex; gap:12px; white-space:nowrap; }
.workspaceLegend span { display:inline-flex; align-items:center; gap:5px; font-size:11px; color:var(--text-secondary); }
.workspaceLegend span::before { content:''; width:6px; height:6px; border:1px solid var(--text-muted); border-radius:2px; }
.workspaceLegend span:last-child::before { border-color:var(--good); background:var(--good); }
#treeBar { width:100%; margin:0; padding:8px 16px; border:0; border-bottom:1px solid var(--border-subtle); border-radius:0; background:var(--surface-base); gap:6px; }
#treeBar button { min-height:30px; background:transparent; border-color:transparent; color:var(--text-secondary); }
#treeBar button:hover { background:var(--surface-hover); color:var(--text-primary); }
#treeBar button.on { background:var(--accent-soft); color:var(--accent-hover); }
#treeBar #viewToggle { border-color:var(--border-subtle); background:var(--surface-raised); color:var(--text-primary); }
#treeBar .sep { background:var(--border-subtle); }
#treeQ { border-color:var(--border-subtle); }
#treeGuide { position:relative; top:auto; left:auto; transform:none; align-self:stretch; margin:0; padding:8px 18px; border:0; border-bottom:1px solid var(--border-subtle); border-radius:0; box-shadow:none; background:var(--surface-base); color:var(--text-secondary); font-size:12px; }
#treeGuide button { min-height:26px; font-size:12px; box-shadow:none; }
.tree { --line:var(--border-strong); filter:none; }
.tree.ltr ul::before, .tree.ttb ul::before { border-color:var(--border-strong); }
.tree .node, .tree .node.tag, .tree .node.card, .tree .node.root { background:var(--surface-base); border:1px solid var(--border-subtle); border-radius:var(--radius-panel); box-shadow:0 2px 4px rgba(0,0,0,.15); text-shadow:none; }
.tree .node.tag { border-left:3px solid var(--cat,var(--border-strong)); padding:12px 16px; }
.tree .node.root { border-top:3px solid var(--accent); padding:16px; }
.tree .node.card { border-left:3px solid var(--text-secondary); }
.tree .node.root img { transform:none; }
.tree .node.root .lbl { color:var(--text-primary); font-size:17px; }
.tree .node .kind { font-size:11px; font-weight:500; margin-bottom:4px; }
.tree .node .why { font-size:12px; color:var(--text-secondary); line-height:1.5; }
.tree .node:hover { background:var(--surface-raised); box-shadow:none; border-top-color:var(--border-strong); border-right-color:var(--border-strong); border-bottom-color:var(--border-strong); }
.tree .node.tag.open, .tree .node:focus-within { border-color:var(--accent); background:var(--surface-raised); box-shadow:0 0 0 1px var(--accent-soft); }
.tree .node.tag.unforged, .tree .node.tag.unforged:hover { background:var(--surface-base) !important; box-shadow:none !important; border:1px solid var(--border-subtle) !important; border-left:3px solid var(--cold) !important; }
.tree .node.tag.unforged .kind::after { content:' · Suggested role'; }
.tree .node.hit.cur { outline:2px solid var(--accent); outline-offset:3px; }
.node .tools { top:-14px; }
.node .tools button { border-radius:5px; background:var(--surface-raised); border-color:var(--border-strong); box-shadow:none; }
.node .tools button:hover { background:var(--surface-hover); color:var(--accent-hover); }
.chip { background:var(--surface-raised); border-color:var(--border-subtle); color:var(--text-secondary); }
.mini, .rec { --r:0deg !important; }
.mini.in .add, .rec.in .add { box-shadow:none; }
.mini.in, .rec.in { box-shadow:0 0 0 2px var(--good); }
.tree .node.hit { box-shadow:0 0 0 2px var(--accent) !important; }
#minimap { background:var(--surface-base); border-color:var(--border-strong); border-radius:6px; box-shadow:none; }
#focusBanner { background:var(--surface-raised); border-color:var(--border-strong); border-radius:6px; box-shadow:var(--elevation-overlay); }
aside { background:var(--surface-base); border-left:1px solid var(--border-subtle); box-shadow:none; }
#deckTop { background:var(--surface-base); border-bottom:1px solid var(--border-subtle); padding:14px 16px; gap:10px; box-shadow:none; }
.nameRow #deckName { font-family:Inter,system-ui,sans-serif; color:var(--text-primary); font-size:15px; letter-spacing:0; padding-left:0; }
#saveStatus { font-size:11px; }
.nameRow button.icon { width:28px; min-height:28px; background:transparent; }
.countRow #count { font-size:22px; }
#bar { height:4px; background:var(--surface-hover); border:0; box-shadow:none; border-radius:2px; }
#bar > div { background:var(--accent); box-shadow:none; }
#health .hchip.neutral { padding-left:0; }
#optBtn { background:transparent; border-color:var(--border-subtle); justify-content:flex-start; color:var(--text-secondary); }
#optBtn:hover { background:var(--surface-hover); color:var(--text-primary); }
#qaRow { padding:12px 16px 6px; }
#deckTabs { padding:8px 16px 0; gap:8px 12px; border-color:var(--border-subtle); }
.toolGroupLabel { text-transform:uppercase; letter-spacing:.08em; font-size:10px; color:var(--text-muted); }
#deckTabs button { border-color:transparent; border-radius:4px 4px 0 0; color:var(--text-secondary); }
#deckTabs button.on { background:var(--accent-soft); color:var(--accent-hover); border-color:transparent; box-shadow:inset 0 -2px var(--accent); }
.pane, #tableView { background:var(--surface-base); }
#deckList h3, .sec { border-color:var(--border-subtle); color:var(--text-secondary); }
.line { min-height:32px; font-size:13px; border-radius:4px; }
.line:hover { background:var(--surface-hover); }
.line .mc { color:var(--text-secondary); }
.kpi, .combo, .cut, .warn, .verRow, .upRow { background:var(--surface-raised); border-color:var(--border-subtle); box-shadow:none; }
.kpi .v { font-size:21px; color:var(--text-primary); }
.menu, #qaList, dialog, #pop { background:var(--surface-raised); border:1px solid var(--border-strong); border-radius:var(--radius-panel); box-shadow:var(--elevation-overlay); }
.menu { padding:6px; }
.menu button { background:transparent; }
.menu button:hover { background:var(--surface-hover); }
#pop .nm, .hero h2, .gTitle { font-family:Inter,system-ui,sans-serif; color:var(--text-primary); letter-spacing:-.025em; }
#pop .ot { background:var(--surface-base); border-color:var(--border-subtle); }
dialog::backdrop { background:rgba(5,8,12,.65); backdrop-filter:blur(3px); }
table.tv th, .tvTop, .tvInfoRow { background:var(--surface-base); border-color:var(--border-subtle); }
table.tv td { border-color:var(--border-subtle); }
table.tv tr:hover td { background:var(--surface-hover); }
.homeWrap { padding-top:48px; }
.hero h2 { font-size:32px; font-weight:600; }
.hero p { color:var(--text-secondary); }
.door, .gOpt, .plaque { background:var(--surface-base); border:1px solid var(--border-subtle); box-shadow:none; border-radius:8px; }
.door:hover, .gOpt:hover { background:var(--surface-raised); box-shadow:none; border-color:var(--border-strong); }
.door.main { border-color:var(--accent); background:var(--surface-base); box-shadow:none; }
.minorLinks button, .dataBar button { border-color:var(--border-subtle); }
.deckCard { border-color:var(--border-subtle); box-shadow:none; }
.deckCard:hover { border-color:var(--accent); box-shadow:none; }
.dataBar { color:var(--text-muted); }
@media(max-width:1100px) { .workbenchHeading p { display:none; } }
@media(max-width:600px) { .workbenchHeading { flex-wrap:wrap; gap:8px; padding:12px; } .workbenchHeading .workspaceLegend { margin-left:0; } header { padding:8px 12px; } }
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { scroll-behavior:auto !important; animation:none !important; transition:none !important; } }

/* Blackened iron forge: retain the workbench geometry, restore material and warmth. */
:root {
  --surface-canvas:#100e0d; --surface-base:#1c1a18; --surface-raised:#27231f;
  --surface-hover:#332b24; --border-subtle:#41362c; --border-strong:#6b5140;
  --text-primary:#f2e8da; --text-secondary:#c7b7a4; --text-muted:#a89886;
  --accent:#e98a42; --accent-hover:#ffbf7b; --accent-soft:rgba(233,138,66,.13);
  --iron-grain:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.045' filter='url(%23g)'/%3E%3C/svg%3E");
}
header {
  background:var(--iron-grain),linear-gradient(180deg,#302923,#1b1714 80%);
  border-bottom:1px solid #795033;
  box-shadow:0 1px 0 #090807,0 3px 14px rgba(0,0,0,.35);
}
header h1 { color:#ffc488; text-shadow:0 1px 1px #000,0 0 16px rgba(233,138,66,.18); }
header h1 .ti { color:var(--accent); }
#treeArea {
  background-image:var(--iron-grain),radial-gradient(ellipse at 45% 90%,rgba(136,56,18,.2),transparent 65%),linear-gradient(135deg,#1b1714,#100e0d 60%);
  background-size:auto,auto,auto;
  box-shadow:inset 0 0 70px rgba(0,0,0,.4);
}
.workbenchHeading { background:linear-gradient(90deg,#211b16,#171310); border-top:1px solid rgba(255,190,120,.06); }
.workbenchHeading h2 { color:var(--accent-hover); font-family:Cinzel,Georgia,serif; font-size:12px; letter-spacing:.04em; }
#treeBar { background:var(--iron-grain),linear-gradient(#29231e,#211c18); border-bottom:1px solid #4a3525; box-shadow:0 2px 5px rgba(0,0,0,.2); }
#treeGuide { background:#1b1713; border-bottom-color:#32271e; }
aside { background:var(--iron-grain),#1c1916; border-left:1px solid #705039; box-shadow:-4px 0 16px rgba(0,0,0,.25); }
#deckTop { background:var(--iron-grain),linear-gradient(140deg,#2b231c,#1b1713); border-bottom:1px solid #4c3728; }
.pane, #tableView { background:#1b1815; }
.tree .node, .tree .node.tag, .tree .node.card {
  background:var(--iron-grain),linear-gradient(145deg,#2a2520,#1d1916);
  border-top-color:#564335; border-right-color:#463529; border-bottom-color:#37291f;
  box-shadow:inset 0 1px 0 rgba(255,220,175,.05),0 3px 8px rgba(0,0,0,.35);
}
.tree .node.root { background:var(--iron-grain),linear-gradient(135deg,#38291d,#201914); border-color:#8c5833; border-top:3px solid var(--accent); box-shadow:0 3px 16px rgba(0,0,0,.45),0 0 24px rgba(205,91,25,.08); }
.tree .node:hover { background:var(--iron-grain),linear-gradient(145deg,#352b22,#241d17); border-right-color:#896044; border-top-color:#896044; }
.tree .node.tag.open, .tree .node:focus-within { background:var(--iron-grain),linear-gradient(145deg,#35271d,#211a14); border-color:var(--accent); box-shadow:0 0 0 1px rgba(233,138,66,.12),0 3px 12px rgba(0,0,0,.4); }
.tree { --line:#70513b; }
.tree.ltr ul::before, .tree.ttb ul::before { border-color:#70513b; }
button { background:linear-gradient(#302820,#241e19); box-shadow:inset 0 1px 0 rgba(255,220,175,.04); }
button.primary { background:linear-gradient(#ffb46c,#df782f); border-color:#ba632b; box-shadow:inset 0 1px rgba(255,225,180,.4),0 2px 5px rgba(0,0,0,.3); }
#bar > div { background:linear-gradient(90deg,#8f4624,#ee934e); }
#minimap { background:var(--iron-grain),#1c1713; border-color:#775033; }
.felt { background:var(--iron-grain),radial-gradient(ellipse at 50% 80%,#302015,#100e0c 75%); }
.hero h2 { font-family:Cinzel,Georgia,serif; color:#f5c18b; font-size:32px; }
.door, .gOpt, .plaque { background:var(--iron-grain),linear-gradient(140deg,#30261d,#1b1713); border-color:#5b402c; }
.door.main { background:var(--iron-grain),linear-gradient(140deg,#3c2919,#211910); }
.menu, #qaList, dialog, #pop { background:var(--iron-grain),linear-gradient(145deg,#30271f,#211a15); border-color:#785337; }
.kpi, .combo, .cut, .verRow { background:linear-gradient(140deg,#2c241d,#231d18); }

/* Four readable card columns plus gutters for the overhanging add controls. */
.tree .node.tag.open { width:410px; max-width:410px; }
.tree .node > .grid {
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:16px 10px;
  margin:18px 8px 10px;
}
.tree .grid .mini { min-width:0; }
.tree .grid .mini img { max-width:100%; }

/* Opening-hand table: native dialog provides focus containment and Escape. */
#handDlg { width:min(1380px,96vw); max-width:96vw; max-height:92vh; padding:0; overflow:auto; }
.handHeader { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:20px 24px 12px; }
.handEyebrow { color:var(--accent); font-size:11px; text-transform:uppercase; letter-spacing:.1em; margin-bottom:6px; }
#handTitle { font-family:Cinzel,Georgia,serif; color:var(--accent-hover); margin:0; }
#handSummary { margin:0; padding:0 24px 16px; color:var(--text-secondary); font-size:13px; }
.handTable { overflow:auto; background:var(--iron-grain),radial-gradient(ellipse at 50% 70%,#392718,#100e0c 85%); border-block:1px solid var(--border-subtle); }
#handSpread { display:flex; justify-content:center; align-items:flex-start; gap:12px; padding:48px 30px 56px; min-width:min-content; min-height:320px; }
.spreadCard { position:relative; flex:0 0 clamp(130px,11vw,180px); width:clamp(130px,11vw,180px); transform:translateY(var(--fan-drop)) rotate(var(--fan-angle)); transition:transform .18s ease; outline-offset:5px; }
.spreadCard img, .handPlaceholder { width:100%; aspect-ratio:488 / 680; display:block; border-radius:8px; box-shadow:0 8px 18px rgba(0,0,0,.55); }
.handPlaceholder { padding:12px; background:var(--surface-raised); overflow:auto; }
.handPlaceholder p { font-size:12px; }
.spreadCard > span { display:block; text-align:center; color:var(--text-secondary); font-size:11px; margin-top:12px; line-height:1.4; }
.spreadCard:hover, .spreadCard:focus-visible { transform:translateY(-14px) rotate(0) scale(1.1); z-index:2; }
.handFooter { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:16px 24px; }
.handFooter > div { display:flex; gap:8px; flex-wrap:wrap; }
#handDlg[open] { animation:hand-arrive 240ms ease-out; }
#handDlg[open]::backdrop { animation:hand-dim 240ms ease-out; }
.spreadCard.dealing { animation:hand-deal 560ms cubic-bezier(.2,.75,.2,1) var(--deal-delay,0ms) backwards; }
.spreadCard { transition:transform 220ms cubic-bezier(.2,.75,.2,1); }
@keyframes hand-arrive { from { opacity:0; translate:0 18px; } to { opacity:1; translate:0 0; } }
@keyframes hand-dim { from { opacity:0; } to { opacity:1; } }
@keyframes hand-deal {
  from { opacity:0; translate:70px 90px; rotate:12deg; scale:.85; }
  70% { opacity:1; translate:-3px -6px; rotate:-1deg; scale:1.015; }
  to { opacity:1; translate:0 0; rotate:0deg; scale:1; }
}
@media(max-width:700px) { .handHeader { padding:16px; } #handSummary { padding-inline:16px; } #handSpread { justify-content:flex-start; } .handFooter { align-items:flex-start; flex-direction:column; padding:16px; } }
