/* ============================================================
   LAUNDRY DAY — Main Stylesheet
   ============================================================ */

/* ---------- Reset & Variables ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0d1117;
  --bg2:         #161b22;
  --bg3:         #1c2128;
  --border:      #30363d;
  --accent:      #58a6ff;
  --green:       #3fb950;
  --danger:      #f85149;
  --warn:        #d29922;
  --gold:        #ffd700;
  --text:        #e6edf3;
  --muted:       #8b949e;
  --shadow:      rgba(0,0,0,.55);

  /* Machine palette */
  --mw:  #eceef2;   /* machine white */
  --mg:  #d4d8de;   /* machine grey */
  --mdk: #3a4150;   /* panel dark */
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ============================================================
   HUD
   ============================================================ */
#game { display: flex; flex-direction: column; height: 100vh; }

#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.hud-center { text-align: center; }
.hud-center h1 {
  font-size: 1.15em;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 3px;
  text-transform: uppercase;
}
.xp-bar-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 4px;
  width: 130px;
  margin-inline: auto;
}
.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--accent));
  border-radius: 2px;
  transition: width .5s ease;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1em;
  font-weight: 700;
}
.hud-icon { font-size: 1.1em; }
#money-display { color: var(--gold); font-size: 1.15em; }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
#main-area {
  display: grid;
  grid-template-columns: 210px 1fr 245px;
  gap: 10px;
  padding: 10px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ============================================================
   SIDE PANELS
   ============================================================ */
#left-panel, #right-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
}
section h2 {
  font-size: .75em;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 7px;
}

/* --------- Basket / Clean pile --------- */
#basket, #clean-pile {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 60px;
  padding: 2px;
}

.empty-hint {
  color: var(--muted);
  font-size: .75em;
  font-style: italic;
  width: 100%;
  text-align: center;
  padding: 6px;
}

.earn-row {
  font-size: .75em;
  color: var(--muted);
  margin-top: 6px;
}
.earn-val { color: var(--gold); font-weight: 700; }

/* --------- Cloth items --------- */
.cloth-item {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: grab;
  font-size: 1.5em;
  border: 2px solid transparent;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  position: relative;
  user-select: none;
  flex-shrink: 0;
}
.cloth-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(88,166,255,.3);
}
.cloth-item.dragging { opacity: .45; transform: scale(.92); }

/* dirty tint overlay */
.cloth-item.dirty::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: repeating-linear-gradient(
    45deg,
    rgba(0,0,0,.18) 0px,
    rgba(0,0,0,.18) 2px,
    transparent 2px,
    transparent 6px
  );
}
.cloth-item.clean {
  border-color: var(--green);
  box-shadow: 0 0 8px rgba(63,185,80,.3);
}
.cloth-item .cloth-lbl {
  font-size: .28em;
  color: rgba(255,255,255,.75);
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-top: 1px;
}

/* ============================================================
   CENTER PANEL — WASHING MACHINE
   ============================================================ */
#center-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* --------- Machine wrapper --------- */
#washing-machine {
  position: relative;
  width: 290px;
}

/* --------- Machine body --------- */
.machine-body {
  background: linear-gradient(165deg, #f8f9fb 0%, #e9ecf0 55%, #dde1e6 100%);
  border-radius: 18px 18px 6px 6px;
  padding: 12px 14px 0;
  position: relative;
  box-shadow:
    inset 2px 3px 8px rgba(255,255,255,.85),
    inset -2px -3px 6px rgba(0,0,0,.08),
    5px 10px 30px var(--shadow),
    0 0 0 1px rgba(255,255,255,.25);
}

/* State classes applied to #washing-machine */
.ws-idle        .machine-body { /* default */ }
.ws-door-open   .machine-body { box-shadow: 5px 10px 30px var(--shadow), 0 0 0 2px var(--accent), inset 2px 3px 8px rgba(255,255,255,.85); }
.ws-running     .machine-body { /* drum spins */ }
.ws-error       .machine-body { animation: wobble .45s ease infinite; }
.ws-complete    .machine-body { box-shadow: 5px 10px 30px var(--shadow), 0 0 0 2px var(--green), inset 2px 3px 8px rgba(255,255,255,.85); }

@keyframes wobble {
  0%,100% { transform: translateX(0) rotate(0); }
  20%      { transform: translateX(-7px) rotate(-.8deg); }
  40%      { transform: translateX(7px) rotate(.8deg); }
  60%      { transform: translateX(-4px) rotate(-.4deg); }
  80%      { transform: translateX(4px) rotate(.4deg); }
}

/* --------- Brand top --------- */
.machine-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 2px;
}
.brand {
  font-size: .7em;
  font-weight: 800;
  color: #555;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.model-tag {
  font-size: .8em;
  background: #ddd;
  color: #666;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  font-weight: 600;
}

