/* ============================================================
   Pootery — main stylesheet
   ============================================================
   Palette: ONIONCORE (dark teal + hot pink) for UI / chrome.
   The pot and kiln come in chunks 2+ in clay browns + kiln
   orange-red so the warm tones contrast with the cool UI.
   ============================================================ */

/* ----- 1. Tokens ----- */

:root {
    /* Onioncore base */
    --bg-deep:      #06141a;     /* near-black with teal undertone */
    --bg-stage:     #0c1f25;     /* a touch lighter — main canvas bg */
    --bg-panel:     #0f2a32;     /* tool panels */
    --bg-frame:     #143842;     /* raised UI frames */

    --teal:         #00ffcc;     /* primary accent (links, focus) */
    --teal-dim:     #4dd9b8;
    --teal-low:     #0a665a;     /* line work */

    --pink:         #ff2e88;     /* CTA / "go" pink */
    --pink-bright:  #ff5cab;
    --pink-deep:    #b81866;

    --ink:          #eaf6f4;     /* main text on dark */
    --ink-dim:      #9fb8b6;
    --ink-low:      #5a7773;

    /* Warm side — for the pot, glazes, kiln. Chunks 2+ */
    --clay-1:       #a05a2c;
    --clay-2:       #6b3a1a;
    --clay-3:       #4a2510;
    --kiln-1:       #ffb24a;
    --kiln-2:       #ff5a1f;
    --kiln-3:       #b21f0c;

    /* Typography */
    --font-title:   "Bungee", "Impact", "Haettenschweiler",
                    "Arial Narrow Bold", system-ui, sans-serif;
    --font-lcd:     "VT323", "Courier New", monospace;
    --font-mono:    "Press Start 2P", "VT323", "Courier New", monospace;
    --font-ui:      system-ui, -apple-system, "Segoe UI", Roboto,
                    "Helvetica Neue", Arial, sans-serif;

    /* Layout */
    --content-max:  920px;
    --radius-sm:    4px;
    --radius-md:    8px;
    --radius-lg:    14px;

    /* Android 15+ / notched-phone safe area. The app targets
       SDK 35 (forced edge-to-edge) so the WebView draws behind
       the bottom gesture / 3-button nav bar. Anything pinned to
       bottom:0 must pad by this or it sits under the system bar
       and becomes untappable. Resolves to 0 on desktop. */
    --safe-bottom:  env(safe-area-inset-bottom, 0px);
    /* Top inset — Android 15 edge-to-edge + iOS notch/hole-punch.
       Pads the top of screen content so a camera cutout doesn't sit
       over the title / titlebars. Resolves to 0 on desktop + tabs. */
    --safe-top:     env(safe-area-inset-top, 0px);
}

/* ----- 2. Reset / base ----- */

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-deep);
    color: var(--ink);
    font-family: var(--font-ui);
    min-height: 100vh;
    min-height: 100dvh;
}

body {
    /* Subtle CRT scanline overlay — applied at the body level so it's
       behind UI but covers the whole viewport. */
    background:
        radial-gradient(ellipse at 50% 0%,
            rgba(0, 255, 204, 0.06) 0%,
            transparent 55%),
        linear-gradient(180deg,
            #07181e 0%,
            var(--bg-deep) 60%,
            #04101a 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

body::before {
    /* Scanlines */
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0.025) 0px,
        rgba(255, 255, 255, 0.025) 1px,
        transparent 1px,
        transparent 3px
    );
    z-index: 9000;
    mix-blend-mode: overlay;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

a {
    color: var(--teal);
    text-decoration: none;
}

a:hover,
a:focus-visible {
    color: var(--pink-bright);
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--pink);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ----- 3. Top bar ----- */

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--teal-low);
    background: linear-gradient(180deg, #0a1f26 0%, #07171c 100%);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    position: relative;
    z-index: 50;
}

.top .back {
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    padding: 4px 8px;
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    background: rgba(0, 255, 204, 0.04);
}

.top .back:hover {
    color: var(--pink-bright);
    border-color: var(--pink);
    text-decoration: none;
    background: rgba(255, 46, 136, 0.08);
}

.crt-clock {
    color: var(--teal-dim);
    font-family: var(--font-lcd);
    font-size: 18px;
    letter-spacing: 2px;
    text-shadow: 0 0 6px rgba(0, 255, 204, 0.4);
}

/* ----- 4. Screens ----- */

.screen {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: calc(24px + var(--safe-top)) 16px 60px;
    min-height: calc(100vh - 110px); /* keep footer near the bottom */
    min-height: calc(100dvh - 110px);
    display: flex;
    flex-direction: column;
}

.screen[hidden] {
    display: none;
}

/* ----- 5. Title screen ----- */

.title-stack {
    margin: 24px auto 0;
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    position: relative;
}

/* Marquee tape — the looping ribbon above the title. Pure CSS,
   uses translateX on a wide single-line span. */
.marquee-tape {
    width: 100%;
    overflow: hidden;
    border-top: 2px solid var(--pink);
    border-bottom: 2px solid var(--pink);
    background: repeating-linear-gradient(
        45deg,
        rgba(255, 46, 136, 0.12) 0 12px,
        transparent 12px 24px
    );
    padding: 6px 0;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.2px;
    color: var(--ink);
    box-shadow:
        0 0 12px rgba(255, 46, 136, 0.25),
        inset 0 0 24px rgba(0, 0, 0, 0.4);
}

.marquee-tape span {
    display: inline-block;
    white-space: nowrap;
    animation: marquee 28s linear infinite;
    padding-left: 100%;
}

@keyframes marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-100%); }
}

/* Big chunky title */
.big-title {
    font-family: var(--font-title);
    margin: 0;
    text-align: center;
    line-height: 0.95;
    text-transform: uppercase;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-shadow:
        4px 4px 0 var(--pink-deep),
        -1px -1px 0 #fff,
        0 0 28px rgba(255, 46, 136, 0.45);
    /* Wobble — subtle on title screen. */
    animation: title-wobble 5.5s ease-in-out infinite;
    transform-origin: 50% 60%;
}

.big-title .line-1,
.big-title .line-2 {
    white-space: nowrap;
}

.big-title .line-1 {
    font-size: clamp(36px, 10vw, 88px);
    color: var(--ink);
    letter-spacing: 0.5px;
}

.big-title .line-2 {
    font-size: clamp(54px, 14vw, 132px);
    color: var(--teal);
    letter-spacing: 1px;
    text-shadow:
        4px 4px 0 var(--pink-deep),
        -2px -2px 0 #fff,
        0 0 36px rgba(0, 255, 204, 0.5);
}

.big-title .oo {
    color: var(--pink);
    -webkit-text-stroke: 1px var(--teal);
    display: inline-block;
    animation: oo-bob 1.6s ease-in-out infinite;
    transform-origin: 50% 60%;
}

@keyframes title-wobble {
    0%, 100% { transform: rotate(-0.6deg) translateY(0); }
    25%      { transform: rotate(0.5deg)  translateY(-2px); }
    50%      { transform: rotate(-0.4deg) translateY(1px); }
    75%      { transform: rotate(0.7deg)  translateY(-1px); }
}

@keyframes oo-bob {
    0%, 100% { transform: translateY(0) scaleY(1); }
    50%      { transform: translateY(-6px) scaleY(0.92); }
}

/* Cursed-LCD subtitle */
.cursed-sub {
    margin: 0;
    font-family: var(--font-lcd);
    font-size: clamp(20px, 3.5vw, 28px);
    letter-spacing: 1.5px;
    color: var(--teal-dim);
    text-align: center;
}

.lcd-frame {
    display: inline-block;
    padding: 8px 16px;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.45) 0 1px,
            transparent 1px 3px
        ),
        linear-gradient(180deg, #021a1a 0%, #052a28 100%);
    border: 2px solid var(--teal-low);
    border-radius: var(--radius-md);
    box-shadow:
        inset 0 0 18px rgba(0, 255, 204, 0.15),
        0 0 12px rgba(0, 255, 204, 0.15);
    text-shadow: 0 0 6px rgba(0, 255, 204, 0.55);
}

.lcd-pre {
    color: var(--pink-bright);
    margin-right: 4px;
}

/* Daily theme banner (Phase 2 chunk 4-lite) — rotating prompt
   above the menu buttons. Pulses subtly so the kid notices. */
.daily-theme-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    width: min(440px, 92vw);
    padding: 12px 18px;
    background: linear-gradient(120deg,
        rgba(255, 46, 136, 0.22) 0%,
        rgba(0, 255, 204, 0.18) 100%);
    border: 1.5px solid var(--pink);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.6px;
    color: var(--ink);
    cursor: pointer;
    text-shadow: 1px 1px 0 #000;
    box-shadow:
        0 0 0 1px #000,
        0 0 14px rgba(255, 46, 136, 0.30);
    animation: daily-pulse 3.5s ease-in-out infinite;
    transition: transform 0.06s ease, box-shadow 0.15s ease;
}

.daily-theme-banner:hover,
.daily-theme-banner:focus-visible {
    box-shadow:
        0 0 0 1px #000,
        0 0 22px rgba(255, 46, 136, 0.55),
        0 0 32px rgba(0, 255, 204, 0.25);
    outline: none;
}

.daily-theme-banner:active { transform: translateY(1px); }

.dtb-label {
    color: var(--teal-dim);
    flex: 0 0 auto;
}

.dtb-theme {
    flex: 1 1 auto;
    /* Without min-width:0, flex items refuse to shrink below their
       content size — a long theme word would push past the banner
       edge. With this + max-width, long names ellipsize cleanly
       instead of bleeding off-screen. */
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    font-family: var(--font-title);
    font-size: clamp(16px, 4.2vw, 24px);
    letter-spacing: 2px;
    color: var(--pink-bright);
    text-shadow:
        2px 2px 0 #000,
        0 0 10px rgba(255, 46, 136, 0.55);
}

.dtb-cta {
    color: var(--teal);
    flex: 0 0 auto;
    text-shadow: 0 0 6px rgba(0, 255, 204, 0.4);
}

/* Featured-pots strip — small discovery hub below the menu.
   Skeleton placeholders pre-render so the space is reserved
   at page load + there's no pop-in when Supabase responds. */
.featured-strip {
    width: 100%;
    max-width: 520px;
    margin: 6px auto 0;
    padding: 10px 12px 12px;
    border: 1px dashed var(--teal-low);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.18);
}

.featured-head {
    margin: 0 0 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    line-height: 1;
}
.featured-eyebrow {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--ink-dim);
}
.featured-emph {
    font-family: var(--font-title, var(--font-mono));
    font-size: 14px;
    letter-spacing: 1.5px;
    color: var(--teal);
    text-shadow: 0 0 8px rgba(0, 255, 204, 0.45);
}

.featured-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.featured-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    background: var(--bg-deep);
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease,
                box-shadow 0.12s ease;
}
.featured-card:hover,
.featured-card:focus-visible {
    transform: translateY(-2px);
    border-color: var(--pink-bright);
    box-shadow: 0 6px 20px rgba(255, 46, 136, 0.3);
    outline: none;
}

.featured-thumb {
    aspect-ratio: 400 / 600;
    background: #06141a;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;   /* above the niche + shelf pseudo-element */
}
.featured-thumb canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

.featured-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    align-items: center;
    text-align: center;
    line-height: 1.2;
}
.featured-name {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--ink);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.featured-by {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--pink-bright);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Skeleton placeholders -- visible immediately on page load
   so the strip occupies its final size before the fetch.
   Shimmer animation telegraphs "loading" without text. */
.featured-card.featured-skeleton {
    cursor: default;
    border-style: dashed;
    border-color: var(--teal-low);
    pointer-events: none;
}
.featured-card.featured-skeleton:hover {
    transform: none;
    border-color: var(--teal-low);
    box-shadow: none;
}

.featured-skeleton .featured-thumb,
.featured-skeleton .skeleton-line {
    background:
        linear-gradient(90deg,
            rgba(0, 255, 204, 0.04) 0%,
            rgba(0, 255, 204, 0.12) 50%,
            rgba(0, 255, 204, 0.04) 100%);
    background-size: 200% 100%;
    animation: featured-shimmer 1.6s ease-in-out infinite;
}
/* No display-niche shelf on the loading skeletons. */
.featured-skeleton .featured-thumb::before { content: none; }

.featured-skeleton .skeleton-line {
    display: block;
    height: 8px;
    width: 70%;
    border-radius: 2px;
}
.featured-skeleton .skeleton-line + .skeleton-line {
    width: 50%;
    height: 7px;
    margin-top: 2px;
}

@keyframes featured-shimmer {
    0%   { background-position: 100% 50%; opacity: 0.7; }
    50%  { background-position: 0%   50%; opacity: 1; }
    100% { background-position: -100% 50%; opacity: 0.7; }
}

