/* ── Puzzles Suite — page & tool styles ────────────────────────────
   Builds on css/shared.css design tokens (:root). LK Forge brand family
   (Orbitron display + Outfit body + JetBrains Mono numerics), with an
   amber accent (#f59e0b). 100% client-side — no network calls. */

:root {
  /* Suite brand accent (amber) — overrides the indigo default from
     shared.css so this suite gets its own identity. */
  --accent:       #f59e0b;
  --accent-h:     #d97706;
  --accent-bg:    #fffbeb;
  --accent-fg:    #92400e;
  --accent-light: #fbbf24;
  --icon-bg:      #fde68a;
}

main { max-width: 860px; margin: 0 auto; padding: 20px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Page shell (hero / hub grid / section / faq / footer) ───────────────
   css/shared.css doesn't define these; ported from the sibling suite
   template (public/tools/productivity/css/productivity.css) so hub and
   tool pages in this suite render correctly. */
.tool-hero { max-width: 860px; margin: 0 auto; padding: 36px 20px 4px; }
.tool-hero .hero-head { display: flex; align-items: center; gap: 16px; }
.tool-hero .hero-icon {
  flex-shrink: 0; width: 52px; height: 52px; border-radius: 14px;
  background: var(--accent); display: flex; align-items: center; justify-content: center;
}
.tool-hero .hero-icon svg { width: 30px; height: 30px; stroke: #fff; fill: none; }
.tool-hero h1 { font-family: 'Orbitron', sans-serif; font-size: clamp(1.55rem, 4.2vw, 2.2rem); font-weight: 900; letter-spacing: -.5px; line-height: 1.2; }
.tool-hero .subtitle { color: var(--muted); font-size: 1.02rem; margin-top: 12px; max-width: 680px; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(264px, 1fr)); gap: 18px; margin-top: 8px; }
.hub-card {
  position: relative; display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.hub-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow-lg); text-decoration: none; }
