:root {
    color-scheme: light;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 20px 20px 28px;
    background-color: #0b0b0b;
    background-image: url("/assets/background.jpg?v=1");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #f5f5f2;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 10, 10, 0.3), rgba(8, 8, 8, 0.45));
    pointer-events: none;
    z-index: 0;
}

.layout {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 16px;
    max-width: 1120px;
    margin: 0 auto;
}

.page-container {
    position: relative;
    min-height: min(78vh, 880px);
}

.page {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    overflow-y: auto;
    padding-bottom: 120px;
}

.page.is-active {
    opacity: 1;
    pointer-events: auto;
}

#pageHome {
    display: flex;
    align-items: center;
    justify-content: center;
}

#pageCall {
    overflow: visible;
}

.ambient-landing {
    text-align: center;
    padding: 40px;
    color: rgba(245, 245, 242, 0.8);
}

.ambient-landing h2 {
    font-size: 40px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.ambient-landing p {
    font-size: 14px;
    opacity: 0.65;
}

.room-panel {
    position: relative;
    padding-bottom: 120px;
}

.call-stack,
.tab-stack {
    display: grid;
    gap: 16px;
}

/* ========================================
   LOADING SCREEN
   ======================================== */

#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #0a0a0f;
    display: block;
    overflow: hidden;
}

#loading-screen.hidden {
    display: none;
}

.loading-animation {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#loading-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.loading-text {
    position: absolute;
    bottom: 6vh;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(201, 169, 89, 0.8);
    font-family: "Cinzel", serif;
    font-size: 1rem;
    letter-spacing: 0.2em;
    animation: pulse-glow 1.5s ease-in-out infinite;
    text-align: center;
    z-index: 1;
}

@keyframes pulse-glow {
    0%,
    100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 20px rgba(201, 169, 89, 0.5);
    }
}

/* ========================================
   RADIAL WHEEL BACKDROP
   ======================================== */

.wheel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.wheel-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ========================================
   RADIAL WHEEL
   ======================================== */

#radial-wheel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(var(--wheel-scale, 0.3))
        rotate(var(--wheel-rotation, 0deg));
    width: min(85vw, 450px);
    height: min(85vw, 450px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
    --wheel-scale: 0.3;
}

#radial-wheel.wheel-visible {
    opacity: 1;
    pointer-events: auto;
    --wheel-scale: 1;
}

.wheel-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.wheel-center-void {
    fill: #050508;
}

.wheel-center-ring {
    fill: none;
    stroke: rgba(201, 169, 89, 0.3);
    stroke-width: 2;
}

.wheel-segment-path {
    fill: url(#segment-gradient);
    stroke: rgba(80, 100, 70, 0.6);
    stroke-width: 2;
    cursor: pointer;
    transition: fill 0.2s ease, stroke 0.2s ease, filter 0.2s ease;
}

.wheel-segment-path:hover,
.wheel-segment-path.hovered {
    fill: url(#segment-gradient-hover);
    stroke: rgba(201, 169, 89, 0.8);
    filter: url(#segment-glow);
}

.wheel-segment-path.selected {
    stroke: #c9a959;
    stroke-width: 3;
    filter: url(#segment-glow);
}

#wheel-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.wheel-segment-icon {
    position: absolute;
    width: 50px;
    height: 50px;
    pointer-events: none;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.wheel-segment-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(1) contrast(1.1);
}

.wheel-segment-label {
    position: absolute;
    font-family: "Cinzel", serif;
    font-size: 0.7rem;
    color: rgba(201, 169, 89, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    pointer-events: none;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s ease;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

.wheel-segment-label.visible {
    opacity: 1;
}

#radial-wheel.wheel-visible .wheel-segment-path {
    animation: segment-pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

#radial-wheel.wheel-visible .wheel-segment-path:nth-child(1) {
    animation-delay: 0.05s;
}
#radial-wheel.wheel-visible .wheel-segment-path:nth-child(2) {
    animation-delay: 0.1s;
}
#radial-wheel.wheel-visible .wheel-segment-path:nth-child(3) {
    animation-delay: 0.15s;
}
#radial-wheel.wheel-visible .wheel-segment-path:nth-child(4) {
    animation-delay: 0.2s;
}
#radial-wheel.wheel-visible .wheel-segment-path:nth-child(5) {
    animation-delay: 0.25s;
}
#radial-wheel.wheel-visible .wheel-segment-path:nth-child(6) {
    animation-delay: 0.3s;
}
#radial-wheel.wheel-visible .wheel-segment-path:nth-child(7) {
    animation-delay: 0.35s;
}

#radial-wheel.wheel-visible .wheel-segment-icon {
    animation: icon-pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    animation-delay: 0.2s;
}

