/**
 * flawed.center - Game Surface Styles
 * 16:10 aspect ratio, framed border, stroke icons
 */

:root {
    --dream-primary-color: #8b4789;
    --dream-secondary-color: #c97fc9;
    --dream-accent-color: #ff6b9d;
    --dream-background-dark: #1a0a1a;
    --dream-text-light: #f0e6f0;
    --frame-color: rgba(180, 200, 240, 0.15);
    --frame-glow: rgba(140, 180, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a12;
}

/* UI Overlay - for login screen */
.dream-ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: auto;
}

/* Animated background */
.dream-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.backdrop-outer-world {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 40%, rgba(255, 100, 200, 0.4), transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(100, 200, 255, 0.4), transparent 50%),
                radial-gradient(circle at 50% 50%, rgba(200, 100, 255, 0.3), transparent 70%);
    background-color: #1a0a2e;
    animation: bubbleShift 15s infinite ease-in-out, hueRotate 20s infinite linear;
}

@keyframes bubbleShift {
    0% { background-position: 0% 0%, 100% 100%, 50% 50%; }
    25% { background-position: 30% 20%, 70% 80%, 40% 60%; }
    50% { background-position: 60% 40%, 40% 60%, 50% 50%; }
    75% { background-position: 20% 70%, 80% 30%, 60% 40%; }
    100% { background-position: 0% 0%, 100% 100%, 50% 50%; }
}

@keyframes hueRotate {
    0% { filter: hue-rotate(0deg) saturate(1.5) brightness(0.8); }
    50% { filter: hue-rotate(180deg) saturate(1.6) brightness(0.7); }
    100% { filter: hue-rotate(360deg) saturate(1.5) brightness(0.8); }
}

/* Game container */
#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Game surface wrapper - 16:10 with frame */
.game-surface-wrapper {
    position: relative;
    width: min(88vw, 150vh);
    aspect-ratio: 16 / 10;
    max-width: 1280px;
    max-height: 800px;
    /* Framing border */
    border: 2px solid var(--frame-color);
    border-radius: 4px;
    box-shadow: 
        0 0 40px var(--frame-glow),
        inset 0 0 80px rgba(10, 10, 30, 0.6);
    background: linear-gradient(135deg, rgba(20, 15, 40, 0.4), rgba(10, 10, 25, 0.6));
}

/* Inner glow frame effect */
.game-surface-wrapper::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: 5px;
    border: 1px solid rgba(200, 220, 255, 0.08);
    pointer-events: none;
    z-index: -1;
}

/* Soft fadeout border effect */
.game-surface-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 20;
    border-radius: 2px;
    box-shadow: 
        inset 0 0 50px 20px rgba(10, 10, 20, 0.7),
        inset 0 0 100px 40px rgba(10, 10, 20, 0.4);
}

/* The main game surface */
.game-surface {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: default; /* Show cursor for now */
    background: rgba(26, 10, 42, 0.3);
    border-radius: 2px;
}

/* Game image */
.game-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
    user-select: none;
}

/* Avatar bubble - follows cursor with offset */
.avatar-bubble {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1000; /* Always on top of everything */
    opacity: 0;
    transition: opacity 0.4s ease;
    background: radial-gradient(circle at 35% 35%, 
        rgba(255, 255, 255, 0.15), 
        rgba(200, 220, 255, 0.1) 40%, 
        rgba(180, 200, 240, 0.05) 70%,
        transparent 90%);
    backdrop-filter: blur(4px);
    border: 1.5px solid rgba(200, 220, 255, 0.3);
    box-shadow: 0 0 25px rgba(180, 200, 240, 0.25),
                inset 0 0 15px rgba(255, 255, 255, 0.1);
}

.avatar-bubble.visible {
    opacity: 1;
    animation: bubbleIdle 4s ease-in-out infinite;
}

/* Glow state when hovering over clickable elements - uses user color if set */
.avatar-bubble.active {
    --glow-color: var(--user-color, rgba(255, 220, 150, 1));
    border-color: var(--glow-color);
    box-shadow: 0 0 35px color-mix(in srgb, var(--glow-color) 60%, transparent),
                0 0 60px color-mix(in srgb, var(--glow-color) 35%, transparent),
                inset 0 0 20px color-mix(in srgb, var(--glow-color) 25%, transparent);
    filter: brightness(1.2);
}