@keyframes daily-pulse {
    0%, 100% { box-shadow: 0 0 0 1px #000, 0 0 14px rgba(255, 46, 136, 0.30); }
    50%      { box-shadow: 0 0 0 1px #000, 0 0 22px rgba(255, 46, 136, 0.55); }
}

@media (max-width: 480px) {
    .daily-theme-banner {
        flex-wrap: wrap;
        padding: 10px 14px;
        gap: 6px;
    }
    .dtb-label, .dtb-cta { font-size: 9px; }
    .dtb-theme { flex-basis: 100%; }
}

/* Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: min(360px, 88vw);
    margin-top: 12px;
}

.big-btn {
    --btn-bg:        #0f2a32;
    --btn-bg-hover:  #14404a;
    --btn-border:    var(--teal-low);
    --btn-fg:        var(--ink);
    --btn-glow:      rgba(0, 255, 204, 0.35);

    position: relative;
    width: 100%;
    padding: 18px 22px;
    font-family: var(--font-title);
    font-size: clamp(18px, 3.4vw, 22px);
    letter-spacing: 2px;
    text-transform: uppercase;
    background: var(--btn-bg);
    color: var(--btn-fg);
    border: 2px solid var(--btn-border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: transform 0.06s ease,
                background 0.12s ease,
                border-color 0.12s ease,
                box-shadow 0.12s ease;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.4),
        0 6px 0 #02141a,
        0 8px 16px rgba(0, 0, 0, 0.5);
    text-shadow: 2px 2px 0 #000;
}

.big-btn:hover,
.big-btn:focus-visible {
    background: var(--btn-bg-hover);
    border-color: var(--teal);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.4),
        0 6px 0 #02141a,
        0 0 18px var(--btn-glow);
    outline: none;
}

.big-btn:active {
    transform: translateY(3px);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.4),
        0 3px 0 #02141a,
        0 0 12px var(--btn-glow);
}

.big-btn .btn-glyph {
    font-size: 1.3em;
    color: var(--teal);
    line-height: 1;
}

/* Install-app variant — subtle teal accent so it reads as a
   utility action, not a primary game CTA. */
.big-btn.install {
    border-color: var(--teal);
    background: linear-gradient(180deg, #0d2a32 0%, #07181e 100%);
}
.big-btn.install .btn-glyph { color: var(--teal); }
.big-btn.install:hover,
.big-btn.install:focus-visible {
    background: linear-gradient(180deg, #144250 0%, #0a2030 100%);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.4),
        0 6px 0 #02141a,
        0 0 18px rgba(0, 255, 204, 0.5);
}

.big-btn.primary {
    --btn-bg:        #2a0a1a;
    --btn-bg-hover:  #41122c;
    --btn-border:    var(--pink);
    --btn-fg:        #fff;
    --btn-glow:      rgba(255, 46, 136, 0.55);

    background: linear-gradient(180deg, #3a1024 0%, #20081a 100%);
    text-shadow:
        2px 2px 0 #000,
        0 0 12px rgba(255, 46, 136, 0.5);
}

.big-btn.primary:hover,
.big-btn.primary:focus-visible {
    background: linear-gradient(180deg, #51163a 0%, #2f0e26 100%);
}

.big-btn.primary .btn-glyph {
    color: var(--pink-bright);
}

/* Drifting clay particle behind the title — a tiny rotating blob */
.clay-drifter {
    position: absolute;
    width: 14px;
    height: 18px;
    left: -40px;
    top: 30%;
    background: radial-gradient(circle at 30% 30%,
        #c97a44 0%,
        var(--clay-1) 60%,
        var(--clay-2) 100%);
    border-radius: 60% 40% 50% 50% / 50% 60% 40% 50%;
    box-shadow: inset -2px -3px 6px rgba(0, 0, 0, 0.4);
    opacity: 0.7;
    animation: clay-drift 14s linear infinite;
    pointer-events: none;
}

@keyframes clay-drift {
    0%   { transform: translate(0, 0) rotate(0deg);    opacity: 0; }
    8%   { opacity: 0.7; }
    50%  { transform: translate(50vw, -30px) rotate(180deg); }
    92%  { opacity: 0.7; }
    100% { transform: translate(100vw, 20px) rotate(360deg); opacity: 0; }
}

/* ----- 6. Specs panel (chunk-8 hook, shipped early but inert
            beyond open/close) ----- */

.specs-hook {
    position: fixed;
    bottom: calc(12px + var(--safe-bottom));
    right: 12px;
    z-index: 60;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    background: var(--bg-frame);
    border: 1px solid var(--teal-low);
    color: var(--teal-dim);
    font-family: var(--font-mono);
    font-size: 11px;
    opacity: 0.5;
    transition: opacity 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.specs-hook:hover,
.specs-hook:focus-visible {
    opacity: 1;
    color: var(--pink-bright);
    transform: scale(1.08);
}

.specs-panel {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 20px;
}

/* `display: flex` above wins against the default `[hidden] { display: none }`,
   so reassert it explicitly. */
.specs-panel[hidden] {
    display: none;
}

.specs-frame {
    width: min(420px, 92vw);
    border: 2px solid var(--teal);
    background: #051419;
    border-radius: var(--radius-md);
    box-shadow:
        0 0 0 1px #000,
        0 0 30px rgba(0, 255, 204, 0.35);
    overflow: hidden;
}

.specs-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, var(--teal) 0%, #00b890 100%);
    color: #002b22;
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
}

.specs-close {
    width: 22px;
    height: 22px;
    line-height: 22px;
    padding: 0;
    background: #002b22;
    color: var(--teal);
    border-radius: 3px;
    font-size: 12px;
}

.specs-close:hover {
    background: var(--pink-deep);
    color: #fff;
}

.specs-body {
    margin: 0;
    padding: 16px;
    color: var(--teal-dim);
    font-family: var(--font-lcd);
    font-size: 18px;
    line-height: 1.2;
    text-shadow: 0 0 4px rgba(0, 255, 204, 0.4);
    white-space: pre;
    overflow-x: auto;
}

/* ----- 7. Site footer overrides (the shared file expects dark bg) ----- */

.site-footer {
    border-top: 1px solid var(--teal-low);
    background: #04121a;
}

/* ----- 8. SHAPE screen (chunk 2 — wheel-throwing) ----- */

#screen-shape {
    padding-top: 12px;
    padding-bottom: 30px;
}

.screen-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 4px 12px;
    margin-bottom: 12px;
    border-bottom: 1px dashed var(--teal-low);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.2px;
}

.back-btn {
    color: var(--teal);
    padding: 5px 10px;
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    background: rgba(0, 255, 204, 0.04);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    white-space: nowrap;
    flex: 0 0 auto;
}

.back-btn:hover,
.back-btn:focus-visible {
    color: var(--pink-bright);
    border-color: var(--pink);
    background: rgba(255, 46, 136, 0.08);
    outline: none;
}

/* Scoped to the screen-titlebar h2 -- without this scope, the
   selector also matched <body class="screen-title">, which
   applied overflow:hidden + white-space:nowrap to the whole
   page on the title screen. Long-standing class-name collision
   that only surfaced once the title got tall enough to need
   scrolling (featured strip + PACK SHOP button). */
.screen-titlebar .screen-title {
    margin: 0;
    font-family: var(--font-title);
    color: var(--pink-bright);
    font-size: clamp(11px, 2.6vw, 20px);
    letter-spacing: 2.5px;
    text-shadow:
        2px 2px 0 #000,
        0 0 10px rgba(255, 46, 136, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    text-align: center;
}

.screen-status {
    color: var(--teal-dim);
    font-family: var(--font-lcd);
    font-size: 16px;
    letter-spacing: 1.5px;
    text-shadow: 0 0 5px rgba(0, 255, 204, 0.4);
    white-space: nowrap;
    flex: 0 0 auto;
}

.shape-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.canvas-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    background: linear-gradient(180deg, #061319 0%, #03090d 100%);
    border: 2px solid var(--teal-low);
    border-radius: var(--radius-lg);
    box-shadow:
        inset 0 0 24px rgba(0, 0, 0, 0.6),
        0 0 18px rgba(0, 255, 204, 0.08),
        0 0 0 1px rgba(0, 0, 0, 0.6);
    width: fit-content;
    max-width: 100%;
}

#shapeCanvas {
    display: block;
    width: clamp(280px, 88vw, 400px);
    aspect-ratio: 400 / 600;
    height: auto;
    /* The CSS pixel size scales; the backing store is set in JS via DPR. */
    background: #0c1f25;
    border-radius: var(--radius-md);
    touch-action: none;       /* prevent page scroll while shaping */
    cursor: grab;             /* hand reads as "this surface is grabbable / shapeable" */
    user-select: none;
    -webkit-user-select: none;
    position: relative;       /* sit ABOVE the wheel-housing pseudo-elements */
    z-index: 1;
}

/* The throwing wheel + stand are now drawn entirely in the canvas
   (see drawWheelStand / drawWheelHeadMetal in game.js), finished to
   match the KILN-9000 chrome. The old CSS splash-pan/cabinet housing
   pseudo-elements were removed — they're fully superseded. */

.shape-hint {
    margin: 2px 8px 0;
    text-align: center;
    color: var(--ink-dim);
    font-family: var(--font-lcd);
    font-size: 18px;
    letter-spacing: 1.2px;
    text-shadow: 0 0 4px rgba(0, 255, 204, 0.2);
    max-width: 420px;
}

/* Clay picker (Day 4 chunk A — material selection)
   Matches the GLAZE/STAMPS palette pattern: label fixed-width on
   the left, swatches in a horizontal-scroll row to the right so
   nothing gets cut off when there are more clays than fit. */
.clay-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(180deg, #082028 0%, #051218 100%);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.45);
    width: 100%;
    max-width: 420px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--teal-low) transparent;
    -webkit-overflow-scrolling: touch;
}

.clay-picker::-webkit-scrollbar       { height: 6px; }
.clay-picker::-webkit-scrollbar-track { background: transparent; }
.clay-picker::-webkit-scrollbar-thumb {
    background: var(--teal-low);
    border-radius: 3px;
}

.clay-picker .row-label {
    min-width: 44px;
    flex: 0 0 auto;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.4px;
    color: var(--teal-dim);
    text-shadow: 0 0 4px rgba(0, 255, 204, 0.3);
}

.clay-swatch {
    flex: 0 0 auto;
    min-width: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: var(--bg-panel);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.12s ease,
                box-shadow 0.12s ease,
                transform 0.06s ease;
}

.clay-swatch:hover,
.clay-swatch:focus-visible {
    border-color: var(--teal);
    outline: none;
}

.clay-swatch:active {
    transform: translateY(1px);
}

.clay-swatch.active {
    border-color: var(--pink-bright);
    background: rgba(255, 46, 136, 0.10);
    box-shadow:
        inset 0 0 6px rgba(255, 46, 136, 0.20),
        0 0 10px rgba(255, 46, 136, 0.40);
}

.clay-swatch .clay-disc {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.55);
    /* Same clay-grain layering as the lump balls (set per-clay in
       buildClayPicker): texture soft-lit over the swatch color. */
    background-image: var(--lump-texture, none);
    background-color: var(--lump-color, #a25a2c);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-blend-mode: soft-light;
    box-shadow: inset -2px -3px 4px rgba(0, 0, 0, 0.4),
                inset 2px 2px 3px rgba(255, 255, 255, 0.18);
}

.clay-swatch .clay-name {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1.2px;
    color: var(--ink-dim);
    text-shadow: 1px 1px 0 #000;
}

.clay-swatch.active .clay-name {
    color: #fff;
}

.shape-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    width: 100%;
    max-width: 420px;
}

.btn-control {
    flex: 1;
    padding: 14px 14px;
    font-family: var(--font-title);
    font-size: clamp(13px, 2.4vw, 16px);
    letter-spacing: 2px;
    text-transform: uppercase;
    background: var(--bg-panel);
    color: var(--ink);
    border: 2px solid var(--teal-low);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.06s ease,
                background 0.12s ease,
                border-color 0.12s ease,
                box-shadow 0.12s ease;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 5px 0 #02141a;
    text-shadow: 1.5px 1.5px 0 #000;
}

.btn-control:hover,
.btn-control:focus-visible {
    background: #14404a;
    border-color: var(--teal);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 5px 0 #02141a,
        0 0 14px rgba(0, 255, 204, 0.3);
    outline: none;
}

.btn-control:active {
    transform: translateY(3px);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 2px 0 #02141a;
}

.btn-control.primary {
    background: linear-gradient(180deg, #3a1024 0%, #20081a 100%);
    border-color: var(--pink);
    color: #fff;
    text-shadow:
        1.5px 1.5px 0 #000,
        0 0 10px rgba(255, 46, 136, 0.5);
}

.btn-control.primary:hover,
.btn-control.primary:focus-visible {
    background: linear-gradient(180deg, #51163a 0%, #2f0e26 100%);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 5px 0 #02141a,
        0 0 14px rgba(255, 46, 136, 0.45);
}

.btn-control .btn-glyph {
    color: var(--pink-bright);
    font-size: 1.2em;
    line-height: 1;
}

/* "Just-shaped" pulse: brief teal halo on RESET / FINISH FORM when
   they fire, so the user gets visual confirmation even before audio
   (audio lands in chunk 7).                                          */
.btn-control.is-flash {
    background: #205060;
    border-color: var(--teal);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 5px 0 #02141a,
        0 0 24px var(--teal);
}

/* COPY LINK -> after click, briefly flash green to confirm. */
.btn-control.is-copied {
    background: #1a4030;
    border-color: #33ff99;
    color: #d4ffe6;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 5px 0 #02141a,
        0 0 18px rgba(51, 255, 153, 0.6);
}

/* ----- 9. DECORATE screen (chunk 3 — paint / glaze / stamp) ----- */

#screen-decorate {
    padding-top: 12px;
    padding-bottom: 30px;
}

#decorateCanvas {
    display: block;
    width: clamp(280px, 88vw, 400px);
    aspect-ratio: 400 / 600;
    height: auto;
    background: #0c1f25;
    border-radius: var(--radius-md);
    touch-action: none;
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
}

/* Floating overlay button on the canvas frame (undo lives here).
   Sits in the top-right corner of the canvas-wrap, slightly inset.
   overflow: hidden lets the canvas zoom + pan inside the wrap
   without spilling onto the surrounding tool rails. */
.canvas-wrap { position: relative; overflow: hidden; }

/* Zoom controls -- bottom-left of the canvas-wrap so they don't
   collide with the UNDO button in the top-right. */
.zoom-controls {
    position: absolute;
    bottom: 14px;
    left: 14px;
    z-index: 4;
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    background: rgba(10, 14, 18, 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.zoom-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--teal-low);
    border-radius: 3px;
    background: var(--bg-deep);
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease,
                background 0.12s ease;
}
.zoom-btn:hover:not([disabled]) {
    transform: scale(1.06);
    border-color: var(--teal);
    background: rgba(0, 255, 204, 0.10);
}
.zoom-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

.zoom-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 0 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--ink);
    background: var(--bg-deep);
    border: 1px solid var(--teal-low);
    border-radius: 3px;
}

/* Floating command ribbon — ERASE / CLEAR / UNDO / REDO. A
   vertical strip pinned to the canvas top-right (clear of the
   bottom-left zoom cluster). Commands act on the whole painting,
   so they're deliberately NOT siblings of the BRUSH tool row. */
.canvas-cmd-ribbon {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cmd-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: 52px;
    min-height: 44px;          /* thumb-friendly touch target */
    padding: 5px 3px;
    border-radius: 11px;
    background: rgba(12, 31, 37, 0.85);
    border: 1px solid var(--teal-low);
    color: var(--teal);
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: background 0.12s ease,
                border-color 0.12s ease,
                color 0.12s ease,
                box-shadow 0.12s ease,
                transform 0.06s ease;
    text-shadow: 0 0 6px rgba(0, 255, 204, 0.3);
}

.cmd-glyph {
    font-size: 18px;
    line-height: 1;
}

.cmd-label {
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 1px;
    line-height: 1;
}

.cmd-btn:hover,
.cmd-btn:focus-visible {
    background: rgba(20, 64, 74, 0.92);
    border-color: var(--teal);
    color: var(--pink-bright);
    outline: none;
    box-shadow: 0 0 14px rgba(255, 46, 136, 0.35);
}

.cmd-btn:active {
    transform: translateY(1px);
}

.cmd-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
    color: var(--ink-low);
    border-color: var(--ink-low);
    text-shadow: none;
    box-shadow: none;
}

/* NUKE keeps a faint danger tint so it reads as the "wipe
   everything" command. */
.cmd-clear .cmd-glyph {
    color: #ff6b6b;
}

/* Stamp rotation row */
.rotate-row {
    align-items: center;
}

.tool-slider {
    flex: 1;
    height: 24px;
    background: transparent;
    cursor: pointer;
    /* Reset native styling so we can style the track + thumb */
    -webkit-appearance: none;
    appearance: none;
}

.tool-slider::-webkit-slider-runnable-track {
    height: 4px;
    background: linear-gradient(90deg,
        var(--teal-low) 0%,
        var(--pink) 100%);
    border-radius: 2px;
}

.tool-slider::-moz-range-track {
    height: 4px;
    background: linear-gradient(90deg,
        var(--teal-low) 0%,
        var(--pink) 100%);
    border-radius: 2px;
}

.tool-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--pink-bright);
    border: 2px solid #fff;
    margin-top: -6px;
    cursor: grab;
    box-shadow: 0 0 8px rgba(255, 46, 136, 0.55);
}

.tool-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--pink-bright);
    border: 2px solid #fff;
    cursor: grab;
    box-shadow: 0 0 8px rgba(255, 46, 136, 0.55);
}

.tool-slider:focus-visible {
    outline: none;
}

.tool-slider:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(0, 255, 204, 0.45),
                0 0 12px rgba(255, 46, 136, 0.55);
}

.rotate-value {
    min-width: 42px;
    text-align: right;
    font-family: var(--font-lcd);
    font-size: 16px;
    color: var(--teal-dim);
    text-shadow: 0 0 5px rgba(0, 255, 204, 0.35);
}

.rotate-reset {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    background: var(--bg-panel);
    border: 1px solid var(--teal-low);
    color: var(--teal-dim);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.12s ease, border-color 0.12s ease;
}

.rotate-reset:hover,
.rotate-reset:focus-visible {
    color: var(--pink-bright);
    border-color: var(--pink-bright);
    outline: none;
}

/* Flip-horizontal toggle — same chassis as .rotate-reset so the
   row reads as a single control cluster. .is-active is added in
   game.js whenever D.stampFlipH is true so the button lights up
   teal while the next stamp is mirrored. */
.rotate-flip {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    background: var(--bg-panel);
    border: 1px solid var(--teal-low);
    color: var(--teal-dim);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.12s ease, border-color 0.12s ease,
                background 0.12s ease;
}
.rotate-flip:hover,
.rotate-flip:focus-visible {
    color: var(--pink-bright);
    border-color: var(--pink-bright);
    outline: none;
}
.rotate-flip.is-active {
    color: var(--teal);
    border-color: var(--teal);
    background: rgba(0, 255, 204, 0.16);
    box-shadow: 0 0 8px rgba(0, 255, 204, 0.35);
}
.rotate-flip.is-active:hover,
.rotate-flip.is-active:focus-visible {
    color: #fff;
    border-color: var(--teal);
}

.decorate-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.decorate-tools {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    /* Row spacing is per-row margin (not flex gap) so a collapsed
       .ctx-block can animate its margin to zero and leave NO dead
       space between the rows that remain visible. */
    gap: 0;
    padding: 12px;
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #082028 0%, #051218 100%);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-md);
    box-shadow:
        inset 0 0 16px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 0, 0, 0.4);
}

.tool-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Per-row spacing (see .decorate-tools gap:0 note). Every row but
   the first gets a top margin; the STASH label hugs the strip
   below it. */
.decorate-tools > .tool-row,
.decorate-tools > .stash-label {
    margin-top: 10px;
}
.decorate-tools > .stash-label:first-child {
    margin-top: 0;
}
.decorate-tools > .stash-label + .pack-tabs {
    margin-top: 4px;
}

/* Progressive disclosure: contextual rows collapse smoothly when
   the active tool doesn't use them. max-height + opacity animate
   (display:none can't), and margin-top -> 0 removes the row's
   spacing so no dead-space lingers. */
.ctx-block {
    overflow: hidden;
    max-height: 240px;
    opacity: 1;
    transition: max-height 0.28s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.18s ease,
                margin-top 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
.decorate-tools > .ctx-block.ctx-hidden {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .ctx-block { transition: none; }
}

/* STASH header above the pack strip. */
.stash-label {
    align-self: flex-start;
}

.row-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.4px;
    color: var(--teal-dim);
    min-width: 52px;
    flex: 0 0 auto;
    text-shadow: 0 0 4px rgba(0, 255, 204, 0.3);
}

.tool-modes {
    flex-wrap: wrap;
    gap: 6px;
}