.hub-card .hub-tag { position: absolute; top: 18px; right: 18px; font-size: .72rem; font-weight: 700; color: var(--accent-fg); background: var(--accent-bg); padding: 2px 9px; border-radius: 999px; }
.hub-card .hub-icon { width: 52px; height: 52px; border-radius: 12px; background: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.hub-card .hub-icon svg { width: 27px; height: 27px; stroke: #fff; fill: none; }
.hub-card h2 { font-family: 'Orbitron', sans-serif; font-size: 1.15rem; font-weight: 700; color: var(--text); margin-bottom: 7px; }
.hub-card p { font-size: .9rem; color: var(--muted); line-height: 1.6; margin-bottom: 16px; }
.hub-card .hub-open { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 700; color: var(--accent); }
.hub-note { max-width: 860px; margin: 4px auto 0; padding: 0 20px; color: var(--muted); font-size: .92rem; }
.section { max-width: 860px; margin: 16px auto; padding: 24px 20px; }
.section > h2 { font-family: 'Orbitron', sans-serif; font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
.section > .section-sub { color: var(--muted); margin-bottom: 20px; }
.section-sub a { color: var(--accent); }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.faq summary { cursor: pointer; padding: 16px 18px; font-weight: 700; font-size: .98rem; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; float: right; color: var(--accent); font-weight: 700; }
.faq details[open] summary::after { content: '\2013'; }
.faq .faq-body { padding: 0 18px 16px; font-size: .92rem; color: var(--muted); line-height: 1.7; }
.faq .faq-body a { color: var(--accent); }
footer.page-footer { border-top: 1px solid var(--border); padding: 24px 20px; text-align: center; font-size: .82rem; color: var(--muted); margin-top: 24px; }
footer.page-footer nav { margin-bottom: 6px; }
footer.page-footer nav a { color: var(--muted); }
footer.page-footer nav a:hover { color: var(--text); }

/* Tool-specific maze generator styles are added in Task 5. */

@media print {
  body * { visibility: hidden; }
  .maze-wrap, .maze-wrap * { visibility: visible; }
  .maze-wrap { position: absolute; inset: 0; margin: 0; padding: 0; }
  #maze-canvas { width: 100% !important; height: auto !important; }
}

/* ── Tool controls & maze canvas layout ────────────────────────────
   Responsive grid for difficulty/size controls, centered canvas container,
   generic .is-hidden rule for show/hide toggle on custom-size inputs. */
.tool-controls { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: 1rem 0; }
.tool-controls label { display: inline-flex; align-items: center; gap: .35rem; }
.maze-wrap { max-width: 640px; margin: 1rem auto; }
#maze-canvas { width: 100%; display: block; border: 1px solid var(--accent); border-radius: 8px; background: #fff; }
.is-hidden { display: none !important; }
.btn-primary { background: var(--accent); color: #1a1a1a; border: 0; padding: .5rem 1rem; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn-ghost { background: transparent; border: 1px solid var(--accent); color: inherit; padding: .5rem 1rem; border-radius: 8px; cursor: pointer; }
.btn-toggle { display: inline-flex; align-items: center; gap: .45rem; background: #2563eb; color: #fff; border: 0; padding: .5rem 1rem; border-radius: 8px; cursor: pointer; font-weight: 600; user-select: none; }
.btn-toggle:hover { background: #1d4ed8; }
.btn-toggle input { width: 1rem; height: 1rem; margin: 0; cursor: pointer; accent-color: #fff; }
.btn-toggle:has(:checked), .btn-toggle[aria-pressed="true"] { background: #1d4ed8; box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
#play-status { font-weight: 700; color: var(--accent); }
#maze-canvas:focus-visible { outline: 3px solid var(--accent-light); outline-offset: 2px; }

/* Play-mode keyboard hint — on-screen arrow symbols cue the physical arrow keys. */
.play-hint { max-width: 640px; margin: .6rem auto 0; display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; }
.play-hint-label { font-weight: 700; color: var(--accent-fg); font-size: .92rem; }
.play-hint-sub { font-size: .82rem; color: var(--muted); max-width: 40rem; line-height: 1.45; }
.keycap-pad { display: inline-flex; flex-direction: column; align-items: center; gap: 5px; }
.keycap-row { display: inline-flex; gap: 5px; }
.keycap { display: inline-flex; align-items: center; justify-content: center; min-width: 2.1rem; height: 2.1rem;
  border: 1px solid var(--accent); border-bottom-width: 3px; border-radius: 7px; background: var(--accent-bg);
  color: var(--accent-fg); font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 1.1rem; line-height: 1; }
@media (max-width: 480px) {
  .tool-controls { gap: .5rem; }
  .maze-wrap { max-width: 100%; }
}

/* ── Sliding Puzzle ── */
.sp-controls{display:flex;flex-wrap:wrap;gap:.75rem;align-items:center;margin:1.25rem 0}
.sp-source{display:flex;gap:.4rem}
.sp-source .sp-thumb{width:38px;height:38px;border-radius:8px;border:2px solid var(--border);
  background-size:cover;cursor:pointer;padding:0}
.sp-source .sp-thumb[aria-pressed="true"]{border-color:var(--accent)}
.sp-upload-label input{display:block;font-size:.85rem;max-width:190px}
.sp-stats{margin-left:auto;font-variant-numeric:tabular-nums;color:var(--muted)}
.sp-stage{display:flex;gap:1.25rem;flex-wrap:wrap;align-items:flex-start}
.sp-board{display:grid;gap:2px;width:min(460px,92vw);aspect-ratio:1;background:var(--border);
  border:3px solid var(--accent);border-radius:12px;overflow:hidden;touch-action:manipulation}
.sp-tile{border:0;padding:0;background-repeat:no-repeat;cursor:pointer;
  display:flex;align-items:center;justify-content:center;font-family:'JetBrains Mono',monospace;
  font-weight:600;font-size:clamp(1rem,4vw,1.6rem);color:#fff;
  transition:filter .12s}
.sp-tile.is-blank{background:transparent;cursor:default;pointer-events:none}
.sp-tile:focus-visible{outline:3px solid var(--accent);outline-offset:-3px}
.sp-reference{margin:0;width:150px}
.sp-reference img{width:100%;border-radius:8px;border:1px solid var(--border)}
.sp-status{min-height:1.6rem;font-weight:700;color:var(--accent)}
.sp-board:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
@media (max-width:560px){.sp-stats{margin-left:0;width:100%}}

/* ── Word Search ── */
.ws-controls{display:flex;flex-direction:column;gap:.9rem;margin:1.25rem 0}
.ws-words-label{display:flex;flex-direction:column;gap:.35rem;font-weight:600;max-width:520px}
#ws-words{font-family:'JetBrains Mono',monospace;font-size:.95rem;padding:.6rem .7rem;border:1.5px solid var(--border);border-radius:10px;resize:vertical;background:var(--surface);color:var(--text)}
.ws-presets{display:flex;flex-wrap:wrap;gap:.4rem}
.ws-presets .ws-preset{padding:.35rem .7rem;border:1.5px solid var(--border);border-radius:100px;background:var(--surface2);cursor:pointer;font-size:.85rem;font-weight:600;color:var(--text)}
.ws-presets .ws-preset:hover{border-color:var(--accent)}
.ws-opts{display:flex;flex-wrap:wrap;gap:.6rem;align-items:center}
.ws-opts label{display:inline-flex;align-items:center;gap:.35rem;font-weight:600}
.ws-message{color:#b91c1c;font-weight:600;min-height:0}
.ws-message:empty{display:none}
.ws-status{min-height:1.6rem;font-weight:700;color:var(--accent)}
.ws-stage{display:flex;gap:1.5rem;flex-wrap:wrap;align-items:flex-start;margin-top:.5rem}
.ws-grid{display:grid;gap:0;border:2px solid var(--accent);border-radius:8px;overflow:hidden;
  touch-action:none;user-select:none;-webkit-user-select:none}
.ws-cell{display:flex;align-items:center;justify-content:center;aspect-ratio:1;
  font-family:'JetBrains Mono',monospace;font-weight:600;font-size:clamp(.7rem,2.4vw,1.05rem);
  border:.5px solid var(--border);color:var(--text);background:var(--surface)}
.ws-cell.sel{background:var(--accent);color:#fffdf7}
.ws-cell.found{background:color-mix(in srgb,var(--accent) 55%,transparent);color:#fffdf7}
.ws-cell.answer{outline:2px solid var(--accent);outline-offset:-2px}
.ws-wordlist{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(2,minmax(90px,1fr));gap:.2rem .9rem;min-width:190px}
.ws-wordlist li{font-weight:600}
.ws-wordlist li.done{text-decoration:line-through;color:var(--muted)}
@media (max-width:560px){.ws-wordlist{grid-template-columns:repeat(2,1fr)}}
@media print{
  body *{visibility:hidden}
  #ws-print-area,#ws-print-area *{visibility:visible}
  #ws-print-area{position:absolute;left:0;top:0;width:100%}
  .ws-cell{border:.5px solid #000;color:#000;background:#fff}
  .ws-print-title[hidden]{display:none}
}