.avatar-bubble.active .bubble-chevron {
    border-bottom-color: var(--glow-color);
    filter: drop-shadow(0 0 6px var(--glow-color));
}

@keyframes bubbleIdle {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        filter: drop-shadow(0 0 15px rgba(180, 200, 240, 0.2));
    }
    25% {
        transform: translate(2px, -4px) scale(1.02);
        filter: drop-shadow(0 0 20px rgba(180, 200, 240, 0.3));
    }
    50% {
        transform: translate(-1px, -6px) scale(1.01);
        filter: drop-shadow(0 0 18px rgba(180, 200, 240, 0.25));
    }
    75% {
        transform: translate(-3px, -3px) scale(1.03);
        filter: drop-shadow(0 0 22px rgba(180, 200, 240, 0.35));
    }
}

.avatar-bubble img {
    width: 85%;
    height: 85%;
    object-fit: cover;
    border-radius: 50%;
    position: absolute;
    top: 7.5%;
    left: 7.5%;
    opacity: 0.9;
}

.bubble-shine {
    position: absolute;
    top: 12%;
    left: 18%;
    width: 30%;
    height: 20%;
    background: radial-gradient(ellipse at center, 
        rgba(255, 255, 255, 0.6) 0%, 
        transparent 70%);
    border-radius: 50%;
    transform: rotate(-25deg);
}

/* Cursor chevron - triangle at top-left corner pointing to cursor position */
.bubble-chevron {
    position: absolute;
    top: -2px;
    left: -2px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 10px solid rgba(220, 235, 255, 0.9);
    transform: rotate(-45deg);
    filter: drop-shadow(0 0 4px rgba(180, 200, 240, 0.6));
    z-index: 5;
}

.control-btn.highlight {
    transform: scale(1.15);
    border-color: rgba(255, 240, 200, 0.6);
    box-shadow: 0 0 25px rgba(255, 220, 150, 0.5),
                0 0 40px rgba(255, 200, 100, 0.25);
    background: radial-gradient(circle at 35% 35%, 
        rgba(255, 255, 200, 0.2), 
        rgba(150, 140, 100, 0.25) 50%, 
        rgba(100, 90, 70, 0.3) 100%);
}

.control-btn.highlight svg {
    stroke: rgba(255, 250, 230, 1);
}

/* Logout button highlight */
.logout-btn.highlight {
    transform: scale(1.15);
    border-color: rgba(255, 180, 150, 0.6);
    box-shadow: 0 0 25px rgba(255, 150, 120, 0.5);
}

.logout-btn.highlight svg {
    stroke: rgba(255, 230, 220, 1);
}

/* Control buttons container */
.game-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 30;
    pointer-events: auto;
}

.control-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(200, 220, 255, 0.25);
    background: radial-gradient(circle at 35% 35%, 
        rgba(255, 255, 255, 0.1), 
        rgba(80, 100, 160, 0.15) 50%, 
        rgba(50, 70, 130, 0.2) 100%);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 0 12px rgba(100, 150, 200, 0.15);
    padding: 0;
    pointer-events: auto !important;
}

.control-btn:hover {
    transform: scale(1.1);
    border-color: rgba(200, 220, 255, 0.45);
    box-shadow: 0 0 20px rgba(100, 150, 200, 0.35);
    background: radial-gradient(circle at 35% 35%, 
        rgba(255, 255, 255, 0.15), 
        rgba(100, 120, 180, 0.2) 50%, 
        rgba(70, 90, 150, 0.25) 100%);
}

.control-btn svg {
    width: 18px;
    height: 18px;
    stroke: rgba(210, 225, 255, 0.85);
    stroke-width: 1.8;
    fill: none;
    pointer-events: none;
}

.control-btn:hover svg {
    stroke: rgba(230, 240, 255, 1);
}