@keyframes segment-pop-in {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes icon-pop-in {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ========================================
   FLOATING HOME BUTTON
   ======================================== */

.home-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: rgba(20, 25, 20, 0.9);
    border: 2px solid rgba(201, 169, 89, 0.5);
    border-radius: 50%;
    cursor: pointer;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
    transition: opacity 0.3s ease,
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        border-color 0.2s ease, box-shadow 0.2s ease;
}

.home-button.visible {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    animation: home-button-breathe 3s ease-in-out infinite;
}

.home-button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0.9);
    transition: filter 0.2s ease, transform 0.2s ease;
}

.home-button:hover {
    border-color: rgba(201, 169, 89, 0.9);
    box-shadow: 0 0 20px rgba(201, 169, 89, 0.3),
        inset 0 0 15px rgba(201, 169, 89, 0.1);
}

.home-button:hover img {
    filter: brightness(1.1);
    transform: scale(1.1);
}

.home-button:active {
    transform: scale(0.95);
}

.home-button.raised {
    bottom: 110px;
}

@keyframes home-button-breathe {
    0%,
    100% {
        box-shadow: 0 0 10px rgba(201, 169, 89, 0.1);
    }
    50% {
        box-shadow: 0 0 20px rgba(201, 169, 89, 0.25);
    }
}

.wheel-call-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: rgba(20, 25, 20, 0.95);
    border: 2px solid #4ade80;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 200;
    font-family: "Cinzel", serif;
    font-size: 12px;
    color: #e7f9e7;
    animation: call-pulse 2s ease-in-out infinite;
}

.wheel-call-indicator.visible {
    display: flex;
}

@keyframes call-pulse {
    0%,
    100% {
        box-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(74, 222, 128, 0.6);
    }
}

.title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.title-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

body[data-page="home"] .title-actions {
    opacity: 0;
    pointer-events: none;
}

body[data-page="home"] .title-row h1 {
    opacity: 0.7;
}

h1 {
    margin: 0;
    font-size: 26px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-family: "Bebas Neue", sans-serif;
}

.text-button {
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #f9f9f6;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.02em;
    max-width: 360px;
    text-align: right;
    font-family: "Archivo Black", sans-serif;
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    transition: border 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.text-button:active {
    transform: scale(0.98);
}

.text-button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.panel {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    padding: 14px 16px;
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.primary {
    display: grid;
    gap: 16px;
}

.content-grid {
    display: grid;
    gap: 16px;
}

.side-panels {
    display: grid;
    gap: 16px;
}

.home-panel {
    display: grid;
    gap: 12px;
}

.home-panel h2 {
    margin: 0;
    font-size: 20px;
    font-family: "Bebas Neue", sans-serif;
    letter-spacing: 0.05em;
}

.home-links {
    display: grid;
    gap: 8px;
}

.home-links input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #f5f5f2;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

button.primary {
    border: none;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.85);
    color: #151515;
}

button.secondary {
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.12);
    color: #f5f5f2;
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

button.secondary:active {
    transform: scale(0.98);
}

a.secondary {
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.12);
    color: #f5f5f2;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

a.secondary:active {
    transform: scale(0.98);
}

button.secondary[disabled],
button.primary[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.stage {
    position: relative;
    padding: 12px;
    height: min(70vh, 520px);
    display: flex;
    align-items: stretch;
}

.stage.theater {
    position: fixed;
    inset: 0;
    z-index: 20;
    margin: 0;
    border-radius: 0;
    height: 100vh;
    padding: 16px;
}

.stage.theater .stage-video {
    height: 100%;
    border-radius: 22px;
}

.stage.theater .control-bar {
    left: 20px;
    right: 20px;
    bottom: 24px;
}

.stage.theater .pip {
    bottom: 100px;
}

.stage-video {
    width: 100%;
    height: 100%;
    border-radius: 22px;
    background: rgba(10, 10, 10, 0.4);
    object-fit: cover;
}

.pip {
    position: absolute;
    right: 18px;
    bottom: 78px;
    width: clamp(120px, 28vw, 170px);
    aspect-ratio: 3 / 4;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.32);
    cursor: pointer;
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
}

.pip.top-left {
    left: 18px;
    right: auto;
    top: 18px;
    bottom: auto;
}

.pip.top-right {
    right: 18px;
    top: 18px;
    bottom: auto;
}

.pip.bottom-left {
    left: 18px;
    right: auto;
    bottom: 78px;
}

.pip.bottom-right {
    right: 18px;
    bottom: 78px;
}

.pip-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.control-bar {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
    display: flex;
    justify-content: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
}

.icon-button {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.14);
    color: #f9f9f6;
    display: grid;
    place-items: center;
    padding: 0;
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    transition: transform 0.2s ease, background 0.2s ease;
}

.icon-button:active {
    transform: scale(0.94);
}

.icon-button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.icon {
    width: 22px;
    height: 22px;
}

.icon-button .icon-off {
    display: none;
}