/* Pack tabs — single horizontal strip that scrolls (momentum on
   touch) instead of wrapping into a tall block. Selected pack
   keeps the pink-fill .active style. Desktop: fits if there's
   room, otherwise scrolls the same way. */
.pack-tabs {
    flex-wrap: nowrap;
    gap: 4px;
    padding-bottom: 6px;
    margin-bottom: 2px;
    border-bottom: 1px dashed var(--teal-low);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--teal-low) transparent;
}
.pack-tabs::-webkit-scrollbar {
    height: 5px;
}
.pack-tabs::-webkit-scrollbar-thumb {
    background: var(--teal-low);
    border-radius: 3px;
}
.pack-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.pack-tab {
    flex: 0 0 auto;
    min-height: 44px;          /* thumb-friendly touch target */
    padding: 7px 12px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.4px;
    background: var(--bg-deep);
    color: var(--teal-dim);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    transition: background 0.12s ease,
                color 0.12s ease,
                border-color 0.12s ease,
                box-shadow 0.12s ease,
                transform 0.06s ease;
    text-shadow: 1px 1px 0 #000;
    white-space: nowrap;
}

.pack-tab:hover,
.pack-tab:focus-visible {
    color: var(--teal);
    border-color: var(--teal);
    background: rgba(0, 255, 204, 0.06);
    outline: none;
}

.pack-tab:active {
    transform: translateY(1px);
}

.pack-tab.active {
    background: linear-gradient(180deg, #ff3d96 0%, #b81866 100%);
    color: #fff;
    border-color: var(--pink-bright);
    box-shadow:
        inset 0 0 8px rgba(255, 255, 255, 0.20),
        0 0 12px rgba(255, 46, 136, 0.55);
}

/* MODDED's @rgb-cycle glaze — the swatch itself cycles through
   the rainbow so the user knows the strokes will too. */
.swatch.dynamic-rgb {
    background:
        linear-gradient(135deg,
            #ff0040 0%,
            #ff8800 14%,
            #ffee00 28%,
            #00ff44 42%,
            #00bbff 56%,
            #2200ff 70%,
            #ff00aa 84%,
            #ff0040 100%);
    background-size: 360% 360%;
    animation: rgb-slide 3.6s linear infinite;
}

@keyframes rgb-slide {
    0%   { background-position: 0%   50%; }
    100% { background-position: 360% 50%; }
}

.tool-btn {
    flex: 1;
    min-width: 30%;            /* 6 tools wrap 3-up on phones */
    min-height: 44px;          /* thumb-friendly touch target */
    padding: 10px 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1.6px;
    background: var(--bg-panel);
    color: var(--ink);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    transition: background 0.12s ease,
                color 0.12s ease,
                border-color 0.12s ease,
                box-shadow 0.12s ease,
                transform 0.06s ease;
    text-shadow: 1px 1px 0 #000;
}

.tool-btn:hover,
.tool-btn:focus-visible {
    background: #14404a;
    border-color: var(--teal);
    outline: none;
}

.tool-btn:active {
    transform: translateY(1px);
}

.tool-btn.active {
    background: linear-gradient(180deg, #ff3d96 0%, #b81866 100%);
    color: #fff;
    border-color: var(--pink-bright);
    box-shadow:
        inset 0 0 10px rgba(255, 255, 255, 0.18),
        0 0 12px rgba(255, 46, 136, 0.5);
}

/* TEXTURE button — disabled when the active pack has no
   surfaceTexture asset (e.g., BASIC, DINOSAUR, BREAKFAST, MUSIC,
   MEGA at time of writing). Reads grayed-out so the user knows
   it's there but inert. Click is also blocked via DOM disabled. */
.tool-btn.disabled,
.tool-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.6);
}

/* SIZE was three discrete .size-btn pucks; now a .tool-slider
   matching ROT, so the styles here were removed. */

.palette-row {
    align-items: flex-start;
}

.palette-row .row-label {
    padding-top: 8px;
}

.palette {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 2px 4px 6px;
}

.swatch {
    position: relative;   /* anchor for the floating name chip */
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.55);
    padding: 0;
    cursor: pointer;
    box-shadow: 0 0 0 1px var(--teal-low);
    transition: transform 0.1s ease, box-shadow 0.12s ease;
}

.swatch:hover,
.swatch:focus-visible {
    box-shadow: 0 0 0 1px var(--teal);
    outline: none;
}

.swatch.active {
    transform: scale(1.18);
    box-shadow:
        0 0 0 1px #fff,
        0 0 0 3px var(--pink-bright),
        0 0 10px rgba(255, 46, 136, 0.6);
}

/* Floating name chip above each glaze swatch on hover/focus.
   Built from the data-name attribute set by buildToolUI; reads
   "CHERRY RED" / "SCANLINE GRAY" / etc. Pure CSS so it works
   without a JS handler and respects native focus-visible. */
.swatch[data-name]::after {
    content: attr(data-name);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 3px 7px;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1.4px;
    color: var(--teal);
    background: rgba(8, 22, 28, 0.92);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.16s ease, transform 0.16s ease;
    z-index: 4;
}
.swatch:hover::after,
.swatch:focus-visible::after,
.swatch.active::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.stamp-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    background: var(--bg-panel);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    padding: 3px;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stamp-btn:hover,
.stamp-btn:focus-visible {
    border-color: var(--teal);
    outline: none;
}

.stamp-btn canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.stamp-btn.active {
    background: rgba(255, 46, 136, 0.18);
    border-color: var(--pink-bright);
    box-shadow:
        inset 0 0 6px rgba(255, 46, 136, 0.25),
        0 0 10px rgba(255, 46, 136, 0.45);
}

/* CRUNCH texture skins — same footprint as stamp buttons, but the
   tile previews the tilable texture as a cropped background image. */
.texture-swatch {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    background-color: var(--bg-panel);
    background-size: cover;
    background-position: center;
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.12s ease, box-shadow 0.12s ease,
                transform 0.06s ease;
}
/* Translucent skins back their texture with a white tile so the
   checker layered in JS reads as "see-through" rather than dim. */
.texture-swatch.translucent { background-color: #f4f4f4; }
.texture-swatch:hover,
.texture-swatch:focus-visible {
    border-color: var(--teal);
    outline: none;
}
.texture-swatch:active { transform: translateY(1px); }
.texture-swatch.active {
    border-color: var(--pink-bright);
    box-shadow:
        inset 0 0 0 2px rgba(255, 46, 136, 0.5),
        0 0 10px rgba(255, 46, 136, 0.55);
}

/* A contextual row with no content for the active pack (e.g. the
   CRUNCH skins row on BASIC, which has no textures) collapses out
   entirely, overriding the tool-context show state. */
.ctx-block.ctx-empty { display: none !important; }

.decorate-controls {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 420px;
}

/* ----- 10. KILN screen (chunk 5 — firing animation) ----- */

#screen-kiln {
    padding-top: 12px;
    padding-bottom: 30px;
}

.kiln-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.kiln-wrap {
    position: relative;
}

#kilnCanvas {
    display: block;
    width: clamp(280px, 88vw, 400px);
    aspect-ratio: 400 / 600;
    height: auto;
    background: #06141a;
    border-radius: var(--radius-md);
    touch-action: manipulation;
    user-select: none;
}