/* Status LED */
.status-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #aaa;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.3);
  transition: background .3s, box-shadow .3s;
}
.led-on       { background: var(--green) !important; box-shadow: 0 0 7px var(--green) !important; }
.led-running  { background: var(--accent) !important; box-shadow: 0 0 7px var(--accent) !important; animation: pulse-led .9s infinite; }
.led-error    { background: var(--danger) !important; box-shadow: 0 0 7px var(--danger) !important; animation: pulse-led .35s infinite; }
.led-done     { background: var(--gold) !important; box-shadow: 0 0 7px var(--gold) !important; }
@keyframes pulse-led { 0%,100%{opacity:1} 50%{opacity:.2} }

/* --------- Detergent drawer --------- */
.det-drawer {
  margin: 0 18px 10px;
  background: #cdd1d7;
  border-radius: 4px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.2), 0 1px 0 rgba(255,255,255,.6);
}
.drawer-inner {
  display: flex;
  padding: 5px;
  gap: 4px;
}
.drawer-slot {
  flex: 1;
  height: 26px;
  background: #fff;
  border-radius: 3px;
  border: 1px solid #bbb;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.slot-fill {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 0%;
  border-radius: 0 0 2px 2px;
  transition: height .6s ease;
}
.slot-label {
  font-size: .55em;
  color: #aaa;
  margin-bottom: 2px;
  position: relative;
  z-index: 1;
}

/* --------- Door hinges --------- */
.hinge {
  position: absolute;
  left: 8px;
  width: 9px;
  height: 18px;
  background: linear-gradient(90deg, #bbb, #ddd, #bbb);
  border-radius: 0 3px 3px 0;
  box-shadow: 1px 1px 3px rgba(0,0,0,.25);
  z-index: 2;
}
.hinge-top { top: 78px; }
.hinge-bot { top: 180px; }

/* --------- Door --------- */
.door {
  width: 230px;
  height: 230px;
  margin: 0 auto 0;
  position: relative;
}

/* Porthole layers */
.porthole-outer {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #aaa 0%, #666 100%);
  padding: 7px;
  box-shadow:
    inset 0 3px 6px rgba(255,255,255,.2),
    inset 0 -3px 6px rgba(0,0,0,.3),
    0 4px 14px rgba(0,0,0,.4),
    0 0 0 5px #c8cdd4;
}
.porthole-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #5a5a6a, #3a3a48);
  padding: 5px;
  box-shadow: inset 0 2px 5px rgba(255,255,255,.1), inset 0 -2px 5px rgba(0,0,0,.3);
}
.porthole-glass {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #12121f;
  overflow: hidden;
  position: relative;
  transition: background .3s;
}
.porthole-glass.drag-over {
  background: #0f1f35;
  box-shadow: inset 0 0 24px rgba(88,166,255,.35);
}

