/* Page + fixed stage */
body {
  margin: 0;
  padding: 0;
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

#container {
  position: relative;
  width: 500px;
  height: 600px;
  overflow: hidden;
}

/* Two canvases layered (your original sizes) */
canvas {
  position: absolute;
  inset: 0;
  width: 500px;
  height: 600px;
  touch-action: none; /* better mobile touch */
}

/* ---------- Arcade overlay ---------- */
#arcade-room {
  position: absolute;
  inset: 0;
  z-index: 10;                 /* above canvases */
  overflow: hidden;
  background: transparent;
  transform-origin: 50% 50%;
  will-change: transform;
}

#arcade-room .arcade-floor {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 50% 60%, rgba(0,0,0,0) 0%, rgba(0,0,0,.5) 70%, rgba(0,0,0,.75) 100%),
    repeating-linear-gradient(0deg, rgba(0,0,0,.04) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.04) 0 1px, transparent 1px 32px),
    #182026;
}

/* Node layout on a 0..100 virtual grid mapped to the container */
#arcade-room .arcade-node {
  --size: 9; /* percentage of room width */
  position: absolute;
  left: calc(var(--x) * 1% - var(--size) * 0.5%);
  top:  calc(var(--y) * 1% - var(--size) * 0.5%);
  width: calc(var(--size) * 1%);
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  border: 2px solid #0b5cff;
  background: #e6eef3;
  color: #111;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

#arcade-room .arcade-node .icon { font-size: 28px; line-height: 1; }
#arcade-room .arcade-node .label {
  position: absolute; bottom: -1.6em; left: 50%; transform: translateX(-50%);
  font: 600 12px/1.2 system-ui, sans-serif; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  white-space: nowrap;
}

#arcade-room .arcade-node:hover,
#arcade-room .arcade-node:focus-visible {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 16px 30px rgba(0,0,0,.45);
  background: #fff;
  outline: none;
}

/* Back button */
#arcade-back {
  position: absolute; left: 8px; top: 8px;
  z-index: 20;
  background: rgba(0,0,0,.5);
  color: #fff; border: 1px solid rgba(255,255,255,.3);
  border-radius: 6px; padding: 6px 10px; cursor: pointer;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  #arcade-room, #arcade-room .arcade-node { transition: none !important; }
}
/* ==== Daedalus Blues (light default) ==== */
:root{
  --bg: #eaf3ff;                 /* calming light-blue background */
  --panel: #f3f7ff;              /* panels/cards */
  --ink: #0e2240;                /* primary text */
  --muted: #6a7a95;              /* list/inactive text */
  --cell: #dfe9fb;               /* grid cell bg */
  --cell-border: #c9d7ef;
  --cell-hover: #cfe0fa;
  --cell-found: #d9e8ff;
  --accent: #ff8a2b;             /* orange for strike/highlight */
  --glow: rgba(15, 67, 150, .35);/* cool blue shadow */
}

/* Auto-dim for dark mode while keeping the same hues */
@media (prefers-color-scheme: dark){
  :root{
    --bg: #0d1119;
    --panel: #121a26;
    --ink: #d9e4f7;
    --muted: #9fb0cb;
    --cell: #0d1522;
    --cell-border: rgba(255,255,255,.06);
    --cell-hover: #162132;
    --cell-found: #121d2e;
    --accent: #ffb35d;           /* amberish orange for contrast */
    --glow: rgba(45,124,255,.25);
  }
}

/* Apply background behind your 500×600 stage so it isn’t a dark sticker on white */
body{ background: var(--bg); }

/* Optional: tint the arcade floor to your scheme */
#arcade-room .arcade-floor{
  background:
    radial-gradient(120% 80% at 50% 60%, rgba(0,0,0,0) 0%, rgba(0,0,0,.35) 70%, rgba(0,0,0,.55) 100%),
    #182026;
  box-shadow: 0 10px 40px var(--glow) inset;
}

/* ==== Word Search visual tokens (no layout assumptions) ==== */
.ws-stage{ background: var(--panel); }
.ws-grid    { --ws-gap: 2px; }
.ws-cell{
  background: var(--cell);
  border: 1px solid var(--cell-border);
  color: var(--ink);
}
.ws-cell.ws-hover{ background: var(--cell-hover); }
.ws-cell.ws-found{ background: var(--cell-found); color: var(--ink); }
.ws-lines line{ stroke: var(--accent); }

/* Word list as COLUMNS (not rows) above the grid */
.ws-list{
  column-gap: 12px;
  /* start at 2 narrow columns in your 500px stage */
  column-count: 2;
  list-style: none; margin: 0; padding: 0;
}
.ws-list li{
  break-inside: avoid;
  background: var(--cell);
  border: 1px solid var(--cell-border);
  border-radius: 10px;
  padding: 6px 10px;
  margin: 6px 0;
  color: var(--ink);
}
.ws-list li.ws-done{
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--accent);
  color: var(--muted);
}

/* scale up to 3 columns if/when you widen the arcade */
@media (min-width: 760px){ .ws-list{ column-count: 3; } }

/* Back button to match scheme */
.ws-back{
  background: var(--cell);
  border: 1px solid var(--cell-border);
  color: var(--ink);
  box-shadow: 0 8px 20px var(--glow);
}

/* When arcade is open, stop centering the fixed 500×600 box */
body.arcade-open {
  display: block;         /* override the flex centering */
  height: 100dvh;         /* dynamic viewport height (mobile-safe) */
}

/* Let the container fill the viewport while in arcade mode */
#container.arcade-open {
  width: 100dvw;
  height: 100dvh;
}

/* Optional: give the arcade a proper backdrop when full screen */
#arcade-room.arcade-open {
  background: var(--bg);
}

/* ---------- Arcade tiles: grid-aligned option ---------- */
/* Toggle by adding class "grid" to #arcade-room */
#arcade-room.grid{
  /* place nodes on a responsive grid instead of absolute coords */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  padding: 24px;
  align-content: start;
}

/* Keep the floor as a background layer in grid mode */
#arcade-room.grid .arcade-floor{
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* In grid mode, nodes are regular grid items (not absolutely positioned) */
#arcade-room.grid .arcade-node{
  position: static;          /* overrides absolute */
  width: auto;               /* let the grid size it */
  aspect-ratio: 1 / 1;       /* keep them square */
  --size: auto;              /* ignore --x/--y */
}

/* Label sits inside the tile edge in grid mode */
#arcade-room.grid .arcade-node .label{
  position: static;
  transform: none;
  margin-top: 10px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}

/* Optional: slightly larger icon for nicer balance in squares */
#arcade-room.grid .arcade-node .icon{ font-size: 32px; }
