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

html {
    height: 100%;
    overscroll-behavior: none;
}

body {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(180deg, #0a0a2e 0%, #16213e 50%, #0f3460 100%);
    background-attachment: fixed;
    font-family: Arial, Helvetica, sans-serif;
    color: #fff;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    touch-action: none;
}

#canvas {
    position: fixed;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

#ui {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    display: flex;
    gap: clamp(16px, 4vw, 40px);
    z-index: 10;
    font-size: clamp(14px, 2.4vmin, 24px);
    font-weight: bold;
    line-height: 1.2;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.3);
    padding: clamp(6px, 1.4vmin, 10px) clamp(14px, 3vw, 30px);
    border-radius: 10px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: none;
    white-space: nowrap;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
    z-index: 20;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    overflow-y: auto;
    touch-action: none;
}

.overlay.hidden {
    display: none;
}

.panel {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    color: #fff;
    padding: clamp(22px, 6vmin, 50px) clamp(22px, 10vmin, 80px);
    border-radius: 15px;
    text-align: center;
    border: 2px solid #0f3460;
    box-shadow: 0 0 30px rgba(15, 52, 96, 0.5);
    width: min(100%, 520px);
    max-height: 100%;
    overflow-y: auto;
}

.panel h1 {
    font-size: clamp(28px, 8vmin, 48px);
    margin-bottom: clamp(10px, 3vmin, 20px);
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.panel p {
    font-size: clamp(13px, 3vmin, 18px);
    margin-bottom: clamp(4px, 1vmin, 10px);
    color: #ccc;
}

.panel button {
    margin-top: clamp(16px, 4vmin, 30px);
    padding: clamp(10px, 2vmin, 12px) clamp(28px, 8vmin, 40px);
    min-height: 44px;
    font-size: clamp(15px, 3.2vmin, 18px);
    cursor: pointer;
    background: linear-gradient(45deg, #e94560, #0f3460);
    color: white;
    border: none;
    border-radius: 25px;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: bold;
    touch-action: manipulation;
}

.panel button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.6);
}

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

#rotateHint {
    display: none;
}

@media (orientation: portrait) and (pointer: coarse) {
    #rotateHint {
        display: block;
        position: fixed;
        left: 50%;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        transform: translateX(-50%);
        width: max-content;
        max-width: 90vw;
        font-size: 12px;
        color: rgba(255, 255, 255, 0.55);
        text-align: center;
        z-index: 15;
        pointer-events: none;
    }
}
