:root {
    --wood-dark: #3d2a1c;
    --wood: #6b4226;
    --wood-light: #9a6b3f;
    --paper: #faf6ee;
    --ink: #2b2118;
    --muted: #7c6f5c;
    --accent: #1db954;
    --accent-dark: #169c46;
    --danger: #b3402a;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;

    /* Shadows are tinted toward the ink hue instead of pure black, per
       good-taste guidance — a warm room, not a generic UI. */
    --shadow-color: 43, 33, 24;
}

* { box-sizing: border-box; }

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.hidden { display: none !important; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--wood-dark);
    color: var(--paper);
    padding: 0.7rem 1.2rem;
    z-index: 100;
    border-radius: 0 0 8px 0;
}
.skip-link:focus {
    left: 0;
}

:focus-visible {
    outline: 3px solid #fff59d;
    outline-offset: 2px;
}

html, body { height: 100%; overflow-x: hidden; }

body {
    margin: 0;
    font-family: "Poppins", "Segoe UI", system-ui, sans-serif;
    background: #efe9de;
    color: var(--ink);
}

/* The room itself is a single screen: it fills the viewport exactly and
   never scrolls, on desktop or mobile — 100dvh accounts for mobile browser
   chrome (address bar, etc.) so the room isn't cut off or scrollable. */
body.room-page {
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    position: fixed;
    inset: 0;
    width: 100%;
}
body.room-page .messages {
    position: fixed;
    top: 4.4rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 45;
    width: min(480px, 90vw);
    padding: 0;
}
body.room-page main#main-content {
    padding: 0;
    max-width: none;
    margin: 0;
}
body.room-page .site-footer {
    display: none;
}

a { color: var(--wood-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* No header bar anymore — just the avatar, floating free over whatever's
   beneath it (the room, or a plain page background). */
.site-header {
    position: fixed;
    top: 0.9rem;
    right: 1.1rem;
    left: auto;
    z-index: 40;
    background: none;
    padding: 0;
}

/* --- Avatar circle + side menu (top-right, every page) --- */

.site-nav {
    display: flex;
    justify-content: flex-end;
}

.avatar-circle {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.avatar-circle:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, 0.9); }
.avatar-circle-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.side-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 14, 8, 0.35);
    z-index: 60;
}

.side-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(280px, 82vw);
    background: var(--paper);
    box-shadow: -18px 0 40px rgba(var(--shadow-color), 0.35);
    padding: 1.4rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    z-index: 61;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.side-menu.open { transform: translateX(0); }
.side-menu-user {
    margin: 0 0 0.8rem;
    font-weight: 600;
    color: var(--ink);
    padding-bottom: 0.7rem;
    border-bottom: 1px solid #e2d6c1;
}
.side-menu a, .side-menu .link-button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.65rem 0.2rem;
    color: var(--ink);
    font-size: 0.95rem;
}
.side-menu a:hover, .side-menu .link-button:hover { text-decoration: none; color: var(--accent-dark); }
.side-menu .link-button.danger { color: var(--danger); }

/* The menu is white-with-dark-text by default; when it's floating over a
   wall that's itself nearly white, that would disappear — so on a light
   wall it flips to dark-with-light-text instead. */
