/* electricity.css — гра «Електричне коло» */
:root {
  --bg: #0e1622;
  --panel: #16222f;
  --panel-2: #1d2c3c;
  --text: #eaf2f8;
  --muted: #9fb2c2;
  --accent: #33c2b0;
  --accent-2: #4aa3df;
  --ok: #57c98a;
  --warn: #ffce6b;
  --info: #6bb6ff;
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: var(--font); }

.back-to-hub {
  position: fixed; top: 14px; left: 14px; z-index: 20;
  background: rgba(0,0,0,0.35); color: #fff; text-decoration: none;
  padding: 8px 14px; border-radius: 10px; font-size: 14px;
  border: 1px solid rgba(255,255,255,0.25);
}
.back-to-hub:hover { background: rgba(0,0,0,0.55); }

.game { display: flex; height: 100vh; }

/* Дошка (світлий «робочий аркуш») */
.board {
  flex: 1;
  background: radial-gradient(1000px 600px at 50% 30%, #f4f8fb, #dbe4ec);
  display: flex; align-items: center; justify-content: center;
  min-width: 0;
}
.board-svg { width: 100%; height: 100%; max-height: 100vh; }

/* Контакти */
.term { fill: #ffffff; stroke: #33546e; stroke-width: 2.5; cursor: pointer; transition: fill .12s, r .12s; }
.term:hover { fill: #d7f3ee; }
.term.sel { fill: var(--accent); stroke: #1b8f80; }

/* Дроти */
.wire-hit { stroke: transparent; stroke-width: 18; cursor: pointer; }
.wire { stroke: #b5651d; stroke-width: 6; stroke-linecap: round; fill: none; pointer-events: none; }
.wire.live { stroke: #ffb733; stroke-dasharray: 13 8; animation: flow .5s linear infinite; }
.lead { stroke: #5a6b7a; stroke-width: 5; stroke-linecap: round; }
@keyframes flow { to { stroke-dashoffset: -21; } }

/* Батарейка */
.battery-body { fill: #3a4756; stroke: #22303f; stroke-width: 2; }
.battery-cap { fill: #8a939c; }
.battery-label { font-size: 30px; text-anchor: middle; }
.term-label { font-weight: 800; font-size: 24px; text-anchor: middle; }
.term-label.plus { fill: #e23b3b; }
.term-label.minus { fill: #2a4bd7; }
.comp-name { fill: #55606b; font-size: 15px; text-anchor: middle; font-weight: 600; }

/* Лампочка */
.bulb .bulb-glass { stroke: #7d8894; stroke-width: 2.5; }
.bulb .filament { stroke: #8a939c; stroke-width: 2.5; fill: none; }
.bulb.on .filament { stroke: #b5451a; stroke-width: 3; }
.bulb .bulb-base { fill: #8a939c; }
.bulb-halo { fill: #ffe27a; opacity: .55; }
.bulb-rays line { stroke: #ffbe3d; stroke-width: 4; stroke-linecap: round; }

/* Вимикач */
.switch-hit { fill: transparent; cursor: pointer; }
.switch-contact { fill: #55606b; }
.switch-lever { stroke: #55606b; stroke-width: 7; stroke-linecap: round; transition: all .15s; }
.switch.closed .switch-lever { stroke: #2f9e63; }
.switch-lever.live { stroke: #ffb733; }

/* Роз'єм */
.socket-empty rect { fill: #ffffff; stroke: #9aa7b3; stroke-width: 2.5; stroke-dasharray: 6 5; }
.socket-empty .socket-q { fill: #9aa7b3; font-size: 30px; font-weight: 800; text-anchor: middle; }
.socket-item rect { fill: #fff6df; stroke: #e0b64d; stroke-width: 2.5; }
.socket-emoji { font-size: 34px; text-anchor: middle; }
.socket { cursor: pointer; }

/* ── Панель ─────────────────────────────────────────────────────────── */
.panel {
  width: 380px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid rgba(255,255,255,0.08);
  overflow-y: auto;
}
.panel-inner { padding: 22px 22px 32px; }
.panel h1 { font-size: 24px; margin: 0 0 14px; }
.panel h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 0 10px; }

.status {
  padding: 12px 14px; border-radius: 12px; line-height: 1.5; font-size: 14px;
  border-left: 4px solid var(--info); background: rgba(107,182,255,0.12);
}
.status-ok { border-left-color: var(--ok); background: rgba(87,201,138,0.15); }
.status-warn { border-left-color: var(--warn); background: rgba(255,206,107,0.13); }
.status-info { border-left-color: var(--info); background: rgba(107,182,255,0.12); }

.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0; color: var(--muted); font-size: 14px; line-height: 1.4;
}
.tasks li.done { color: var(--text); }
.tasks .chk {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
  background: rgba(255,255,255,0.08); color: var(--muted);
}
.tasks li.done .chk { background: var(--ok); color: #05271a; }

.hint { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.items { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-2); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; padding: 10px 12px; cursor: pointer;
  color: var(--text); font-size: 14px; text-align: left; font-family: var(--font);
  transition: border-color .12s, transform .12s;
}
.item:hover { border-color: rgba(255,255,255,0.25); transform: translateX(2px); }
.item.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.item-emoji { font-size: 24px; }
.item-name { flex: 1; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.badge.cond { background: var(--ok); color: #05271a; }
.badge.insul { background: #6b7785; color: #101820; }

.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.btn {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #04201c; border: none; padding: 10px 14px; border-radius: 10px;
  font-weight: 700; cursor: pointer; font-family: var(--font); font-size: 14px;
}
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid rgba(255,255,255,0.15); }
.btn:hover { filter: brightness(1.08); }
.tip { color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 18px; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 14px; }

@media (max-width: 860px) {
  .game { flex-direction: column; }
  .board { height: 52vh; flex: none; }
  .panel { width: 100%; flex: 1; }
}

/* Сенсорні пристрої: більші зони дотику, без затримки подвійного тапу */
@media (hover: none) and (pointer: coarse) {
  body { touch-action: manipulation; }
  .wire-hit { stroke-width: 30; }
  .item { padding: 14px 12px; }
  .btn { padding: 12px 16px; }
}
