/* QR Forging — palette follows GradiForge (black, deep navy, gold, forge fire). */

:root {
    --bg:          #030407;
    --deep-blue:   #090f41;
    --navy:        #16376f;
    --surface:     #0a0d1e;
    --surface-2:   #0f1330;
    --border:      #1a2350;
    --border-gold: rgba(181, 148, 16, .32);
    --text:        #eef1f8;
    --text-dim:    #a2abc4;
    --text-muted:  #6f7793;
    --gold:        #b59410;
    --gold-light:  #e3c15e;
    --hot:         #ffa53c;
    --flame:       #f3841a;
    --ember:       #6b1706;
    --blue-light:  #60a5fa;
    --danger:      #ff6b6b;

    --molten:  linear-gradient(135deg, #e3c15e 0%, #ffa53c 55%, #f3841a 100%);
    --radius:    8px;
    --radius-lg: 14px;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --shadow: 0 24px 70px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    color: var(--text);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background:
        radial-gradient(ellipse 90% 60% at 50% -10%, rgba(22, 55, 111, .45) 0%, transparent 70%),
        radial-gradient(ellipse 70% 45% at 50% 110%, rgba(243, 132, 26, .14) 0%, transparent 70%),
        linear-gradient(180deg, #050826 0%, var(--bg) 60%);
    background-color: var(--bg);
    background-attachment: fixed;
}

main { display: block; position: relative; z-index: 1; }

a { color: var(--gold-light); text-decoration: none; }
a:hover { color: #f0d68a; }

.qf-mono { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; }
.qf-dim  { color: var(--text-dim); }
.hidden  { display: none !important; }

.qf-embers {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ---------- Top bar ---------- */

.qf-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 18px clamp(16px, 4vw, 34px);
    background: linear-gradient(to bottom, rgba(3, 4, 7, .85), rgba(3, 4, 7, 0));
    pointer-events: none;
}
.qf-bar > * { pointer-events: auto; }
.qf-back { justify-self: start; }
.qf-nav  { justify-self: end; display: flex; gap: 6px; }

.qf-brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.qf-brand:hover { color: var(--text); }
.qf-mark { width: 30px; height: 30px; flex-shrink: 0; filter: drop-shadow(0 0 8px rgba(255, 165, 60, .35)); }
.qf-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.qf-brand-name { white-space: nowrap; font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; }
.qf-brand-text .qf-mono { font-size: 9px; }

@media (max-width: 560px) {
    .qf-bar { grid-template-columns: auto 1fr auto; padding-top: 14px; }
    .qf-brand { justify-self: center; }
    .qf-brand-text .qf-mono { display: none; }
    .qf-bar .qf-back { font-size: 0; padding-inline: 8px; }
    .qf-bar .qf-back::before { content: "\2190"; font-size: 14px; }
    .qf-nav .qf-btn { padding-inline: 9px; }
}

/* ---------- Buttons ---------- */

.qf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .09em;
    color: var(--text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 7px 12px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.qf-btn-primary   { color: var(--gold-light); border-color: var(--gold); }
.qf-btn-primary:hover { background: rgba(181, 148, 16, .14); color: var(--gold-light); }
.qf-btn-secondary { border-color: var(--border); color: var(--text-dim); }
.qf-btn-secondary:hover { background: rgba(226, 232, 240, .07); color: var(--text); }
.qf-btn-ghost     { color: var(--gold-light); padding-inline: 6px; }
.qf-btn-ghost:hover { background: rgba(181, 148, 16, .12); }
.qf-btn:focus-visible, .btn:focus-visible, .tab-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 13px 22px;
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform .1s ease, box-shadow .2s ease, background .15s ease, opacity .15s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
    width: 100%;
    margin-top: 18px;
    color: #1a0e02;
    background: var(--molten);
    box-shadow: 0 0 0 1px rgba(255, 189, 56, .35) inset, 0 10px 30px rgba(243, 132, 26, .18);
}
.btn-primary:hover { color: #1a0e02; box-shadow: 0 0 0 1px rgba(255, 220, 140, .6) inset, 0 10px 38px rgba(243, 132, 26, .35); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--border-gold); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); }

.btn-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-width: 140px; }

/* ---------- Landing / forge scene ---------- */

.page-home { overflow: hidden; height: 100%; }

.hero {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background:
        radial-gradient(ellipse 60% 50% at 50% 35%, rgba(9, 15, 65, .9) 0%, transparent 75%),
        radial-gradient(ellipse 50% 35% at 30% 85%, rgba(243, 132, 26, .16) 0%, transparent 70%),
        radial-gradient(ellipse 50% 35% at 72% 85%, rgba(96, 165, 250, .10) 0%, transparent 70%),
        var(--bg);
}

#forge-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: manipulation;
}

.hero-heading {
    position: absolute;
    top: clamp(78px, 13vh, 130px);
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    padding: 0 16px;
    text-align: center;
    pointer-events: none;
    z-index: 5;
}
.hero-heading .qf-mono { color: var(--gold-light); }
.hero-heading h1 {
    margin: 8px 0 6px;
    font-size: clamp(2rem, 6vw, 3.4rem);
    font-weight: 700;
    letter-spacing: -.03em;
    background: linear-gradient(180deg, #fff 0%, #f3e2b0 55%, var(--hot) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero-heading p { margin: 0; color: var(--text-dim); font-size: clamp(.9rem, 2vw, 1.02rem); }
@media (max-aspect-ratio: 9/10) {
    .hero-heading { top: 74px; }
    .hero-heading h1 { font-size: 2rem; margin: 4px 0 2px; }
    .hero-heading p { font-size: .85rem; max-width: 280px; margin: 0 auto; }
}

.station-label {
    position: absolute;
    left: 0; top: 0;
    z-index: 6;
    pointer-events: none;
    transform: translate(-50%, -50%);
    text-align: center;
    white-space: nowrap;
    transition: opacity .3s ease;
}
.station-label .qf-mono { display: block; color: var(--gold-light); }
.station-label strong { display: block; font-size: 1.05rem; font-weight: 600; margin-top: 2px; }
.station-label.is-read .qf-mono { color: var(--blue-light); }

.station-caption {
    position: absolute;
    left: 50%;
    bottom: calc(96px + env(safe-area-inset-bottom));
    transform: translate(-50%, 10px);
    z-index: 6;
    width: min(92vw, 420px);
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s ease, transform .25s ease;
}
.station-caption.visible { opacity: 1; transform: translate(-50%, 0); }
/* Short screens (landscape phones, small laptops): the labels already say it. */
@media (max-height: 700px) { .station-caption { display: none; } }
.station-caption p { margin: 0; font-size: .9rem; color: var(--text-dim); }

.hero-actions {
    position: absolute;
    left: 50%;
    bottom: calc(28px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 7;
    display: flex;
    gap: 10px;
}
.hero-actions .qf-btn { white-space: nowrap; padding: 10px 16px; background: rgba(3, 4, 7, .55); backdrop-filter: blur(6px); }
.hero-actions .qf-btn-read { color: var(--blue-light); border-color: rgba(96, 165, 250, .5); }
.hero-actions .qf-btn-read:hover { background: rgba(96, 165, 250, .12); color: var(--blue-light); }

.hero-fade {
    position: fixed;
    inset: 0;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    background: radial-gradient(circle at var(--fx, 50%) var(--fy, 50%), var(--fc, #ffa53c) 0%, var(--bg) 55%);
    transition: opacity .5s ease;
}
.hero-fade.active { opacity: 1; pointer-events: auto; }

/* Without WebGL the action buttons become the main entry points. */
.no-webgl .hero-actions { bottom: 40%; flex-direction: column; }
.no-webgl .hero-actions .qf-btn { font-size: 13px; padding: 16px 28px; }

/* ---------- Generic page shell ---------- */

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 112px 16px 64px;
    min-height: 100vh;
}
.page-kicker { color: var(--gold-light); margin: 0 0 8px; }
.page h1 {
    font-size: clamp(1.7rem, 4.5vw, 2.3rem);
    margin: 0 0 6px;
    letter-spacing: -.025em;
}
.page .subtitle { color: var(--text-dim); margin: 0 0 28px; line-height: 1.55; }

/* A forged plate: dark steel with a hot top edge and rivets. */
.card {
    position: relative;
    background:
        linear-gradient(180deg, rgba(255, 189, 56, .06), transparent 120px),
        linear-gradient(160deg, var(--surface-2) 0%, var(--surface) 60%, #06081a 100%);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg);
    padding: clamp(18px, 4vw, 28px);
    box-shadow: var(--shadow), 0 1px 0 rgba(255, 220, 140, .12) inset;
}
.card::before, .card::after {
    content: "";
    position: absolute;
    top: 10px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #f0d68a, var(--gold) 60%, #4a3a05);
    opacity: .7;
}
.card::before { left: 10px; }
.card::after  { right: 10px; }

/* ---------- Tabs ---------- */

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 22px;
    padding: 5px;
    background: rgba(3, 4, 7, .55);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
    flex: 1;
    min-width: max-content;
    border: none;
    background: transparent;
    color: var(--text-dim);
    padding: 9px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
    color: #1a0e02;
    background: var(--molten);
    box-shadow: 0 0 18px rgba(243, 132, 26, .35);
}

@media (max-width: 480px) {
    .tab-btn { min-width: 0; padding: 9px 4px; letter-spacing: .04em; font-size: 10.5px; }
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: panel-in .25s ease; }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } }

.panel-note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 12px 0 0;
    font-size: .84rem;
    color: var(--text-dim);
    line-height: 1.5;
}
.panel-note::before {
    content: "";
    flex-shrink: 0;
    width: 7px; height: 7px;
    margin-top: 6px;
    border-radius: 2px;
    background: var(--hot);
    box-shadow: 0 0 8px var(--hot);
}
.panel-note.is-direct::before { background: var(--blue-light); box-shadow: 0 0 8px var(--blue-light); }

/* ---------- Form elements ---------- */

textarea, input[type="text"], input[type="url"] {
    width: 100%;
    background: rgba(3, 4, 7, .6);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 14px;
    font-size: 1rem;
    font-family: inherit;
}
textarea { resize: vertical; min-height: 150px; }
textarea:focus, input[type="text"]:focus, input[type="url"]:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(181, 148, 16, .18);
}
::placeholder { color: var(--text-muted); }

.char-count { text-align: right; font-size: .78rem; color: var(--text-muted); margin-top: 6px; }

.dropzone {
    display: block;
    border: 1.5px dashed var(--border-gold);
    border-radius: var(--radius-lg);
    padding: 38px 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(3, 4, 7, .35);
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--gold); }
.dropzone.dragover {
    border-color: var(--hot);
    background: rgba(243, 132, 26, .08);
    box-shadow: 0 0 30px rgba(243, 132, 26, .15) inset;
}
.dropzone .dz-icon { font-size: 1.6rem; color: var(--gold-light); }
.dropzone p { margin: 6px 0; color: var(--text-dim); }
.dropzone .filename { color: var(--text); font-weight: 600; word-break: break-all; }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.progress {
    height: 4px;
    margin-top: 14px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .06);
    overflow: hidden;
}
.progress > span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--molten);
    box-shadow: 0 0 12px var(--hot);
    transition: width .15s linear;
}

