/* PxG Puzzles: the index reuses style.css (cards), the puzzle pages extend poketracker.css (same palette, header, controls) */
[hidden] { display: none !important; }

/* ---- index ---- */
.section-title { color: #f1e9ff; font-size: 1.3rem; margin: 0 0 18px; text-align: center; letter-spacing: 0.04em; }
.zapdos-image { background: linear-gradient(135deg, #3b2a05 0%, #1a1230 100%); }
.moltres-image { background: linear-gradient(135deg, #7c2d12 0%, #1a1230 100%); }
.lugia-image { background: linear-gradient(135deg, #1e3a5f 0%, #1a1230 100%); }
.card--zapdos .card-image img { object-fit: contain; padding: 14px; }
.card--lugia .card-image img { object-fit: contain; padding: 18px; }
.card--moltres .card-image img { object-fit: contain; padding: 10px; image-rendering: pixelated; }

/* ---- shared pieces for the puzzle pages ---- */
.pt .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 0.85rem; margin-bottom: 14px; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.accent:hover:not(:disabled) { filter: brightness(1.1); }
.btn:disabled { opacity: 0.5; cursor: default; }
.pt-header h1 { margin-right: auto; }
.pt-header .tutorial-link { text-decoration: none; }

.stat-pill {
    display: flex; align-items: center; gap: 8px; padding: 7px 12px; min-height: 38px;
    background: #0c0818; border: 1px solid var(--line); border-radius: 8px;
}
.stat-pill__label { color: var(--muted); font-size: 0.8rem; }
.count, .timer { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 1.4ch; text-align: right; }
.count.on { color: #fbbf24; }
.count.off { color: var(--down); }
.count.skip { color: #7dd3fc; }
.timer { min-width: 7ch; text-align: center; font-size: 1.05rem; }
.timer[data-state="success"] { color: var(--up); cursor: help; }
.timer[data-state="timesup"] { color: var(--down); }

/* soft full-page tint used as feedback (win / lose / hit / miss) */
body::after {
    content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
    opacity: 0; transition: opacity 0.3s ease; background: transparent;
}
body[data-flash]:not([data-flash=""])::after { opacity: 0.22; }
body[data-flash="win"]::after { background: #4ade80; }
body[data-flash="hit"]::after { background: #38bdf8; }
body[data-flash="miss"]::after, body[data-flash="lose"]::after { background: #f87171; }
.pt { position: relative; z-index: 1; }

/* ---- Zapdos Circuits ---- */
.grid-wrap { overflow-x: auto; padding: 4px 0 12px; }
.circuit-grid {
    --cell: 56px;
    display: grid; width: max-content; margin: 0 auto;
    background: #0c0818 url('/pxg/assets/puzzles/images/circuits/floor.png');
    background-size: var(--cell) var(--cell);
    box-shadow: 0 0 0 1px var(--line), 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 2px; user-select: none; -webkit-user-select: none;
}
.circuit-grid > div { background-size: 100% 100%; background-repeat: no-repeat; transition: transform 0.12s ease-out; }
.circuit-grid > .wire { cursor: pointer; }

/* ---- Moltres Search ---- */
.moltres-panel { position: relative; padding-right: 150px; min-height: 150px; }
.moltres-sprite {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 128px; height: 128px;
    image-rendering: pixelated; filter: drop-shadow(0 0 14px rgba(251, 146, 60, 0.45)); pointer-events: none; user-select: none;
}
.char-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.char-form input {
    width: 52px; height: 60px; text-align: center; text-transform: uppercase; font-size: 1.8rem; font-weight: 700; font-family: inherit;
    background: #0c0818; color: var(--text); border: 1px solid var(--line); border-radius: 10px;
}
.char-form input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.summary { min-height: 1.4em; }
.result-columns { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.result-column { flex: 1 1 200px; max-width: 280px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.result-column h3 { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.result-column ul { list-style: none; }
.result-column li { padding: 4px 0; border-bottom: 1px solid rgba(168, 85, 247, 0.1); }
.result-column li:last-child { border-bottom: 0; }

/* ---- Lugia Flute ---- */
.flute-stage { position: relative; max-width: 1043px; margin: 0 auto; container-type: inline-size; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.flute-stage #flute-image { display: block; width: 100%; height: auto; transition: filter 0.6s ease; user-select: none; -webkit-user-select: none; }
.flute-stage #flute-image.blur { filter: blur(3px); }
/* Pillar auras: cut-outs of each pillar stacked over the picture, glowing through drop-shadow.
   Each pillar has a pink and a cyan layer; only their opacity animates, so the glow fades smoothly.
   Sizes use cqw so the glow scales with the picture. */
.aura {
    position: absolute; z-index: 1; height: auto; opacity: 0; pointer-events: none;
    transition: opacity 0.35s ease-in-out;
    will-change: opacity;
}
.aura.on { opacity: 1; transition: opacity 0.2s ease-out; }
/* Pink appears together with the note, so it needs a slower, softer fade-in than cyan to read as a fade
   (a short ease-out is ~80% visible in the first frames and looks like a pop). */
.aura.pink.on { transition: opacity 0.4s ease-in-out; }
.aura.pink {
    filter: drop-shadow(0 0 0.15cqw #ff4fa0) drop-shadow(0 0 0.15cqw #ff4fa0) drop-shadow(0 0 0.4cqw #ff4fa0) drop-shadow(0 0 0.7cqw rgba(255, 79, 160, 0.85));
}
.aura.cyan {
    filter: drop-shadow(0 0 0.15cqw #3ec8ff) drop-shadow(0 0 0.15cqw #3ec8ff) drop-shadow(0 0 0.4cqw #3ec8ff) drop-shadow(0 0 0.7cqw rgba(62, 200, 255, 0.85));
}

.note-text, .flute-results {
    position: absolute; z-index: 2; color: #000; font-weight: 900; font-size: 6.7cqw; line-height: 1.1; pointer-events: none;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
}
.note-text { top: var(--y, 50%); left: 40%; animation: note-rise 5s forwards; }
.note-text.countdown { font-size: 20cqw; }
@keyframes note-rise {
    0% { opacity: 0.8; top: var(--y, 50%); }
    24%, 100% { opacity: 0; top: calc(var(--y, 50%) - 10%); }
}
.flute-results { top: 22%; left: 50%; transform: translateX(-50%); text-align: center; white-space: nowrap; }
.flute-results__detail { font-size: 0.45em; margin-top: 0.3em; }

/* ---- tutorials ---- */
.tutorial { max-width: 760px; margin: 0 auto 14px; text-align: center; line-height: 1.6; }
.tutorial p { margin: 0 0 14px; }
.tutorial .hint { margin-bottom: 14px; }
.tutorial-gif { display: block; margin: 0 auto 16px; max-width: min(300px, 70%); height: auto; border-radius: 10px; }
.tutorial .table-box { max-width: 520px; margin: 0 auto 18px; text-align: left; }
.tutorial table.dt td, .tutorial table.dt th { padding: 8px 14px; }
.goodluck { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; margin-bottom: 0; }
.goodluck img { width: 40px; height: 40px; object-fit: contain; }
kbd {
    display: inline-block; min-width: 1.8em; padding: 1px 7px; text-align: center; font: inherit; font-size: 0.85rem;
    background: #0c0818; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
}

@media (max-width: 640px) {
    .pt-header { flex-wrap: wrap; gap: 10px; }
    .char-form input { width: 40px; height: 50px; font-size: 1.4rem; }
    .moltres-panel { padding-right: 14px; min-height: 0; }
    .moltres-sprite { position: static; transform: none; display: block; margin: 0 auto 8px; width: 96px; height: 96px; }
}
@media (prefers-reduced-motion: reduce) {
    .circuit-grid > div { transition: none; }
}

/* Lugia Flute page background: PxGear purple by default, or the original plain gray (toggle in the header).
   "Background color" feedback is a solid full-page layer that fades in and out over either background. */
body.flute-page.gray-bg { background: #959595; }
.flute-page.gray-bg .hint { color: #1a1230; }
body.flute-page::after { opacity: 0; transition: opacity 0.4s ease-in-out; }
body.flute-page.flashing::after { opacity: 1; transition-duration: 0.15s; }
body.flute-page[data-flash-color="hit"]::after { background: #80cee1; }
body.flute-page[data-flash-color="miss"]::after, body.flute-page[data-flash-color="lose"]::after { background: #f67280; }
body.flute-page[data-flash-color="win"]::after { background: #77dd77; }

.bg-toggle {
    padding: 4px 10px; font: inherit; font-size: 12px; font-weight: 600; letter-spacing: 0.03em; cursor: pointer;
    color: #ccc; background: transparent; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 6px;
}
.bg-toggle:hover { color: #fff; }
.bg-toggle::before {
    content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px;
    border-radius: 3px; background: #959595; border: 1px solid rgba(255, 255, 255, 0.4);
}
.bg-toggle[aria-pressed="true"] { background: #fff; color: #111; border-color: #fff; }
