:root {
  color-scheme: dark;
  --bg: #071117;
  --panel: rgba(13, 31, 41, 0.88);
  --panel-strong: #102631;
  --line: rgba(126, 220, 235, 0.18);
  --text: #effbff;
  --muted: #91aab5;
  --accent: #67f5ad;
  --accent-2: #56d4ff;
  --danger: #ff6f7d;
  --warning: #ffcf5c;
  --purple: #c996ff;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; background: radial-gradient(circle at 20% 0%, rgba(86, 212, 255, 0.09), transparent 34%), linear-gradient(180deg, #071117, #081820 42%, #061015); }
.topbar { position: sticky; top: 0; z-index: 50; min-height: 64px; padding: max(10px, env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); background: rgba(5, 15, 21, 0.82); }
.brand { display: inline-flex; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #061015; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0 24px rgba(103, 245, 173, 0.24); font-size: 21px; font-weight: 900; }
.brand strong { display: block; font-size: 13px; letter-spacing: 0.08em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; letter-spacing: 0.24em; }
.topbar-spacer { flex: 1; }
.currency-chip { display: flex; align-items: center; gap: 5px; min-width: 68px; justify-content: center; padding: 8px 11px; border: 1px solid rgba(255, 207, 92, 0.27); border-radius: 12px; background: rgba(255, 207, 92, 0.08); color: var(--warning); }
.icon-button { min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,0.035); cursor: pointer; font-size: 11px; font-weight: 800; letter-spacing: 0.05em; }
.icon-button:hover { border-color: rgba(103,245,173,0.5); }

.main-area { width: min(1500px, 100%); margin: 0 auto; padding: 16px; }
.screen { display: none; }
.screen.is-active { display: block; }
.panel { border: 1px solid var(--line); background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: 0.18em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(24px, 3.4vw, 40px); line-height: 1.05; }
h2 { margin-bottom: 8px; font-size: 25px; }
h3 { margin-bottom: 8px; font-size: 12px; letter-spacing: 0.08em; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.65; }

.button { min-height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; font-weight: 900; letter-spacing: 0.04em; transition: transform .15s ease, border-color .15s ease, opacity .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .38; }
.button.primary { color: #06221a; background: linear-gradient(135deg, var(--accent), #a7ffcf); }
.button.secondary { border-color: var(--line); background: rgba(255,255,255,.045); }
.button.ghost { border-color: rgba(255,255,255,.08); background: transparent; color: var(--muted); }
.button.danger { color: white; background: linear-gradient(135deg, #ca3f56, var(--danger)); }
.button.ultimate { color: #1c0f27; background: linear-gradient(135deg, var(--purple), #ff86d5); }
.button.wide { width: 100%; margin-top: 10px; }

.map-toolbar, .editor-toolbar, .game-toolbar { padding: 18px; display: flex; align-items: center; gap: 18px; justify-content: space-between; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; }
.toolbar-actions.wrap { flex-wrap: wrap; }
.world-tabs { margin: 12px 0; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.world-tab { flex: 0 0 auto; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.035); cursor: pointer; font-weight: 800; font-size: 12px; }
.world-tab.is-active { color: #061219; background: var(--accent); border-color: transparent; }
.world-tab.is-locked { opacity: .34; }

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "map details";
  gap: 14px;
}
.map-main-column { grid-area: map; min-width: 0; }
.map-viewport { position: relative; min-height: 660px; overflow: hidden; background: radial-gradient(circle at 58% 16%, rgba(103,245,173,.15), transparent 26%), linear-gradient(180deg, #173542 0%, #102732 48%, #0a1b24 100%); }
.map-viewport::before { content: ""; position: absolute; inset: 58% 0 0; background: linear-gradient(160deg, rgba(30,88,74,.88), rgba(12,43,41,.98)); clip-path: polygon(0 20%, 18% 3%, 37% 24%, 58% 0, 74% 23%, 100% 7%, 100% 100%, 0 100%); }
.map-viewport::after { content: ""; position: absolute; inset: 70% -10% -20%; background: repeating-linear-gradient(120deg, rgba(103,245,173,.04) 0 2px, transparent 2px 20px); transform: rotate(-4deg); }
.map-sky-glow { position: absolute; inset: 0; background: radial-gradient(circle at 30% 25%, rgba(86,212,255,.14), transparent 32%), radial-gradient(circle at 75% 45%, rgba(201,150,255,.12), transparent 25%); pointer-events: none; }
.map-paths { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; overflow: visible; }
.map-path { fill: none; stroke: rgba(218,245,247,.28); stroke-width: .85; stroke-dasharray: 2 1.6; vector-effect: non-scaling-stroke; }
.map-path.is-complete { stroke: rgba(103,245,173,.8); }
.map-nodes { position: absolute; inset: 0; z-index: 3; }
.map-node { position: absolute; width: 52px; height: 52px; transform: translate(-50%, -50%); border-radius: 50%; border: 3px solid rgba(255,255,255,.34); display: grid; place-items: center; background: #183945; color: white; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.35); transition: transform .16s ease, filter .16s ease; }
.map-node:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.08); }
.map-node:disabled { cursor: not-allowed; filter: grayscale(.9); opacity: .36; }
.map-node.is-selected { outline: 4px solid rgba(255,255,255,.15); transform: translate(-50%, -50%) scale(1.1); }
.map-node.is-complete { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(103,245,173,.1), 0 10px 25px rgba(0,0,0,.4); }
.map-node[data-type="elite"] { background: #4a2d62; border-radius: 16px; }
.map-node[data-type="boss"] { width: 62px; height: 62px; background: #6a2438; border-color: var(--danger); clip-path: polygon(50% 0, 91% 22%, 91% 72%, 50% 100%, 9% 72%, 9% 22%); border-radius: 0; }
.map-node[data-type="treasure"], .map-node[data-type="shop"], .map-node[data-type="upgrade"], .map-node[data-type="event"], .map-node[data-type="camp"] { width: 44px; height: 44px; background: #3c4961; }
.map-node-label { position: absolute; top: calc(100% + 5px); left: 50%; transform: translateX(-50%); width: 120px; text-align: center; font-size: 10px; font-weight: 800; text-shadow: 0 2px 5px #000; pointer-events: none; }
.map-node-stars { position: absolute; bottom: calc(100% + 2px); white-space: nowrap; color: var(--warning); font-size: 10px; }
.map-floating-play {
  grid-area: action;
  display: none;
  position: static;
  width: 100%;
  z-index: auto;
}
.map-legend { position: absolute; left: 14px; bottom: 12px; z-index: 4; display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(4,13,18,.66); color: var(--muted); font-size: 9px; font-weight: 800; }
.map-legend span { display: flex; align-items: center; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); }
.dot.elite { background: var(--purple); }.dot.event { background: var(--warning); }.dot.boss { background: var(--danger); }

.node-panel { grid-area: details; min-height: 500px; padding: 20px; align-self: stretch; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; margin: 15px 0; }
.tag { padding: 6px 9px; border-radius: 999px; background: rgba(86,212,255,.09); border: 1px solid rgba(86,212,255,.18); color: #c9f2ff; font-size: 10px; font-weight: 800; }
.stats-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 20px 0; }
.stats-list div { padding: 10px 6px; border-radius: 12px; background: rgba(255,255,255,.035); text-align: center; }
.stats-list dt { color: var(--muted); font-size: 9px; font-weight: 800; }
.stats-list dd { margin: 4px 0 0; font-size: 14px; font-weight: 900; }
.lock-text { margin: 13px 0 0; color: var(--danger); font-size: 11px; text-align: center; }

.game-toolbar { margin-bottom: 12px; padding: 10px 12px; }
.hud-cluster { flex: 1; display: grid; grid-template-columns: repeat(5, minmax(70px, 1fr)); gap: 8px; }
.hud-cluster > div { min-width: 0; padding: 7px 10px; border-radius: 11px; background: rgba(255,255,255,.035); }
.hud-cluster span { display: block; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.hud-cluster strong { display: block; margin-top: 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; }
.canvas-panel { position: relative; height: min(78vh, 860px); min-height: 560px; overflow: hidden; }
#gameCanvas { display: block; width: 100%; height: 100%; min-width: 1px; min-height: 1px; touch-action: none; background: #071117; }
.canvas-status { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; pointer-events: none; background: radial-gradient(circle at center, rgba(18,52,62,.82), rgba(5,15,21,.96)); color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .05em; transition: opacity .18s ease; }
.canvas-status.is-ready { opacity: 0; }
.shot-controls { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: none; gap: 8px; z-index: 5; }
.shot-controls.is-visible { display: flex; }
.game-side { padding: 15px; display: flex; flex-direction: column; gap: 18px; }
.game-side section { padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.game-side section:last-child { border-bottom: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-heading span { color: var(--accent); font-size: 10px; font-weight: 900; }
.power-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.power-button { position: relative; min-height: 52px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.035); cursor: pointer; padding: 7px; text-align: left; }
.power-button.is-active { border-color: var(--accent); background: rgba(103,245,173,.1); }
.power-button strong { display: block; font-size: 10px; }
.power-button small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.power-count { position: absolute; top: 5px; right: 7px; color: var(--warning); font-size: 10px; font-weight: 900; }
.meter { height: 9px; margin: 7px 0 10px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.06); }
.meter i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--purple), #ff86d5); box-shadow: 0 0 12px rgba(201,150,255,.45); transition: width .2s ease; }
.select, .input, .json-area { width: 100%; border: 1px solid var(--line); border-radius: 11px; background: #0a1b23; color: var(--text); outline: none; }
.select, .input { min-height: 42px; padding: 0 11px; }
.json-area { min-height: 360px; padding: 12px; resize: vertical; font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.game-help p { color: var(--muted); font-size: 11px; line-height: 1.6; }

.editor-layout { display: grid; grid-template-columns: 260px minmax(420px, 1fr) 340px; gap: 12px; margin-top: 12px; }
.editor-tools, .editor-json, .editor-board-panel { padding: 16px; }
.editor-tools label { display: block; margin-bottom: 13px; color: var(--muted); font-size: 11px; font-weight: 800; }
.editor-tools label .input, .editor-tools label .select { margin-top: 5px; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.editor-grid { display: grid; grid-template-columns: repeat(9, minmax(34px, 1fr)); aspect-ratio: 9 / 10; gap: 4px; padding: 6px; border-radius: 12px; background: #061119; }
.editor-cell { position: relative; border: 1px dashed rgba(120,220,235,.15); border-radius: 6px; background: rgba(255,255,255,.02); cursor: crosshair; overflow: hidden; }
.editor-cell:hover { border-color: var(--accent); }
.editor-cell.is-filled { border-style: solid; background: rgba(86,212,255,.16); }
.editor-cell strong { position: absolute; inset: 0; display: grid; place-items: center; font: 800 11px ui-monospace, monospace; }
.editor-cell small { position: absolute; top: 2px; left: 3px; color: var(--warning); font-size: 8px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(2,8,12,.78); backdrop-filter: blur(10px); }
.modal-backdrop[hidden] { display: none; }
.modal-card { position: relative; width: min(760px, 100%); max-height: min(88vh, 900px); overflow: auto; padding: 24px; }
.modal-close { position: sticky; float: right; top: 0; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #0b1b23; cursor: pointer; }
.modal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 14px; }
.modal-option { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.035); cursor: pointer; }
.modal-option.is-selected { border-color: var(--accent); background: rgba(103,245,173,.08); }
.modal-option h3 { font-size: 13px; }
.modal-option p { min-height: 42px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.slider-row { display: grid; grid-template-columns: 190px 1fr 72px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.slider-row label { font-size: 11px; font-weight: 800; }
.slider-row output { color: var(--accent); text-align: right; font-size: 11px; font-weight: 900; }
.slider-row input[type="range"] { width: 100%; accent-color: var(--accent); }
.perk-card { position: relative; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.035); }
.perk-card.is-equipped { border-color: var(--accent); }
.perk-card .rarity { color: var(--purple); font-size: 9px; letter-spacing: .1em; font-weight: 900; }
.perk-card h3 { margin: 4px 0 7px; font-size: 14px; }
.perk-card p { color: var(--muted); font-size: 11px; line-height: 1.5; }
.star-row { color: var(--warning); font-size: 30px; letter-spacing: 8px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 15px 0; }
.result-stats > div { padding: 12px; border-radius: 12px; background: rgba(255,255,255,.035); text-align: center; }
.result-stats span { display: block; color: var(--muted); font-size: 9px; }
.result-stats strong { display: block; margin-top: 3px; font-size: 18px; }

.toast { position: fixed; z-index: 120; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 16px); min-width: 180px; max-width: calc(100vw - 28px); padding: 11px 16px; border: 1px solid rgba(103,245,173,.25); border-radius: 999px; background: rgba(7,23,28,.94); color: white; box-shadow: var(--shadow); text-align: center; font-size: 12px; font-weight: 800; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .map-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "map"
      "action"
      "details";
  }
  .game-layout { grid-template-columns: 1fr; }
  .map-floating-play {
    display: block;
    min-height: 54px;
    margin: 0;
    box-shadow: 0 12px 28px rgba(0,0,0,.28);
  }
  .node-panel { min-height: auto; }
  .game-side { display: grid; grid-template-columns: 1fr 1fr; }
  .game-help { display: none; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-board-panel { order: 1; }.editor-tools { order: 2; }.editor-json { order: 3; }
  .editor-grid { max-width: 720px; margin: 0 auto; }
}

@media (max-width: 700px) {
  .main-area { padding: 9px; }
  .topbar { padding-left: 9px; padding-right: 9px; gap: 6px; }
  .brand strong { font-size: 10px; }.brand small { display: none; }.brand-mark { width: 32px; height: 32px; }
  .icon-button { min-height: 34px; padding: 0 8px; font-size: 9px; }
  .currency-chip { min-width: 56px; padding: 7px 8px; }
  .map-toolbar, .editor-toolbar { align-items: flex-start; flex-direction: column; padding: 14px; }
  .toolbar-actions { width: 100%; overflow-x: auto; }
  .toolbar-actions .button { flex: 0 0 auto; }
  .map-viewport { min-height: 560px; }
  .map-layout { gap: 9px; }
  .game-toolbar { display: grid; grid-template-columns: auto 1fr auto; }
  .hud-cluster { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .hud-cluster > div:nth-child(4), .hud-cluster > div:nth-child(5) { display: none; }
  .hud-cluster > div { padding: 5px 7px; }
  .hud-cluster strong { font-size: 11px; }
  .canvas-panel { height: 68vh; min-height: 520px; }
  .game-side { grid-template-columns: 1fr; }
  .power-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .power-button { min-height: 48px; text-align: center; padding: 5px 2px; }
  .power-button strong { font-size: 8px; }.power-button small { display: none; }.power-count { top: 2px; right: 4px; font-size: 8px; }
  .stats-list { grid-template-columns: repeat(3, 1fr); }
  .slider-row { grid-template-columns: 1fr 70px; }
  .slider-row input { grid-column: 1 / -1; grid-row: 2; }
  .modal-card { padding: 18px; }
  .editor-grid { grid-template-columns: repeat(9, minmax(26px, 1fr)); gap: 2px; }
  .result-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition-duration: .01ms !important; }
}

/* =========================================================
   Complete edition: modes, accessibility, collection, tools
========================================================= */
:root { --text-scale: 1; }
html { font-size: calc(16px * var(--text-scale)); }
.slot-button { min-width: 72px; }
.feature-grid, .mode-hero-grid, .challenge-grid, .guide-grid, .achievement-grid, .skin-grid, .slot-grid, .dev-grid, .settings-grid, .check-grid {
  display: grid; gap: 12px;
}
.feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }
.feature-card, .mode-card, .challenge-card, .skin-card, .dev-grid button {
  border: 1px solid rgba(117, 224, 255, .22); border-radius: 14px; padding: 15px; text-align: left;
  background: linear-gradient(145deg, rgba(22,55,67,.9), rgba(7,20,28,.96)); color: var(--text-color, #eafaff); cursor: pointer;
}
.feature-card:hover, .mode-card:hover, .challenge-card:hover, .skin-card:not(:disabled):hover, .dev-grid button:hover { transform: translateY(-1px); border-color: rgba(103,245,173,.65); }
.feature-card strong, .mode-card strong, .challenge-card strong { display: block; margin-bottom: 7px; letter-spacing: .04em; }
.feature-card span, .mode-card span, .challenge-card span, .skin-card span { color: #a9c1cc; font-size: .82rem; }
.mode-hero-grid { grid-template-columns: repeat(2, minmax(0,1fr)); margin: 18px 0 22px; }
.mode-card p, .challenge-card p { color: #c7dbe3; line-height: 1.55; }
.challenge-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.challenge-card.is-cleared { border-color: rgba(103,245,173,.68); box-shadow: inset 0 0 0 1px rgba(103,245,173,.12); }
.guide-grid { grid-template-columns: repeat(2, minmax(0,1fr)); max-height: 58vh; overflow: auto; margin: 16px 0; padding-right: 4px; }
.guide-card { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 13px; border-radius: 13px; border: 1px solid rgba(255,255,255,.1); background: rgba(6,17,24,.72); }
.guide-card.is-seen { border-color: rgba(103,245,173,.35); }
.guide-card h3 { margin: 0 0 5px; }
.guide-card p { margin: 0; color: #bdd0d8; font-size: .86rem; line-height: 1.55; }
.guide-card small { display: inline-block; margin-top: 8px; color: #67f5ad; }
.guide-icon, .tutorial-big-icon { display: grid; place-items: center; border-radius: 12px; background: rgba(86,212,255,.12); color: #fff; font-weight: 900; font-size: 1.35rem; }
.tutorial-focus { text-align: center; max-width: 560px; margin: 0 auto 18px; }
.tutorial-big-icon { width: 82px; height: 82px; margin: 0 auto 16px; font-size: 2.2rem; }
.collection-summary, .dev-diagnostics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 20px; }
.collection-summary > div, .dev-diagnostics > div { padding: 12px; border-radius: 12px; background: rgba(5,16,23,.72); border: 1px solid rgba(255,255,255,.09); }
.collection-summary span, .dev-diagnostics span { display: block; color: #9cb6c1; font-size: .7rem; }
.collection-summary strong, .dev-diagnostics strong { display: block; margin-top: 4px; font-size: 1.15rem; }
.skin-grid { grid-template-columns: repeat(3, minmax(0,1fr)); margin-bottom: 20px; }
.skin-card { display: grid; gap: 7px; }
.skin-card:disabled { opacity: .42; cursor: not-allowed; }
.skin-card.is-selected { border-color: #67f5ad; }
.skin-card i { height: 42px; border-radius: 10px; background: linear-gradient(120deg, var(--skin-a), var(--skin-b)); box-shadow: 0 0 18px color-mix(in srgb, var(--skin-a) 35%, transparent); }
.achievement-grid { grid-template-columns: repeat(2, minmax(0,1fr)); max-height: 42vh; overflow: auto; }
.achievement-card { padding: 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.09); background: rgba(6,17,24,.7); opacity: .65; }
.achievement-card.is-unlocked { opacity: 1; border-color: rgba(247,227,109,.48); }
.achievement-card p { color: #b9cdd5; font-size: .83rem; }
.slot-grid { grid-template-columns: repeat(3, minmax(0,1fr)); margin-top: 18px; }
.slot-card { padding: 14px; border-radius: 13px; border: 1px solid rgba(255,255,255,.1); background: rgba(6,17,24,.76); }
.slot-card.is-active { border-color: #67f5ad; }
.pause-menu { display: grid; gap: 10px; margin: 18px 0; }
.dev-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.dev-grid button { text-align: center; }
.validation-log { max-height: 240px; overflow: auto; padding: 12px; border-radius: 10px; background: #03090d; color: #b8e8d1; font-size: .75rem; white-space: pre-wrap; }
.settings-grid { grid-template-columns: repeat(2, minmax(0,1fr)); margin: 16px 0; }
.settings-grid label { display: grid; gap: 7px; color: #c7dbe3; }
.check-grid { grid-template-columns: repeat(2, minmax(0,1fr)); margin: 14px 0 20px; }
.check-row { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 9px; background: rgba(255,255,255,.035); }
body.high-contrast { --panel-border: rgba(255,255,255,.46); }
body.high-contrast .panel, body.high-contrast .button, body.high-contrast .feature-card { border-width: 2px; }
body.color-safe .dot.stage, body.color-safe .dot.elite, body.color-safe .dot.event, body.color-safe .dot.boss { filter: grayscale(.2) contrast(1.35); }
body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
body.reduce-flashes .canvas-panel::after { display: none !important; }
body.one-handed-left .game-layout, body.one-handed-right .game-layout { grid-template-columns: 1fr; }
body.one-handed-left .game-side, body.one-handed-right .game-side { position: fixed; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 25; width: min(340px, 82vw); max-height: 44vh; overflow: auto; box-shadow: 0 16px 45px rgba(0,0,0,.55); }
body.one-handed-left .game-side { left: 8px; }
body.one-handed-right .game-side { right: 8px; }
body.one-handed-left .canvas-panel, body.one-handed-right .canvas-panel { min-height: 72vh; }
@media (max-width: 760px) {
  .feature-grid, .mode-hero-grid, .challenge-grid, .guide-grid, .achievement-grid, .skin-grid, .slot-grid, .dev-grid, .settings-grid, .check-grid { grid-template-columns: 1fr; }
  .collection-summary, .dev-diagnostics { grid-template-columns: repeat(2,1fr); }
  .slot-button { min-width: 58px; padding-inline: 8px; }
}

/* Animated tutorial demonstrations */
.tutorial-demo {
  position: relative;
  width: 112px;
  min-width: 112px;
  height: 82px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(86,212,255,.10), rgba(7,17,23,.72));
  box-shadow: inset 0 0 26px rgba(103,245,173,.06);
}
.tutorial-focus .tutorial-demo { width: min(280px, 100%); height: 150px; margin: 0 auto 18px; }
.tutorial-demo i { position: absolute; display: block; font-style: normal; }
.demo-ball { width: 12px; height: 12px; border-radius: 50%; background: var(--accent, #67f5ad); box-shadow: 0 0 12px rgba(103,245,173,.9); }
.demo-launcher { left: 48%; bottom: 7px; width: 24px; height: 8px; border-radius: 50%; background: #fff; opacity: .85; }
.demo-guide { left: 54%; bottom: 18px; width: 2px; height: 62px; transform: rotate(28deg); transform-origin: bottom; background: linear-gradient(to top, rgba(255,255,255,.9), transparent); }
.tutorial-demo-basics .demo-ball { left: 55%; bottom: 22px; animation: tutorial-launch 1.6s ease-in-out infinite; }
.demo-block { width: 42px; height: 34px; border-radius: 8px; display:grid!important; place-items:center; color:#fff; font-weight:900; background:#56d4ff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
.demo-block.phase { left:35px; top:24px; background: repeating-linear-gradient(135deg,#71808c 0 6px,#aeb9c2 6px 12px); }
.demo-pulse { inset:16px 27px; border:2px solid #fff; border-radius:12px; animation:tutorial-pulse 1.2s ease-out infinite; }
.demo-portal { width:32px; height:32px; border:4px solid #56d4ff; border-radius:50%; top:25px; box-shadow:0 0 12px #56d4ff; }
.demo-portal.a { left:8px; } .demo-portal.b { right:8px; border-color:#b889ff; box-shadow:0 0 12px #b889ff; }
.portal-ball { left:20px; top:35px; animation:tutorial-portal 1.8s linear infinite; }
.demo-reflector { left:44px; top:18px; width:8px; height:56px; background:#ffd15c; transform:rotate(45deg); border-radius:6px; }
.reflect-ball { left:12px; top:55px; animation:tutorial-reflect 1.5s ease-in-out infinite; }
.demo-block.moving { left:34px; top:15px; animation:tutorial-move 1.8s ease-in-out infinite alternate; }
.demo-direction { left:42px; bottom:5px; font-size:22px; color:#fff; }
.demo-block.regen { left:35px; top:25px; background:#59d98e; }
.demo-plus { right:18px; top:5px; color:#67f5ad; font-size:28px; font-weight:900; animation:tutorial-rise 1.4s ease-out infinite; }
.demo-block.linked { top:25px; width:34px; } .demo-block.linked.left { left:10px; } .demo-block.linked.right { right:10px; }
.demo-link { left:42px; top:40px; width:28px; height:3px; background:#ffd15c; box-shadow:0 0 8px #ffd15c; animation:tutorial-link .9s alternate infinite; }
.demo-switch { left:10px; top:28px; width:30px; height:25px; border-radius:6px; background:#67f5ad; color:#071117; font-weight:900; display:grid!important; place-items:center; }
.demo-gate { right:20px; top:10px; width:8px; height:62px; background:repeating-linear-gradient(to bottom,#ffd15c 0 8px,transparent 8px 14px); animation:tutorial-gate 1.6s steps(2,end) infinite; }
.demo-gravity { left:40px; top:25px; width:32px; height:32px; border:5px double #b889ff; border-radius:50%; box-shadow:0 0 18px #b889ff; }
.gravity-ball { left:10px; top:12px; animation:tutorial-orbit 1.8s linear infinite; transform-origin:46px 29px; }
.demo-block.bomb { left:35px; top:24px; background:#ff5268; }
.demo-countdown { left:27px; top:16px; width:58px; height:50px; border:2px solid #ff5268; border-radius:12px; animation:tutorial-countdown 1s steps(2,end) infinite; }
.demo-boss-core { left:35px; top:25px; width:42px; height:34px; border-radius:10px; background:#ff5bd6; color:#fff; font-size:10px; font-weight:900; display:grid!important; place-items:center; }
.demo-boss-part { top:32px; width:22px; height:22px; border-radius:6px; background:#56d4ff; } .demo-boss-part.left{left:8px}.demo-boss-part.right{right:8px}
.tutorial-demo-boss .demo-boss-core { animation:tutorial-core 1.5s ease-in-out infinite; }
.demo-ball.power { top:35px; } .demo-ball.power.a{left:20px;background:#ffd15c}.demo-ball.power.b{left:50px;background:#ff5bd6}.demo-ball.power.c{right:20px;background:#56d4ff}
.tutorial-demo-powers .demo-ball { animation:tutorial-power 1.5s ease-in-out infinite alternate; }
.demo-ultimate { inset:0; display:grid!important; place-items:center; color:#fff09a; font-size:48px; text-shadow:0 0 20px #ffd15c; animation:tutorial-core 1.2s ease-in-out infinite; }
.demo-ring { left:23px; top:8px; width:64px; height:64px; border:2px solid #ffd15c; border-radius:50%; animation:tutorial-pulse 1.2s linear infinite; }
.demo-block.danger { left:35px; top:12px; background:#ff765f; animation:tutorial-danger .7s ease-in-out infinite alternate; }
.demo-line { left:8px; right:8px; bottom:14px; height:3px; background:#ff5268; box-shadow:0 0 10px #ff5268; }
.demo-infinity { left:20px; top:10px; font-size:48px; color:#67f5ad; } .demo-boss-small { right:20px; top:28px; font-size:28px; color:#ff5bd6; }
@keyframes tutorial-launch { 0%{transform:translate(0,0)} 55%{transform:translate(27px,-58px)} 100%{transform:translate(52px,-20px)} }
@keyframes tutorial-pulse { from{transform:scale(.75);opacity:.9} to{transform:scale(1.2);opacity:0} }
@keyframes tutorial-portal { 0%{transform:translateX(0);opacity:1} 42%{transform:translateX(16px);opacity:0} 58%{transform:translateX(64px);opacity:0} 100%{transform:translateX(72px);opacity:1} }
@keyframes tutorial-reflect { 0%{transform:translate(0,0)} 50%{transform:translate(34px,-26px)} 100%{transform:translate(75px,4px)} }
@keyframes tutorial-move { from{transform:translateX(-22px)} to{transform:translateX(22px)} }
@keyframes tutorial-rise { from{transform:translateY(18px);opacity:0} to{transform:translateY(-3px);opacity:1} }
@keyframes tutorial-link { from{opacity:.2} to{opacity:1} }
@keyframes tutorial-gate { 0%,45%{opacity:1} 50%,100%{opacity:.12} }
@keyframes tutorial-orbit { to{transform:rotate(360deg)} }
@keyframes tutorial-countdown { 0%{opacity:1} 50%{opacity:.28} }
@keyframes tutorial-core { 50%{transform:scale(1.12);filter:brightness(1.35)} }
@keyframes tutorial-power { to{transform:translateY(-18px) scale(1.25)} }
@keyframes tutorial-danger { to{filter:brightness(1.5);box-shadow:0 0 18px #ff5268} }
.reduced-motion .tutorial-demo i { animation: none!important; }
@media (max-width: 520px) { .guide-card .tutorial-demo { width:84px; min-width:84px; height:72px; } }

/* =========================================================
   Advanced play: fusion, undo, puzzles, route contracts
========================================================= */
.game-toolbar-actions { display: flex; align-items: center; gap: 7px; }
.undo-button { white-space: nowrap; border-color: rgba(157,223,255,.24); }
.undo-button:not(:disabled) { color: #dff6ff; box-shadow: inset 0 0 0 1px rgba(157,223,255,.08); }
.button.fusion {
  border-color: rgba(255, 211, 106, .32);
  background: linear-gradient(135deg, rgba(255,211,106,.13), rgba(201,150,255,.12));
  color: #fff1bd;
}
.button.fusion.is-active { border-color: #ffd36a; box-shadow: 0 0 20px rgba(255,211,106,.18); }
.fusion-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; margin-top: 16px; }
.fusion-card {
  min-width: 0; padding: 15px; border: 1px solid rgba(255,211,106,.2); border-radius: 15px;
  background: linear-gradient(145deg, rgba(30,47,57,.96), rgba(8,20,28,.98)); color: var(--text); text-align: left; cursor: pointer;
}
.fusion-card:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(255,211,106,.7); }
.fusion-card:disabled { cursor: not-allowed; opacity: .42; }
.fusion-card.is-selected { border-color: #ffd36a; box-shadow: inset 0 0 0 1px rgba(255,211,106,.15); }
.fusion-card h3 { margin: 8px 0 6px; font-size: 14px; }
.fusion-card p { min-height: 42px; margin-bottom: 9px; color: #c8d8df; font-size: 11px; line-height: 1.5; }
.fusion-card small { display: block; color: #9cb6c1; font-size: 9px; line-height: 1.5; }
.fusion-card strong { display: block; margin-top: 10px; color: #ffd36a; font-size: 10px; letter-spacing: .08em; }
.fusion-icon { display: inline-grid; place-items: center; min-width: 50px; min-height: 34px; padding: 0 10px; border-radius: 999px; background: rgba(255,211,106,.1); font-size: 20px; }
.puzzle-card { border-color: rgba(157,223,255,.24); }
.puzzle-card.is-cleared { border-color: rgba(255,228,135,.66); }
.route-effect-tag { border-color: rgba(255,211,106,.32); background: rgba(255,211,106,.1); color: #ffe7a3; }
.route-effect-tag.is-warning { border-color: rgba(255,111,125,.38); background: rgba(255,111,125,.1); color: #ffc3ca; }

@media (max-width: 700px) {
  .game-toolbar { grid-template-columns: auto minmax(0,1fr); }
  .game-toolbar-actions { grid-column: 1 / -1; width: 100%; }
  .game-toolbar-actions .button { flex: 1 1 0; min-width: 0; padding-inline: 8px; }
  .fusion-grid { grid-template-columns: 1fr; }
  .fusion-card p { min-height: 0; }
}


/* ===== Tactical expansion: active enemies, allied blocks and secret routes ===== */
.map-path.is-secret {
  stroke: rgba(255, 229, 126, .9);
  stroke-width: 1.15;
  stroke-dasharray: 1.2 1.1;
  filter: drop-shadow(0 0 4px rgba(255, 220, 100, .7));
  animation: secret-path-pulse 1.8s ease-in-out infinite;
}
.map-node.is-secret {
  border-color: #ffe67d;
  box-shadow: 0 0 0 4px rgba(255, 230, 125, .12), 0 0 24px rgba(255, 210, 80, .42), 0 10px 25px rgba(0,0,0,.4);
}
.map-node.is-secret::after {
  content: "✧";
  position: absolute;
  right: -7px;
  top: -10px;
  color: #fff1a5;
  font-size: 17px;
  text-shadow: 0 0 8px #ffd45b;
}
.secret-route-tag {
  border-color: rgba(255, 223, 99, .45);
  background: rgba(255, 214, 80, .12);
  color: #fff1ac;
}
@keyframes secret-path-pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .map-path.is-secret { animation: none; }
}
