* { box-sizing: border-box; }
:root { color-scheme: dark; font-family: ui-sans-serif, system-ui, sans-serif; color: #f4eedb; background: #102a32; }
body { margin: 0; min-height: 100dvh; display: grid; place-items: center; padding: 32px; background: radial-gradient(ellipse at 80% 0, #25414c, transparent 65%), #102a32; }
button { font: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid #ffe69c; outline-offset: 4px; }
.game { display: grid; grid-template-columns: .78fr 1.22fr; align-items: center; gap: clamp(30px, 6vw, 80px); width: min(1080px, 100%); }
.eyebrow { font-size: 9px; font-weight: 800; letter-spacing: 2px; color: #adc4bb; display: flex; gap: 10px; align-items: center; margin: 0 0 26px; }
.spark { color: #ffce76; font-size: 24px; line-height: 1; }
h1 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(48px, 7.5vw, 90px); font-weight: 400; line-height: 1; letter-spacing: -4px; margin: 0 0 20px; }
h1 > span { color: #ffce76; }
.intro { font-size: clamp(16px, 2vw, 21px); color: #c5d3cb; line-height: 1.65; margin: 0 0 28px; }
.instructions { display: grid; grid-template-columns: 27px 1fr; gap: 12px; align-items: baseline; padding: 24px 0; border-top: 1px solid #436068; border-bottom: 1px solid #436068; }
.instructions p { font-size: 12px; color: #cedbd5; line-height: 1.6; margin: 0; }
.step { color: #c5a76b; font-family: ui-monospace, monospace; font-size: 10px; }
.status { min-height: 130px; margin-top: 28px; }
.status-label, .label { color: #a3c1b9; font-size: 9px; letter-spacing: 2px; font-weight: 750; margin: 0 0 9px; }
.status h2 { font-family: Georgia, serif; font-size: 26px; font-weight: 400; margin: 0 0 10px; }
.status > p:last-child { font-size: 12px; line-height: 1.7; color: #b8ccc3; margin: 0; }
.primary { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 15px 20px; border-radius: 10px; border: 1px solid #ffce76; color: #183039; background: #ffce76; font-weight: 750; font-size: 13px; }
.primary:hover:enabled { background: #ffe0a4; }
.primary:disabled { background: transparent; color: #66868b; border-color: #42616a; cursor: default; }
.quiet { font-size: 10px; color: #8caaa6; line-height: 1.7; margin: 17px 0 0; }
.puzzle { min-width: 0; background: #15323c; border: 1px solid #48616a; border-radius: 22px; padding: 24px; box-shadow: 0 28px 80px #05192255; }
.board-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 0 5px; }
.board-header h2 { font-size: 17px; font-weight: 600; margin: 6px 0 0; }
.night-mark { color: #ffce76; font-size: 39px; line-height: 1; }
.optics { position: relative; aspect-ratio: 1; background: radial-gradient(ellipse, #1e3c49, #132b37 75%); border: 1px solid #375361; border-radius: 15px; }
.cells { position: absolute; inset: 5.6962%; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(7, 1fr); }
.tile { position: relative; min-width: 0; min-height: 0; margin: 2px; border: 1px solid #345361; border-radius: 7px; background: #213e4b; display: grid; place-items: center; }
.tile.empty { background: #1a3440; border-color: #294651; }
.tile.lit { border-color: #6b735b; background-color: #303e41; }
.tile svg { width: 65%; height: 65%; overflow: visible; }
.tile.mirror { background: #345663; border-color: #61838e; transition: background .15s; }
.tile.mirror:hover:enabled { background: #496d78; }
.tile.mirror:disabled { cursor: default; }
.mirror line { stroke: #cae6e6; stroke-width: 3.5; stroke-linecap: round; }
.mirror circle { fill: #90bbc3; }
.tile.hinted { outline: 3px solid #ffce76; outline-offset: 1px; z-index: 2; }
.gem path { fill: #7196a2; stroke: #a2bbc0; stroke-width: 1; }
.gem.lit path { fill: #ffdc8c; stroke: #fff4c6; }
.goal rect { fill: #527b83; stroke: #a2c5c6; stroke-width: 1; }
.goal path { fill: #89adb3; }
.goal.lit rect { fill: #ffcf75; stroke: #ffecc0; }
.goal.lit path { fill: #ffe8ac; }
.block { background: #132a33; border: 1px solid #45606a; }
.block svg { width: 45%; }
.block path { stroke: #526f77; stroke-width: 2; }
#beam { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
#beam path { fill: none; stroke: #ffe09c; stroke-linecap: round; stroke-linejoin: round; }
#beam-line { stroke-width: .035; }
#beam-glow { stroke-width: .12; opacity: .65; }
#source > circle { fill: #ffce76; }
#source .source-core { fill: #fff3c9; }
.board-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 4px; }
.facts { display: flex; gap: 24px; }
.facts p { margin: 0; }
.facts b { display: block; font-size: 21px; font-weight: 500; color: #ffe2a7; font-variant-numeric: tabular-nums; }
.facts span { font-size: 9px; color: #a3beb8; }
.tools { display: flex; gap: 7px; }
.tools button { border: 1px solid #506d75; background: #213f49; border-radius: 8px; color: #d5e1d8; padding: 10px; font-size: 11px; }
.tools button:hover:enabled { background: #345762; }
.tools button:disabled { opacity: .4; cursor: default; }
#reset { font-size: 19px; padding: 5px 11px; }
.levels { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; padding-top: 16px; border-top: 1px solid #3b5862; }
.levels button { min-width: 0; aspect-ratio: 1; border-radius: 8px; border: 1px solid #3f5e69; background: transparent; color: #a9c2bc; font-size: 11px; position: relative; }
.levels button[aria-current="true"] { background: #ffce76; border-color: #ffce76; color: #1a3339; font-weight: 800; }
.levels .completed::after { content: ''; width: 4px; height: 4px; background: #a8d7b7; border-radius: 50%; position: absolute; bottom: 4px; left: calc(50% - 2px); }
.levels .completed[aria-current="true"]::after { background: #245347; }
.progress { font-size: 10px; color: #91afa8; text-align: center; margin: 14px 0 0; }
@media (max-width: 740px) {
  body { display: block; padding: 20px 12px; }
  .game { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; max-width: 520px; margin: auto; }
  .story { display: contents; }
  .eyebrow { grid-row: 1; margin-bottom: 14px; font-size: 8px; }
  h1 { grid-row: 2; font-size: 64px; margin-bottom: 10px; }
  .intro { grid-row: 3; font-size: 15px; margin-bottom: 15px; }
  .intro br { display: none; }
  .instructions { grid-row: 4; padding: 14px 0; gap: 6px 10px; }
  .status { grid-row: 6; min-height: 0; margin: 18px 4px; }
  .primary { grid-row: 7; }
  .status h2 { font-size: 23px; }
  .quiet { display: none; }
  .puzzle { grid-row: 5; width: 100%; margin-top: 18px; padding: 16px 12px; border-radius: 17px; }
  .board-header h2 { font-size: 15px; }
  .tile { margin: 1.5px; border-radius: 5px; }
  .facts { gap: 15px; }
  .facts b { font-size: 19px; }
  .tools button { font-size: 10px; padding: 9px; }
  .board-footer { gap: 8px; }
  .levels { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
