/* Steam & Spark - full-window app. Canvas fills the viewport; HUD floats on top. */
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: #000; }
body.ss-app {
  color: #e8ffe8; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  position: fixed; inset: 0;
}
.ss-canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; cursor: crosshair; }
.ss-top, .ss-bottom, .ss-msg { position: fixed; left: 0; right: 0; pointer-events: none; z-index: 10; }
.ss-top { top: 0; display: flex; align-items: flex-start; gap: 6px; padding: calc(6px + env(safe-area-inset-top)) calc(6px + env(safe-area-inset-right)) 0 calc(6px + env(safe-area-inset-left)); }
.ss-chips { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 4px; }
.ss-chip { pointer-events: auto; background: rgba(4, 20, 10, 0.78); border: 1px solid rgba(57, 255, 90, 0.4); border-radius: 8px; padding: 2px 7px; font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; backdrop-filter: blur(3px); }
.ss-chip b { color: #b8ffb8; }
.ss-chip--bad { border-color: #ff5a5a; color: #ffb0b0; background: rgba(60, 0, 0, 0.8); }
.ss-topbtns { display: flex; gap: 5px; pointer-events: auto; flex: 0 0 auto; }
.ss-btn {
  pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; padding: 4px 10px;
  border: 1.5px solid #39ff5a; border-radius: 10px; background: rgba(10, 40, 18, 0.88); color: #f0fff0; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
}
.ss-btn:hover, .ss-btn:focus-visible { background: #39ff5a; color: #001408; outline: none; }
.ss-btn:disabled { opacity: 0.45; cursor: not-allowed; background: rgba(8, 8, 8, 0.85); color: #9a9; }
.ss-round { width: 40px; padding: 0; font-size: 18px; }
.ss-btn--sm { min-height: 34px; padding: 2px 8px; font-size: 12px; border-radius: 8px; }
.ss-msg { top: calc(56px + env(safe-area-inset-top)); display: flex; justify-content: center; padding: 0 10px; }
.ss-msg:not([hidden]) { display: flex; }
.ss-msg { color: #ffe566; font-weight: 700; font-size: 13.5px; text-align: center; text-shadow: 0 1px 3px #000; }
.ss-msg[hidden] { display: none; }
.ss-bottom { bottom: 0; padding: 0 calc(6px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left)); }
.ss-bottom { z-index: 26; }
.ss-tools { pointer-events: auto; display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; padding-top: 4px; touch-action: pan-x; }
.ss-tools::-webkit-scrollbar { display: none; }
.ss-tool {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; min-height: 46px; padding: 3px 9px; text-align: left;
  border: 1.5px solid #39ff5a; border-radius: 12px; background: rgba(10, 40, 18, 0.88); color: #f0fff0; font: inherit; font-weight: 700; font-size: 12.5px; cursor: pointer;
}
.ss-tool small { display: block; font-weight: 400; color: #c8ffd4; font-size: 10.5px; }
.ss-ico { font-size: 18px; }
.ss-tool[aria-pressed="true"] { background: #39ff5a; color: #001408; border-color: #e8ffe8; }
.ss-tool[aria-pressed="true"] small { color: #003a14; }
.ss-tool:disabled { opacity: 0.45; cursor: not-allowed; background: rgba(8, 8, 8, 0.85); }
.ss-tool--locked { border-style: dashed; }
.ss-stick { position: fixed; z-index: 9; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 2px solid rgba(57, 255, 90, 0.5); background: rgba(57, 255, 90, 0.08); pointer-events: none; }
.ss-stick[hidden] { display: none; }
.ss-knob { position: absolute; left: 36px; top: 36px; width: 48px; height: 48px; border-radius: 50%; background: rgba(57, 255, 90, 0.55); border: 2px solid #b8ffb8; }
.ss-pop {
  position: fixed; z-index: 29; max-width: min(320px, 92vw); background: rgba(6, 22, 12, 0.95); border: 1px solid #39ff5a;
  border-radius: 10px; padding: 6px 9px; font-size: 12.5px; line-height: 1.35; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6); -webkit-user-select: text; user-select: text;
}
.ss-pop[hidden], .ss-panel[hidden] { display: none; }
.ss-pop h3 { margin: 0 26px 2px 0; font-size: 14px; color: #b8ffb8; }
.ss-pop .row, .ss-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.ss-pop-x { position: absolute; right: 2px; top: 0; background: none; border: 0; color: #c8ffd4; font-size: 22px; cursor: pointer; min-width: 34px; min-height: 34px; }
.ss-pbar { height: 7px; border-radius: 4px; background: #111; border: 1px solid rgba(57, 255, 90, 0.35); overflow: hidden; margin: 2px 0 3px; }
.ss-pbar > div { height: 100%; background: linear-gradient(90deg, #39ff5a, #ffe566); }
.ss-pbar.hot > div { background: linear-gradient(90deg, #ff9a3a, #ff3a3a); }
.ss-bad { color: #ff9a9a; font-weight: 700; }
.ss-warn { color: #ffe566; font-weight: 700; }
.ss-good { color: #8dff9d; font-weight: 700; }
.ss-panel {
  position: fixed; z-index: 20; right: calc(8px + env(safe-area-inset-right)); top: calc(54px + env(safe-area-inset-top));
  width: min(380px, calc(100vw - 16px)); max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px); overflow-y: auto;
  background: rgba(4, 18, 9, 0.96); border: 1px solid #39ff5a; border-radius: 12px; padding: 10px 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7);
}
.ss-panel h2 { margin: 0 30px 6px 0; font-size: 17px; color: #b8ffb8; }
.ss-panel p { margin: 0 0 8px; font-size: 12.5px; line-height: 1.4; }
.ss-upg { display: flex; flex-direction: column; gap: 6px; }
.ss-upg .ss-btn { justify-content: flex-start; text-align: left; }
.ss-help { color: #9fcfa8; }
@media (max-height: 480px) { /* phone landscape */
  .ss-chip { font-size: 11.5px; padding: 1px 6px; }
  .ss-tool { min-height: 40px; padding: 2px 7px; }
  .ss-tool small { display: none; }
  .ss-round { width: 36px; min-height: 36px; }
  .ss-msg { top: calc(44px + env(safe-area-inset-top)); }
}
.ss-sub { margin: 8px 0 5px; font-size: 13.5px; color: #b8ffb8; }
.ss-sell { display: flex; flex-direction: column; gap: 5px; }
.ss-sellrow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ss-sellrow > span { flex: 1 1 140px; font-size: 12.5px; }
/* tool options (wire gauge picker, transformer rotation) float above the build bar */
.ss-toolopts { position: fixed; z-index: 27; left: 50%; transform: translateX(-50%); bottom: calc(62px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 5px; max-width: calc(100vw - 16px); padding: 5px 8px; border-radius: 12px; background: rgba(4, 20, 10, 0.86); border: 1px solid rgba(57, 255, 90, 0.4); font-size: 12.5px; }
.ss-toolopts[hidden] { display: none; }
.ss-toolopts > span { color: #b8ffb8; font-weight: 700; }
.ss-btn.ss-on { background: #39ff5a; color: #04140a; }
/* build categories + flyout submenus */
.ss-cat { position: relative; padding-right: 20px; }
.ss-cat .ss-catname { display: block; }
.ss-cat small { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-caret { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 10px; opacity: 0.8; transition: transform 0.12s; }
.ss-cat[aria-expanded="true"] .ss-caret { transform: translateY(-50%) rotate(180deg); }
.ss-badge { position: absolute; top: 2px; right: 3px; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px; background: #ffd24a; color: #1a1200; font-size: 9.5px; font-weight: 800; line-height: 14px; text-align: center; }
.ss-cat .ss-badge + .ss-caret, .ss-cat .ss-caret { top: 62%; }
.ss-quick { border-color: #9fcfa8; }
.ss-fly { position: fixed; z-index: 28; display: flex; flex-direction: column; gap: 5px; min-width: 190px; max-width: calc(100vw - 12px); max-height: calc(100vh - 160px); max-height: calc(100dvh - 160px); overflow-y: auto; padding: 7px; border-radius: 12px; background: rgba(4, 18, 9, 0.96); border: 1px solid #39ff5a; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7); }
.ss-fly[hidden] { display: none; }
.ss-fly-h { font-size: 12px; font-weight: 800; color: #b8ffb8; padding: 0 2px 2px; }
.ss-fly .ss-tool { width: 100%; }
@media (max-width: 520px) {
  .ss-cat .ss-catname { font-size: 11.5px; }
  .ss-cat small { max-width: 92px; }
}
.ss-fly .ss-tool small { display: block; }
@media (max-width: 520px) and (min-height: 481px) { /* phone portrait: wrap the bar into rows */
  .ss-tools { flex-wrap: wrap; overflow-x: visible; touch-action: manipulation; }
  .ss-tool { min-height: 42px; padding: 3px 8px; }
  .ss-cat { padding-right: 18px; }
  .ss-cat small, .ss-quick small { display: none; }
  .ss-fly .ss-tool small { display: block; }
}
.ss-catshort { display: none; }
@media (max-width: 520px) and (min-height: 481px) {
  .ss-tools { gap: 4px; }
  .ss-cat .ss-catname, .ss-qname { display: none; }
  .ss-catshort { display: block; font-size: 12px; }
  .ss-tool { padding: 3px 7px; gap: 4px; }
  .ss-cat { padding-right: 16px; }
}
/* active tool / category: obvious highlight */
.ss-tool[aria-pressed="true"] { box-shadow: 0 0 0 2px #e8ffe8, 0 0 12px rgba(57, 255, 90, 0.8); }
.ss-quick[data-tool="inspect"][aria-pressed="true"] { box-shadow: none; }
.ss-pending { animation: ss-pend 0.8s ease-in-out infinite alternate; }
@keyframes ss-pend { from { box-shadow: 0 0 0 2px #ffe566, 0 0 6px #ffe566; } to { box-shadow: 0 0 0 3px #ffb020, 0 0 16px #ffb020; } }
@media (max-width: 520px) and (min-height: 481px) { .ss-quick[data-tool="wire"] .ss-qname { display: block; font-size: 12px; } .ss-quick[data-tool="wire"] small { display: none; } }
/* tutorial, goals, camp, hints */
.ss-offer { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.62); }
.ss-offer[hidden] { display: none; }
.ss-offer-card { width: min(420px, 100%); background: rgba(4, 18, 9, 0.97); border: 1px solid #39ff5a; border-radius: 14px; padding: 18px 16px 14px; box-shadow: 0 8px 28px rgba(0,0,0,0.7); }
.ss-offer-card h2 { margin: 0 0 8px; color: #b8ffb8; font-size: 20px; }
.ss-offer-card p { margin: 0 0 14px; font-size: 14px; line-height: 1.45; }
.ss-offer-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ss-offer-btns .ss-btn { flex: 1 1 140px; min-height: 48px; }
.ss-tut { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.ss-tut[hidden] { display: none; }
.ss-tut-dim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.ss-tut-hole { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0,0,0,0.55), 0 0 0 3px #39ff5a, 0 0 18px #39ff5a; pointer-events: none; }
.ss-tut-hole--nodim { box-shadow: 0 0 0 3px #39ff5a, 0 0 18px #39ff5a; }
.ss-tut-rad { position: fixed; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255, 230, 120, 0.85), 0 0 22px rgba(255, 210, 80, 0.65); pointer-events: none; }
.ss-tut-tip { position: fixed; z-index: 34; pointer-events: auto; box-sizing: border-box; width: min(360px, calc(100vw - 16px)); background: rgba(4, 18, 9, 0.96); border: 1px solid #39ff5a; border-radius: 12px; padding: 10px 12px 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.7); }
.ss-tut-text { margin: 0 0 8px; font-size: 14px; line-height: 1.4; }
.ss-tut-next { width: 100%; min-height: 44px; margin-bottom: 6px; }
.ss-tut-skip { width: 100%; background: transparent; border-color: #6a9; color: #c8ffd4; min-height: 34px; }
.ss-goals { position: fixed; z-index: 15; left: calc(8px + env(safe-area-inset-left)); top: calc(52px + env(safe-area-inset-top)); width: min(230px, calc(100vw - 120px)); background: rgba(4, 18, 9, 0.9); border: 1px solid rgba(57,255,90,0.45); border-radius: 10px; padding: 6px 8px; font-size: 12.5px; }
.ss-goals[hidden] { display: none; }
.ss-goals-h { display: flex; align-items: center; gap: 6px; font-weight: 800; color: #b8ffb8; }
.ss-goals-h span { font-weight: 600; color: #c8ffd4; flex: 1; }
.ss-goals-h .ss-btn { min-height: 26px; width: 26px; padding: 0; }
.ss-goals ul { margin: 6px 0 0; padding: 0; list-style: none; }
.ss-goals li { margin: 0 0 6px; }
.ss-goals li small { display: block; color: #9fcfa8; font-weight: 400; font-size: 11.5px; }
.ss-goals li.ss-done { color: #8f8; }
.ss-hint { position: fixed; z-index: 16; left: 50%; transform: translateX(-50%); bottom: calc(72px + env(safe-area-inset-bottom)); width: min(420px, calc(100vw - 16px)); text-align: center; pointer-events: none; padding: 7px 10px; border-radius: 10px; background: rgba(20, 16, 0, 0.88); border: 1px solid #ffe566; color: #ffe566; font-weight: 700; font-size: 13px; text-shadow: 0 1px 3px #000; animation: ss-hint 1.2s ease-in-out infinite alternate; }
.ss-hint[hidden] { display: none; }
@keyframes ss-hint { from { box-shadow: 0 0 0 0 rgba(255,229,102,0.2); } to { box-shadow: 0 0 12px 2px rgba(255,229,102,0.45); } }
.ss-camp { border-color: #ffe566; background: rgba(40, 30, 0, 0.92); animation: ss-hint 0.9s ease-in-out infinite alternate; }
.ss-camp[hidden] { display: none; }
@media (max-width: 520px) {
  .ss-goals { width: min(200px, calc(100vw - 90px)); top: calc(92px + env(safe-area-inset-top)); }
  .ss-tut-text { font-size: 13.5px; }
}

.ss-btn[hidden], .ss-tut-next[hidden], .ss-tool[hidden] { display: none !important; }

.ss-tut-mark { position: fixed; border-radius: 10px; box-shadow: 0 0 0 2px #8dff9d, 0 0 10px rgba(57,255,90,0.7); pointer-events: none; }
.ss-tut-mark[hidden] { display: none; }

.ss-btnlbl { font-size: 10.5px; margin-left: 3px; font-weight: 800; }
@media (max-width: 640px) { .ss-btnlbl { display: none; } }
/* Trading Post / Upgrades screens */
.ss-screen {
  position: fixed; inset: 0; z-index: 32; display: flex; align-items: center; justify-content: center;
  padding: calc(8px + env(safe-area-inset-top)) 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.55);
}
.ss-screen[hidden] { display: none; }
.ss-screen-card {
  position: relative; width: min(520px, 100%); max-height: min(92dvh, 740px);
  display: flex; flex-direction: column; overflow: hidden;
  background: rgba(4, 18, 9, 0.97); border: 1px solid #39ff5a; border-radius: 14px;
  padding: 14px 14px 10px; box-shadow: 0 8px 28px rgba(0,0,0,0.7);
}
.ss-screen-card h2 { margin: 0 36px 10px 0; font-size: 18px; color: #b8ffb8; }
.ss-screen-body { overflow-y: auto; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
.ss-tabs { display: flex; gap: 6px; margin: 0 0 10px; }
.ss-tab { flex: 1 1 0; min-height: 44px; border-radius: 10px; font-weight: 800; }
.ss-tab[aria-selected="true"], .ss-tab.ss-on { background: #39ff5a; color: #04140a; }
.ss-sellrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(57, 255, 90, 0.16); }
.ss-sellico { font-size: 22px; width: 32px; text-align: center; flex: 0 0 auto; }
.ss-sellinfo { flex: 1 1 120px; display: flex; flex-direction: column; gap: 1px; }
.ss-sellinfo small { color: #9fcfa8; font-weight: 500; }
.ss-sellbtns { display: flex; flex-wrap: wrap; gap: 5px; }
.ss-sellbtns .ss-btn { min-height: 40px; }
.ss-selltally { margin-top: 10px; padding: 8px 2px 2px; font-size: 14px; color: #b8ffb8; }
.ss-coming { color: #c8ffd4; line-height: 1.45; padding: 8px 2px; margin: 0; }
.ss-upgrow { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(57, 255, 90, 0.16); }
.ss-upginfo { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ss-upginfo small { color: #9fcfa8; font-weight: 500; }
.ss-upgrow .ss-btn { flex: 0 0 auto; min-width: 76px; min-height: 44px; }
.ss-upg-owned { opacity: 0.8; }
@media (max-width: 520px) {
  .ss-screen { padding: 0; }
  .ss-screen-card { width: 100%; max-height: 100%; height: 100%; border-radius: 0; }
  .ss-screen-card h2 { font-size: 17px; }
}

/* round 14: ownership mark, credit, gift pack */
.ss-credit { margin: 8px 0 0; font-size: 11.5px; color: #9fcfa8; }
.ss-credit a, .ss-mark { color: #b8ffb8; }
.ss-mark { position: fixed; z-index: 11; left: calc(8px + env(safe-area-inset-left)); bottom: calc(60px + env(safe-area-inset-bottom)); font-size: 10.5px; opacity: 0.55; text-decoration: none; pointer-events: auto; text-shadow: 0 1px 2px #000; }
.ss-mark:hover, .ss-mark:focus-visible { opacity: 1; text-decoration: underline; }
.ss-gift { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; margin: 0 0 8px; border: 1px dashed #ffe566; border-radius: 10px; background: rgba(60, 50, 0, 0.35); }
.ss-gift small { flex: 1 1 200px; display: block; color: #fff3b0; font-size: 12px; }
@media (max-height: 480px) { .ss-mark { bottom: calc(50px + env(safe-area-inset-bottom)); } }