.icon-button.is-off .icon-on {
    display: none;
}

.icon-button.is-off .icon-off {
    display: block;
}

.icon-button.is-exit .icon-on {
    display: none;
}

.icon-button.is-exit .icon-off {
    display: block;
}

.icon-button.danger {
    background: rgba(255, 80, 80, 0.2);
    color: #ff5b5d;
    border-color: rgba(255, 91, 93, 0.5);
}

.status {
    font-size: 13px;
    letter-spacing: 0.03em;
}

.invite {
    display: grid;
    gap: 12px;
}

.audio-hint {
    display: grid;
    gap: 10px;
    font-size: 13px;
    border-color: rgba(255, 199, 120, 0.45);
}

.reconnect-panel {
    display: grid;
    gap: 10px;
    font-size: 13px;
    border-color: rgba(255, 196, 96, 0.45);
}

.reconnect-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    border-color: rgba(255, 196, 96, 0.45);
}

.reconnect-banner .reconnect-btn {
    white-space: nowrap;
}

.reconnect-title {
    font-weight: 600;
}

.invite input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 13px;
    background: rgba(255, 255, 255, 0.08);
    color: #f5f5f2;
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.ghost-button {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #f5f5f2;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.chat-panel,
.game-panel {
    display: grid;
    gap: 12px;
}

.chat-messages {
    max-height: 260px;
    overflow-y: auto;
    display: grid;
    gap: 8px;
    padding-right: 4px;
}

.chat-message {
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 13px;
    line-height: 1.3;
    display: grid;
    gap: 4px;
}

.chat-message.own {
    background: rgba(255, 255, 255, 0.2);
    align-self: end;
    text-align: right;
}

.chat-message.partner {
    align-self: start;
    text-align: left;
}

.chat-name {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.85;
}

.chat-meta {
    font-size: 11px;
    opacity: 0.6;
}

.chat-form {
    display: flex;
    gap: 8px;
}

.chat-form input {
    flex: 1;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #f5f5f2;
}

.games-panel {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.games-mount {
    display: grid;
    gap: 16px;
}

.games-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 12px;
}

.game-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.games-hint {
    font-size: 12px;
    opacity: 0.6;
    margin-bottom: 12px;
    text-align: center;
}

.game-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 12px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #f5f5f2;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s ease, transform 0.1s ease;
}

.game-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.game-btn:active {
    transform: scale(0.96);
    background: rgba(255, 255, 255, 0.25);
}

.game-icon {
    font-size: 32px;
    line-height: 1;
}

.game-label {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
}

.links-panel,
.mementos-panel,
.music-panel {
    display: grid;
    gap: 12px;
}

.empty-state {
    font-size: 13px;
    opacity: 0.7;
    text-align: center;
}

.link-form {
    display: grid;
    gap: 8px;
}

.link-form input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #f5f5f2;
}

.link-list {
    display: grid;
    gap: 10px;
}

.link-card {
    display: flex;
    gap: 10px;
    align-items: stretch;
    padding: 12px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.link-card a {
    color: inherit;
    text-decoration: none;
    display: flex;
    gap: 12px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.link-preview {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.link-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.link-preview-placeholder {
    font-size: 10px;
    text-align: center;
    padding: 6px;
    opacity: 0.6;
}

.link-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.link-title {
    font-size: 14px;
    font-weight: 600;
    color: #f5f5f2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-meta {
    font-size: 12px;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-description {
    font-size: 12px;
    opacity: 0.6;
    line-height: 1.4;
    max-height: 36px;
    overflow: hidden;
}

.link-delete {
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #f5f5f2;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    align-self: center;
}

.mementos-form {
    display: grid;
    gap: 8px;
}

.mementos-form input[type="file"] {
    color: #f5f5f2;
}

.mementos-form input[type="text"] {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #f5f5f2;
}

.mementos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.memento-card {
    display: grid;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
}

.memento-thumb {
    position: relative;
    width: 100%;
    padding-top: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

.memento-thumb img,
.memento-thumb video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.memento-type {
    position: absolute;
    right: 8px;
    bottom: 8px;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.6);
}

.memento-caption {
    font-size: 12px;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mementos-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.mementos-modal-content {
    background: rgba(15, 15, 15, 0.95);
    border-radius: 18px;
    padding: 18px;
    max-width: 520px;
    width: 100%;
    display: grid;
    gap: 12px;
    position: relative;
}

.mementos-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #f5f5f2;
    border-radius: 999px;
    width: 32px;
    height: 32px;
    cursor: pointer;
}

.mementos-viewer img,
.mementos-viewer video {
    width: 100%;
    border-radius: 12px;
    background: #000;
}

.mementos-viewer-caption {
    font-size: 14px;
    font-weight: 600;
}

.mementos-viewer-meta {
    font-size: 12px;
    opacity: 0.7;
}

.mementos-delete {
    margin-top: 16px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #f5f5f2;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
}

.music-player {
    display: grid;
    gap: 12px;
}

.music-player iframe {
    width: 100%;
    height: 360px;
    border: none;
    border-radius: 14px;
    background: #000;
}

.music-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.music-open-link {
    text-decoration: none;
}

#switchCamera.rear-active {
    background: rgba(255, 255, 255, 0.3);
}

.game-panel.is-collapsed .game-picker,
.game-panel.is-collapsed .games-hint,
.chat-panel.is-collapsed .chat-messages,
.chat-panel.is-collapsed .chat-form {
    display: none;
}

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.8);
    color: #f5f5f2;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.mood-splash {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.mood-splash.is-hiding {
    opacity: 0;
}

.mood-content {
    text-align: center;
    padding: 40px 20px;
    max-width: 500px;
}

.mood-greeting {
    font-size: 32px;
    font-weight: 300;
    color: #f5f5f2;
    margin-bottom: 8px;
}

.mood-question {
    font-size: 18px;
    color: rgba(245, 245, 242, 0.7);
    margin-bottom: 40px;
}

.mood-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.mood-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    width: 90px;
    border: none;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    color: #f5f5f2;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.mood-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.mood-btn:active {
    transform: scale(0.95);
}