body.invert-side-menu .side-menu {
    background: var(--wood-dark);
    box-shadow: -18px 0 40px rgba(0, 0, 0, 0.45);
}
body.invert-side-menu .side-menu-user {
    color: var(--paper);
    border-bottom-color: rgba(255, 255, 255, 0.2);
}
body.invert-side-menu .side-menu a,
body.invert-side-menu .side-menu .link-button {
    color: var(--paper);
}
body.invert-side-menu .side-menu a:hover,
body.invert-side-menu .side-menu .link-button:hover {
    color: #fff59d;
}
body.invert-side-menu .side-menu .link-button.danger { color: #ff8a80; }

.link-button {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    padding: 0;
}
.link-button.danger { color: var(--danger); }
.link-button.small { font-size: 0.8rem; }

.messages { list-style: none; padding: 0.5rem 2rem; margin: 0; }
.messages .message {
    background: #fff3cd;
    border: 1px solid #ffe08a;
    padding: 0.5rem 0.6rem 0.5rem 1rem;
    border-radius: var(--radius-sm);
    margin: 0.4rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: opacity 0.35s ease, transform 0.35s ease;
}
.messages .message > span { flex: 1; }
/* Messages retire themselves (see nav.js) so nothing is left parked over the
   room; this is the state they fade out through. */
.messages .message--leaving {
    opacity: 0;
    transform: translateY(-6px);
}
.message-close {
    border: 0;
    background: transparent;
    font-size: 1.15rem;
    line-height: 1;
    padding: 0.15rem 0.35rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: inherit;
    opacity: 0.55;
}
.message-close:hover,
.message-close:focus-visible { opacity: 1; background: rgba(0, 0, 0, 0.08); }

@media (prefers-reduced-motion: reduce) {
    .messages .message { transition: none; }
}
.messages .message.success { background: #d4edda; border-color: #b6dfc0; }
.messages .message.error { background: #f8d7da; border-color: #eeb4b9; }

main { max-width: 1100px; margin: 0 auto; padding: 5rem 2rem 2rem; }

.hint { color: var(--muted); font-size: 0.9rem; }

.hero { text-align: center; padding: 3rem 1rem; }
.hero h1 { font-size: 2.1rem; margin-bottom: 0.6rem; letter-spacing: -0.01em; }
.hero p { max-width: 620px; margin: 0 auto 1.5rem; color: #5a4d3d; line-height: 1.55; }

/* A glimpse of the room, blurred into the landing page's hero, so the whole
   site feels like one warm, consistent place rather than "a room" bolted
   onto an unrelated marketing page. */
.hero--room {
    position: relative;
    padding: 5rem 1.5rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background-color: #8a7f6b;
    background-image:
        radial-gradient(circle at 18% 30%, rgba(184, 137, 90, 0.55), transparent 42%),
        radial-gradient(circle at 82% 70%, rgba(0,0,0,0.28), transparent 45%),
        radial-gradient(circle at 50% -10%, rgba(255,255,255,0.18), transparent 55%);
    overflow: hidden;
    isolation: isolate;
}
.hero--room::before {
    /* a soft cast of warm light, like the pendant lamp in the real room */
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(255, 214, 150, 0.35), transparent 55%);
    z-index: -1;
}
.hero--room h1, .hero--room p { color: #fff8ee; }
.hero--room p { color: rgba(255, 248, 238, 0.88); }

.hero-kicker {
    margin: 0 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    font-weight: 600;
    color: #ffd6a0;
}

/* A row of tilted "pinned song" mockups under the CTA — a decorative taste
   of the real room, built from plain emoji + text so it needs no imagery
   and never looks stale. */
.hero-preview {
    display: flex;
    justify-content: center;
    gap: 1.6rem;
    margin-top: 2.8rem;
    flex-wrap: wrap;
}
.hero-preview-pin {
    display: inline-block;
    background: var(--paper);
    padding: 10px 10px 12px;
    border-radius: 2px;
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.35);
    transform: rotate(var(--tilt, -4deg));
    transition: transform 0.2s ease;
}
.hero-preview-pin:hover { transform: rotate(0deg) translateY(-3px); }
.hero-preview-card--red { --tilt: -6deg; }
.hero-preview-card--yellow { --tilt: 3deg; }
.hero-preview-card--blue { --tilt: -2deg; }
.hero-preview-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    font-size: 2.2rem;
    background: #eee3cd;
    border-radius: 2px;
}
.hero-preview-caption {
    display: block;
    margin-top: 6px;
    font-family: "Caveat", cursive;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.1;
    color: var(--ink);
    text-align: center;
}
.hero-preview-caption span {
    display: block;
    font-family: "Caveat", cursive;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--muted);
}

.cta {
    display: inline-block;
    background: var(--accent);
    color: white !important;
    padding: 0.65rem 1.4rem;
    border-radius: 999px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}
.cta:hover { background: var(--accent-dark); text-decoration: none; transform: translateY(-1px); }
.cta.big { font-size: 1.05rem; padding: 0.85rem 1.9rem; }
.cta.small { padding: 0.4rem 0.95rem; font-size: 0.85rem; }
.cta--ghost {
    background: transparent;
    color: var(--wood-dark) !important;
    border: 1.5px solid var(--wood);
}
.cta--ghost:hover { background: rgba(107, 66, 38, 0.08); }
.cta.danger { background: var(--danger); }
.cta.danger:hover { background: #8f3220; }

.exhibition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.exhibition-card {
    background: var(--paper);
    border: 1px solid #e2d6c1;
    border-radius: var(--radius-md);
    padding: 1rem;
    display: block;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.exhibition-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(var(--shadow-color), 0.12);
    text-decoration: none;
}
.exhibition-card h3 { margin: 0 0 0.3rem; color: var(--ink); }
.exhibition-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* ============================================================
   The room: a wall canvas holding the corkboard, posters, and
   the turntable, all positioned in one shared percentage space
   (see exhibitions/layout.py — Python and CSS/JS share bounds).
   ============================================================ */

.owner-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.room {
    --wall-color: #8a7f6b;
    --cork-color: #b8895a;
}

/* The room fills the whole page: a wall (with the corkboard, posters and
   turntable) sitting above a floor, both in one continuous scene. */
.room-scene {
    position: relative;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

.wall {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    touch-action: none;
    background-color: var(--wall-color);
    background-image: radial-gradient(circle at 50% -10%, rgba(255,255,255,0.16), transparent 55%);
    box-shadow: inset 0 0 120px rgba(0,0,0,0.18);
    overflow: hidden;
}
.wall::after {
    /* baseboard: a thin trim where the wall meets the floor */
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: clamp(8px, 1vh, 14px);
    background: linear-gradient(180deg, #e9e2d3, #c9bfa9);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* The room's name, mounted on the wall as a sign — glowing neon tube,
   solid matte plaque, or plain colored text, owner's choice. */
.room-sign {
    position: absolute;
    top: 2%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    max-width: 90%;
    font-size: clamp(1.3rem, 3.2vw, 2.3rem);
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}
.room-sign--font-caveat { font-family: "Caveat", cursive; }
.room-sign--font-poppins { font-family: "Poppins", sans-serif; font-weight: 600; }
.room-sign--font-serif { font-family: Georgia, "Times New Roman", serif; }

.room-sign--neon {
    font-family: "Caveat", cursive;
    color: var(--sign-color, #ff5ec4);
    text-shadow:
        0 0 4px var(--sign-color, #ff5ec4),
        0 0 11px var(--sign-color, #ff5ec4),
        0 0 19px var(--sign-color, #ff5ec4),
        0 0 40px var(--sign-color, #ff5ec4);
    animation: neon-flicker 4.5s infinite ease-in-out;
}
.room-sign--matte {
    background: var(--sign-color, #3d2a1c);
    color: #fff;
    padding: 0.4rem 1.1rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 24px rgba(var(--shadow-color), 0.35);
}
.room-sign--plain {
    color: var(--sign-color, #fff7d6);
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

@keyframes neon-flicker {
    0%, 89%, 100% { opacity: 1; }
    90% { opacity: 0.75; }
    91% { opacity: 1; }
    93% { opacity: 0.85; }
    94% { opacity: 1; }
}

.corkboard-rect {
    position: absolute;
    transform: translate(-50%, -50%);
    background-color: var(--cork-color);
    background-image:
        radial-gradient(circle, rgba(255,255,255,0.16) 1px, transparent 1.6px),
        radial-gradient(circle, rgba(0,0,0,0.15) 1px, transparent 1.6px),
        radial-gradient(circle, rgba(0,0,0,0.07) 1.4px, transparent 2px);
    background-size: 13px 13px, 19px 19px, 27px 27px;
    background-position: 0 0, 6px 10px, 14px 3px;
    border: clamp(8px, 1.4vw, 14px) solid var(--wood);
    border-radius: var(--radius-sm);
    box-shadow:
        0 20px 40px rgba(var(--shadow-color), 0.35),
        inset 0 0 40px rgba(0,0,0,0.28);
    pointer-events: none;
}
/* Movable/resizable for the room's owner — otherwise it's purely decorative
   and must never intercept clicks meant for the items pinned on top of it. */
.corkboard-rect--editable {
    pointer-events: auto;
    cursor: grab;
    touch-action: none;
}
.corkboard-rect--editable.dragging { cursor: grabbing; }
.corkboard-resize-handle {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50% 4px 4px 4px;
    background: var(--paper);
    border: 3px solid var(--wood-dark);
    cursor: nwse-resize;
    pointer-events: auto;
    touch-action: none;
    z-index: 2;
}

/* The floor beneath the wall: plain wood planks. */
.floor {
    position: relative;
    flex: 0 0 clamp(60px, 10vh, 120px);
    background-color: #5c3f25;
    background-image:
        repeating-linear-gradient(90deg, rgba(0,0,0,0.08) 0 2px, transparent 2px 90px),
        linear-gradient(180deg, #7a5636, #4a3018);
    box-shadow: inset 0 14px 28px rgba(0,0,0,0.4);
}

/* Freehand doodle layer, over the wall but under the items (posters and
   frames should still read as the focal point). */
.doodle-layer, .doodle-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}
.doodle-layer { object-fit: cover; }
.doodle-canvas:not(.hidden) {
    pointer-events: auto;
    cursor: crosshair;
    touch-action: none;
    z-index: 7;
}

.empty-room {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255,255,255,0.8);
    font-style: italic;
    text-align: center;
    width: 70%;
    margin: 0;
}

/* --- Shared behaviour for anything hung on the wall (papers + posters) --- */

.wall-item {
    position: absolute;
    transform: translate(-50%, -50%) rotate(var(--rotation, 0deg));
    width: clamp(78px, 10.5vw, 128px);
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), filter 0.35s ease;
    user-select: none;
    z-index: 2;
}
.wall-item:hover {
    transform: translate(-50%, -54%) rotate(var(--rotation, 0deg)) scale(1.08);
    filter: drop-shadow(0 14px 18px rgba(var(--shadow-color), 0.3));
    z-index: 6;
}
.wall-item:focus-within {
    transform: translate(-50%, -54%) rotate(var(--rotation, 0deg)) scale(1.07);
    z-index: 6;
}
.wall-item--editable { cursor: grab; touch-action: none; }
.wall-item.dragging {
    cursor: grabbing;
    transition: none;
    z-index: 20;
    filter: drop-shadow(0 20px 16px rgba(var(--shadow-color), 0.4));
}
.wall-item.is-now-playing {
    filter: drop-shadow(0 0 0 3px rgba(29, 185, 84, 0.55)) drop-shadow(0 14px 18px rgba(var(--shadow-color), 0.3));
}

/* A song added without a page reload plays itself in, so it's obvious where
   on the wall it landed. */
@keyframes wall-item-arrive {
    0% { opacity: 0; transform: translate(-50%, -78%) rotate(var(--rotation, 0deg)) scale(0.72); }
    60% { opacity: 1; transform: translate(-50%, -46%) rotate(var(--rotation, 0deg)) scale(1.06); }
    100% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--rotation, 0deg)) scale(1); }
}
.wall-item--arriving { animation: wall-item-arrive 0.65s cubic-bezier(0.22, 1, 0.36, 1); }
@media (prefers-reduced-motion: reduce) {
    .wall-item--arriving { animation: none; }
}

/* A poster with its caption hidden is meant to look deliberate: the card
   closes up around the artwork instead of leaving an empty strip below it. */
.wall-item--no-labels .paper-card { padding: 7px 7px 7px; }
.wall-item--no-labels .paper-caption { display: none; }

/* --- Emoji stickers: much simpler than wall-items — no pin/frame/placement,
   they just float wherever they're dropped. --- */

.sticker {
    position: absolute;
    transform: translate(-50%, -50%) rotate(var(--rotation, 0deg));
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1;
    user-select: none;
    z-index: 3;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
    transition: transform 0.2s ease;
}
.sticker--editable { cursor: grab; touch-action: none; }
.sticker.dragging { cursor: grabbing; transition: none; z-index: 20; }
.sticker-emoji { display: block; }
/* Always visible (not hover-only) — a hover-revealed control would be
   unreachable on touch devices, which have no persistent hover state. Kept
   small and subtle (low opacity at rest, full on hover/focus for mouse
   users) so it doesn't compete with the emoji itself. */
.sticker-remove-form {
    position: absolute;
    top: -8px;
    right: -10px;
    opacity: 0.55;
    transition: opacity 0.15s ease;
}
.sticker--editable:hover .sticker-remove-form,
.sticker--editable:focus-within .sticker-remove-form {
    opacity: 1;
}
.sticker-remove-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(43, 33, 24, 0.85);
    color: #fff;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
}

.sticker-preview {
    font-size: 3rem;
    text-align: center;
    min-height: 3.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sticker-form { display: flex; gap: 0.5rem; }
.sticker-form input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: var(--radius-sm);
    font-size: 1.4rem;
    text-align: center;
}

.item-trigger {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-align: inherit;
    cursor: pointer;
}

/* Both looks (pinned poster / framed picture) are always in the DOM;
   which one shows is purely CSS, driven by the item's current
   data-placement — so dragging an item across the corkboard boundary can
   flip its look instantly, with no server round-trip needed first. */
.wall-item .poster-view { display: none; }
.wall-item[data-placement="wall"] .paper-view { display: none; }
.wall-item[data-placement="wall"] .poster-view { display: block; }
.item-controls .board-only { display: flex; }
.item-controls .wall-only { display: none; }
.wall-item[data-placement="wall"] .item-controls .board-only { display: none; }
.wall-item[data-placement="wall"] .item-controls .wall-only { display: flex; }
.item-trigger:focus-visible {
    outline: 3px solid #fff59d;
    outline-offset: 3px;
    border-radius: 3px;
}

/* Paper pinned to the corkboard */

.paper-card {
    display: block;
    background: var(--paper);
    padding: 9px 9px 11px;
    border-radius: 2px;
    box-shadow:
        0 12px 20px rgba(0,0,0,0.3),
        0 2px 4px rgba(0,0,0,0.18);
    position: relative;
}
.paper-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    box-shadow: 0 1px 3px rgba(0,0,0,0.35);
    pointer-events: none;
}
.paper-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: #eee3cd;
}
.paper-caption {
    display: block;
    margin: 6px 1px 0;
    font-family: "Caveat", cursive;
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.05;
    color: var(--ink);
    text-align: center;
}
.paper-caption span {
    display: block;
    font-family: "Caveat", cursive;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--muted);
}

.pin {
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    z-index: 3;
    box-shadow:
        0 3px 4px rgba(0,0,0,0.45),
        inset -2px -2px 4px rgba(0,0,0,0.25),
        inset 2px 3px 4px rgba(255,255,255,0.65);
}
.pin--red { background: radial-gradient(circle at 35% 30%, #ff8a80, #c62828); }
.pin--blue { background: radial-gradient(circle at 35% 30%, #82b1ff, #1565c0); }
.pin--yellow { background: radial-gradient(circle at 35% 30%, #fff59d, #f9a825); }
.pin--green { background: radial-gradient(circle at 35% 30%, #b9f6ca, #2e7d32); }
.pin--white { background: radial-gradient(circle at 35% 30%, #ffffff, #cfcfcf); }
.pin--black { background: radial-gradient(circle at 35% 30%, #6e6e6e, #111111); }
.pin--pink { background: radial-gradient(circle at 35% 30%, #ff8fd8, #c2185b); }
.pin--orange { background: radial-gradient(circle at 35% 30%, #ffcc80, #ef6c00); }

/* Poster hung on the wall, framed like a small gallery piece */

.poster-frame {
    display: block;
    padding: 9px;
    border-radius: 3px;
    position: relative;
    box-shadow:
        0 16px 26px rgba(var(--shadow-color), 0.32),
        0 2px 5px rgba(0,0,0,0.2);
}
.poster-frame::before {
    /* the nail/hook it hangs from */
    content: "";
    position: absolute;
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d8d0c2;
    box-shadow: 0 2px 3px rgba(0,0,0,0.4);
}
.poster-mat {
    display: block;
    background: var(--paper);
    padding: 8px;
}
.poster-mat img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}
.poster-view--natural .poster-frame { background: linear-gradient(155deg, #d9b98a, #b6905d); }
.poster-view--walnut .poster-frame { background: linear-gradient(155deg, #5a3a22, #2e1c10); }
.poster-view--black .poster-frame { background: linear-gradient(155deg, #3a3a3a, #101010); }
.poster-view--white .poster-frame { background: linear-gradient(155deg, #ffffff, #d8d3c8); }
.poster-view--gold .poster-frame { background: linear-gradient(155deg, #e8c66b, #a67c1e); }

/* --- Shared pin/frame-color picker + item controls popover --- */

.item-controls {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 6px;
    background: rgba(43, 33, 24, 0.92);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.wall-item--editable:hover .item-controls,
.wall-item--editable:focus-within .item-controls {
    opacity: 1;
    pointer-events: auto;
}
.pin-picker { display: flex; gap: 4px; }
.pin-swatch, .frame-swatch {
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 0;
}
.pin-swatch--red { background: #c62828; }
.pin-swatch--blue { background: #1565c0; }
.pin-swatch--yellow { background: #f9a825; }
.pin-swatch--green { background: #2e7d32; }
.pin-swatch--white { background: #f2f2f2; }
.pin-swatch--black { background: #111111; }
.pin-swatch--pink { background: #c2185b; }
.pin-swatch--orange { background: #ef6c00; }
.frame-swatch--natural { background: linear-gradient(155deg, #d9b98a, #b6905d); }
.frame-swatch--walnut { background: linear-gradient(155deg, #5a3a22, #2e1c10); }
.frame-swatch--black { background: linear-gradient(155deg, #3a3a3a, #101010); }
.frame-swatch--white { background: linear-gradient(155deg, #ffffff, #d8d3c8); }
.frame-swatch--gold { background: linear-gradient(155deg, #e8c66b, #a67c1e); }
.item-controls .link-button.danger { color: #ff8a80; font-size: 0.75rem; }

/* --- Play popover: click a paper/poster to open this, instead of
   playing it immediately --- */

.wall-item.popover-open { z-index: 25; }

.play-popover {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(6px) scale(0.94);
    margin-bottom: 10px;
    width: 168px;
    background: var(--paper);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    box-shadow: 0 18px 36px rgba(var(--shadow-color), 0.4);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
    z-index: 30;
}
.play-popover::after {
    /* little speech-bubble tail pointing at the item */
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: var(--paper);
}
.play-popover.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0) scale(1);
}
.play-popover-cover {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
    margin-bottom: 0.5rem;
}
.play-popover-title {
    margin: 0;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ink);
    line-height: 1.25;
}
.play-popover-artist {
    margin: 0.1rem 0 0.6rem;
    font-size: 0.78rem;
    color: var(--muted);
}
.play-popover-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}
.play-popover-btn:hover { background: var(--accent-dark); }
.play-popover-turntable-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    margin-top: 0.4rem;
    background: transparent;
    color: var(--wood-dark);
    border: 1.5px solid var(--wood);
    border-radius: 999px;
    padding: 0.45rem;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
}
.play-popover-turntable-btn:hover { background: rgba(107, 66, 38, 0.08); }
.play-popover-link {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.72rem;
    color: var(--muted);
    text-decoration: underline;
}

/* --- Turntable --- */

.turntable-unit {
    position: absolute;
    transform: translate(-50%, -50%);
    width: clamp(120px, 16vw, 190px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    z-index: 5;
    user-select: none;
}
.wall[data-editable="true"] .turntable-unit { cursor: grab; touch-action: none; }
.turntable-unit.dragging { cursor: grabbing; }

.turntable-body {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    background: linear-gradient(155deg, var(--wood-light), var(--wood-dark));
    box-shadow: 0 16px 26px rgba(var(--shadow-color), 0.4), inset 0 0 0 3px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.turntable-body--editable[role="button"] { cursor: pointer; }
.turntable-menu { width: 190px; }
.turntable-menu .hint { margin: 0; }

.turntable-platter {
    width: 72%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #1c1c1c;
    box-shadow: inset 0 0 0 6px #333, 0 4px 10px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Playback progress as a ring traced around the record's edge, instead of a
   linear bar. It's a SIBLING of #turntable-record (not a descendant of
   whatever has the spin animation), so it stays visually fixed while the
   vinyl spins underneath it. */
.turntable-progress-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 82%;
    aspect-ratio: 1;
    transform: translate(-50%, -50%) rotate(-90deg);
    pointer-events: none;
    z-index: 4;
}
.turntable-progress-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.25);
    stroke-width: 5;
}
.turntable-progress-ring-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 5;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.25s linear;
}

.turntable-record {
    width: 82%;
    aspect-ratio: 1;
    border-radius: 50%;
    background-color: #101010;
    background-size: cover;
    background-position: center;
    position: relative;
    box-shadow: inset 0 0 0 3px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
    animation: spin-record 4.5s linear infinite;
    animation-play-state: paused;
}
.turntable-record--empty {
    background: repeating-radial-gradient(circle, #1c1c1c 0 4px, #262626 4px 8px);
}
.turntable-record::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 13%; height: 13%;
    background: #eee;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 2px #333;
}
.turntable-unit.is-playing .turntable-record { animation-play-state: running; }

.turntable-arm {
    position: absolute;
    top: 12%;
    right: 10%;
    width: 6%;
    height: 40%;
    background: linear-gradient(#ddd, #999);
    border-radius: 4px;
    transform-origin: top center;
    transform: rotate(-20deg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.45);
    transition: transform 0.4s ease;
}
.turntable-arm::before {
    content: "";
    position: absolute;
    top: -30%; left: -60%;
    width: 220%; height: 24%;
    border-radius: 50%;
    background: #ccc;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.turntable-unit.is-playing .turntable-arm { transform: rotate(8deg); }

@keyframes spin-record { to { transform: rotate(360deg); } }

/* Centered right on the record, so pressing play/pause never needs the
   title/artist text to be visible first. */
.turntable-toggle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(30px, 4vw, 40px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
    z-index: 4;
}
.turntable-toggle:hover { background: #fff; }
.turntable-toggle[aria-pressed="true"] { background: var(--accent); color: #fff; }

.autoplay-hint {
    position: absolute;
    top: 3%;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    box-shadow: 0 8px 20px rgba(var(--shadow-color), 0.25);
    z-index: 8;
}
.autoplay-hint button { font-weight: 600; color: var(--accent-dark); }

/* Owner-only footnote when songs/stickers live on walls the classic view
   can't show — deliberately quiet, tucked into a bottom corner. */
.other-walls-note {
    position: absolute;
    left: 50%;
    bottom: 0.6rem;
    transform: translateX(-50%);
    margin: 0;
    max-width: min(420px, 90vw);
    text-align: center;
    font-size: 0.78rem;
    color: rgba(255, 248, 238, 0.75);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    z-index: 8;
}
.other-walls-note a { color: #fff59d; text-decoration: underline; }

/* --- Corner shortcuts: small controls always available to the owner,
   replacing the old giant bottom drawer. Personalizing (colors, sign,
   adding songs, doodling) is always on; only dragging/resizing existing
   items, the turntable and the corkboard needs edit mode turned on first. --- */

.corner-fab {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: rgba(20, 14, 8, 0.55);
    color: #fff;
    cursor: pointer;
    font-size: 1.3rem;
    box-shadow: 0 8px 18px rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 40;
    transition: transform 0.15s ease;
}
.corner-fab:hover { transform: translateY(-1px); }

.personalize-fab {
    top: 0.9rem;
    left: 1.1rem;
}

.add-fab {
    top: calc(0.9rem + 46px + 10px);
    left: 1.1rem;
    background: var(--accent);
    font-weight: 700;
}
.add-fab:hover { background: var(--accent-dark); transform: translateY(-1px); }

.doodle-fab {
    top: calc(0.9rem + 2 * (46px + 10px));
    left: 1.1rem;
}

.sticker-fab {
    top: calc(0.9rem + 3 * (46px + 10px));
    left: 1.1rem;
}

.corner-popover {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%) translateY(12px) scale(0.96);
    width: min(360px, 92vw);
    max-height: 76vh;
    overflow-y: auto;
    background: var(--paper);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.3rem;
    box-shadow: 0 -20px 55px rgba(var(--shadow-color), 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 50;
}
.corner-popover.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0) scale(1);
}
.corner-popover h3 { margin-top: 0; }

.personalize-popover {
    left: 1.1rem;
    bottom: auto;
    top: calc(0.9rem + 46px + 10px);
    transform: translateY(-8px) scale(0.96);
}
.personalize-popover.open { transform: translateY(0) scale(1); }

.search-form input, .search-form select,
.style-form input, .style-form select, .style-form textarea {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.7rem;
    border: 1px solid #ccc;
    border-radius: var(--radius-sm);
}
.style-form input[type="color"] { height: 42px; padding: 4px; cursor: pointer; }

.search-results { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.7rem; }
.search-result {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border: 1px solid #eee0c8;
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    flex-wrap: wrap;
}
.search-result img { width: 48px; height: 48px; border-radius: 4px; object-fit: cover; }
.search-result-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.search-result-info strong { font-size: 0.9rem; }
.search-result-info span { font-size: 0.8rem; color: var(--muted); }
.add-item-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.doodle-color-picker { display: flex; gap: 0.5rem; margin: 0.8rem 0; flex-wrap: wrap; }
.doodle-color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.15);
    background: var(--swatch-color);
    cursor: pointer;
    padding: 0;
}
.doodle-color-swatch.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.doodle-tools { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.6rem; }

.auth-form {
    max-width: 400px;
    margin: 2rem auto;
    background: var(--paper);
    padding: 2rem;
    border-radius: var(--radius-md);
    border: 1px solid #e2d6c1;
}
.auth-form input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.7rem;
    border: 1px solid #ccc;
    border-radius: var(--radius-sm);
}
.form-error { color: var(--danger); }

/* ============================================================
   The 3D room: a full-viewport WebGL canvas with a CSS3D layer
   over it, plus a deliberately minimal floating control cluster.
   Chrome stays out of the way — the room is the interface.
   ============================================================ */

body.room3d-page {
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    position: fixed;
    inset: 0;
    width: 100%;
    background: #0d0b09;
}
body.room3d-page main#main-content { padding: 0; max-width: none; margin: 0; }
body.room3d-page .site-footer { display: none; }
body.room3d-page .messages {
    position: fixed;
    top: 4.4rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 45;
    width: min(480px, 90vw);
    padding: 0;
}

.room3d {
    position: relative;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    background: #0d0b09;
    opacity: 0;
    transition: opacity 0.6s ease;
}
.room3d.is-ready { opacity: 1; }

.room3d-canvas-host, .room3d-css-host {
    position: absolute;
    inset: 0;
}
.room3d-canvas {
    display: block;
    width: 100%;
    height: 100%;
    /* The canvas is in the tab order so the room can be looked around from
       the keyboard; that only helps if you can see where focus landed. */
    outline-offset: -4px;
    /* Without this a touch-drag becomes a browser pan instead of reaching
       the pointer handlers that turn the camera. */
    touch-action: none;
}
/* The CSS3D layer floats over the canvas and lets drags fall through to
   it; Phase C's content (posters, corkboard, turntable) opts back in with
   pointer-events: auto on the individual elements it mounts. */
.room3d-css-host, .room3d-css-layer { pointer-events: none; }

/* Loading + fallback */

.room3d-loading, .room3d-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 40%, #1d1712, #0b0908 70%);
    z-index: 20;
    color: var(--paper);
    text-align: center;
    padding: 1.5rem;
}
/* A class selector beats the browser's own [hidden] { display: none }, so
   the display:flex above would otherwise keep the fallback on screen even
   when the room booted perfectly. */
.room3d-loading[hidden], .room3d-fallback[hidden] { display: none; }
.room3d-loading { opacity: 1; transition: opacity 0.4s ease; }
.room3d-loading.is-done { opacity: 0; }
.room3d-loading p {
    margin: 1.1rem 0 0;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    color: rgba(250, 246, 238, 0.78);
}
.room3d-loading-disc {
    display: block;
    width: 52px;
    height: 52px;
    margin: 0 auto;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 50%, #fff 0 4px, transparent 4px),
        repeating-radial-gradient(circle at 50% 50%, #171717 0 3px, #242424 3px 6px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    animation: room3d-spin 1.6s linear infinite;
}
@keyframes room3d-spin { to { transform: rotate(360deg); } }

.room3d-fallback { z-index: 25; }
.room3d-fallback h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.room3d-fallback p { margin: 0 0 1.1rem; color: rgba(250, 246, 238, 0.75); font-size: 0.9rem; }

/* Floating control cluster: one soft glass pill, not a row of buttons. */

.room3d-controls {
    position: fixed;
    left: 50%;
    bottom: max(1.1rem, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem;
    border-radius: 999px;
    background: rgba(18, 13, 9, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    z-index: 30;
}
.room3d-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 42px;
    height: 42px;
    padding: 0 0.7rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #fff8ee !important;
    font: inherit;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.16s ease, transform 0.16s ease;
}
.room3d-control:hover { background: rgba(255, 255, 255, 0.12); text-decoration: none; transform: translateY(-1px); }
.room3d-control[aria-pressed="true"] { background: rgba(255, 214, 150, 0.2); }
.room3d-control-label { font-size: 0.82rem; font-weight: 600; letter-spacing: 0.01em; }
.room3d-control--wide { padding: 0 0.9rem; }

/* --- Content mounted on the 3D walls. Each surface is a fixed-size
   "wall" in CSS pixels that CSS3DObject maps onto a real wall, so the
   items inside keep the exact percentage positions the server stores.
   Sizes are re-expressed in px here because vw units would measure the
   viewport, not the wall. --- */

.room3d-source { position: absolute; left: -99999px; top: 0; }
.wall3d-surface {
    position: relative;
    width: 1000px;
    height: 500px;
    overflow: visible;
    pointer-events: none;
}
.wall3d-surface .wall-item,
.wall3d-surface .sticker,
.wall3d-surface .corkboard-rect { pointer-events: auto; }
.wall3d-surface .wall-item { width: 96px; }
.wall3d-surface .wall-item:hover { transform: translate(-50%, -52%) rotate(var(--rotation, 0deg)) scale(1.05); }
/* The caption has to fit its card: a 96px paper can't carry 16px Caveat.
   Long titles clamp to two lines and ellipsis rather than spilling out. */
.wall3d-surface .paper-card { padding: 6px 6px 8px; }
.wall3d-surface .paper-caption {
    font-size: 11px;
    line-height: 1.1;
    margin: 5px 1px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wall3d-surface .paper-caption span {
    font-size: 9.5px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wall3d-surface .pin { width: 13px; height: 13px; top: -6px; }
.wall3d-surface .sticker { font-size: 40px; }
/* In a rendered room a permanent "×" on every sticker is visual noise, so
   here it appears on hover or focus only. (The 2D wall keeps its
   always-visible button — that was a deliberate touch-device fix.) */
.wall3d-surface .sticker-remove-form { opacity: 0; pointer-events: none; }
.wall3d-surface .sticker--editable:hover .sticker-remove-form,
.wall3d-surface .sticker--editable:focus-within .sticker-remove-form {
    opacity: 1;
    pointer-events: auto;
}
.wall3d-surface .doodle-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.wall3d-surface .play-popover { width: 190px; }

/* In 3D the corkboard's cork, frame and thickness are real geometry, so
   the HTML one becomes a transparent hit area sitting on top of it. */
.corkboard-rect--flat {
    background: none;
    border: none;
    box-shadow: none;
}

/* What's on the deck, as page chrome: always legible, never colliding with
   a poster, and immune to the fact that CSS3D content can't be occluded by
   the WebGL room. */
.room3d-nowplaying {
    position: fixed;
    left: max(1.1rem, env(safe-area-inset-left));
    bottom: max(1.1rem, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 0.6rem;
    max-width: min(300px, 60vw);
    padding: 0.35rem 0.9rem 0.35rem 0.35rem;
    border-radius: 999px;
    background: rgba(18, 13, 9, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    z-index: 30;
}
.room3d-nowplaying-btn {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
}
.room3d-nowplaying-btn:hover { background: var(--accent-dark); }
.room3d-nowplaying-text { display: flex; flex-direction: column; min-width: 0; }
.room3d-nowplaying-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff8ee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.room3d-nowplaying-artist {
    font-size: 0.74rem;
    color: rgba(255, 248, 238, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Owner panels: one glassy card stack above the control pill --- */

.room3d-panels {
    position: fixed;
    left: 50%;
    bottom: calc(max(1.1rem, env(safe-area-inset-bottom)) + 4.2rem);
    transform: translateX(-50%);
    width: min(380px, calc(100vw - 1.6rem));
    z-index: 31;
}
.room3d-panel {
    background: rgba(24, 18, 13, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 20px;
    padding: 1rem 1.1rem 1.1rem;
    color: var(--paper);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    max-height: 58vh;
    overflow-y: auto;
}
.room3d-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.35rem;
}
.room3d-panel-head h2 { margin: 0; font-size: 1rem; font-weight: 600; letter-spacing: 0.01em; }
.room3d-panel-close {
    border: none;
    background: transparent;
    color: rgba(255, 248, 238, 0.65);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    border-radius: 8px;
}
.room3d-panel-close:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.room3d-panel-hint { margin: 0 0 0.8rem; font-size: 0.78rem; color: rgba(255, 248, 238, 0.6); line-height: 1.4; }

.room3d-panel input[type="text"],
.room3d-panel input[type="search"],
.room3d-panel textarea,
.room3d-panel select {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.07);
    color: var(--paper);
    font: inherit;
}
.room3d-panel input[type="color"] {
    width: 100%;
    height: 38px;
    padding: 3px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.07);
    cursor: pointer;
}
.room3d-panel label { display: block; font-size: 0.78rem; color: rgba(255, 248, 238, 0.72); margin-bottom: 0.2rem; }
.room3d-panel p { margin: 0 0 0.7rem; }
.room3d-search { display: flex; gap: 0.5rem; }
.room3d-search input { flex: 1; }
.room3d-results { margin-top: 0.9rem; display: flex; flex-direction: column; gap: 0.55rem; }
.room3d-result {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
}
.room3d-result img { width: 40px; height: 40px; border-radius: 7px; object-fit: cover; }
.room3d-result-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.room3d-result-info strong { font-size: 0.82rem; }
.room3d-result-info span { font-size: 0.74rem; color: rgba(255, 248, 238, 0.6); }
.room3d-sticker-preview {
    font-size: 2.6rem;
    text-align: center;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.room3d-sticker-form { display: flex; gap: 0.5rem; }
.room3d-sticker-form input { flex: 1; text-align: center; font-size: 1.3rem; }
.room3d-panel-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 0.4rem; }
/* Three moods, shown as a segmented control inside the glass pill: which
   one is active has to be visible at a glance, not inferred from an icon
   that changes every time you press it. */
.room3d-moods {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}
.room3d-mood {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #fff8ee;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.16s ease, transform 0.16s ease;
}
.room3d-mood:hover { background: rgba(255, 255, 255, 0.14); }
.room3d-mood.is-active {
    background: rgba(255, 214, 150, 0.26);
    box-shadow: inset 0 0 0 1px rgba(255, 214, 150, 0.5);
}

/* Furniture the owner can re-cover gets a quiet hover cue, so the feature
   isn't hidden: the cursor changes and a hint appears. */
body.room3d-furniture-hover .room3d-canvas { cursor: pointer; }
.room3d-furniture-hint {
    position: fixed;
    left: 50%;
    top: 1.1rem;
    transform: translateX(-50%);
    margin: 0;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: rgba(18, 13, 9, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 248, 238, 0.9);
    font-size: 0.76rem;
    pointer-events: none;
    z-index: 32;
    opacity: 0;
    transition: opacity 0.2s ease;
}
body.room3d-furniture-hover .room3d-furniture-hint { opacity: 1; }

.furniture-patterns { display: flex; gap: 0.4rem; margin-top: 0.8rem; }
.furniture-pattern {
    flex: 1;
    padding: 0.45rem 0.3rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: var(--paper);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}
.furniture-pattern.is-active { background: rgba(255, 214, 150, 0.22); border-color: rgba(255, 214, 150, 0.5); }

.room3d-control-divider {
    width: 1px;
    height: 22px;
    margin: 0 0.15rem;
    background: rgba(255, 255, 255, 0.18);
}
.room3d-control[aria-expanded="true"] { background: rgba(255, 255, 255, 0.18); }

/* While the brush is armed the canvas is a drawing surface, not a camera. */
body.room3d-doodling .room3d-canvas { cursor: crosshair; }

/* The "drag to look around" hint: its own legible pill, clear of the
   control cluster, and it retires for good once you've actually dragged. */
.room3d-hint {
    position: fixed;
    left: 50%;
    bottom: calc(max(1.1rem, env(safe-area-inset-bottom)) + 4rem);
    transform: translateX(-50%);
    margin: 0;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: rgba(18, 13, 9, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 0.76rem;
    letter-spacing: 0.01em;
    color: rgba(255, 248, 238, 0.82);
    pointer-events: none;
    z-index: 29;
    white-space: nowrap;
    transition: opacity 0.45s ease;
}
.room3d-hint.is-gone { opacity: 0; }
body.room3d-panel-open .room3d-hint { opacity: 0; }

/* --- Friends page --- */

.friends-page { max-width: 640px; margin: 0 auto; }
.friends-page h1 { margin-bottom: 1.2rem; }

.friends-card {
    background: var(--paper);
    border: 1px solid #e2d6c1;
    border-radius: var(--radius-md);
    padding: 1.2rem 1.4rem;
    margin-bottom: 1.2rem;
}
.friends-card h2 { margin: 0 0 0.6rem; font-size: 1.1rem; }

.friends-add-form {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.friends-add-form input {
    flex: 1 1 220px;
    padding: 0.55rem 0.7rem;
    border: 1px solid #ccc;
    border-radius: var(--radius-sm);
}

.friends-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.friends-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee0c8;
}
.friends-list-item:last-child { border-bottom: none; }
.friends-list-actions { display: flex; gap: 0.8rem; align-items: center; }

.friends-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 0.4rem;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    vertical-align: middle;
}

.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: #a3927a;
    font-size: 0.85rem;
}

/* --- Generic confirm dialog: replaces native confirm() for destructive
   actions (e.g. "Quitar esta canción"), styled to match the rest of the
   site instead of a jarring browser popup. One overlay, shared by every
   .confirm-form on the page (see static/js/confirm-dialog.js). --- */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 14, 8, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 80;
    padding: 1rem;
}
.confirm-dialog {
    background: var(--paper);
    color: var(--ink);
    border-radius: var(--radius-md);
    padding: 1.3rem 1.4rem;
    max-width: min(360px, 92vw);
    box-shadow: 0 20px 50px rgba(var(--shadow-color), 0.45);
}
.confirm-dialog p {
    margin: 0 0 1.1rem;
    line-height: 1.4;
}
.confirm-dialog-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
}

@media (max-width: 560px) {
    .side-menu { width: 88vw; }
    .corner-fab { width: 40px; height: 40px; font-size: 1.2rem; }
    .add-fab { top: calc(0.9rem + 40px + 10px); }
    .personalize-popover { top: calc(0.9rem + 40px + 10px); }
    .doodle-fab { top: calc(0.9rem + 2 * (40px + 10px)); }
    .sticker-fab { top: calc(0.9rem + 3 * (40px + 10px)); }
    .hero-preview { gap: 1rem; margin-top: 2rem; }
    .hero-preview-cover { width: 64px; height: 64px; font-size: 1.7rem; }

    /* Every corner popover (add-song, doodle, personalize, sticker) anchors
       near the TOP of the screen instead of the bottom here, and is capped
       well short of full height — a bottom-anchored panel would get pushed
       up/covered by the on-screen keyboard the moment a text input inside
       it (search, sticker emoji, color fields) is focused. Also widened to
       fill the narrow viewport instead of a fixed 360px. */
    .corner-popover {
        left: 50%;
        right: auto;
        bottom: auto;
        top: 4.2rem;
        width: calc(100vw - 1.6rem);
        max-height: 62vh;
        transform: translateX(-50%) translateY(-8px) scale(0.96);
    }
    .corner-popover.open {
        transform: translateX(-50%) translateY(0) scale(1);
    }
    .friends-list-item { flex-wrap: wrap; row-gap: 0.4rem; }
    .friends-list-actions { flex-wrap: wrap; }
    .room3d-control { min-width: 40px; height: 40px; padding: 0 0.55rem; }
    .room3d-hint { font-size: 0.68rem; }
    /* The bottom edge belongs to the control pill on a phone, so what's
       playing moves up to the free top-left corner instead of hiding
       underneath it. */
    .room3d-nowplaying {
        top: max(0.9rem, env(safe-area-inset-top));
        bottom: auto;
        max-width: min(230px, 62vw);
    }
    .room3d-panels { width: calc(100vw - 1.2rem); }
}

@media (prefers-reduced-motion: reduce) {
    .room3d-loading-disc { animation: none; }
    .room3d, .room3d-control { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
    .turntable-record { animation: none; }
    .room-sign--neon { animation: none; }
    .wall-item, .wall-item:hover, .wall-item:focus-within,
    .turntable-arm, .exhibition-card, .cta, .corner-popover, .side-menu,
    .play-popover {
        transition: none;
    }
    .wall-item:hover, .wall-item:focus-within {
        transform: translate(-50%, -50%) rotate(var(--rotation, 0deg));
    }
}