/* Celebration overlay — appears after the firing reveal */
.kiln-celebrate {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 8%;
    pointer-events: none;
    text-align: center;
    animation: celebrate-in 600ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.kiln-celebrate[hidden] {
    display: none;
}

.celebrate-title {
    margin: 0;
    font-family: var(--font-title);
    font-size: clamp(48px, 12vw, 96px);
    line-height: 1;
    letter-spacing: 6px;
    color: #fff;
    text-shadow:
        4px 4px 0 var(--pink-deep),
        -2px -2px 0 var(--teal),
        0 0 28px rgba(255, 90, 31, 0.7),
        0 0 56px rgba(255, 200, 60, 0.5);
    transform: rotate(-3deg);
}

.celebrate-sub {
    margin: 12px 0 0;
    font-family: var(--font-title);
    font-size: clamp(18px, 4vw, 28px);
    letter-spacing: 3px;
    color: var(--kiln-1);
    text-shadow:
        2px 2px 0 #000,
        0 0 14px rgba(255, 140, 30, 0.55);
}

/* Exploded variant — red/violent palette instead of celebratory
   orange. The text shake reads as a small "this hurts" tremor. */
.kiln-celebrate.is-exploded .celebrate-title {
    color: #fff;
    text-shadow:
        4px 4px 0 #7a1818,
        -2px -2px 0 #ff3a3a,
        0 0 28px rgba(255, 60, 30, 0.85),
        0 0 56px rgba(255, 30, 20, 0.55);
    transform: rotate(-2deg);
    animation: explode-jitter 0.10s steps(2) 8;
}

.kiln-celebrate.is-exploded .celebrate-sub {
    color: #ff9060;
    text-shadow:
        2px 2px 0 #000,
        0 0 14px rgba(255, 90, 30, 0.7);
}

@keyframes explode-jitter {
    0%   { transform: translate(0, 0) rotate(-2deg); }
    25%  { transform: translate(-3px, 1px) rotate(-3deg); }
    50%  { transform: translate(3px, -2px) rotate(-1deg); }
    75%  { transform: translate(-2px, 2px) rotate(-3deg); }
    100% { transform: translate(0, 0) rotate(-2deg); }
}

.celebrate-saved {
    margin: 22px 0 0;
    font-family: var(--font-lcd);
    font-size: 18px;
    letter-spacing: 1.5px;
    color: var(--teal);
    text-shadow: 0 0 8px rgba(0, 255, 204, 0.45);
    animation: saved-blink 1.2s ease-in-out infinite alternate;
}

@keyframes celebrate-in {
    from { opacity: 0; transform: scale(0.7); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes saved-blink {
    from { opacity: 0.55; }
    to   { opacity: 1; }
}

.kiln-controls {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 420px;
    justify-content: center;
}

.kiln-controls[hidden] {
    display: none;
}

.kiln-controls .btn-control {
    flex: 1;
}

/* ----- 11. GALLERY screen (chunk 6 — localStorage thumb grid + PNG export) ----- */

#screen-gallery {
    padding-top: 12px;
    padding-bottom: 30px;
}

.gallery-stack {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

/* Gallery tabs — Day 5 chunk E (MINE / EVERYONE) */
.gallery-tabs {
    width: 100%;
    max-width: 720px;
    display: flex;
    gap: 8px;
}

.gallery-tab {
    flex: 1;
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1.5px;
    background: var(--bg-deep);
    color: var(--teal-dim);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-shadow: 1px 1px 0 #000;
    transition: background 0.12s ease,
                color 0.12s ease,
                border-color 0.12s ease,
                box-shadow 0.12s ease,
                transform 0.06s ease;
}

.gallery-tab:hover,
.gallery-tab:focus-visible {
    color: var(--teal);
    border-color: var(--teal);
    background: rgba(0, 255, 204, 0.06);
    outline: none;
}

.gallery-tab.active {
    background: linear-gradient(180deg, #ff3d96 0%, #b81866 100%);
    color: #fff;
    border-color: var(--pink-bright);
    box-shadow:
        inset 0 0 8px rgba(255, 255, 255, 0.18),
        0 0 12px rgba(255, 46, 136, 0.45);
}

/* Author byline on public pot cards */
.pot-author {
    font-family: var(--font-lcd);
    font-size: 13px;
    letter-spacing: 0.8px;
    color: var(--pink-bright);
    text-shadow: 0 0 5px rgba(255, 46, 136, 0.35);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Empty-state / message text inside the grid */
.gallery-msg {
    grid-column: 1 / -1;
    margin: 24px 0;
    text-align: center;
    font-family: var(--font-lcd);
    font-size: 18px;
    letter-spacing: 1px;
    color: var(--ink-dim);
}

.a-lot-of-pots {
    width: 100%;
    max-width: 720px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(90deg, rgba(255,46,136,0.15), rgba(0,255,204,0.10));
    border: 1px solid var(--pink);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--ink);
    box-shadow: 0 0 14px rgba(255, 46, 136, 0.25);
}

.a-lot-of-pots[hidden] { display: none; }

.lop-glyph {
    color: var(--pink-bright);
    font-size: 18px;
    text-shadow: 0 0 8px rgba(255, 46, 136, 0.6);
}

.gallery-grid {
    width: 100%;
    max-width: 720px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.gallery-grid:empty { display: none; }

.pot-card {
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #082028 0%, #051218 100%);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-md);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    transition: border-color 0.12s ease,
                box-shadow 0.12s ease,
                transform 0.06s ease;
    text-align: left;
}

.pot-card:hover,
.pot-card:focus-visible {
    border-color: var(--pink-bright);
    box-shadow: 0 0 14px rgba(255, 46, 136, 0.35);
    outline: none;
    transform: translateY(-2px);
}

/* Shared-to-Everyone pots glow pink (replaces the old globe badge). */
.pot-card.is-shared {
    border-color: var(--pink-bright);
    box-shadow:
        0 0 0 1px rgba(255, 46, 136, 0.4),
        0 0 16px rgba(255, 46, 136, 0.5);
}
.pot-card.is-shared:hover,
.pot-card.is-shared:focus-visible {
    box-shadow:
        0 0 0 1px rgba(255, 46, 136, 0.55),
        0 0 22px rgba(255, 46, 136, 0.65);
}

.pot-thumb {
    aspect-ratio: 400 / 600;
    background: #06141a;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--teal-low);
    position: relative;
}

.pot-thumb canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;   /* above the niche + pedestal pseudo-elements */
    z-index: 1;
}

/* ---- Gallery display niche + pedestal (CSS "display cabinet") ----
   Gallery + detail pots render on a TRANSPARENT canvas (no wood
   plinth), so each pot sits in a lit recessed niche on a steel
   pedestal finished to match the KILN-9000 / wheel chrome. Used by
   the gallery grid + detail modal AND the title-page "FRESH FROM
   EVERYONE" strip (.featured-thumb), so the preview matches the vault;
   profile/battle keep the plain flat thumb. */
.pot-thumb,
.featured-thumb,
.battle-entry-thumb {
    position: relative;
    background:
        radial-gradient(ellipse 72% 56% at 50% 20%,
            rgba(0, 255, 204, 0.11) 0%,
            rgba(150, 180, 188, 0.05) 32%,
            transparent 64%),
        linear-gradient(180deg, #0b1d23 0%, #060f14 100%);
    box-shadow:
        inset 0 9px 22px rgba(0, 0, 0, 0.55),
        inset 0 -2px 6px rgba(0, 0, 0, 0.40);
}
/* Pot canvas sits above the niche + shelf pseudo-elements. */
.pot-thumb canvas,
.featured-thumb canvas,
.battle-entry-thumb canvas {
    position: relative;
    z-index: 1;
}
.pot-thumb::before,
.featured-thumb::before,
.battle-entry-thumb::before {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    /* A simple flat shelf the pot stands on — top edge lands at the
       pot base line (~85% down). Thin steel ledge with a teal top
       sheen + copper front edge, and a soft shadow underneath. No 3-D
       podium, no wedged plate. */
    bottom: 13%;
    height: 5px;
    z-index: 0;            /* behind the pot canvas */
    border-radius: 2px;
    background: linear-gradient(180deg, #34474e 0%, #18272d 100%);
    box-shadow:
        inset 0 1px 0 rgba(0, 255, 204, 0.30),     /* teal top sheen */
        0 1px 0 rgba(192, 128, 64, 0.40),          /* copper front edge */
        0 9px 16px -5px rgba(0, 0, 0, 0.55);       /* soft shadow under shelf */
}

/* Pot age decay overlays. Pure CSS -- a pseudo-element layers
   sepia + crack hatching on top of the rendered canvas.

     .is-vintage  -- 7-29 days old. Subtle sepia mist + faint
                     hairline crack across the thumb. Reads as
                     "older pot" without making the kid think
                     anything's wrong with it.
     .is-cracked  -- 30+ days. Heavier sepia, visible crack
                     lines, faint chip on the rim. Antique pot
                     vibe -- it's been on the shelf a while. */

.pot-thumb.is-vintage::after,
.pot-thumb.is-cracked::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.pot-thumb.is-vintage::after {
    background:
        /* Faint hairline crack from upper-right to lower-left */
        linear-gradient(225deg,
            transparent 47%,
            rgba(120, 70, 30, 0.18) 49%,
            rgba(180, 130, 70, 0.22) 50%,
            rgba(120, 70, 30, 0.18) 51%,
            transparent 53%) no-repeat,
        /* Sepia mist across the whole thumb */
        radial-gradient(ellipse at 50% 40%,
            rgba(255, 230, 180, 0.0) 0%,
            rgba(180, 130, 70, 0.12) 70%,
            rgba(80, 40, 20, 0.20) 100%);
    mix-blend-mode: multiply;
}

.pot-thumb.is-cracked::after {
    background:
        /* Main crack -- diagonal */
        linear-gradient(215deg,
            transparent 42%,
            rgba(40, 20, 10, 0.55) 44%,
            rgba(200, 160, 110, 0.4) 45%,
            rgba(40, 20, 10, 0.55) 46%,
            transparent 48%) no-repeat,
        /* Secondary crack -- shallower angle */
        linear-gradient(165deg,
            transparent 62%,
            rgba(40, 20, 10, 0.42) 64%,
            rgba(180, 140, 90, 0.32) 65%,
            rgba(40, 20, 10, 0.42) 66%,
            transparent 68%) no-repeat,
        /* Chip on the upper-left rim */
        radial-gradient(circle at 22% 18%,
            rgba(60, 30, 15, 0.55) 0%,
            rgba(60, 30, 15, 0.0) 8%),
        /* Heavier sepia */
        radial-gradient(ellipse at 50% 40%,
            rgba(255, 220, 170, 0.0) 0%,
            rgba(160, 110, 60, 0.22) 70%,
            rgba(60, 30, 15, 0.35) 100%);
    mix-blend-mode: multiply;
}

/* "This pot is also shared" indicator on personal-gallery
   thumbs. Subtle but always present once a pot has a publicId.
   Globe glyph inside a pink-bordered teal disc. */
.pot-shared-flag {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(10, 26, 32, 0.92);
    border: 1.5px solid var(--pink);
    color: #d4ffe6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 0 10px rgba(255, 46, 136, 0.45);
    pointer-events: none;
    z-index: 2;
}

/* Trophy emblem — pot has placed in a battle. Top-LEFT so it
   doesn't collide with the shared-globe (top-right). Color
   ramps by tier: gold for 1st, silver for 2nd, copper for HM. */
.pot-trophy-flag {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(10, 26, 32, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
    pointer-events: none;
    z-index: 2;
    border: 1.5px solid #d4af37;
    color: #ffe88a;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 0 12px rgba(212, 175, 55, 0.55);
}
.pot-trophy-flag.tier-second {
    border-color: #c2cdd6;
    color: #e6edf2;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 0 12px rgba(194, 205, 214, 0.55);
}
.pot-trophy-flag.tier-honorable {
    border-color: #b87333;
    color: #f0b078;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 0 12px rgba(184, 115, 51, 0.55);
}

/* DRAFT badge on unfired-pot thumbnails. Top-right corner so it
   doesn't conflict with the trophy (top-left) or the shared
   globe (also top-right but only one of these states applies to
   any given card — drafts can't be shared). The whole card also
   gets a slightly muted look via .is-draft below. */
.pot-draft-flag {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 3px 7px;
    border-radius: var(--radius-sm);
    background: rgba(0, 255, 204, 0.18);
    border: 1px solid var(--teal);
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1.4px;
    text-shadow: 0 0 4px rgba(0, 255, 204, 0.5);
    pointer-events: none;
    z-index: 2;
}

/* Drafts feel slightly "in progress" via mild desaturation + a
   teal border accent. Hover restores full brightness so the kid
   can preview the pot at its real color before continuing. */
.pot-card.is-draft {
    border-color: var(--teal-low);
}
.pot-card.is-draft .pot-thumb {
    filter: saturate(0.85) brightness(0.95);
    transition: filter 0.16s ease;
}
.pot-card.is-draft:hover .pot-thumb,
.pot-card.is-draft:focus-visible .pot-thumb {
    filter: none;
}

.pot-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pot-name {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--ink);
    text-shadow: 1px 1px 0 #000;
    /* truncate */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pot-date {
    font-family: var(--font-lcd);
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--teal-dim);
}

.pot-pack-tag {
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1.2px;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(0, 255, 204, 0.1);
    color: var(--teal);
    border: 1px solid var(--teal-low);
}

/* Empty state */
.gallery-empty {
    width: 100%;
    max-width: 420px;
    margin-top: 30px;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #082028 0%, #051218 100%);
    border: 1px dashed var(--teal-low);
    border-radius: var(--radius-lg);
    text-align: center;
}

.gallery-empty[hidden] { display: none; }

.empty-glyph {
    font-size: 64px;
    color: var(--teal-low);
    line-height: 1;
}

.empty-title {
    margin: 0;
    font-family: var(--font-title);
    color: var(--pink-bright);
    font-size: 22px;
    letter-spacing: 3px;
    text-shadow: 2px 2px 0 #000;
}

.empty-sub {
    margin: 0;
    font-family: var(--font-lcd);
    font-size: 18px;
    color: var(--ink-dim);
    letter-spacing: 1px;
}

.gallery-empty .big-btn {
    width: 100%;
    max-width: 280px;
    margin-top: 8px;
}

/* Detail modal */
.pot-detail {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.pot-detail[hidden] { display: none; }

.pot-detail-card {
    width: min(440px, 96vw);
    /* Definite height (NOT just max-height) so the flex:1
       canvas-wrap actually has leftover space to claim. Capped
       at 96vh to leave a small backdrop margin. */
    height: min(96vh, 720px);
    max-height: 96vh;
    /* Self-contained popup: nothing scrolls. The titlebar / name /
       actions take their natural height, the canvas-wrap takes
       whatever's left and shrinks the pot preview to fit. */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #051419;
    border: 2px solid var(--teal);
    border-radius: var(--radius-md);
    box-shadow:
        0 0 0 1px #000,
        0 0 30px rgba(0, 255, 204, 0.35);
}

/* Shared pots glow pink in the detail modal too, matching the
   vault card. Overrides the teal frame so "this is shared" reads
   at a glance. */
.pot-detail-card.is-shared {
    border-color: var(--pink-bright);
    box-shadow:
        0 0 0 1px #000,
        0 0 34px rgba(255, 46, 136, 0.6);
}

.detail-titlebar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, var(--teal) 0%, #00b890 100%);
    color: #002b22;
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.2px;
}

.detail-pack {
    background: rgba(0, 0, 0, 0.45);
    color: var(--teal);
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: 1.6px;
}

.detail-date {
    flex: 1;
    color: #002b22;
    font-family: var(--font-lcd);
    font-size: 13px;
    text-align: right;
    margin-right: 8px;
}

.detail-canvas-wrap {
    /* Takes whatever vertical space is left after titlebar / name /
       actions; min-height:0 lets the flex item actually shrink
       below its content. Inner flex centers the canvas. */
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Lit display niche — top spotlight glow over a dark recess, to
       match the gallery-grid display case. */
    background:
        radial-gradient(ellipse 64% 48% at 50% 18%,
            rgba(0, 255, 204, 0.10) 0%,
            transparent 60%),
        linear-gradient(180deg, #0b1d23 0%, #060f14 100%);
    box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.55);
    padding: 8px;
    overflow: hidden;
}

#detailCanvas {
    display: block;
    /* The canvas's width="400" height="600" attributes provide the
       intrinsic 2:3 ratio; max-width AND max-height = 100% let the
       browser scale down to whichever container dimension runs out
       first, preserving aspect — no explicit width/height in CSS,
       no aspect-ratio, no 0×0 collapse. */
    max-width: 100%;
    max-height: 100%;
    background: transparent;   /* let the lit display niche show behind */
    border-radius: var(--radius-sm);
}

.detail-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    /* v1.1 polish — lip-gradient treatment echoing the pot rim's
       light-to-shadow curve. Top edge picks up a faint teal glow
       (the "catch light"), background fades to deeper bg-deep.
       Replaces the previous dashed-top divider which read as
       utilitarian against the canvas above. */
    background:
        linear-gradient(180deg,
            rgba(0, 255, 204, 0.08) 0%,
            rgba(0, 0, 0, 0)        14%,
            rgba(0, 0, 0, 0.18)     100%);
    border-top: 1px solid rgba(0, 255, 204, 0.18);
}

.detail-name-row .row-label {
    min-width: 56px;
}

.detail-name-input {
    flex: 1;
    /* <input> has a UA default min-width from its `size` attribute
       (~150px) that overrides flex shrinking — making the row
       overflow horizontally on narrow popups. Explicit min-width:0
       lets flex actually compress it to fit. */
    min-width: 0;
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-deep);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-family: var(--font-lcd);
    font-size: 18px;
    letter-spacing: 1px;
    -webkit-text-fill-color: var(--ink); /* iOS dark-mode safety */
}

.detail-name-input:focus {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 8px rgba(255, 46, 136, 0.3);
}

.detail-actions {
    display: flex;
    /* Wrap so wide buttons don't push the popup past its width.
       (Shared by the account + submit-picker action rows; the
       gallery detail modal overrides this to stacked rows below.) */
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px 14px;
    /* v1.1 polish — continue the lip-gradient deepening downward
       so the entire metadata strip reads as one polished surface
       (titlebar > canvas > name-row > actions). Subtle bottom
       glow hints at the pot inside being warm. */
    background:
        linear-gradient(180deg,
            rgba(0, 0, 0, 0.18)        0%,
            rgba(0, 0, 0, 0.28)        70%,
            rgba(255, 46, 136, 0.08)   100%);
}

.detail-actions .btn-control {
    flex: 0 1 auto;
    min-width: 90px;
    padding: 12px 10px;
}

/* ===== Gallery detail modal action rows (scoped to #potDetail so
   the account + submit-picker .detail-actions keep their layout). */
#potDetail .detail-actions {
    flex-direction: column;
    flex-wrap: nowrap;
}
#potDetail .detail-action-row {
    display: flex;
    gap: 10px;
}
#potDetail .detail-actions .btn-control {
    flex: 1;
    min-width: 0;
}
/* CRITICAL: .btn-control sets display:flex, which (author origin)
   overrides the UA [hidden]{display:none}, so the conditionally-
   hidden detail buttons (SAVE / STOP-SHARING / REMIX) were all
   showing at once. Restore the hide so the show/hide logic works
   AND so empty rows can be detected below. */
#potDetail .detail-actions .btn-control[hidden] { display: none !important; }

/* A row whose buttons are all hidden collapses so it leaves no dead
   gap (e.g. SHARE|STOP-SHARING on a public pot, DELETE|SAVE on a
   non-draft public pot). */
#potDetail .detail-action-row:not(:has(> .btn-control:not([hidden]))) {
    display: none;
}

/* "SHARED" status button (the SHARE slot once a pot is shared). It's
   disabled but should read as a positive pink badge, not a greyed-out
   dead button. */
#potDetail .detail-actions .btn-control.is-shared-status,
#potDetail .detail-actions .btn-control.is-shared-status[disabled] {
    background: linear-gradient(180deg, #ff3d96 0%, #b81866 100%);
    border-color: var(--pink-bright);
    color: #fff;
    opacity: 1;
    cursor: default;
    box-shadow:
        inset 0 0 8px rgba(255, 255, 255, 0.18),
        0 0 12px rgba(255, 46, 136, 0.45);
}

/* ----- 12. Easter eggs (chunk 8 — Konami dev menu, PINGAS flash, OVERCLOCKED toast) ----- */

/* DEV_MENU.EXE — opens on the Konami code at the title screen */
.dev-menu {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.dev-menu[hidden] { display: none; }

.dev-frame {
    width: min(420px, 92vw);
    border: 2px solid var(--pink);
    background: #051419;
    border-radius: var(--radius-md);
    box-shadow:
        0 0 0 1px #000,
        0 0 32px rgba(255, 46, 136, 0.5);
    overflow: hidden;
    animation: dev-shake 0.12s steps(2) 4;
}

@keyframes dev-shake {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-2px, 1px); }
    50%  { transform: translate(2px, -1px); }
    75%  { transform: translate(-1px, 2px); }
    100% { transform: translate(0, 0); }
}

.dev-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, var(--pink) 0%, var(--pink-deep) 100%);
    color: #fff;
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.6px;
    text-shadow: 1px 1px 0 #000;
}

.dev-body {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-family: var(--font-lcd);
    font-size: 18px;
    color: var(--teal-dim);
    text-shadow: 0 0 5px rgba(0, 255, 204, 0.3);
}

.dev-warn,
.dev-foot {
    margin: 0;
    color: var(--pink-bright);
    text-shadow: 0 0 6px rgba(255, 46, 136, 0.45);
}

.dev-foot {
    color: var(--teal-dim);
    font-size: 14px;
    margin-top: 4px;
}

.dev-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 0;
}

.dev-toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--pink);
}

.dev-toggle span {
    flex: 1;
}

.dev-toggle em {
    color: var(--ink-low);
    font-style: normal;
    font-size: 14px;
}

/* PINGAS flash overlay */
.pingas-flash {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    animation: pingas-flash 1.2s ease-out forwards;
}

.pingas-flash[hidden] { display: none; }

@keyframes pingas-flash {
    0%   { opacity: 0; transform: scale(0.4); }
    20%  { opacity: 1; transform: scale(1.15); }
    50%  { opacity: 1; transform: scale(1.0); }
    100% { opacity: 0; transform: scale(1.4); }
}

.robotnik-silhouette {
    width: 180px;
    height: 216px;
    filter: drop-shadow(0 0 18px rgba(255, 46, 136, 0.7))
            drop-shadow(0 0 32px rgba(0, 255, 204, 0.4));
}

.pingas-text {
    position: absolute;
    bottom: 22%;
    font-family: var(--font-title);
    font-size: clamp(48px, 12vw, 96px);
    letter-spacing: 8px;
    color: #fff;
    text-shadow:
        5px 5px 0 var(--pink-deep),
        -2px -2px 0 var(--teal),
        0 0 24px rgba(255, 46, 136, 0.8);
    transform: rotate(-4deg);
}

/* OVERCLOCKED toast — corner notification */
.overclocked-toast {
    position: fixed;
    top: 64px;
    right: 16px;
    z-index: 260;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: linear-gradient(90deg,
        rgba(255, 46, 136, 0.95),
        rgba(0, 255, 204, 0.95));
    background-size: 200% 100%;
    color: #02141a;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1.5px;
    border-radius: var(--radius-md);
    box-shadow:
        0 0 0 2px #000,
        0 0 24px rgba(255, 46, 136, 0.6),
        0 0 32px rgba(0, 255, 204, 0.4);
    animation:
        oc-slide-in 0.4s ease-out both,
        oc-rainbow  2.4s linear infinite,
        oc-slide-out 0.5s ease-in 3.6s forwards;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.4);
}

.overclocked-toast[hidden] { display: none; }

.oc-glyph {
    font-size: 18px;
    text-shadow: 0 0 6px #fff;
}

@keyframes oc-slide-in {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

@keyframes oc-slide-out {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(120%); opacity: 0; }
}

@keyframes oc-rainbow {
    from { background-position: 0%   50%; }
    to   { background-position: 200% 50%; }
}

/* Kiln overheat glitch — shaking + RGB split filter on the canvas */
.kiln-overheat #kilnCanvas {
    animation: kiln-shake 0.06s steps(2) infinite;
    filter: drop-shadow(2px 0 0 rgba(255, 0, 0, 0.6))
            drop-shadow(-2px 0 0 rgba(0, 255, 255, 0.6));
}

@keyframes kiln-shake {
    0%   { transform: translate(0,  0); }
    25%  { transform: translate(-2px, 1px); }
    50%  { transform: translate(2px, -2px); }
    75%  { transform: translate(-1px, 2px); }
    100% { transform: translate(1px,  0); }
}

/* ----- 13. Achievements (Day 4 chunk C — TROPHY grid + toast) ----- */

#screen-achievements {
    padding-top: 12px;
    padding-bottom: 30px;
}

.ach-grid {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.ach-card {
    padding: 14px 14px 18px;
    border-radius: var(--radius-md);
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #082028 0%, #051218 100%);
    border: 1px solid var(--teal-low);
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.ach-card.is-unlocked {
    border-color: var(--pink);
    box-shadow: 0 0 14px rgba(255, 46, 136, 0.30);
}

.ach-card.is-locked {
    opacity: 0.55;
}

.ach-icon {
    font-size: 36px;
    line-height: 1;
    color: var(--pink-bright);
    text-shadow: 0 0 12px rgba(255, 46, 136, 0.55);
    margin-bottom: 2px;
}

.ach-card.is-locked .ach-icon {
    color: var(--ink-low);
    text-shadow: none;
}

.ach-title {
    margin: 0;
    font-family: var(--font-title);
    font-size: 14px;
    letter-spacing: 2px;
    color: var(--ink);
    text-shadow: 1.5px 1.5px 0 #000;
}

.ach-desc {
    margin: 0;
    font-family: var(--font-lcd);
    font-size: 16px;
    letter-spacing: 0.8px;
    color: var(--ink-dim);
    line-height: 1.2;
}

.ach-reward {
    margin-top: 4px;
    align-self: center;
    padding: 3px 8px;
    border-radius: 3px;
    background: rgba(0, 255, 204, 0.10);
    border: 1px solid var(--teal-low);
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1.3px;
}

/* Achievement unlock toast — center-top banner that pops in
   with a scale + shine. Way more legible for a 5yo than a
   tiny right-corner chip, and it doesn't get covered by the
   floating madder-controls on phones. */
.ach-toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 260;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 22px;
    background:
        radial-gradient(ellipse at center,
            rgba(255, 210, 70, 0.18) 0%,
            transparent 70%),
        linear-gradient(90deg,
            rgba(255, 210, 70, 0.97),
            rgba(255, 46, 136, 0.97));
    color: #1a0e08;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 1.4px;
    border-radius: var(--radius-md);
    border: 2px solid #fff;
    box-shadow:
        0 0 0 1px #000,
        0 6px 0 #2a0820,
        0 0 28px rgba(255, 210, 70, 0.55),
        0 0 36px rgba(255, 46, 136, 0.5);
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.55);
    max-width: calc(100vw - 32px);
    text-align: center;
    animation:
        ach-pop-in 0.45s cubic-bezier(.2,.9,.3,1.3) both,
        ach-slide-out 0.5s ease-in 4.2s forwards;
}