/* ---------- Raw-text switch: an iron lever that heats when engaged ---------- */

.char-count.is-over, .char-count.is-over span { color: var(--danger); }

.forge-toggle {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px dashed var(--border-gold);
    border-radius: var(--radius-lg);
    background: rgba(3, 4, 7, .45);
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, box-shadow .25s ease;
}
.forge-toggle:hover { border-color: var(--gold); }
.forge-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
}

.ft-track {
    position: relative;
    flex-shrink: 0;
    width: 52px; height: 28px;
    margin-top: 1px;
    border-radius: 6px;
    background: linear-gradient(180deg, #11141f, #1d2233);
    border: 1px solid #2f3650;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, .7);
    transition: background .3s ease, border-color .3s ease;
}
/* Small rivets at each end of the lever slot. */
.ft-track::before, .ft-track::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 3px; height: 3px;
    margin-top: -1.5px;
    border-radius: 50%;
    background: #4a5068;
}
.ft-track::before { left: 5px; }
.ft-track::after  { right: 5px; }

/* The knob is a small steel ingot. */
.ft-knob {
    position: absolute;
    top: 3px; left: 3px;
    z-index: 1;
    width: 22px; height: 20px;
    border-radius: 4px;
    background: linear-gradient(180deg, #c4cad8 0%, #7c8499 55%, #4e5568 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .5);
    transition: transform .28s cubic-bezier(.3, 1.4, .5, 1), background .3s ease, box-shadow .3s ease;
}

.ft-text { display: flex; flex-direction: column; gap: 4px; }
.ft-title { color: var(--text); transition: color .2s ease; }
.ft-desc  { font-size: .84rem; line-height: 1.5; color: var(--text-dim); }

.forge-toggle:has(input:checked) {
    border-style: solid;
    border-color: var(--hot);
    background: linear-gradient(90deg, rgba(243, 132, 26, .12), rgba(3, 4, 7, .45) 70%);
    box-shadow: 0 0 24px rgba(243, 132, 26, .12);
}
.forge-toggle input:checked + .ft-track {
    background: linear-gradient(90deg, #3a1204, #b03a0a);
    border-color: #c25a14;
}
.forge-toggle input:checked + .ft-track .ft-knob {
    transform: translateX(24px);
    background: linear-gradient(180deg, #fff3c4 0%, #ffd27a 40%, #ffa53c 75%, #f3841a 100%);
    box-shadow: 0 0 12px rgba(255, 165, 60, .85), 0 0 2px #fff3c4, inset 0 1px 0 rgba(255, 255, 255, .7);
    animation: knob-heat .5s ease;
}
.forge-toggle input:checked ~ .ft-text .ft-title { color: var(--gold-light); }
.forge-toggle input:focus-visible + .ft-track { outline: 2px solid var(--gold); outline-offset: 3px; }

@keyframes knob-heat {
    0%   { box-shadow: 0 0 0 rgba(255, 165, 60, 0); }
    40%  { box-shadow: 0 0 22px 6px rgba(255, 210, 122, .95); }
    100% { box-shadow: 0 0 12px rgba(255, 165, 60, .85); }
}

.result-url.is-raw {
    font-family: inherit;
    font-size: .9rem;
    color: var(--text);
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 180px;
    overflow-y: auto;
}

/* ---------- Alerts / status ---------- */

.alert { padding: 12px 16px; border-radius: 10px; font-size: .9rem; margin-bottom: 18px; }
.alert-error { background: rgba(255, 107, 107, .1); color: #ffa0a0; border: 1px solid rgba(255, 107, 107, .3); }
.alert-info  { background: rgba(96, 165, 250, .08); color: var(--blue-light); border: 1px solid rgba(96, 165, 250, .25); }

.spinner {
    width: 18px; height: 18px;
    border: 2.5px solid rgba(26, 14, 2, .25);
    border-top-color: #1a0e02;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Result / forged QR ---------- */

.result-card { text-align: center; }
.result-kicker { color: var(--gold-light); margin: 0; }
.result-card h2 { margin: 6px 0 18px; font-size: 1.6rem; letter-spacing: -.02em; }

.qr-anvil {
    position: relative;
    display: inline-block;
    padding: 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, #1b2036, #0b0e1d);
    border: 1px solid var(--border-gold);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .5), 0 0 60px rgba(243, 132, 26, .12);
}
.qr-anvil canvas {
    display: block;
    width: min(280px, 70vw);
    height: auto;
    aspect-ratio: 1;
    border-radius: 6px;
}
.qr-anvil.strike { animation: strike .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes strike {
    0%   { transform: translateY(0); }
    30%  { transform: translateY(5px) scale(.985); }
    100% { transform: translateY(0); }
}

.result-url {
    margin: 16px auto 0;
    max-width: 520px;
    font-family: var(--mono);
    font-size: .78rem;
    color: var(--text-dim);
    word-break: break-all;
    background: rgba(3, 4, 7, .55);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 8px;
}
.result-card .panel-note { justify-content: center; text-align: left; max-width: 520px; margin-inline: auto; }

/* ---------- View page ---------- */

.view-text {
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(3, 4, 7, .55);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    font-size: 1rem;
    line-height: 1.6;
    max-height: 55vh;
    overflow-y: auto;
}

.view-media img, .view-media video {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    margin: 0 auto;
    border-radius: 10px;
    background: #000;
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    background: rgba(3, 4, 7, .55);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.file-icon {
    display: grid;
    place-items: center;
    width: 46px; height: 54px;
    flex-shrink: 0;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    color: #1a0e02;
    background: var(--molten);
    text-transform: uppercase;
}
.file-meta .name { font-weight: 600; word-break: break-all; }
.file-meta .size { color: var(--text-dim); font-size: .85rem; }

.meta-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 16px;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}

/* ---------- Scan page: the reading frame ---------- */

.forge-frame {
    position: relative;
    padding: 12px;
    border-radius: 16px;
    background: linear-gradient(160deg, #1b2036, #070917);
    border: 1px solid #2a3150;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .6) inset, 0 20px 60px rgba(0, 0, 0, .5);
}
.forge-frame .ff-corner {
    position: absolute;
    width: 28px; height: 28px;
    border: 3px solid var(--gold);
    z-index: 3;
    pointer-events: none;
    filter: drop-shadow(0 0 6px rgba(227, 193, 94, .45));
    transition: border-color .2s ease, filter .2s ease;
}
.ff-corner.tl { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.ff-corner.tr { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.ff-corner.bl { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.ff-corner.br { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }

.ff-beam {
    position: absolute;
    left: 12px; right: 12px;
    top: 12px;
    height: 3px;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--blue-light) 20%, #fff 50%, var(--blue-light) 80%, transparent);
    box-shadow: 0 0 18px 4px rgba(96, 165, 250, .45);
    animation: beam 2.6s ease-in-out infinite alternate;
}
@keyframes beam { to { top: calc(100% - 15px); } }
.forge-frame.is-idle .ff-beam { display: none; }

.forge-frame.is-read .ff-corner { border-color: var(--hot); filter: drop-shadow(0 0 14px rgba(255, 165, 60, .9)); }
.forge-frame.is-read .ff-beam { animation: none; top: 50%; background: var(--molten); box-shadow: 0 0 30px 8px rgba(255, 165, 60, .6); }

#reader-viewport {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    min-height: 280px;
}
#reader-viewport video { display: block; width: 100% !important; height: auto !important; }
/* Restyle html5-qrcode's own target box to match the frame. */
#qr-shaded-region { border-color: rgba(3, 4, 7, .55) !important; }
#qr-shaded-region > div { background-color: var(--gold-light) !important; }

.scan-modes { display: flex; gap: 4px; margin-bottom: 18px; }

.scan-result { margin-top: 20px; animation: panel-in .3s ease; }
.scan-result .decoded {
    word-break: break-all;
    background: rgba(3, 4, 7, .55);
    border: 1px solid var(--border-gold);
    padding: 14px;
    border-radius: 10px;
    font-size: .92rem;
    margin: 8px 0 4px;
}

/* ---------- 404 / expired ---------- */

.not-found { text-align: center; padding: 60px 20px; }
.not-found .code {
    font-size: clamp(3.5rem, 12vw, 5rem);
    font-weight: 700;
    margin: 0;
    background: var(--molten);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.not-found p { color: var(--text-dim); margin: 8px auto 26px; max-width: 420px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .ff-beam { top: 50%; }
}