/* Door handle */
.door-handle {
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 52px;
  background: linear-gradient(90deg, #999, #ccc, #999);
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 2px 5px rgba(0,0,0,.3);
  cursor: pointer;
  transition: background .2s;
  z-index: 3;
}
.door-handle:hover { background: linear-gradient(90deg, #bbb, #e0e0e0, #bbb); }

/* Door open state — slight visual push-back */
.ws-door-open .door { transform: perspective(500px) rotateY(-18deg); transform-origin: left center; }

/* --------- Drum --------- */
.drum {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: radial-gradient(ellipse at 35% 35%, #4e4e60 0%, #2a2a3a 65%, #181826 100%);
}

/* Drum plate (rotates) */
.drum-plate {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

/* Drum holes (perforations) */
.drum-hole {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: radial-gradient(ellipse, #0a0a14 60%, #1a1a28);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.9);
}
.dh1 { top: 18%; left: 18%; }
.dh2 { top: 18%; right: 18%; }
.dh3 { top: 50%; left: 8%; transform: translateY(-50%); }
.dh4 { top: 50%; right: 8%; transform: translateY(-50%); }
.dh5 { bottom: 18%; left: 18%; }
.dh6 { bottom: 18%; right: 18%; }

/* Drum ribs */
.drum-rib {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}
.r1 { background: repeating-conic-gradient(rgba(255,255,255,.04) 0deg 5deg, transparent 5deg 60deg); }
.r2 { background: repeating-conic-gradient(rgba(255,255,255,.03) 0deg 4deg, transparent 4deg 40deg) ; transform: rotate(20deg); }
.r3 { background: radial-gradient(ellipse at 50% 30%, rgba(255,255,255,.06) 0%, transparent 60%); }

/* Spin animations */
@keyframes spin-cw  { to { transform: rotate(360deg); } }
@keyframes spin-ccw { to { transform: rotate(-360deg); } }
.ws-running .drum-plate { animation: spin-cw 2.8s linear infinite; }
.ws-running.rev .drum-plate { animation: spin-ccw 2.8s linear infinite; }

/* Drum clothes dots */
.drum-clothes {
  position: absolute;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 25%;
  pointer-events: none;
}
.drum-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  opacity: .85;
  flex-shrink: 0;
}

/* Water */
.drum-water {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 0%;
  background: linear-gradient(180deg, rgba(80,160,255,.2) 0%, rgba(40,100,220,.65) 100%);
  transition: height 2.5s ease;
  border-radius: 0 0 50% 50%;
  pointer-events: none;
}

/* Foam */
.drum-foam {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 50%;
}
.bubble {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.65);
  animation: bubble-up linear infinite;
}
@keyframes bubble-up {
  0%   { transform: translateY(0) scale(1); opacity: .7; }
  100% { transform: translateY(-120px) scale(.3); opacity: 0; }
}

/* Drop hint */
.drop-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.18);
  font-size: .7em;
  pointer-events: none;
  transition: color .2s;
  text-align: center;
  padding: 20px;
}
.porthole-glass.drag-over .drop-hint { color: rgba(88,166,255,.8); }

/* Glass shine */
.glass-shine {
  position: absolute;
  top: 6%;
  left: 10%;
  width: 32%;
  height: 32%;
  background: radial-gradient(ellipse, rgba(255,255,255,.14) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* --------- Control panel --------- */
.ctrl-panel {
  background: linear-gradient(180deg, var(--mdk) 0%, #2b3040 100%);
  margin: 8px -14px 0;
  padding: 10px 14px;
  border-radius: 0 0 6px 6px;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.3);
}

/* Display */
.ctrl-display { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.disp-screen {
  flex: 1;
  background: #071207;
  border: 1px solid #0f2a0f;
  border-radius: 4px;
  padding: 5px 10px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,.6), 0 0 4px rgba(63,185,80,.15);
  font-family: 'Courier New', monospace;
}
.disp-time {
  font-size: 1.15em;
  color: #3fb950;
  font-weight: 700;
  letter-spacing: 4px;
}
.disp-msg {
  font-size: .58em;
  color: #27ae60;
  letter-spacing: 2px;
  margin-top: 1px;
}
.disp-icons { display: flex; flex-direction: column; gap: 2px; }
.di { font-size: .8em; opacity: .22; transition: opacity .3s; }
.di.active { opacity: 1; }

/* Dial & buttons */
.ctrl-row { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.dial-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.dial-outer {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: #1a1e26;
  padding: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,.5), inset 0 1px 2px rgba(255,255,255,.08);
}
.dial {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #555, #2f2f2f);
  position: relative;
  cursor: pointer;
  transition: transform .35s ease;
  box-shadow: inset 0 1px 3px rgba(255,255,255,.08);
}
.dial-dot {
  position: absolute;
  top: 4px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 9px;
  background: var(--danger);
  border-radius: 2px;
}
.dial-label { font-size: .48em; color: var(--muted); letter-spacing: 1px; }

.ctrl-btns { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.mbtn {
  width: 100%;
  padding: 7px;
  border: none;
  border-radius: 4px;
  font-weight: 700;
  font-size: .72em;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all .15s;
}
.mbtn-start {
  background: linear-gradient(180deg, #3fb950, #2ea043);
  color: #fff;
  box-shadow: 0 3px 0 #1a6b2a, 0 0 8px rgba(63,185,80,.25);
}
.mbtn-start:hover:not(:disabled) { background: linear-gradient(180deg, #50d060, #3fb950); transform: translateY(-1px); }
.mbtn-start:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #1a6b2a; }
.mbtn-start:disabled { background: #253525; color: #3a5a3a; box-shadow: none; cursor: default; }

.mbtn-stop {
  background: linear-gradient(180deg, #6e4040, #5a3030);
  color: var(--danger);
  box-shadow: 0 2px 0 #3a1a1a;
}
.mbtn-stop:hover:not(:disabled) { background: linear-gradient(180deg, #8e5050, #7a4040); }
.mbtn-stop:disabled { background: #2a1f1f; color: #4a2a2a; box-shadow: none; cursor: default; }

/* Progress bar */
.prog-track {
  height: 7px;
  background: #1a2030;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 4px;
  transition: width .12s linear;
}
.prog-pct {
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  font-size: .5em;
  color: rgba(255,255,255,.55);
}

/* --------- Machine feet --------- */
.machine-feet {
  display: flex;
  justify-content: space-around;
  padding: 0 24px;
  margin-top: 1px;
}
.foot {
  width: 18px; height: 7px;
  background: linear-gradient(180deg, #999, #666);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
}

/* --------- Machine error overlay --------- */
.machine-error-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.72);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
  z-index: 20;
}
.err-box {
  background: #1c0808;
  border: 2px solid var(--danger);
  border-radius: 10px;
  padding: 18px 22px;
  text-align: center;
  max-width: 210px;
  box-shadow: 0 0 24px rgba(248,81,73,.45);
}
.err-icon { font-size: 2em; margin-bottom: 6px; }
.err-name { font-size: .95em; font-weight: 700; color: var(--danger); margin-bottom: 4px; }
.err-desc { font-size: .7em; color: var(--muted); margin-bottom: 12px; line-height: 1.5; }
.err-btns { display: flex; flex-direction: column; gap: 6px; }
.err-fix-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: var(--danger);
  color: #fff;
  font-size: .75em;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.err-fix-btn:hover { background: #ff6b63; transform: scale(1.04); }

/* --------- Capacity bar --------- */
#capacity-bar { width: 290px; }
.cap-label { font-size: .72em; color: var(--muted); display: block; margin-bottom: 3px; }
.cap-track { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.cap-fill { height: 100%; background: linear-gradient(90deg, var(--green), var(--warn)); border-radius: 3px; transition: width .3s ease; }

/* ============================================================
   RIGHT PANEL — Controls & Upgrades
   ============================================================ */

/* ---- Program list ---- */
#program-list { display: flex; flex-direction: column; gap: 4px; }
.prog-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  font-size: .78em;
  transition: border-color .15s, background .15s;
  text-align: left;
  width: 100%;
}
.prog-btn:hover { border-color: var(--accent); background: #1a2440; }
.prog-btn.selected { border-color: var(--accent); background: #1a2440; box-shadow: 0 0 8px rgba(88,166,255,.2); }
.prog-btn.disabled { opacity: .35; cursor: default; pointer-events: none; }
.prog-icon { font-size: 1.2em; }
.prog-info { display: flex; flex-direction: column; }
.prog-name { font-weight: 700; font-size: .92em; }
.prog-meta { font-size: .75em; color: var(--muted); }

/* ---- Detergent / Softener ---- */
#detergent-list, #softener-list { display: flex; flex-direction: column; gap: 4px; }
.det-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  font-size: .78em;
  transition: border-color .15s, background .15s;
  width: 100%;
  text-align: left;
}
.det-btn:hover:not(.unavailable) { border-color: var(--accent); background: #1a2440; }
.det-btn.selected { border-color: var(--accent); background: #1a2440; }
.det-btn.unavailable { opacity: .35; cursor: default; }
.det-swatch { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.det-name { flex: 1; font-weight: 600; }
.det-stock { font-size: .75em; color: var(--muted); margin-left: auto; }

/* ---- Upgrades ---- */
#upgrade-list { display: flex; flex-direction: column; gap: 5px; }
.upg-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 9px;
  background: var(--bg3);
  transition: border-color .15s, background .15s;
}
.upg-card:not(.purchased):not(.locked) { cursor: pointer; }
.upg-card:hover:not(.purchased):not(.locked) { border-color: var(--gold); background: #201e10; }
.upg-card.affordable:not(.purchased):not(.locked) { border-color: var(--gold); }
.upg-card.purchased { border-color: var(--green); opacity: .6; }
.upg-card.locked { opacity: .3; cursor: default; }
.upg-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.upg-name { font-size: .78em; font-weight: 700; }
.upg-cost { font-size: .72em; color: var(--gold); font-weight: 700; }
.upg-cost.free { color: var(--green); }
.upg-desc { font-size: .68em; color: var(--muted); }

/* ============================================================
   NOTIFICATIONS
   ============================================================ */
#notifications {
  position: fixed;
  top: 56px;
  right: 14px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
}
.notif {
  padding: 9px 15px;
  border-radius: 8px;
  font-size: .82em;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  animation: notif-in .28s ease, notif-out .28s ease 2.72s forwards;
  max-width: 240px;
  line-height: 1.4;
}
@keyframes notif-in  { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes notif-out { from { transform: translateX(0); opacity: 1; } to { transform: translateX(110%); opacity: 0; } }
.notif-success { background: #122a14; border: 1px solid var(--green); color: var(--green); }
.notif-warn    { background: #2a1e08; border: 1px solid var(--warn);  color: var(--warn); }
.notif-error   { background: #2a0a0a; border: 1px solid var(--danger); color: var(--danger); }
.notif-level   { background: #1a0f2e; border: 1px solid #9b59b6; color: #c39bd3; }
.notif-info    { background: #0f1e30; border: 1px solid var(--accent); color: var(--accent); }

/* --------- Floating money text --------- */
.money-float {
  position: fixed;
  font-size: 1.15em;
  font-weight: 800;
  color: var(--gold);
  pointer-events: none;
  z-index: 1001;
  text-shadow: 0 2px 6px rgba(0,0,0,.5);
  animation: float-up 1.6s ease forwards;
}
@keyframes float-up {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  60%  { opacity: 1; transform: translateY(-45px) scale(1.25); }
  100% { opacity: 0; transform: translateY(-85px) scale(.8); }
}

/* ============================================================
   PLUMBING PANEL
   ============================================================ */
#plumbing-panel {
  flex-shrink: 0;
  background: var(--bg2);
  border-top: 2px solid #1e2a3a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.plumb-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 14px 3px;
  flex-shrink: 0;
}
.plumb-title {
  font-size: .75em;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.plumb-subtitle {
  font-size: .65em;
  color: #4a5568;
}

/* Canvas fills the panel horizontally */
#plumbing-canvas {
  display: block;
  width: 100%;
  flex-shrink: 0;
}

.plumb-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px 5px;
  gap: 10px;
  flex-shrink: 0;
}

.clean-btn {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg3);
  color: var(--text);
  font-size: .72em;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  white-space: nowrap;
}
.clean-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: #1a2440;
}
.clean-btn:disabled {
  opacity: .35;
  cursor: default;
}
.clean-btn.clog-warn {
  border-color: var(--danger);
  color: var(--danger);
  animation: pulse-btn .8s infinite;
}
@keyframes pulse-btn {
  0%,100% { box-shadow: none; }
  50%      { box-shadow: 0 0 8px rgba(248,81,73,.5); }
}

.plumb-warn {
  font-size: .72em;
  font-weight: 700;
  color: var(--danger);
  text-align: center;
  flex: 1;
  animation: pulse-btn .6s infinite;
}

/* ============================================================
   SCROLLBARS
   ============================================================ */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ============================================================
   HUD — RP / SC chips
   ============================================================ */
.hud-rp, .hud-sc {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .85em;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
}
.hud-rp { color: #82cfff; }
.hud-sc { color: #f0b0ff; }

/* ============================================================
   TAB BAR
   ============================================================ */
.tab-bar {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 4px 4px 0;
  flex-shrink: 0;
}
.tab-btn {
  flex: 1;
  padding: 6px 4px;
  font-size: .72em;
  font-weight: 600;
  background: none;
  border: none;
  border-radius: 6px 6px 0 0;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab-btn:hover  { background: var(--bg3); color: var(--text); }
.tab-btn.active { background: var(--bg2); color: var(--accent); border-bottom: 2px solid var(--accent); }

.tab-pane { display: none; overflow-y: auto; flex: 1; padding: 4px 0; }
.tab-pane.active { display: block; }
.tab-hint { font-size: .72em; color: var(--muted); padding: 2px 8px 6px; }

/* ============================================================
   RESEARCH TREE
   ============================================================ */
#research-tree {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
}
.research-branch {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.research-branch-label {
  font-size: .7em;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}
.research-arrow {
  font-size: 1em;
  color: var(--border);
  line-height: 1.2;
}
.research-node {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 6px;
  cursor: default;
  opacity: .5;
  text-align: center;
}
.research-node.available {
  opacity: 1;
  cursor: pointer;
  border-color: var(--accent);
}
.research-node.available:hover { background: #1a2440; }
.research-node.done {
  opacity: 1;
  border-color: var(--green);
  background: rgba(63,185,80,.12);
}
.research-node.locked { opacity: .35; cursor: not-allowed; }
.rn-top  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.rn-icon { font-size: 1em; }
.rn-cost { font-size: .65em; font-weight: 700; color: #82cfff; }
.rn-name { font-size: .72em; font-weight: 700; color: var(--text); }
.rn-desc { font-size: .62em; color: var(--muted); margin-top: 2px; line-height: 1.3; }

/* ============================================================
   ACHIEVEMENTS
   ============================================================ */
#achievement-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 8px;
}
.ach-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  opacity: .45;
}
.ach-card.unlocked {
  opacity: 1;
  border-color: var(--gold);
  background: rgba(255,215,0,.07);
}
.ach-icon { font-size: 1.3em; flex-shrink: 0; }
.ach-info { display: flex; flex-direction: column; gap: 1px; }
.ach-name { font-size: .75em; font-weight: 700; }
.ach-desc { font-size: .67em; color: var(--muted); }
.ach-reward { font-size: .65em; color: #f0b0ff; font-weight: 600; }

/* ============================================================
   CHALLENGES
   ============================================================ */
.challenge-refresh-info {
  font-size: .67em;
  color: var(--muted);
  padding: 0 8px 4px;
}
#challenge-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 8px;
}
.ch-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
}
.ch-card.complete { border-color: var(--green); background: rgba(63,185,80,.08); }
.ch-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.ch-name { font-size: .78em; font-weight: 700; }
.ch-reward { font-size: .65em; color: #f0b0ff; font-weight: 600; }
.ch-desc { font-size: .67em; color: var(--muted); margin-bottom: 5px; }
.ch-bar-wrap {
  height: 5px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 2px;
}
.ch-bar { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.ch-progress { font-size: .62em; color: var(--muted); text-align: right; }

/* ============================================================
   COSMETICS SHOP
   ============================================================ */
#cosmetics-shop { padding: 6px 8px; }
.cos-section { margin-bottom: 10px; }
.cos-section-label {
  font-size: .7em;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 5px;
}
.cos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 5px;
}
.cos-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 4px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.cos-item:hover  { background: #1a2440; border-color: var(--accent); }
.cos-item.equipped { border-color: var(--green); background: rgba(63,185,80,.1); }
.cos-item.buyable  { border-color: var(--border); }
.cos-preview {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  margin-bottom: 3px;
  background: var(--bg);
  font-size: 1.2em;
  display: flex;
  align-items: center;
  justify-content: center;
}
.trim-preview { background: linear-gradient(135deg, #888, #ccc, #888); }
.cos-name { font-size: .6em; color: var(--text); line-height: 1.2; }
.cos-cost { font-size: .6em; color: #f0b0ff; font-weight: 600; }
.cos-item.equipped .cos-cost { color: var(--green); }

/* ============================================================
   MACHINE COSMETICS — Skin classes
   ============================================================ */
.skin-arctic  .machine-body { background: linear-gradient(160deg, #bbdefb, #90caf9); }
.skin-slate   .machine-body { background: linear-gradient(160deg, #607d8b, #455a64); }
.skin-slate   .machine-body,
.skin-slate   .machine-top  { color: #e0f7fa; }
.skin-rose    .machine-body { background: linear-gradient(160deg, #f8bbd9, #f48fb1); }
.skin-obsidian .machine-body {
  background: linear-gradient(160deg, #3a3a3a, #1a1a1a);
  border-color: #555;
}
.skin-obsidian .machine-top { color: #e0e0e0; }

/* ============================================================
   MACHINE COSMETICS — LED classes
   ============================================================ */
.led-ocean   .machine-body { box-shadow: 0 0 14px rgba(0,188,212,.6), inset 0 0 6px rgba(0,188,212,.1); }
.led-matrix  .machine-body { box-shadow: 0 0 14px rgba(76,175,80,.6), inset 0 0 6px rgba(76,175,80,.1); }
.led-gold    .machine-body { box-shadow: 0 0 18px rgba(255,215,0,.55), inset 0 0 6px rgba(255,215,0,.1); }
.led-rainbow .machine-body {
  animation: led-rainbow-glow 3s linear infinite;
}
@keyframes led-rainbow-glow {
  0%   { box-shadow: 0 0 16px rgba(255,0,0,.6); }
  16%  { box-shadow: 0 0 16px rgba(255,165,0,.6); }
  33%  { box-shadow: 0 0 16px rgba(255,255,0,.6); }
  50%  { box-shadow: 0 0 16px rgba(0,255,0,.6); }
  66%  { box-shadow: 0 0 16px rgba(0,0,255,.6); }
  83%  { box-shadow: 0 0 16px rgba(148,0,211,.6); }
  100% { box-shadow: 0 0 16px rgba(255,0,0,.6); }
}

/* ============================================================
   MACHINE COSMETICS — Trim classes
   ============================================================ */
.trim-chrome .door          { border: 3px solid #c0c0c0; }
.trim-chrome .porthole-outer { border-color: #a8a8a8; }
.trim-black  .door          { border: 3px solid #1a1a1a; }
.trim-black  .porthole-outer { border-color: #111; }
.trim-brass  .door          { border: 3px solid #b8860b; }
.trim-brass  .porthole-outer { border-color: #cd9a15; }

/* ============================================================
   MACHINE COSMETICS — Sticker
   ============================================================ */
.machine-sticker {
  position: absolute;
  bottom: 22px;
  right: 14px;
  font-size: 1.6em;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.5));
  z-index: 5;
}