.ach-toast[hidden] { display: none; }

.ach-toast-icon {
    font-size: 28px;
    line-height: 1;
    color: #fff;
    text-shadow: 0 0 14px rgba(255, 255, 255, 0.9),
                 0 0 24px rgba(255, 210, 70, 0.7);
    animation: ach-icon-bob 1.2s ease-in-out infinite alternate;
}

.ach-toast-eyebrow {
    font-size: 9px;
    letter-spacing: 2px;
    opacity: 0.75;
    margin-top: 2px;
}

.ach-toast-text {
    font-family: var(--font-title, var(--font-mono));
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1.5px;
    transform: rotate(-1.5deg);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55),
                 0 2px 6px rgba(0, 0, 0, 0.25);
}

@keyframes ach-pop-in {
    0%   { transform: translateX(-50%) translateY(-30px) scale(0.7);
           opacity: 0; }
    60%  { transform: translateX(-50%) translateY(4px)   scale(1.06);
           opacity: 1; }
    100% { transform: translateX(-50%) translateY(0)     scale(1);
           opacity: 1; }
}

@keyframes ach-icon-bob {
    from { transform: translateY(0)    rotate(-3deg); }
    to   { transform: translateY(-2px) rotate(3deg);  }
}

@keyframes ach-slide-out {
    from { transform: translateX(-50%) translateY(0)    scale(1);
           opacity: 1; }
    to   { transform: translateX(-50%) translateY(-30px) scale(0.85);
           opacity: 0; }
}

/* ----- Stats screen ----- */

#screen-stats {
    padding: 0 16px 30px;
}

.stats-intro {
    margin: 4px 0 14px;
    color: var(--ink-dim);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    max-width: 720px;
    margin: 0 auto;
}

.stats-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 14px 10px;
    min-height: 96px;
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-md);
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #0a2030 0%, #061319 100%);
    text-align: center;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.stats-tile:hover { transform: translateY(-2px); }
.stats-tile.is-dim { opacity: 0.55; }

.stats-tile.accent-gold {
    border-color: #ffea00;
    box-shadow: 0 0 14px rgba(255, 234, 0, 0.3);
}
.stats-tile.accent-pink {
    border-color: var(--pink-bright);
    box-shadow: 0 0 14px rgba(255, 46, 136, 0.3);
}

.stats-val {
    font-family: var(--font-title, var(--font-mono));
    font-size: 28px;
    letter-spacing: 1px;
    color: var(--ink);
    text-shadow: 0 0 8px rgba(0, 255, 204, 0.25);
    line-height: 1;
}
.stats-val-small {
    font-size: 14px;
    letter-spacing: 1.2px;
    color: var(--teal);
}
.stats-tile.accent-gold .stats-val { color: #ffea00; text-shadow: 0 0 10px rgba(255, 234, 0, 0.5); }
.stats-tile.accent-pink .stats-val { color: var(--pink-bright); text-shadow: 0 0 10px rgba(255, 46, 136, 0.5); }

.stats-lbl {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1.5px;
    color: var(--ink-dim);
}

/* ----- Pack Shop screen ----- */

#screen-shop {
    padding: 0 16px 30px;
}

.shop-intro {
    margin: 4px 0 14px;
    color: var(--ink-dim);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}

.shop-grid {
    display: grid;
    /* Desktop: 2-up at >=540px-wide grid space (cards ~260px each)
       phone: stay >=180px so two compact cards fit on wider phones,
       wrap to one column on the narrowest screens via the media
       query below. */
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    max-width: 760px;
    margin: 0 auto;
}

/* Narrow phones: one card per row, full available width, tighter
   internal padding so the 56px cover + price chip don't crowd the
   pack name out of the middle column. */
@media (max-width: 520px) {
    .shop-grid {
        grid-template-columns: 1fr;
    }
    .shop-card {
        grid-template-columns: 48px 1fr;
        gap: 10px;
        padding: 10px 12px;
    }
    .shop-cover {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
}

.shop-card {
    display: grid;
    /* CTA column was removed when the action button moved into
       the pack-detail modal. The card is now [icon] [meta]. */
    grid-template-columns: 56px 1fr;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-md);
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #0a2030 0%, #061319 100%);
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease,
                box-shadow 0.12s ease;
}
.shop-card:hover {
    transform: translateY(-2px);
    border-color: var(--teal);
    box-shadow: 0 6px 16px rgba(0, 255, 204, 0.18);
}

.shop-card.is-owned {
    border-color: #33ff99;
}
.shop-card.is-owned:hover {
    border-color: #66ffb3;
    box-shadow: 0 6px 16px rgba(51, 255, 153, 0.25);
}

.shop-card.is-queued {
    border-style: dashed;
    border-color: var(--pink-bright);
    opacity: 0.78;
}
.shop-card.is-queued:hover {
    opacity: 1;
    border-color: var(--pink-bright);
    box-shadow: 0 6px 16px rgba(255, 46, 136, 0.25);
}

/* MEGA tier ($1.99 themed packs) — pink glow, matching shared pots
   in the vault. */
.shop-card.is-mega {
    border-color: var(--pink-bright);
    box-shadow:
        0 0 0 1px rgba(255, 46, 136, 0.4),
        0 0 16px rgba(255, 46, 136, 0.5);
}
.shop-card.is-mega:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 0 1px rgba(255, 46, 136, 0.55),
        0 0 22px rgba(255, 46, 136, 0.65);
}

/* Coming-soon (points-unlock) packs — subdued + dashed so they read
   as "not yet available." */
.shop-card.is-coming-soon {
    opacity: 0.8;
    border-style: dashed;
}
.shop-card.is-coming-soon .shop-status { color: var(--teal-dim); }

.shop-cover {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    line-height: 1;
}

.shop-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.shop-name {
    margin: 0;
    font-family: var(--font-title, var(--font-mono));
    font-size: 14px;
    letter-spacing: 1.4px;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

/* Pack-type chip — CRAFTER / BUILD: BEAR / SPECIAL. Sits inline
   next to the pack name in the shop card. Color-coded per type:
   teal crafter (the default making-stuff vibe), pink builder
   (the "assemble a character" hook), gold special (premium). */
.shop-type-tag {
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 1px;
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
    border: 1px solid currentColor;
    line-height: 1;
}
.shop-type-tag.type-crafter { color: var(--teal); }
.shop-type-tag.type-builder { color: var(--pink-bright); }
.shop-type-tag.type-special {
    color: #ffd24a;
    background: rgba(255, 210, 74, 0.1);
}

.shop-desc {
    margin: 0;
    font-size: 11px;
    line-height: 1.3;
    color: var(--ink-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.shop-status {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.2px;
    color: var(--teal);
}
.shop-card.is-owned .shop-status   { color: #66ffb3; }
.shop-card.is-queued .shop-status  { color: var(--pink-bright); }

/* .shop-cta retained for historical reference only — the chip was
   removed from buildShopCard. The CTA now lives in the pack-detail
   modal below. Keeping the rule scoped to its class means nothing
   renders unless we re-introduce the chip. */
.shop-cta {
    align-self: center;
    padding: 6px 10px;
    border: 1px solid var(--teal);
    border-radius: var(--radius-sm);
    background: var(--bg-deep);
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    white-space: nowrap;
}
.shop-card.is-owned .shop-cta {
    border-color: #66ffb3;
    color: #66ffb3;
}
.shop-card.is-queued .shop-cta {
    border-color: var(--pink-bright);
    color: var(--pink-bright);
}

/* ----- Pack-detail modal -----
   Opens when the user taps a shop card. Shows every glaze + every
   stamp in the pack and hosts the PLAY / BUY / NOTIFY ME button.
   Built lazily by openPackPreviewModal in game.js; closed by ✕,
   ESC, or backdrop click. */
.pack-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(3, 10, 14, 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.pack-modal {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 22px 22px 18px;
    border: 1px solid var(--teal);
    border-radius: var(--radius-md);
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #082030 0%, #04131a 100%);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6),
                0 0 0 1px rgba(0, 255, 204, 0.08) inset;
    color: var(--ink);
}
.pack-modal.is-owned {
    border-color: #66ffb3;
}
.pack-modal.is-queued {
    border-color: var(--pink-bright);
}

.pack-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    line-height: 1;
    font-size: 18px;
    border: 1px solid var(--teal-low);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    color: var(--teal);
    cursor: pointer;
}
.pack-modal-close:hover {
    border-color: var(--teal);
    color: #fff;
}

.pack-modal-header {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 14px;
    align-items: center;
    margin-right: 36px;   /* clear the close button */
    margin-bottom: 14px;
}
.pack-modal-cover {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    line-height: 1;
}
.pack-modal-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.pack-modal-name {
    margin: 0;
    font-family: var(--font-title, var(--font-mono));
    font-size: 20px;
    letter-spacing: 1.6px;
    color: var(--ink);
}
.pack-modal-status {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1.4px;
    color: var(--teal);
}
.pack-modal.is-owned  .pack-modal-status { color: #66ffb3; }
.pack-modal.is-queued .pack-modal-status { color: var(--pink-bright); }

.pack-modal-desc {
    margin: 0 0 16px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--ink-dim);
}

.pack-modal-section {
    margin: 14px 0 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--teal-low);
    text-transform: uppercase;
}

.pack-modal-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.pack-modal-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.pack-modal-swatch.is-rgb {
    background: conic-gradient(
        from 0deg,
        #ff0080, #ff8000, #ffea00, #80ff00,
        #00ff80, #00d4ff, #2b6fff, #8000ff, #ff0080);
}

.pack-modal-stamps {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
}
.pack-modal-stamp {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(0, 255, 204, 0.12);
    border-radius: var(--radius-sm);
    padding: 6px;
}
.pack-modal-stamp canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.pack-modal-textures {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
}
.pack-modal-texture {
    aspect-ratio: 1 / 1;
    background-color: rgba(0, 0, 0, 0.35);
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(0, 255, 204, 0.12);
    border-radius: var(--radius-sm);
}

.pack-modal-action {
    width: 100%;
    margin-top: 18px;
    padding: 12px 14px;
    border: 1px solid var(--teal);
    border-radius: var(--radius-md);
    background: rgba(0, 255, 204, 0.08);
    color: var(--teal);
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 2px;
    cursor: pointer;
}
.pack-modal-action:hover {
    background: rgba(0, 255, 204, 0.18);
    color: #fff;
}
.pack-modal.is-owned .pack-modal-action {
    border-color: #66ffb3;
    color: #66ffb3;
    background: rgba(102, 255, 179, 0.08);
}
.pack-modal.is-owned .pack-modal-action:hover {
    background: rgba(102, 255, 179, 0.2);
    color: #fff;
}
.pack-modal.is-queued .pack-modal-action {
    border-color: var(--pink-bright);
    color: var(--pink-bright);
    background: rgba(255, 46, 136, 0.08);
}
.pack-modal.is-queued .pack-modal-action:hover {
    background: rgba(255, 46, 136, 0.18);
    color: #fff;
}

/* Narrow phones: tighten the modal so it fills the viewport
   nicely and the stamp grid stays at least 4 columns wide. */
@media (max-width: 520px) {
    .pack-modal-overlay { padding: 12px; }
    .pack-modal { padding: 18px 16px 14px; }
    .pack-modal-header {
        grid-template-columns: 56px 1fr;
        gap: 12px;
        margin-bottom: 10px;
    }
    .pack-modal-cover { width: 56px; height: 56px; font-size: 32px; }
    .pack-modal-name { font-size: 18px; }
    .pack-modal-stamps {
        grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    }
}

/* ----- 14a-i. PROFILE screen (Phase 1 chunk 2 — public pages) ----- */

#screen-profile {
    padding-top: 12px;
    padding-bottom: 30px;
}

.profile-header {
    width: 100%;
    max-width: 720px;
    margin: 0 auto 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #082028 0%, #051218 100%);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.45);
}

.profile-name-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-display-name {
    margin: 0;
    font-family: var(--font-title);
    font-size: clamp(22px, 5vw, 32px);
    letter-spacing: 2px;
    color: var(--ink);
    text-shadow: 2px 2px 0 #000, 0 0 12px rgba(0, 255, 204, 0.20);
}

.profile-handle {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.4px;
    color: var(--pink-bright);
    text-shadow: 0 0 6px rgba(255, 46, 136, 0.45);
}

.profile-bio {
    margin: 4px 0 0;
    font-family: var(--font-lcd);
    font-size: 17px;
    line-height: 1.3;
    color: var(--ink-dim);
}

.profile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.3px;
    color: var(--teal-dim);
}

.profile-stat {
    padding: 3px 8px;
    border-radius: 3px;
    background: rgba(0, 255, 204, 0.08);
    border: 1px solid var(--teal-low);
    color: var(--teal);
    text-shadow: 0 0 4px rgba(0, 255, 204, 0.25);
}

.profile-stat strong {
    color: var(--pink-bright);
    font-weight: normal;
    text-shadow: 0 0 4px rgba(255, 46, 136, 0.35);
}

.profile-grid {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.profile-grid:empty { display: none; }

.profile-loading,
.profile-empty,
.profile-missing {
    text-align: center;
    font-family: var(--font-lcd);
    font-size: 17px;
    margin: 18px auto 0;
    color: var(--ink-dim);
    max-width: 420px;
}

.profile-missing {
    color: #ff8060;
}

/* Author bylines become clickable buttons when they belong to a
   real account (the author has a username). When there's no
   user_id behind the byline (true anonymous), stays plain text. */
.pot-author-link {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    /* Explicit longhands — `font: inherit` (shorthand) was wiping
       font-family and pulling in the parent's system sans, which
       made signed-in @handles render in a different font from
       anonymous bylines on the same gallery card. Restating the
       .pot-author typography here keeps the look identical both
       when combined with .pot-author (gallery cards) and standalone
       (battle creator byline). */
    font-family: var(--font-lcd);
    font-size: 13px;
    letter-spacing: 0.8px;
    color: inherit;
    text-align: left;
}

.pot-author-link {
    color: var(--pink-bright);
    text-shadow: 0 0 5px rgba(255, 46, 136, 0.45);
    text-decoration: underline;
    text-decoration-color: rgba(255, 46, 136, 0.4);
    text-underline-offset: 2px;
}

.pot-author-link:hover,
.pot-author-link:focus-visible {
    color: #fff;
    text-decoration-color: var(--teal);
    outline: none;
}

/* ----- 14a. ACCOUNT screen (Phase 1 — auth + profile) ----- */

#screen-account {
    padding-top: 12px;
    padding-bottom: 30px;
}

.account-stack {
    width: 100%;
    display: flex;
    justify-content: center;
}

.account-stack[hidden] { display: none; }

.account-card {
    width: 100%;
    max-width: 480px;
    padding: 20px;
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #082028 0%, #051218 100%);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.45);
}

.account-headline {
    margin: 0;
    font-family: var(--font-title);
    font-size: clamp(18px, 4vw, 24px);
    letter-spacing: 2px;
    color: var(--pink-bright);
    text-align: center;
    text-shadow: 2px 2px 0 #000, 0 0 12px rgba(255, 46, 136, 0.45);
}

.account-blurb {
    margin: 0;
    font-family: var(--font-lcd);
    font-size: 16px;
    line-height: 1.3;
    color: var(--ink-dim);
    text-align: center;
}

.account-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink-low);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    margin: 4px 0;
}

.account-divider::before,
.account-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--teal-low);
}

.account-foot {
    margin: 4px 0 0;
    font-family: var(--font-lcd);
    font-size: 15px;
    text-align: center;
    color: var(--teal);
    text-shadow: 0 0 6px rgba(0, 255, 204, 0.35);
    min-height: 18px;
}

.account-foot.is-error {
    color: #ff8060;
    text-shadow: 0 0 6px rgba(255, 80, 30, 0.4);
}

.account-card textarea.detail-name-input {
    resize: vertical;
    line-height: 1.3;
    padding: 10px;
}

