/* ============================================================
   Puzzles — hub (/puzzles/), tutorials, cascade chains
   Location: assets/css/puzzles.css
   ============================================================ */
.pz-crumbs { font-size: 0.8em; opacity: 0.7; margin: 0 0 6px; }
.pz-crumbs a { color: #0f0; }
.pz-header .pz-badge {
    display: inline-block; font-size: 0.75em; letter-spacing: 1px; text-transform: uppercase;
    border: 1px solid #0ff; color: #0ff; border-radius: 3px; padding: 2px 8px; margin-bottom: 10px;
}
.pz-tag { font-size: 0.75em; border: 1px solid #0f0; color: #0f0; border-radius: 3px; padding: 2px 8px; }
.pz-tag-gold { border-color: #ffd700; color: #ffd700; }
.muted { opacity: 0.65; font-size: 0.85em; }
.btn-primary { display: inline-block; padding: 8px 16px; border-radius: 5px; text-decoration: none; font-weight: bold; }

/* ---------------- hub ---------------- */
/* Palette follows the old /puzzles/ page: green = classics, cyan = chains, gold = Elite.
   Cards are near-opaque so text reads cleanly over the rain. */
.puzzles-hub {
    --pz-green: #00ff41; --pz-green-dim: rgba(0, 255, 65, 0.35);
    --pz-cyan: #00e5ff;  --pz-cyan-dim: rgba(0, 229, 255, 0.35);
    --pz-gold: #ffd700;  --pz-gold-dim: rgba(255, 215, 0, 0.35);
}

/* welcome + stat tiles */
.pz-welcome {
    background: rgba(0, 17, 0, 0.92); border: 2px solid var(--pz-green); border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.3); padding: 20px 24px; margin: 0 0 28px; text-align: center;
}
.pz-welcome-line { margin: 0 0 16px; font-size: 1.15em; color: var(--pz-green); text-shadow: 0 0 8px rgba(0, 255, 65, 0.6); }
.pz-welcome-line strong { color: #fff; text-shadow: 0 0 10px var(--pz-green); }
.pz-pill {
    display: inline-block; margin-left: 8px; padding: 3px 12px; border-radius: 20px; font-size: 0.75em; font-weight: bold;
    background: var(--pz-green); color: #000; text-shadow: none; box-shadow: 0 0 10px rgba(0, 255, 65, 0.5); vertical-align: middle;
}
.pz-pill-gold { background: var(--pz-gold); box-shadow: 0 0 10px rgba(255, 215, 0, 0.6); }
.pz-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.pz-stat {
    display: grid; gap: 4px; padding: 16px 10px; border-radius: 10px;
    background: rgba(12, 12, 12, 0.95); border: 2px solid var(--pz-green);
    transition: transform 0.2s, box-shadow 0.2s;
}
.pz-stat:hover { transform: translateY(-3px); box-shadow: 0 0 22px rgba(0, 255, 65, 0.45); }
.pz-stat-value { font-size: 2em; font-weight: bold; color: var(--pz-green); text-shadow: 0 0 15px var(--pz-green); }
.pz-stat-label { font-size: 0.75em; letter-spacing: 2px; text-transform: uppercase; color: #9a9a9a; }

/* section panels */
.pz-panel {
    position: relative; margin: 0 0 34px; padding: 22px 22px 26px; border-radius: 14px;
    background: rgba(0, 0, 0, 0.55); border: 1px solid var(--pz-green-dim);
}
.pz-panel::before {
    content: ''; position: absolute; left: 10%; right: 10%; top: -1px; height: 2px;
    background: linear-gradient(90deg, transparent, var(--pz-accent, var(--pz-green)), transparent);
}
.pz-panel-green { --pz-accent: var(--pz-green); }
.pz-panel-cyan  { --pz-accent: var(--pz-cyan); border-color: var(--pz-cyan-dim); background: rgba(0, 18, 24, 0.6); }
.pz-panel-gold  { --pz-accent: var(--pz-gold); border-color: var(--pz-gold-dim); background: rgba(20, 16, 0, 0.55); }
.pz-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; margin-bottom: 8px; }
.pz-section-head h2 { margin: 0; font-size: 1.5em; color: var(--pz-accent); text-shadow: 0 0 14px var(--pz-accent); }
.pz-lede { max-width: 75ch; margin: 0 0 18px; line-height: 1.6; color: var(--pz-accent); opacity: 0.9; }
.pz-tag-cyan { border-color: var(--pz-cyan); color: var(--pz-cyan); }

/* cards */
.pz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.pz-card {
    --c: var(--pz-green); --c-glow: rgba(0, 255, 65, 0.25); --c-bg: rgba(0, 17, 0, 0.94);
    position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
    padding: 46px 20px 22px; border-radius: 14px; text-decoration: none; color: #ccc;
    background: var(--c-bg); border: 2px solid var(--c); box-shadow: 0 0 20px var(--c-glow);
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s;
}
.pz-card::before {       /* the glowing top edge */
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--c), transparent);
}
.pz-card:hover { transform: translateY(-5px); box-shadow: 0 14px 38px var(--c-glow), 0 0 26px var(--c-glow); }
.pz-card-cyan { --c: var(--pz-cyan); --c-glow: rgba(0, 229, 255, 0.28); --c-bg: rgba(0, 16, 22, 0.94); }
.pz-card-gold { --c: var(--pz-gold); --c-glow: rgba(255, 215, 0, 0.3); --c-bg: rgba(20, 16, 0, 0.94); }

.pz-num {
    position: absolute; top: 8px; right: 14px; font-size: 2.6em; font-weight: bold; line-height: 1;
    color: var(--c); opacity: 0.18; pointer-events: none;
}
.pz-card-title {
    margin-top: 6px; font-size: 1.25em; font-weight: bold; letter-spacing: 1px; line-height: 1.35;
    color: var(--c); text-shadow: 0 0 12px var(--c-glow), 0 0 4px var(--c);
}
.pz-card-text { font-size: 0.88em; line-height: 1.65; color: #c9c9c9; }
.pz-chip {
    display: inline-block; padding: 4px 14px; border-radius: 16px; font-size: 0.75em; letter-spacing: 1px; text-transform: uppercase;
    border: 1px solid var(--c); color: var(--c); background: rgba(255, 255, 255, 0.04);
}
.pz-stars { font-size: 1.05em; color: var(--pz-gold); letter-spacing: 2px; text-shadow: 0 0 8px rgba(255, 215, 0, 0.6); }
.pz-stars .muted { letter-spacing: 1px; text-shadow: none; color: #888; font-size: 0.8em; }
.pz-star-off { color: #3a3a3a; text-shadow: none; }
.pz-progress { display: flex; align-items: center; gap: 10px; width: 100%; font-size: 0.8em; color: var(--c); }
.pz-progress-done { justify-content: center; color: var(--pz-gold); }
.pz-bar { flex: 1; height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden; }
.pz-bar span { display: block; height: 100%; width: var(--p, 0%); background: var(--c); box-shadow: 0 0 8px var(--c); }
.pz-btn {
    margin-top: auto; display: inline-block; padding: 11px 26px; border-radius: 8px; font-weight: bold; letter-spacing: 1px;
    border: 2px solid var(--c); color: var(--c); background: rgba(0, 0, 0, 0.7); text-transform: uppercase; font-size: 0.85em;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.pz-card:hover .pz-btn { background: var(--c); color: #000; box-shadow: 0 0 22px var(--c); }

.pz-done-badge {
    position: absolute; top: 12px; left: 12px; padding: 4px 12px; border-radius: 12px; font-size: 0.75em; font-weight: bold;
    background: var(--pz-gold); color: #000; box-shadow: 0 0 14px rgba(255, 215, 0, 0.65); z-index: 1;
}
.pz-done-badge[hidden] { display: none; }
/* Released in the last two weeks (v3.23.0) */
.pz-new-badge { position: absolute; top: 12px; left: 12px; z-index: 1; padding: 2px 9px; border-radius: 10px; background: #ff3cac; color: #fff; font-size: 0.72em; font-weight: bold; letter-spacing: 1px; text-transform: uppercase; }
.pz-preview-chip { display: inline-block; padding: 2px 8px; border: 1px dashed #ffd23f; border-radius: 10px; color: #ffd23f; font-size: 0.78em; }
.pz-card.is-solved, .pz-card.is-complete { border-color: var(--pz-gold); }
.pz-card.is-solved .pz-num, .pz-card.is-complete .pz-num { color: var(--pz-gold); opacity: 0.35; }
.pz-card.is-next { box-shadow: 0 0 28px rgba(0, 255, 65, 0.55); animation: pz-pulse 2.4s ease-in-out infinite; }
.pz-card.is-locked { border-color: #444; box-shadow: none; }
.pz-card.is-locked .pz-card-title, .pz-card.is-locked .pz-btn, .pz-card.is-locked .pz-chip { color: #666; border-color: #555; text-shadow: none; }
.pz-card.is-locked:hover .pz-btn { background: #555; color: #000; box-shadow: none; }
@keyframes pz-pulse { 0%, 100% { box-shadow: 0 0 18px rgba(0, 255, 65, 0.35); } 50% { box-shadow: 0 0 34px rgba(0, 255, 65, 0.7); } }
@media (prefers-reduced-motion: reduce) { .pz-card, .pz-stat { transition: none; } .pz-card.is-next { animation: none; } }

.pz-elite-empty { max-width: 560px; }
.pz-cta-inline { margin-top: 18px; }

/* ---------------- stage pages ---------------- */
.pz-dots { list-style: none; margin: 10px 0 0; padding: 0; display: flex; justify-content: center; gap: 8px; }
.pz-dots a {
    width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(0, 255, 0, 0.5); color: #0f0;
    display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-size: 0.85em;
}
.pz-dots a.is-solved { background: #0f0; color: #000; border-color: #0f0; }
.pz-dots a.is-current { border-color: #0ff; box-shadow: 0 0 10px rgba(0, 255, 255, 0.6); }

.pz-stages { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 6px; }
.pz-stage-row {
    display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center;
    border: 1px solid rgba(0, 255, 0, 0.25); border-radius: 6px; padding: 8px 12px; background: rgba(0, 0, 0, 0.55); margin: 0;
}
.pz-stage-no {
    width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(0, 255, 0, 0.5);
    display: inline-flex; align-items: center; justify-content: center; font-size: 0.85em; font-weight: bold;
}
.pz-stage-row.is-solved .pz-stage-no { background: #0f0; color: #000; border-color: #0f0; }
.pz-stage-row.is-current { border-color: #0ff; }
.pz-stage-row.is-current .pz-stage-no { border-color: #0ff; color: #0ff; }
.pz-stage-row.is-locked { opacity: 0.55; }
.pz-stage-title { font-weight: bold; color: #0f0; }
.pz-stage-meta { font-size: 0.8em; color: #0ff; text-align: right; }
.pz-stage-meta code { background: none; border: 0; padding: 0; color: #ffd700; font-weight: bold; }

.pz-story summary { cursor: pointer; font-weight: bold; color: #0f0; }
.pz-howto { border: 1px solid rgba(0, 255, 255, 0.5); border-left-width: 4px; border-radius: 6px; background: rgba(0, 20, 20, 0.6); padding: 10px 14px; margin: 0 0 14px; }
.pz-howto summary { cursor: pointer; font-weight: bold; color: #0ff; }
.pz-howto ol { margin: 10px 0 2px; padding-left: 1.4em; line-height: 1.6; }
.pz-howto li { margin: 0 0 6px; }
.pz-howto strong { color: #0f0; }
.pz-narrative { line-height: 1.7; margin: 10px 0 14px; }
.pz-body {
    font-family: 'Courier New', monospace; font-size: 1.05em; color: #0ff; white-space: pre-wrap; word-break: break-word;
    background: rgba(0, 20, 20, 0.7); border: 1px solid #0ff; border-left-width: 4px; border-radius: 6px; padding: 14px 16px; margin: 0 0 18px;
}
.pz-image { display: block; max-width: 100%; border: 1px solid #0f0; border-radius: 6px; margin: 0 0 14px; }

.pz-answer { display: grid; gap: 6px; margin: 0 0 14px; }
.pz-answer label { font-weight: bold; color: #0f0; }
.pz-answer-row { display: flex; gap: 8px; }
.pz-answer-row input { flex: 1; min-width: 0; }
.pz-submit {
    background: #0f0; color: #000; border: 1px solid #0f0; border-radius: 5px; padding: 0 22px; font: inherit; font-weight: bold; cursor: pointer;
}
.pz-submit:hover:not(:disabled) { box-shadow: 0 0 14px rgba(0, 255, 0, 0.6); }
.pz-submit:disabled { opacity: 0.5; cursor: default; }
.pz-result { min-height: 1.3em; margin: 0; font-weight: bold; }
.pz-result.is-ok { color: #0f0; }
.pz-result.is-error { color: #ff5a5a; }

.pz-hints { display: grid; gap: 6px; margin: 0 0 12px; justify-items: start; }
.pz-hintbtn, .pz-linkbtn {
    background: transparent; color: #ffd700; border: 1px dashed #ffd700; border-radius: 5px; padding: 6px 12px; font: inherit; font-size: 0.9em; cursor: pointer;
}
.pz-linkbtn { border: 0; padding: 0; text-decoration: underline; color: #0ff; }
.pz-hintbtn:disabled { opacity: 0.45; cursor: default; }
.pz-hint-list { margin: 0; padding-left: 22px; color: #ffd700; line-height: 1.6; justify-self: stretch; }
.pz-hint-list li { margin-bottom: 4px; }
.pz-tools { font-size: 0.85em; }
.pz-tools a { color: #0f0; margin-right: 10px; }
.pz-meta { margin: 0 0 10px; }

.pz-locked { border-color: #ffd700; color: #ffd700; }
.pz-locked a { color: #0ff; }
.is-dimmed { opacity: 0.35; pointer-events: none; }
.pz-done { border-color: #0ff; }
.pz-done h2 { color: #0ff; }
.pz-done-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.pz-gate .pz-cta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

/* [hidden] must win over display rules */
.pz-done[hidden], .pz-locked[hidden] { display: none; }

/* ---------------- logic grid (logic stages) ---------------- */
.lg-h { margin: 4px 0 8px; font-size: 1em; color: var(--pz-cyan, #00e5ff); letter-spacing: 1px; text-transform: uppercase; }
.lg-clues { margin: 0 0 16px; padding-left: 26px; display: grid; gap: 4px; }
.lg-clue { color: #ccc; }
.lg-clue::marker { color: #00ff41; }
.lg-clue-btn { all: unset; display: block; cursor: pointer; line-height: 1.5; border-radius: 4px; padding: 1px 4px; }
.lg-clue-btn:hover, .lg-clue-btn:focus-visible { background: rgba(0, 255, 65, 0.08); outline: 1px dashed rgba(0, 255, 65, 0.5); }
.lg-clue.is-done .lg-clue-btn { color: #5d6b5d; text-decoration: line-through; }
.lg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 12px; font-size: 0.9em; }
.lg-auto { display: inline-flex; align-items: center; gap: 6px; color: #aaa; cursor: pointer; }
.lg-auto input { accent-color: #00ff41; width: 16px; height: 16px; }
.lg-status { color: #00e5ff; }
.lg-status.is-full { color: #ffd700; text-shadow: 0 0 8px rgba(255, 215, 0, 0.6); }
.lg-reset { margin-left: auto; background: transparent; color: #00ff41; border: 1px solid #00ff41; border-radius: 6px; padding: 6px 12px; font: inherit; cursor: pointer; }
.lg-reset:hover { background: #00ff41; color: #000; }
.lg-wrap { overflow-x: auto; padding-bottom: 4px; }
.lg-table { width: auto; border-collapse: collapse; margin: 0 auto; background: rgba(0, 12, 0, 0.9); }
.lg-table th { background: rgba(0, 30, 0, 0.9); }
.lg-table th, .lg-table td { border: 1px solid rgba(0, 255, 65, 0.35); padding: 0; }
.lg-table .lg-corner { border: none; background: transparent; }
.lg-col { vertical-align: bottom; max-width: 118px; }
.lg-row { text-align: right; white-space: nowrap; }
.lg-label { all: unset; display: block; box-sizing: border-box; width: 100%; padding: 8px 10px; cursor: pointer;
    color: #00ff41; font-weight: bold; font-size: 0.88em; line-height: 1.25; text-align: center; overflow-wrap: break-word; hyphens: auto; }
.lg-row .lg-label { text-align: right; }
.lg-label:hover, .lg-label:focus-visible { background: rgba(0, 255, 65, 0.12); text-shadow: 0 0 8px #00ff41; }
.lg-cell { all: unset; display: flex; align-items: center; justify-content: center; box-sizing: border-box;
    width: 100%; min-width: 48px; height: 48px; cursor: pointer; font-size: 1.35em; font-weight: bold; transition: background 0.12s; }
.lg-cell:hover, .lg-cell:focus-visible { background: rgba(0, 255, 65, 0.12); outline: 1px solid #00ff41; outline-offset: -1px; }
.lg-cell.is-cross { color: #ff4d6a; }
.lg-cell.is-cross.is-auto { color: rgba(255, 77, 106, 0.45); }
.lg-cell.is-check { color: #000; background: #00ff41; box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.35), 0 0 12px rgba(0, 255, 65, 0.6); }
.lg-legend { margin: 10px 0 0; font-size: 0.85em; text-align: center; }

@media (max-width: 600px) {
    .pz-stage-row { grid-template-columns: 30px 1fr; }
    .pz-stage-meta { grid-column: 2; text-align: left; }
    .pz-answer-row { flex-direction: column; }
    .pz-submit { padding: 10px; }
    .pz-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .pz-stat { padding: 12px 6px; }
    .pz-stat-value { font-size: 1.5em; }
    .pz-stat-label { letter-spacing: 1px; }
    .pz-card { padding: 42px 16px 18px; }
    .lg-cell { min-width: 40px; height: 40px; font-size: 1.15em; }
    .lg-col { max-width: 70px; }
    .lg-label { padding: 6px; font-size: 0.78em; }
    .lg-row { white-space: normal; max-width: 96px; }
}

/* ---- "this chain is also a 3D maze" offer on a chain page ---- */
.pz-maze-offer { border-left: 3px solid #00ffff; }
.pz-maze-offer h2 { margin-top: 0; }
.pz-maze-offer .pz-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.maze-offer-skip { color: #7fffd4; }

/* ---- community maze gallery ---- */
.gal-sort a[aria-current] { font-weight: bold; text-decoration: none; }
.gal-pages { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: center; margin-top: 18px; }