/* Logout button */
.logout-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 30;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 120, 120, 0.25);
    background: radial-gradient(circle at 35% 35%, 
        rgba(255, 200, 200, 0.08), 
        rgba(120, 60, 60, 0.15) 50%, 
        rgba(80, 40, 40, 0.2) 100%);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    pointer-events: auto !important;
}

.logout-btn:hover {
    transform: scale(1.1);
    border-color: rgba(255, 120, 120, 0.45);
    box-shadow: 0 0 15px rgba(255, 100, 100, 0.25);
}

.logout-btn svg {
    width: 18px;
    height: 18px;
    stroke: rgba(255, 180, 180, 0.85);
    stroke-width: 1.8;
    fill: none;
    pointer-events: none;
}

.logout-btn:hover svg {
    stroke: rgba(255, 210, 210, 1);
}

/* Character panel */
.character-panel {
    --user-color: rgba(100, 140, 200, 1);
    position: absolute;
    top: 52px;
    right: 10px;
    width: 220px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(200, 220, 255, 0.2);
    background: radial-gradient(circle at 30% 20%, 
        rgba(60, 80, 140, 0.5), 
        rgba(30, 40, 80, 0.7) 100%);
    backdrop-filter: blur(12px);
    z-index: 40;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.2s ease;
    pointer-events: none;
}

/* Character panel with user color applied */
.character-panel.has-user-color {
    background: radial-gradient(circle at 30% 20%, 
        color-mix(in srgb, var(--user-color) 25%, rgba(40, 50, 80, 0.6)),
        color-mix(in srgb, var(--user-color) 10%, rgba(20, 30, 60, 0.8)) 100%);
    border-color: color-mix(in srgb, var(--user-color) 40%, rgba(200, 220, 255, 0.2));
}
}

.character-panel.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.character-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.character-panel-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(200, 220, 255, 0.3);
    object-fit: cover;
}

.character-panel-info {
    flex: 1;
    overflow: hidden;
}

.character-panel-name {
    font-size: 14px;
    font-weight: 600;
    color: rgba(240, 245, 255, 0.95);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.character-panel-handle {
    font-size: 12px;
    color: rgba(180, 200, 240, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.character-panel-did {
    font-size: 10px;
    color: rgba(150, 170, 210, 0.5);
    font-family: monospace;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(200, 220, 255, 0.12);
    word-break: break-all;
    line-height: 1.4;
}

/* Character panel status badge */
.character-panel-status {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 500;
    color: rgba(220, 235, 255, 0.9);
    background: rgba(100, 140, 200, 0.25);
    border: 1px solid rgba(150, 180, 230, 0.3);
    border-radius: 12px;
    margin-bottom: 12px;
    text-transform: capitalize;
}

/* Character panel spectrum section */
.character-panel-spectrum {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(200, 220, 255, 0.12);
}

.character-panel-section-title {
    font-size: 10px;
    font-weight: 600;
    color: rgba(180, 200, 240, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

/* Spectrum box - octant container with user color */
.character-panel-spectrum-box {
    --octant-color: rgba(180, 200, 240, 0.8);
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--octant-color) 35%, transparent);
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--octant-color) 12%, rgba(20, 25, 45, 0.6)),
        color-mix(in srgb, var(--octant-color) 6%, rgba(15, 20, 40, 0.7)) 100%);
}

.character-panel-octant {
    font-size: 15px;
    font-weight: 700;
    color: var(--octant-color);
    margin-bottom: 10px;
    text-transform: capitalize;
    text-shadow: 0 0 12px color-mix(in srgb, var(--octant-color) 50%, transparent);
    letter-spacing: 0.5px;
}

.character-panel-coords {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
}

.spectrum-coord {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
}

.spectrum-label {
    color: rgba(180, 200, 240, 0.6);
}

.spectrum-value {
    color: rgba(220, 235, 255, 0.85);
    font-family: monospace;
    font-weight: 500;
}

/* Volume button svg styling */
.volume-btn svg polygon {
    fill: rgba(210, 225, 255, 0.3);
    stroke: rgba(210, 225, 255, 0.85);
    stroke-width: 1.5;
}

.volume-btn:hover svg polygon {
    fill: rgba(230, 240, 255, 0.4);
}