/* ----- Push notification settings + opt-in modal (chunk W3) ----- */

.push-toggle-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.push-toggle-btn { align-self: flex-start; }
.push-toggle-btn.is-on {
    background: #1a4030;
    border-color: #33ff99;
    color: #d4ffe6;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 5px 0 #02141a,
        0 0 14px rgba(51, 255, 153, 0.45);
}

.push-settings-note {
    margin: 0;
    color: var(--ink-dim);
    font-size: 12px;
    line-height: 1.4;
}

.push-optin-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: push-optin-fade 220ms ease-out;
}

.push-optin-modal[hidden] { display: none; }

@keyframes push-optin-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.push-optin-card {
    width: 100%;
    max-width: 360px;
    padding: 22px 22px 18px;
    border: 1px solid var(--teal);
    border-radius: var(--radius-md);
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #0a2630 0%, #061319 100%);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.6),
        0 12px 0 #02141a,
        0 0 28px rgba(0, 255, 204, 0.35);
    text-align: center;
    animation: push-optin-pop 280ms cubic-bezier(.2,.9,.3,1.2);
}

@keyframes push-optin-pop {
    from { transform: translateY(20px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.push-optin-glyph {
    font-size: 38px;
    line-height: 1;
    margin-bottom: 8px;
    color: var(--pink);
    text-shadow: 0 0 18px rgba(255, 46, 136, 0.5);
}

.push-optin-title {
    margin: 0 0 8px;
    font-size: 18px;
    letter-spacing: 0.06em;
    color: var(--ink);
}

.push-optin-body {
    margin: 0 0 16px;
    color: var(--ink-dim);
    font-size: 13px;
    line-height: 1.5;
}

.push-optin-actions {
    display: flex;
    gap: 10px;
    justify-content: stretch;
}

.push-optin-actions .btn-control { flex: 1; }

@media (max-width: 480px) {
    .push-optin-card { padding: 18px 16px 14px; }
    .push-optin-actions { flex-direction: column; }
}

/* ----- Share confirm + onboarding + complete overlay -----
   Built to teach a 5-year-old that sharing CREATES a copy.
   Two pots visible side-by-side in the confirm modal so the
   "non-destructive outcome" is obvious before tapping confirm. */

.share-confirm-modal,
.share-onboard-modal {
    position: fixed;
    inset: 0;
    z-index: 220;   /* above pot-detail (#potDetail) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: push-optin-fade 200ms ease-out;
}

.share-confirm-modal[hidden],
.share-onboard-modal[hidden] { display: none; }

.share-confirm-card,
.share-onboard-card {
    width: 100%;
    max-width: 420px;
    padding: 22px 20px 18px;
    border: 1px solid var(--teal);
    border-radius: var(--radius-md);
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #0a2630 0%, #061319 100%);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.6),
        0 12px 0 #02141a,
        0 0 28px rgba(0, 255, 204, 0.32);
    text-align: center;
    animation: push-optin-pop 260ms cubic-bezier(.2,.9,.3,1.2);
}

.share-confirm-title {
    margin: 0 0 6px;
    font-size: 16px;
    letter-spacing: 0.06em;
    color: var(--ink);
}

.share-confirm-lede {
    margin: 0 0 14px;
    color: #d4ffe6;
    font-size: 13px;
    line-height: 1.5;
}

.share-preview-row {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    margin: 0 auto 14px;
}

.share-preview-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    min-width: 0;
}

.share-preview-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1.2px;
    color: var(--ink-dim);
}

.share-preview-thumb {
    position: relative;
    width: 100%;
    max-width: 140px;
    aspect-ratio: 400 / 600;
    background: #06141a;
    border-radius: var(--radius-sm);
    border: 1px solid var(--teal-low);
    overflow: hidden;
}

.share-preview-thumb canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.share-preview-thumb.is-copy {
    border-color: var(--pink);
    box-shadow: 0 0 14px rgba(255, 46, 136, 0.35);
    animation: share-preview-copy 1600ms ease-in-out infinite alternate;
}

@keyframes share-preview-copy {
    from { transform: translateY(0)    scale(1);    box-shadow: 0 0 10px rgba(255, 46, 136, 0.25); }
    to   { transform: translateY(-4px) scale(1.02); box-shadow: 0 0 18px rgba(255, 46, 136, 0.55); }
}

.share-preview-tag {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 26, 32, 0.85);
    border: 1px solid var(--teal-low);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 1px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.share-preview-thumb.is-copy .share-preview-tag {
    border-color: var(--pink);
    color: #ffd4e6;
}

.share-preview-arrow {
    align-self: center;
    color: var(--pink);
    font-size: 24px;
    line-height: 1;
    text-shadow: 0 0 10px rgba(255, 46, 136, 0.6);
}

.share-preview-plus {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--pink);
    border-radius: 50%;
    line-height: 24px;
    text-align: center;
    font-weight: bold;
}

.share-confirm-author-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    text-align: left;
}

.share-confirm-actions {
    display: flex;
    gap: 10px;
}

.share-confirm-actions .btn-control { flex: 1; }

@media (max-width: 480px) {
    .share-confirm-card { padding: 18px 14px 14px; }
    .share-confirm-actions { flex-direction: column; }
    .share-preview-thumb { max-width: 110px; }
}

/* First-time REMIX onboarding modal — same visual family as
   the share-onboard (centered card, pink-glow border), but
   pink throughout (remix is the "social/play with friends"
   action). */

.remix-onboard-modal {
    position: fixed;
    inset: 0;
    z-index: 230;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: push-optin-fade 200ms ease-out;
}
.remix-onboard-modal[hidden] { display: none; }

.remix-onboard-card {
    width: 100%;
    max-width: 380px;
    padding: 22px 22px 18px;
    border: 1px solid var(--pink-bright);
    border-radius: var(--radius-md);
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #2a0c1e 0%, #0a0612 100%);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.6),
        0 12px 0 #02141a,
        0 0 28px rgba(255, 46, 136, 0.4);
    text-align: center;
    animation: push-optin-pop 280ms cubic-bezier(.2,.9,.3,1.2);
}

.remix-onboard-glyph {
    font-size: 38px;
    line-height: 1;
    margin-bottom: 8px;
    color: var(--pink-bright);
    text-shadow: 0 0 18px rgba(255, 46, 136, 0.6);
    animation: remix-glyph-spin 2.4s linear infinite;
}
@keyframes remix-glyph-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.remix-onboard-title {
    margin: 0 0 8px;
    font-family: var(--font-title, var(--font-mono));
    font-size: 18px;
    letter-spacing: 0.06em;
    color: var(--pink-bright);
    text-shadow: 0 0 8px rgba(255, 46, 136, 0.45);
}

.remix-onboard-body {
    margin: 0 0 14px;
    color: #ffd4e6;
    font-size: 13px;
    line-height: 1.5;
}
.remix-onboard-body strong {
    color: #fff;
    text-shadow: 0 0 6px rgba(255, 46, 136, 0.5);
}
.remix-onboard-author {
    color: #fff;
    font-weight: bold;
}

.remix-onboard-canvas-wrap {
    width: 120px;
    aspect-ratio: 400 / 600;
    margin: 0 auto 16px;
    background: #06141a;
    border: 1px solid var(--pink-bright);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 0 12px rgba(255, 46, 136, 0.35);
}
.remix-onboard-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.remix-onboard-actions {
    display: flex;
    gap: 10px;
}
.remix-onboard-actions .btn-control { flex: 1; }

@media (max-width: 480px) {
    .remix-onboard-card { padding: 18px 14px 14px; }
    .remix-onboard-actions { flex-direction: column; }
}

/* Persistent "remixing @user" chip — floating in the
   bottom-center of the screen while a remix is in progress
   (i.e. REMIX.pending is set). Visible on shape + decorate
   only; auto-hides on title / kiln transitions. */

.remix-in-progress-chip {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 90;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--pink-bright);
    border-radius: 14px;
    background: rgba(10, 8, 20, 0.88);
    color: #ffd4e6;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.5px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.6),
        0 0 16px rgba(255, 46, 136, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
    animation: remix-chip-pulse 2.4s ease-in-out infinite;
}
.remix-in-progress-chip[hidden] { display: none; }

.remix-in-progress-glyph {
    font-size: 13px;
    line-height: 1;
    color: var(--pink-bright);
}

@keyframes remix-chip-pulse {
    0%, 100% { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6),
                            0 0 12px rgba(255, 46, 136, 0.35); }
    50%      { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6),
                            0 0 20px rgba(255, 46, 136, 0.6); }
}

/* First-share onboarding modal -- "sharing makes a copy"        */

.share-onboard-anim {
    position: relative;
    height: 90px;
    margin: 0 auto 12px;
    width: 180px;
}

.share-onboard-source,
.share-onboard-copy {
    position: absolute;
    top: 0;
    width: 50px;
    height: 75px;
    background:
        radial-gradient(ellipse at 50% 40%, #ffb86b 0%, #b86230 60%, #5c2814 100%);
    border: 1.5px solid var(--teal);
    border-radius: 8px 8px 20px 20px / 8px 8px 14px 14px;
    box-shadow: 0 0 12px rgba(0, 255, 204, 0.3);
}

.share-onboard-source { left: 24px; }

.share-onboard-copy {
    left: 24px;
    opacity: 0;
    animation: share-onboard-spawn 2400ms ease-in-out infinite;
    border-color: var(--pink);
    box-shadow: 0 0 12px rgba(255, 46, 136, 0.45);
}

@keyframes share-onboard-spawn {
    0%   { left: 24px;  opacity: 0;   transform: scale(0.8); }
    20%  { left: 24px;  opacity: 1;   transform: scale(1); }
    70%  { left: 110px; opacity: 1;   transform: scale(1); }
    100% { left: 110px; opacity: 0;   transform: scale(0.9); }
}

.share-onboard-plus {
    position: absolute;
    top: 28px;
    left: 90px;
    color: var(--pink);
    font-family: var(--font-mono);
    font-size: 14px;
    text-shadow: 0 0 8px rgba(255, 46, 136, 0.6);
    animation: share-onboard-plus 2400ms ease-in-out infinite;
}

@keyframes share-onboard-plus {
    0%, 30%        { opacity: 0; transform: translateY(0); }
    40%, 60%       { opacity: 1; transform: translateY(-6px); }
    100%           { opacity: 0; transform: translateY(-10px); }
}

.share-onboard-title {
    margin: 0 0 8px;
    font-size: 16px;
    letter-spacing: 0.06em;
    color: var(--ink);
}

.share-onboard-body {
    margin: 0 0 16px;
    color: #d4ffe6;
    font-size: 13px;
    line-height: 1.5;
}

.share-onboard-body strong {
    color: var(--pink);
    text-shadow: 0 0 6px rgba(255, 46, 136, 0.3);
}

/* "+1 copy lifts off" success overlay. Pot on the left stays
   put; copy on the right slides up + fades. Pointer-events
   none so the user can keep interacting with the gallery
   while it plays.                                            */

.share-complete-overlay {
    position: fixed;
    inset: 0;
    z-index: 215;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 200ms ease;
}

.share-complete-overlay[hidden] { display: none; }
.share-complete-overlay.is-playing { opacity: 1; }

.share-complete-stay,
.share-complete-fly {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 130px;
}

.share-complete-stay canvas,
.share-complete-fly canvas {
    width: 120px;
    height: 180px;
    background: #06141a;
    border-radius: var(--radius-sm);
    border: 1px solid var(--teal-low);
}

.share-complete-stay canvas {
    box-shadow: 0 0 18px rgba(0, 255, 204, 0.35);
}

.share-complete-fly canvas {
    border-color: var(--pink);
    box-shadow: 0 0 18px rgba(255, 46, 136, 0.5);
}

.share-complete-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--ink);
}

.share-complete-stay .share-complete-label { color: #99ffd9; }
.share-complete-fly  .share-complete-label { color: #ffb6d4; }

.share-complete-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--pink);
    color: #0a0a14;
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 11px;
    line-height: 28px;
    text-align: center;
    box-shadow:
        0 0 0 2px #0a0a14,
        0 0 14px rgba(255, 46, 136, 0.8);
}

.share-complete-overlay.is-playing .share-complete-fly {
    animation: share-complete-fly-anim 1800ms cubic-bezier(.2, .8, .3, 1) forwards;
}

@keyframes share-complete-fly-anim {
    0%   { transform: translate(-120px, 0)    scale(0.55); opacity: 0; }
    15%  { transform: translate(-120px, 0)    scale(0.95); opacity: 1; }
    55%  { transform: translate(0,      -10px) scale(1);    opacity: 1; }
    100% { transform: translate(0,      -50px) scale(1);    opacity: 0; }
}

.share-complete-overlay.is-playing .share-complete-stay {
    animation: share-complete-stay-anim 1800ms ease-out;
}

@keyframes share-complete-stay-anim {
    0%, 100% { transform: scale(1); }
    40%      { transform: scale(1.03); box-shadow: 0 0 24px rgba(0, 255, 204, 0.55); }
}

@media (max-width: 480px) {
    .share-complete-overlay { gap: 18px; }
    .share-complete-stay canvas,
    .share-complete-fly canvas { width: 96px; height: 144px; }
    @keyframes share-complete-fly-anim {
        0%   { transform: translate(-84px, 0)    scale(0.55); opacity: 0; }
        15%  { transform: translate(-84px, 0)    scale(0.95); opacity: 1; }
        55%  { transform: translate(0,     -8px) scale(1);    opacity: 1; }
        100% { transform: translate(0,    -40px) scale(1);    opacity: 0; }
    }
}

/* ----- Trophy reveal modal (chunk T) -----
   Triumphant reveal when the user opens the app + a battle
   they entered has resolved with their pot placing. Color
   ramps per tier (gold/silver/copper). */

.trophy-reveal-modal {
    position: fixed;
    inset: 0;
    z-index: 230;   /* above push opt-in + share modals */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: push-optin-fade 220ms ease-out;
}

.trophy-reveal-modal[hidden] { display: none; }

.trophy-reveal-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 24px 22px 18px;
    border: 1.5px solid #ffea00;
    border-radius: var(--radius-md);
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #1a1408 0%, #0a0a14 100%);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.6),
        0 12px 0 #02141a,
        0 0 32px rgba(255, 234, 0, 0.45);
    text-align: center;
    animation: trophy-reveal-pop 320ms cubic-bezier(.2,.9,.3,1.3);
    overflow: hidden;
}

.trophy-reveal-modal[data-tier="second"] .trophy-reveal-card {
    border-color: #d8e1e6;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.6),
        0 12px 0 #02141a,
        0 0 28px rgba(216, 225, 230, 0.45);
}
.trophy-reveal-modal[data-tier="honorable"] .trophy-reveal-card {
    border-color: #d28b4a;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.6),
        0 12px 0 #02141a,
        0 0 24px rgba(210, 139, 74, 0.4);
}

