/* Lampline — original browser puzzle. Game prototype by DARBEEN · not a client project.
   Motion: tile turn = transform only, 160ms strong ease-out; lamp glow = opacity; press = scale(0.97);
   hover only on fine pointers; reduced motion = instant turns, no glow pulse.
   Brand rule: culturally neutral, no national/folk motifs, no flags, nothing forge/metal/fire. */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #0c0d10;
  --ink-2: #363a43;
  --ink-3: #5b6069;
  --line: #e1e4ea;
  --line-2: #c9ced8;
  --accent: #2444d8;
  --accent-2: #1d36b5;
  --board: #14161b;
  --tile: #1e2128;
  --tile-2: #262a33;
  --pipe: #555b69;
  --light: #ffcf5a;
  --sans: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", "Noto Sans", "Noto Sans Armenian", Arial, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --r: 18px;
  --max: 1160px;
  --gut-l: max(16px, env(safe-area-inset-left));
  --gut-r: max(16px, env(safe-area-inset-right));
  color-scheme: light;
}
html:lang(hy) { --sans: "Noto Sans Armenian", "Segoe UI", "Sylfaen", system-ui, -apple-system, Arial, sans-serif; }
@media (min-width: 768px) { :root { --gut-l: max(32px, env(safe-area-inset-left)); --gut-r: max(32px, env(safe-area-inset-right)); } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; background: var(--bg); }
body { margin: 0; font: 16px/1.55 var(--sans); color: var(--ink); background: var(--bg); }
h1, h2, p, ol, ul { margin: 0; }
.wrap { width: 100%; max-width: calc(var(--max) + var(--gut-l) + var(--gut-r)); margin: 0 auto; padding: 0 var(--gut-r) 0 var(--gut-l); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 10; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Demo strip */
.strip { background: var(--ink); color: #e8eaef; font-size: 13px; }
.strip__in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding-top: 6px; padding-bottom: 6px; }
.strip__text { display: flex; align-items: center; gap: 8px; }
.strip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--light); flex: none; }
.strip__back { display: inline-flex; align-items: center; gap: 6px; color: #fff; text-decoration: none; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .strip__back:hover { text-decoration: underline; } }

/* Top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; padding-bottom: 18px; }
.logo { font: 760 15px/1 ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif; letter-spacing: 0.14em; color: var(--ink); text-decoration: none; }
.logo span { letter-spacing: 0.02em; font-weight: 600; color: var(--ink-3); margin-left: 4px; }
.langs { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.langs button { min-width: 40px; min-height: 36px; border: 0; border-radius: 999px; background: transparent; font: 600 12px/1 var(--sans); color: var(--ink-3); cursor: pointer; }
.langs button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* Intro */
.intro { padding: 8px 0 22px; display: grid; gap: 10px; }
.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink-2); }
.tags li:first-child { background: #fff4d6; border-color: #f1dc9f; color: #6b4b00; }
h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.75rem); line-height: 1.1; letter-spacing: -0.02em; }
html:lang(hy) h1 { letter-spacing: 0; }
.task { color: var(--ink-3); max-width: 60ch; }

.layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); padding-bottom: 40px; }
@media (min-width: 960px) { .layout { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; } }

/* Play area */
.play { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(14px, 3vw, 24px); display: grid; gap: 14px; }
.hud { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.hud__item { font-size: 14px; color: var(--ink-3); display: flex; align-items: baseline; gap: 6px; }
.hud__item b { font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; min-width: 2ch; }
.hud .btn { margin-left: auto; }

.board-wrap { --end: clamp(22px, 5vw, 40px); display: grid; grid-template-columns: var(--end) minmax(0, 460px) var(--end); justify-content: center; align-items: center; gap: 6px; background: var(--board); border-radius: 16px; padding: clamp(8px, 2vw, 14px) clamp(4px, 1.4vw, 10px); }
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(3px, 0.8vw, 6px); width: 100%; max-width: 460px; margin: 0 auto; }
.end { color: var(--pipe); display: grid; place-items: center; }
.end svg { width: 100%; height: auto; display: block; }
.end--source { color: var(--light); }
.lamp__glow { opacity: 0.35; transition: opacity 300ms var(--ease-out); }
.board-wrap[data-state="won"] .end--lamp { color: var(--light); }
.board-wrap[data-state="won"] .lamp__glow { opacity: 1; }

.tile { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: clamp(6px, 1.4vw, 10px); background: var(--tile); cursor: pointer; display: block; width: 100%; touch-action: manipulation; transition: transform 120ms var(--ease-out), background-color 160ms var(--ease-out); }
.tile svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tile .rot { transform-origin: 50% 50%; transform-box: view-box; transition: transform 160ms var(--ease-out); }
.tile .pipe { stroke: var(--pipe); stroke-width: 15; stroke-linecap: round; fill: none; transition: stroke 160ms var(--ease-out); }
.tile .hub { fill: var(--pipe); transition: fill 160ms var(--ease-out); }
.tile[data-lit="true"] { background: var(--tile-2); }
.tile[data-lit="true"] .pipe { stroke: var(--light); }
.tile[data-lit="true"] .hub { fill: var(--light); }
.tile:active { transform: scale(0.97); }
.tile:focus-visible { outline: 3px solid #8fa6ff; outline-offset: 2px; }
.tile[aria-disabled="true"] { cursor: default; }
@media (hover: hover) and (pointer: fine) { .tile:not([aria-disabled="true"]):hover { background: var(--tile-2); } }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-3); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend__src { background: var(--light); }
.legend__lamp { background: var(--pipe); }

.result[hidden] { display: none; }
.result { border-radius: 14px; background: #fff8e6; border: 1px solid #f1dc9f; padding: 14px 16px; display: grid; gap: 12px; }
.result__title { font-weight: 650; font-size: 17px; }
.result__title:focus { outline: none; }
.result__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; border-radius: 999px; font: 600 14px/1.2 var(--sans); text-decoration: none; cursor: pointer; border: 1px solid transparent; text-align: center; transition: transform 120ms var(--ease-out), background-color 160ms var(--ease-out), border-color 160ms var(--ease-out); }
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--ghost { background: transparent; color: #111318; border-color: #b8bec9; }
@media (hover: hover) and (pointer: fine) { .btn--primary:hover { background: var(--accent-2); border-color: var(--accent-2); } .btn--ghost:hover { background: rgba(17, 19, 24, 0.04); border-color: #8f97a6; } }

/* Side */
.side { display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(16px, 3vw, 22px); display: grid; gap: 10px; }
.card h2 { font-size: 17px; line-height: 1.3; }
.steps { padding-left: 1.3em; display: grid; gap: 6px; color: var(--ink-2); }
.did { list-style: none; padding: 0; display: grid; gap: 8px; color: var(--ink-2); }
.did li { position: relative; padding-left: 18px; }
.did li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 8px; height: 8px; border-radius: 2px; background: var(--light); }

.foot { padding-top: 8px; padding-bottom: 32px; font-size: 13px; color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) {
  .tile, .tile .rot, .tile .pipe, .tile .hub, .btn, .lamp__glow { transition: none; }
  .tile:active, .btn:active { transform: none; }
}