.mood-face {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: border-color 0.2s ease;
}

.mood-btn:hover .mood-face {
    border-color: rgba(255, 255, 255, 0.5);
}

.mood-label {
    font-size: 12px;
    opacity: 0.8;
}

.poem-display {
    text-align: center;
    padding: 40px 20px;
    animation: fadeIn 0.5s ease;
    max-width: 400px;
}

.poem-text {
    font-size: 18px;
    font-style: italic;
    color: #f5f5f2;
    line-height: 1.7;
    margin-bottom: 40px;
    white-space: pre-line;
}

.join-call-btn {
    padding: 16px 48px;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, #e91e63, #9c27b0);
    color: #f5f5f2;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 20px rgba(233, 30, 99, 0.4);
}

.join-call-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(233, 30, 99, 0.5);
}

.join-call-btn:active {
    transform: scale(0.98);
}

.partner-mood-notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    border-radius: 16px;
    padding: 20px;
    max-width: 350px;
    z-index: 1500;
    animation: slideDown 0.5s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mood-notif-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #f5f5f2;
}

.mood-notif-emoji {
    font-size: 28px;
}

.mood-notif-poem {
    font-style: italic;
    color: rgba(245, 245, 242, 0.8);
    line-height: 1.5;
    white-space: pre-line;
    font-size: 14px;
}

.mood-notif-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: rgba(245, 245, 242, 0.5);
    font-size: 18px;
    cursor: pointer;
}

.mood-notif-close:hover {
    color: #f5f5f2;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
textarea,
select {
    font-size: 16px !important;
}

.error-panel {
    display: grid;
    gap: 12px;
    border-color: rgba(255, 120, 120, 0.45);
}

.error-title {
    font-weight: 600;
}

.debug-panel {
    display: grid;
    gap: 10px;
    font-size: 12px;
}

.debug-panel pre {
    margin: 0;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 10px;
}

.hidden {
    display: none;
}

body.theater-mode {
    overflow: hidden;
}


body.theater-mode .title-row,
body.theater-mode .invite,
body.theater-mode .status,
body.theater-mode .audio-hint,
body.theater-mode .reconnect-panel,
body.theater-mode .reconnect-banner,
body.theater-mode .error-panel,
body.theater-mode #wheel-backdrop,
body.theater-mode #radial-wheel,
body.theater-mode .home-button,
body.theater-mode .wheel-call-indicator,
body.theater-mode .page:not([data-page="call"]),
body.theater-mode .home-panel {
    display: none;
}

@media (min-width: 980px) {
    .link-form {
        grid-template-columns: 2fr 1.2fr auto;
        align-items: center;
    }

    .mementos-form {
        grid-template-columns: auto 1fr auto;
        align-items: center;
    }
}

@media (max-width: 720px) {
    body {
        padding: 16px 14px 92px;
    }

    h1 {
        font-size: 22px;
    }

    .text-button {
        max-width: 100%;
        text-align: left;
    }

    .stage {
        height: min(62vh, 420px);
    }

    .pip {
        bottom: 72px;
    }

    .page-container {
        min-height: min(72vh, 760px);
    }
    
    #radial-wheel {
        width: 95vw;
        height: 95vw;
    }

    .wheel-segment-icon {
        width: 40px;
        height: 40px;
    }

    .wheel-segment-label {
        font-size: 0.6rem;
    }
}

@media (max-width: 500px) {
    .home-button {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
        padding: 10px;
    }

    .home-button.raised {
        bottom: 90px;
    }
}