@keyframes trophy-reveal-pop {
    0%   { transform: translateY(30px) scale(0.85); opacity: 0; }
    60%  { transform: translateY(-4px) scale(1.04); opacity: 1; }
    100% { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* Sun-ray burst behind the trophy card */
.trophy-reveal-burst {
    position: absolute;
    inset: -50% -10%;
    background:
        repeating-conic-gradient(
            from 0deg,
            rgba(255, 234, 0, 0.10) 0deg 6deg,
            transparent           6deg 12deg);
    animation: trophy-reveal-spin 16s linear infinite;
    pointer-events: none;
    z-index: 0;
}
.trophy-reveal-modal[data-tier="second"] .trophy-reveal-burst {
    background: repeating-conic-gradient(
        from 0deg,
        rgba(216, 225, 230, 0.10) 0deg 6deg,
        transparent              6deg 12deg);
}
.trophy-reveal-modal[data-tier="honorable"] .trophy-reveal-burst {
    background: repeating-conic-gradient(
        from 0deg,
        rgba(210, 139, 74, 0.08) 0deg 6deg,
        transparent             6deg 12deg);
}
@keyframes trophy-reveal-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.trophy-reveal-ribbon {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.trophy-reveal-glyph {
    font-size: 40px;
    line-height: 1;
    filter: drop-shadow(0 0 12px rgba(255, 234, 0, 0.55));
}

.trophy-reveal-eyebrow {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    color: #ffd24a;
    text-shadow: 0 0 6px rgba(255, 210, 74, 0.6);
}

.trophy-reveal-name {
    position: relative;
    z-index: 1;
    margin: 8px 0 6px;
    font-family: var(--font-title, var(--font-mono));
    font-size: 22px;
    letter-spacing: 0.06em;
    color: #ffea00;
    text-shadow:
        0 2px 0 #1a1408,
        0 0 14px rgba(255, 234, 0, 0.55);
    transform: rotate(-1.5deg);
    line-height: 1.15;
}
.trophy-reveal-modal[data-tier="second"] .trophy-reveal-name {
    color: #e6edf2;
    text-shadow: 0 2px 0 #1a1408, 0 0 14px rgba(216, 225, 230, 0.5);
}
.trophy-reveal-modal[data-tier="honorable"] .trophy-reveal-name {
    color: #f0b078;
    text-shadow: 0 2px 0 #1a1408, 0 0 14px rgba(210, 139, 74, 0.5);
}

.trophy-reveal-context {
    position: relative;
    z-index: 1;
    margin: 0 0 14px;
    color: #d4ffe6;
    font-size: 13px;
    line-height: 1.4;
}
.trophy-reveal-theme {
    color: var(--pink);
    font-weight: bold;
    text-shadow: 0 0 6px rgba(255, 46, 136, 0.4);
}

.trophy-reveal-canvas-wrap {
    position: relative;
    z-index: 1;
    margin: 0 auto 14px;
    width: 160px;
    aspect-ratio: 400 / 600;
    background: #06141a;
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.trophy-reveal-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.trophy-reveal-actions {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 10px;
}

.trophy-reveal-actions .btn-control { flex: 1; }

@media (max-width: 480px) {
    .trophy-reveal-card { padding: 18px 14px 14px; }
    .trophy-reveal-name { font-size: 18px; }
    .trophy-reveal-actions { flex-direction: column; }
}

/* Pot-detail trophy badge — top-right corner over the canvas
   wrap. Tap to jump to that battle's results. */
.detail-canvas-wrap { position: relative; }

.detail-trophy-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 6px 10px;
    border: 1.5px solid #ffea00;
    border-radius: var(--radius-sm);
    background: rgba(10, 8, 4, 0.9);
    color: #ffea00;
    font-family: var(--font-mono);
    cursor: pointer;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 0 14px rgba(255, 234, 0, 0.45);
    transition: transform 0.12s ease;
}
.detail-trophy-badge[hidden] { display: none; }
.detail-trophy-badge:hover { transform: scale(1.04); }
.detail-trophy-badge[data-tier="second"] {
    border-color: #d8e1e6; color: #e6edf2;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.5), 0 0 14px rgba(216, 225, 230, 0.4);
}
.detail-trophy-badge[data-tier="honorable"] {
    border-color: #d28b4a; color: #f0b078;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.5), 0 0 14px rgba(210, 139, 74, 0.4);
}

.detail-trophy-glyph {
    font-size: 18px;
    line-height: 1;
}
.detail-trophy-name {
    font-family: var(--font-title, var(--font-mono));
    font-size: 9px;
    letter-spacing: 1.3px;
    text-shadow: 0 1px 0 #000;
    max-width: 110px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.detail-trophy-theme {
    font-size: 8px;
    letter-spacing: 1px;
    color: var(--ink-dim);
    max-width: 110px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Remix lineage chip on the pot-detail modal — sits in the
   bottom-left of the canvas wrap so it doesn't collide with
   the trophy badge (top-right). Tap to jump to source profile. */
.detail-remix-chip {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--pink-bright);
    border-radius: 12px;
    background: rgba(10, 8, 20, 0.85);
    color: #ffd4e6;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.5px;
    cursor: default;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 0 10px rgba(255, 46, 136, 0.35);
    transition: transform 0.12s ease;
}
.detail-remix-chip[hidden] { display: none; }
.detail-remix-chip:hover { transform: scale(1.03); }

.detail-remix-glyph {
    font-size: 14px;
    line-height: 1;
    color: var(--pink-bright);
}

.detail-remix-text {
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Gallery-thumb remix chip — small subtle line in the meta
   stack below the pot. Lower-noise than the trophy / globe
   corner badges since remix info is contextual, not
   "achievement-y." */
.pot-remix-chip {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.5px;
    color: var(--pink-bright);
    text-shadow: 0 1px 0 #000;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* "X people remixed this" strip — appears on the pot-detail
   modal for public pots that have at least one remix. Hidden
   when count = 0 so the modal doesn't grow without payoff. */
.detail-remixes {
    margin: 6px 14px 10px;
    padding: 8px 10px 10px;
    border: 1px dashed var(--pink-bright);
    border-radius: var(--radius-sm);
    background: rgba(255, 46, 136, 0.06);
}
.detail-remixes[hidden] { display: none; }

.detail-remixes-head {
    margin: 0 0 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--pink-bright);
    text-shadow: 0 0 6px rgba(255, 46, 136, 0.35);
}
.detail-remixes-head #detailRemixesCount {
    font-family: var(--font-title, var(--font-mono));
    font-size: 14px;
    color: #ffd4e6;
    margin-right: 4px;
}

.detail-remixes-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.detail-remix-thumb {
    flex: 0 0 auto;
    width: 76px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 5px;
    border: 1px solid var(--pink-bright);
    border-radius: var(--radius-sm);
    background: var(--bg-deep);
    cursor: pointer;
    transition: transform 0.12s ease;
}
.detail-remix-thumb:hover { transform: translateY(-2px); }

.detail-remix-thumb canvas {
    width: 66px;
    height: 99px;
    background: #06141a;
    border-radius: 2px;
}

.detail-remix-thumb-by {
    font-family: var(--font-mono);
    font-size: 9px;
    color: #ffd4e6;
    max-width: 66px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Profile Trophy Shelf */
.profile-trophy-shelf {
    width: 100%;
    max-width: 720px;
    margin: 14px auto 18px;
    padding: 12px 14px;
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-md);
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #0a2030 0%, #061319 100%);
}
.profile-trophy-shelf[hidden] { display: none; }

.trophy-shelf-titlebar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.trophy-shelf-title {
    margin: 0;
    font-family: var(--font-title, var(--font-mono));
    font-size: 14px;
    letter-spacing: 1.5px;
    color: #ffea00;
    text-shadow: 0 1px 0 #000, 0 0 8px rgba(255, 234, 0, 0.45);
}

.trophy-shelf-count {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--ink-dim);
}

.trophy-shelf-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.trophy-shelf-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border: 1px solid #ffea00;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: transform 0.12s ease;
}
.trophy-shelf-card:hover { transform: translateY(-2px); }

.trophy-shelf-card.tier-second {
    border-color: #d8e1e6;
}
.trophy-shelf-card.tier-honorable {
    border-color: #d28b4a;
}

.trophy-shelf-thumb {
    aspect-ratio: 400 / 600;
    background: #06141a;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.trophy-shelf-thumb canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.trophy-shelf-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    text-align: center;
}
.trophy-shelf-name {
    font-family: var(--font-title, var(--font-mono));
    font-size: 11px;
    letter-spacing: 1px;
    color: #ffea00;
    text-shadow: 0 1px 0 #000;
}
.trophy-shelf-card.tier-second .trophy-shelf-name { color: #e6edf2; }
.trophy-shelf-card.tier-honorable .trophy-shelf-name { color: #f0b078; }

.trophy-shelf-theme {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.trophy-shelf-date {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--ink-dim);
    letter-spacing: 1px;
}

/* ----- 14. Pot battles (Day 5 chunk F) ----- */

/* Battle card in the BATTLES tab — replaces the pot grid layout */
.battle-list {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.battle-list:empty { display: none; }

.battle-card {
    text-align: left;
    width: 100%;
    padding: 14px 16px;
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #082028 0%, #051218 100%);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.12s ease,
                box-shadow 0.12s ease,
                transform 0.06s ease;
}

.battle-card:hover,
.battle-card:focus-visible {
    border-color: var(--pink);
    box-shadow: 0 0 14px rgba(255, 46, 136, 0.35);
    transform: translateY(-1px);
    outline: none;
}

.battle-card.is-expired {
    opacity: 0.7;
    border-style: dashed;
}

.battle-card.is-daily {
    border-color: var(--pink-bright);
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.18) 0 1px,
            transparent 1px 2px),
        linear-gradient(180deg, #1a0a18 0%, #08020b 100%);
    box-shadow: 0 0 14px rgba(255, 46, 136, 0.35);
}

.battle-daily-badge {
    display: inline-block;
    padding: 2px 7px;
    margin-right: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, #ff3d96, #ffa53d);
    color: #1a0e08;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.3px;
    text-shadow: none;
    vertical-align: middle;
}

.battle-card .battle-theme {
    font-family: var(--font-title);
    font-size: clamp(18px, 4vw, 26px);
    letter-spacing: 2.5px;
    color: var(--pink-bright);
    text-shadow: 2px 2px 0 #000, 0 0 10px rgba(255, 46, 136, 0.45);
    text-transform: uppercase;
}

.battle-card .battle-meta-line {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.2px;
    color: var(--teal-dim);
}

.battle-card .battle-meta-line .live  { color: #33ff66; }
.battle-card .battle-meta-line .ended { color: var(--ink-low); }

/* "+ NEW THEME" CTA at the top of the BATTLES tab */
.battle-new-cta {
    width: 100%;
    max-width: 720px;
    padding: 12px 16px;
    background: linear-gradient(180deg, #3a1024 0%, #20081a 100%);
    border: 2px solid var(--pink);
    border-radius: var(--radius-md);
    color: #fff;
    font-family: var(--font-title);
    font-size: 14px;
    letter-spacing: 2px;
    cursor: pointer;
    text-shadow: 2px 2px 0 #000;
    transition: background 0.12s ease, box-shadow 0.12s ease;
}

.battle-new-cta:hover {
    background: linear-gradient(180deg, #51163a 0%, #2f0e26 100%);
    box-shadow: 0 0 14px rgba(255, 46, 136, 0.45);
}

/* Battle detail modal */
.battle-detail,
.create-battle,
.submit-picker {
    position: fixed;
    inset: 0;
    z-index: 230;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.battle-detail[hidden],
.create-battle[hidden],
.submit-picker[hidden] { display: none; }

.battle-detail-card,
.create-battle-card,
.submit-picker-card {
    width: min(560px, 96vw);
    max-height: 92vh;
    overflow-y: auto;
    background: #051419;
    border: 2px solid var(--teal);
    border-radius: var(--radius-md);
    box-shadow:
        0 0 0 1px #000,
        0 0 30px rgba(0, 255, 204, 0.35);
}

.battle-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    font-family: var(--font-lcd);
    font-size: 16px;
    color: var(--teal-dim);
    border-bottom: 1px dashed var(--teal-low);
}

.battle-author { color: var(--pink-bright); }
.battle-entries {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1.2px;
    color: var(--ink-dim);
}

.battle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 14px;
    min-height: 80px;
}

.battle-entry-card {
    background: var(--bg-panel);
    border: 1px solid var(--teal-low);
    border-radius: var(--radius-sm);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.battle-entry-card.is-winner {
    border-color: #ffea00;
    box-shadow: 0 0 14px rgba(255, 234, 0, 0.5);
}

.battle-entry-thumb {
    aspect-ratio: 400 / 600;
    /* background comes from the shared display-niche rule above. */
    border-radius: 3px;
    overflow: hidden;
}

.battle-entry-thumb canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.battle-entry-author {
    font-family: var(--font-lcd);
    font-size: 13px;
    color: var(--ink);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.battle-vote-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.battle-vote-btn {
    flex: 1;
    padding: 7px 10px;
    background: var(--bg-deep);
    border: 1px solid var(--pink-bright);
    border-radius: 3px;
    color: var(--pink-bright);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.2px;
    cursor: pointer;
    text-shadow: 1px 1px 0 #000;
    transition: background 0.12s ease, border-color 0.12s ease,
                transform 0.12s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.battle-vote-btn .vote-heart {
    font-size: 14px;
    line-height: 1;
    color: var(--pink-bright);
    transition: transform 0.12s ease;
}

.battle-vote-btn:hover {
    background: rgba(255, 46, 136, 0.12);
    transform: scale(1.04);
}
.battle-vote-btn:hover .vote-heart {
    transform: scale(1.15);
}

.battle-vote-btn.voted {
    /* Use longhand because the `background:` shorthand with a
       var() can fail to resolve cleanly when the base rule also
       uses the shorthand -- the cascade misses background-color
       and falls back to the base rule's --bg-deep. */
    background-color: var(--pink-deep);
    color: #fff;
    border-color: var(--pink-bright);
    cursor: default;
    box-shadow: 0 0 12px rgba(255, 46, 136, 0.5);
}
.battle-vote-btn.voted .vote-heart {
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
    animation: vote-heart-thump 360ms ease-out;
}

@keyframes vote-heart-thump {
    0%   { transform: scale(1);   }
    30%  { transform: scale(1.45); }
    60%  { transform: scale(0.92); }
    100% { transform: scale(1);   }
}

.battle-vote-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}
.battle-vote-btn.voted[disabled] {
    opacity: 1;   /* voted = celebrated, not dimmed */
}

.battle-vote-count {
    font-family: var(--font-title);
    font-size: 14px;
    color: var(--pink-bright);
    min-width: 24px;
    text-align: center;
    display: inline-block;
    transform-origin: center;
}

.battle-vote-count.is-popped {
    animation: vote-count-pop 420ms cubic-bezier(.2,.9,.3,1.3);
}

@keyframes vote-count-pop {
    0%   { transform: scale(1);   color: var(--pink-bright); }
    40%  { transform: scale(1.55); color: #ffb6d4; text-shadow: 0 0 14px rgba(255, 46, 136, 0.8); }
    100% { transform: scale(1);   color: var(--pink-bright); }
}

/* Whole-card-is-tappable affordance for live battles --
   the card glows softly on hover when the user can vote on
   it by tapping anywhere. */
.battle-entry-card.is-votable {
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.battle-entry-card.is-votable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 18px rgba(255, 46, 136, 0.25);
}

/* "+1 ♥" float -- drifts up from where it spawned + fades */
.battle-entry-card { position: relative; }

.vote-float {
    position: absolute;
    left: 50%;
    bottom: 30%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: bold;
    color: var(--pink-bright);
    text-shadow: 0 0 10px rgba(255, 46, 136, 0.8), 0 1px 0 #000;
    pointer-events: none;
    z-index: 4;
    animation: vote-float-rise 1100ms cubic-bezier(.2, .8, .3, 1) forwards;
}

@keyframes vote-float-rise {
    0%   { opacity: 0; transform: translate(-50%, 10px) scale(0.6); }
    20%  { opacity: 1; transform: translate(-50%, -10px) scale(1.15); }
    70%  { opacity: 1; transform: translate(-50%, -50px) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -80px) scale(0.9); }
}

.battle-winner-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    background: #ffea00;
    color: #1a0e08;
    font-family: var(--font-title, var(--font-mono));
    font-size: 11px;
    letter-spacing: 1px;
    align-self: center;
    transform: rotate(-2deg);
    box-shadow: 0 2px 0 #02141a, 0 0 14px rgba(255, 234, 0, 0.5);
    text-shadow: 0 1px 0 rgba(0,0,0,0.18);
}
.battle-winner-tag.tier-second {
    background: #d8e1e6;
    box-shadow: 0 2px 0 #02141a, 0 0 14px rgba(216, 225, 230, 0.45);
}
.battle-winner-tag.tier-honorable {
    background: #d28b4a;
    color: #2a1a08;
    box-shadow: 0 2px 0 #02141a, 0 0 14px rgba(210, 139, 74, 0.45);
}

/* Tier-grouped battle results: each tier's pots sit under a
   chunky header. Headers run full-width with a glow that
   matches the tier color. */
.battle-tier-head {
    grid-column: 1 / -1;
    margin: 8px 0 4px;
    font-family: var(--font-title, var(--font-mono));
    font-size: 13px;
    letter-spacing: 1.5px;
    text-align: center;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ffea00;
    background: rgba(255, 234, 0, 0.10);
    color: #ffea00;
    text-shadow: 0 1px 0 #000, 0 0 8px rgba(255, 234, 0, 0.45);
    transform: rotate(-0.8deg);
}
.battle-tier-head.tier-second {
    border-color: #d8e1e6;
    background: rgba(216, 225, 230, 0.10);
    color: #e6edf2;
    text-shadow: 0 1px 0 #000, 0 0 8px rgba(216, 225, 230, 0.45);
}
.battle-tier-head.tier-honorable {
    border-color: #d28b4a;
    background: rgba(210, 139, 74, 0.10);
    color: #f0b078;
    text-shadow: 0 1px 0 #000, 0 0 8px rgba(210, 139, 74, 0.45);
}
.battle-tier-head.tier-rest {
    border-color: var(--teal-low);
    background: transparent;
    color: var(--ink-dim);
    font-size: 11px;
    transform: none;
    text-shadow: none;
}

.battle-entry-card.is-trophy {
    border-color: #ffea00;
    box-shadow: 0 0 14px rgba(255, 234, 0, 0.55);
}
.battle-entry-card.is-trophy-second {
    border-color: #d8e1e6;
    box-shadow: 0 0 12px rgba(216, 225, 230, 0.45);
}
.battle-entry-card.is-trophy-honorable {
    border-color: #d28b4a;
    box-shadow: 0 0 12px rgba(210, 139, 74, 0.4);
}

.battle-actions {
    display: flex;
    gap: 10px;
    padding: 12px 14px 14px;
    border-top: 1px dashed var(--teal-low);
}

.battle-actions .btn-control { flex: 1; }

/* Create-battle body */
.create-battle-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.create-battle-hint {
    margin: 0;
    font-family: var(--font-lcd);
    font-size: 14px;
    color: var(--ink-dim);
    line-height: 1.2;
}

/* Submit picker body */
.submit-picker-body {
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
}

.submit-picker-body:empty::before {
    content: "No local pots to submit. Fire some first.";
    display: block;
    grid-column: 1 / -1;
    text-align: center;
    color: var(--ink-dim);
    font-family: var(--font-lcd);
    font-size: 16px;
    padding: 24px 12px;
}

.detail-titlebar em {
    font-style: normal;
    font-weight: normal;
    background: rgba(0,0,0,0.45);
    color: var(--teal);
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: 1.6px;
}

/* ----- 14b. Side-rail layout (tablet+) -----
   Mobile-first: shape + decorate become fixed bottom-sheet
   drawers, kiln stays stacked (its controls only appear post-
   reveal). At >=768px the layout flips to canvas-left +
   side-rail-right so all tools are reachable without
   scrolling. */

.shape-side-rail,
.decorate-side-rail,
.kiln-side-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 420px;
}

/* The handle is in the markup always but only visible/active
   on phone via the media query below. */
.drawer-handle {
    display: none;
}

@media (max-width: 767.98px) {
    /* Phone — turn shape + decorate side-rails into bottom-
       sheet drawers. Kiln rail stays stacked since the controls
       only show up post-reveal and don't compete for space. */
    .shape-side-rail,
    .decorate-side-rail {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 80;
        max-width: none;
        max-height: 72vh;
        max-height: 72dvh;
        overflow-y: auto;
        gap: 12px;
        /* Bottom pad clears the Android gesture / nav bar so the
           last control row (FIRE IT / FINISH FORM) isn't hidden
           under it when the drawer is open. */
        padding: 0 14px calc(18px + var(--safe-bottom));
        background: linear-gradient(180deg,
            #082028 0%,
            #051218 26%,
            #04101a 100%);
        border-top: 2px solid var(--pink);
        border-top-left-radius: 18px;
        border-top-right-radius: 18px;
        box-shadow:
            0 -8px 24px rgba(0, 0, 0, 0.65),
            0 -1px 0 0 rgba(255, 46, 136, 0.35);
        /* Collapsed: leave the 54px handle ABOVE the gesture bar
           (extra --safe-bottom lift) so it stays grabbable. */
        transform: translateY(calc(100% - 54px - var(--safe-bottom)));
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .shape-side-rail.is-open,
    .decorate-side-rail.is-open {
        transform: translateY(0);
    }

    /* Handle is always visible as the always-on-screen 54px tab
       at the top of the drawer. */
    .drawer-handle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        height: 54px;
        flex-shrink: 0;
        /* Solid background matching the drawer's top gradient stop.
           Sticky + transparent let inner-scroll content bleed through
           the TOOLS label — opaque background + higher z-index keep
           the handle visually on top no matter what's behind it. */
        background: #082028;
        border: none;
        padding: 0;
        cursor: pointer;
        font-family: var(--font-mono);
        font-size: 12px;
        letter-spacing: 2px;
        color: var(--pink-bright);
        text-shadow:
            1px 1px 0 #000,
            0 0 8px rgba(255, 46, 136, 0.45);
        position: sticky;
        top: 0;
        z-index: 5;
    }

    .drawer-handle::before {
        content: "";
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 44px;
        height: 4px;
        border-radius: 2px;
        background: var(--teal-low);
    }

    .drawer-pull {
        font-size: 14px;
        transition: transform 0.25s ease;
        line-height: 1;
    }

    .is-open .drawer-pull {
        transform: rotate(180deg);
    }

    /* Reserve enough space at the bottom of the screen so the
       canvas + footer aren't hidden behind the collapsed drawer
       (54px handle + the canvas-wrap's own padding). */
    #screen-shape,
    #screen-decorate {
        padding-bottom: calc(72px + var(--safe-bottom));
    }
}

@media (min-width: 768px) {
    .shape-stack,
    .decorate-stack,
    .kiln-stack {
        flex-direction: row;
        align-items: flex-start;
        justify-content: center;
        gap: 28px;
        max-width: none;
    }

    .shape-side-rail,
    .decorate-side-rail,
    .kiln-side-rail {
        width: 360px;
        max-width: 360px;
        align-items: stretch;
        flex-shrink: 0;
    }

    /* In rail mode the inner rows + controls fill the rail width
       instead of being centered/clamped at 420px. */
    .shape-side-rail .clay-picker,
    .shape-side-rail .shape-controls,
    .shape-side-rail .shape-hint,
    .decorate-side-rail .decorate-tools,
    .decorate-side-rail .decorate-controls,
    .kiln-side-rail .kiln-controls {
        max-width: none;
    }

    /* Hint reads as a small instruction line above the controls
       in the rail — left-aligned makes more sense than centered. */
    .shape-side-rail .shape-hint {
        text-align: left;
    }

    /* Kiln-specific override: center the kiln canvas on screen
       even though the side rail occupies space on the right.
       Without this, justify-content:center on the canvas+rail
       pair pushes the canvas ~190px LEFT of the true viewport
       center (the rail's 360px+gap pulls the pair left). Switch
       kiln-stack to a 3-column grid where the canvas takes the
       center column and the side-rail sits in the right; the
       phantom left column balances the layout so the canvas
       lands on the screen's centerline regardless of whether
       the rail's controls are visible (firing vs reveal). */
    .kiln-stack {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: flex-start;
        gap: 28px;
    }
    .kiln-stack > .canvas-wrap   { grid-column: 2; justify-self: center; }
    .kiln-stack > .kiln-side-rail { grid-column: 3; justify-self: start; }
}

/* ----- 15. Responsive nudges ----- */

@media (max-width: 480px) {
    .title-stack { gap: 22px; }
    .crt-clock { font-size: 14px; }
    .specs-hook { width: 28px; height: 28px; bottom: 8px; right: 8px; }

    .screen-titlebar { font-size: 9px; gap: 6px; padding: 4px 0 10px; }
    .back-btn { font-size: 9px; padding: 4px 7px; }
    .screen-status { font-size: 13px; }
    .canvas-wrap { padding: 5px; border-width: 2px; }
    .shape-hint { font-size: 14px; }
    .shape-controls { gap: 10px; }
    .btn-control { padding: 12px 10px; }

    .decorate-tools { padding: 10px 8px; }
    .decorate-tools > .tool-row,
    .decorate-tools > .stash-label { margin-top: 8px; }
    .row-label { font-size: 9px; min-width: 44px; }
    .tool-btn { font-size: 10px; padding: 8px 4px; letter-spacing: 1.2px; }
    .swatch { width: 28px; height: 28px; }
    .stamp-btn { width: 36px; height: 36px; }

    /* Trim the command ribbon a touch on small phones so it doesn't
       crowd the pot, while staying >=44px tall for thumbs. */
    .cmd-btn { width: 46px; padding: 4px 2px; }
    .cmd-glyph { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .big-title,
    .big-title .oo,
    .clay-drifter,
    .marquee-tape span,
    .swatch.dynamic-rgb,
    .celebrate-saved,
    .dev-frame,
    .kiln-overheat #kilnCanvas,
    .pingas-flash,
    .overclocked-toast {
        animation: none;
    }
    /* Keep the kiln glitch filter visible even without the shake
       so the overheated state still reads correctly. */
}

/* ----- 16. Native (Capacitor) overrides -----
   The shared slim site footer is a fixed bottom strip whose CSS
   (../assets/css/site-footer.css) and ../ links don't resolve
   inside the packaged app — it bleeds in as unstyled web chrome
   over the bottom tool drawer. The inline detector in index.html
   adds html.is-native only in the native runtime; the web build
   at madderverse.org keeps the footer for SEO / legal. */
html.is-native .site-footer-slim,
html.is-native #btnInstall {
    display: none !important;
}

/* ----- 19. Floating primary actions (FINISH FORM / FIRE IT) -----
   Pinned to the bottom-right corner. Visible by default; hidden
   when the matching tool drawer is open so they don't compete
   with the in-drawer tools the kid is choosing. .btn-control
   .primary already gives them the pink/CTA styling — we just
   reposition. */
.float-action {
    position: fixed;
    bottom: calc(72px + var(--safe-bottom));   /* above the 54px collapsed drawer handle + 18px gap */
    right: calc(16px + env(safe-area-inset-right, 0px));
    z-index: 85;                               /* above drawer z-80 */
    /* Match .btn-control.primary visual treatment without depending
       on whether the page CSS class cascade picks it up correctly
       (the button is outside its original .shape-controls/
       .decorate-controls flex parent). */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 2px;
    color: #fff;
    background: linear-gradient(180deg, var(--pink) 0%, var(--pink-deep) 100%);
    border: 1.5px solid var(--pink);
    border-radius: var(--radius-md);
    box-shadow:
        0 0 0 1px #000,
        0 6px 14px rgba(0, 0, 0, 0.55),
        0 0 22px rgba(255, 46, 136, 0.45);
    cursor: pointer;
    transition: opacity 0.18s ease,
                transform 0.06s ease,
                box-shadow 0.15s ease;
    text-shadow: 1px 1px 0 #000;
}

.float-action:hover,
.float-action:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 1px #000,
        0 6px 14px rgba(0, 0, 0, 0.55),
        0 0 32px rgba(255, 46, 136, 0.65);
}

.float-action:active {
    transform: translateY(1px);
}

.float-action .btn-glyph {
    font-size: 16px;
    line-height: 1;
}

/* SAVE + FIRE IT live in a fixed flex ROW so they auto-space and
   never overlap regardless of label width (the old hard-coded
   right:140px assumed a FIRE-IT width that the real button exceeds,
   so they collided). The row owns the fixed positioning; the
   buttons inside drop back to static flow. */
.decorate-float-actions {
    position: fixed;
    bottom: calc(72px + var(--safe-bottom));
    right: calc(16px + env(safe-area-inset-right, 0px));
    z-index: 85;
    display: flex;
    align-items: center;
    gap: 12px;
    /* CRITICAL: the wrapper is a layout box only — it must NOT catch
       taps. It's fixed at the bottom-right, directly over the stamp
       palette (the bottom-most row of the open decorate drawer), so
       an interactive wrapper swallowed every tap there ("can't pick
       a different stamp"). Pass-through on the wrapper; only the
       actual buttons re-enable pointer events. */
    pointer-events: none;
}
.decorate-float-actions .float-action {
    position: static;
    bottom: auto;
    right: auto;
    pointer-events: auto;
}

/* SAVE DRAFT button — sits to the LEFT of FIRE IT with a calmer
   teal treatment so the kid reads pink-FIRE as the primary
   action + teal-SAVE as the "come back later" secondary. */
.decorate-float-save {
    background: linear-gradient(180deg, var(--teal) 0%, #00b890 100%);
    border-color: var(--teal);
    color: #002b22;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.2);
    box-shadow:
        0 0 0 1px #000,
        0 6px 14px rgba(0, 0, 0, 0.55),
        0 0 18px rgba(0, 255, 204, 0.35);
}
.decorate-float-save:hover,
.decorate-float-save:focus-visible {
    box-shadow:
        0 0 0 1px #000,
        0 6px 14px rgba(0, 0, 0, 0.55),
        0 0 28px rgba(0, 255, 204, 0.55);
}

/* Hide when the matching drawer is open. :has() is supported in
   modern Chromium (Capacitor's WebView) + Safari + Firefox 121+,
   so this works in every target. On desktop the drawer never has
   .is-open (the handle is display:none above 768px), so the
   floating button stays visible — which is the intended behavior:
   no separate desktop variant needed. */
#screen-shape:has(.shape-side-rail.is-open) .shape-float-finish,
#screen-decorate:has(.decorate-side-rail.is-open) .decorate-float-fire,
#screen-decorate:has(.decorate-side-rail.is-open) .decorate-float-save {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
}

/* ----- 17. Clay-lump tray (shape screen) -----
   The kid drags a wet lump onto the wheel instead of tapping a
   swatch. The old .clay-picker is superseded — it lived inside
   the collapsed phone drawer where a small child can't reach it. */
.clay-picker { display: none; }

.clay-lump-tray {
    /* Lives inside the shape-side-rail drawer now (at the top,
       above the hint + RESET/FINISH). No more fixed floating —
       it flows in the drawer's column and rides whatever state
       the drawer is in (collapsed = hidden with the rest of the
       tools, open = visible at the top). needsLump auto-opens
       the drawer so the lumps are first thing the kid sees. */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 4px 0 8px;
    width: 100%;
    max-width: 420px;
}

.clay-lump-prompt {
    align-self: center;
    flex: 0 0 auto;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.4px;
    color: var(--teal-dim);
    text-shadow: 0 0 6px rgba(0, 255, 204, 0.4);
    pointer-events: none;
    white-space: nowrap;
}

.clay-lump {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 2px;
    cursor: grab;
    pointer-events: auto;
    touch-action: none;          /* we own the drag gesture */
    -webkit-tap-highlight-color: transparent;
}

.clay-lump:active { cursor: grabbing; }

.clay-lump .lump-ball,
.clay-lump-ghost {
    width: 54px;
    height: 50px;
    /* Irregular blob so it reads as a hand-pinched wet lump,
       not a tidy disc. */
    border-radius: 48% 52% 56% 44% / 60% 58% 42% 40%;
    /* Layer order top->bottom: shine highlight, clay grain texture,
       then the swatch color underneath. The texture soft-lights
       over the color (same blend the rendered pot uses) so the lump
       shows the real clay grain, not a flat fill. --lump-texture is
       set per-clay in JS (buildLumpTray / attachLumpDrag); falls
       back to `none` for any clay with no texture file. */
    background-image:
        radial-gradient(circle at 38% 32%,
            rgba(255, 255, 255, 0.45) 0%,
            rgba(255, 255, 255, 0.12) 22%,
            transparent 46%),
        var(--lump-texture, none);
    background-color: var(--lump-color, #a25a2c);
    background-size: auto, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    background-blend-mode: screen, soft-light;
    box-shadow:
        inset -5px -7px 10px rgba(0, 0, 0, 0.45),
        inset 3px 4px 7px rgba(255, 255, 255, 0.22),
        0 4px 8px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.5);
}

.clay-lump:hover .lump-ball,
.clay-lump:focus-visible .lump-ball {
    outline: none;
    box-shadow:
        inset -5px -7px 10px rgba(0, 0, 0, 0.45),
        inset 3px 4px 7px rgba(255, 255, 255, 0.22),
        0 0 12px rgba(0, 255, 204, 0.55),
        0 4px 8px rgba(0, 0, 0, 0.5);
}

.clay-lump.is-dragging .lump-ball { opacity: 0.3; }

.clay-lump .lump-name {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1px;
    color: var(--ink-dim);
}

/* The ball that follows the finger during a drag. */
.clay-lump-ghost {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 999;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1.12);
    transition: opacity 0.18s ease;
    will-change: transform;
}
.clay-lump-ghost.is-snapback {
    transition: transform 0.22s cubic-bezier(0.34, 0.8, 0.3, 1),
                opacity 0.22s ease;
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    .clay-lump-ghost,
    .clay-lump-ghost.is-snapback { transition: none; }
}

/* ----- 18. Custom-sticker tiles (decorate palette) ----- */

/* Imported PNGs the kid added themselves. Dashed border + a small
   corner mark so it reads as "personal / not for sharing" — these
   pots are also blocked from public battle submission. */
.stamp-btn.is-custom-sticker {
    border-style: dashed;
    border-color: var(--teal);
    position: relative;
    background:
        repeating-conic-gradient(
            rgba(255, 255, 255, 0.04) 0% 25%,
            transparent 25% 50%) 0 0 / 12px 12px,
        var(--bg-panel);
}
.stamp-btn.is-custom-sticker::after {
    content: "★";
    position: absolute;
    top: 2px; right: 4px;
    font-size: 9px;
    color: var(--teal);
    opacity: 0.85;
    pointer-events: none;
}
.stamp-btn.is-custom-sticker img {
    display: block;
    image-rendering: auto;
}

/* The "+" import-sticker tile. */
.stamp-btn.is-add-sticker {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: bold;
    color: var(--teal);
    border-style: dashed;
    border-color: var(--teal-low);
    background: var(--bg-panel);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.stamp-btn.is-add-sticker:hover,
.stamp-btn.is-add-sticker:focus-visible {
    color: var(--pink-bright);
    border-color: var(--pink-bright);
    outline: none;
}

/* iOS: kill double-tap-to-zoom (Safari ignores user-scalable=no). Keeps taps/scroll/pinch; canvas touch-action:none wins on specificity. */
* { touch-action: manipulation; }
