:root {
    color-scheme: dark;
    background: #100906;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    touch-action: none;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body,
#game-shell {
    width: 100%;
    height: 100%;
    height: 100dvh;
    margin: 0;
    overflow: hidden;
    overscroll-behavior: none;
}

html,
body {
    position: fixed;
    inset: 0;
}

body {
    background:
        radial-gradient(circle at 50% 42%, rgba(111, 36, 20, 0.22), transparent 52%),
        #100906;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#game-shell {
    position: fixed;
    inset: 0;
    isolation: isolate;
}

#canvas {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    outline: 0;
    background: #281409;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.overlay {
    position: absolute;
    z-index: 4;
    inset: 0;
    display: grid;
    place-items: center;
    padding:
        max(24px, env(safe-area-inset-top))
        max(24px, env(safe-area-inset-right))
        max(24px, env(safe-area-inset-bottom))
        max(24px, env(safe-area-inset-left));
    background: rgba(13, 7, 5, 0.88);
    backdrop-filter: blur(8px);
}

.overlay[hidden] {
    display: none;
}

.loader-card {
    width: min(460px, 88vw);
    padding: 30px 28px;
    text-align: center;
    border: 1px solid rgba(236, 183, 113, 0.34);
    border-radius: 6px;
    background: linear-gradient(145deg, rgba(52, 26, 17, 0.96), rgba(20, 11, 8, 0.98));
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.loader-card h1,
.loader-card h2 {
    margin: 10px 0 8px;
    color: #f2c083;
    font-size: clamp(22px, 5vw, 38px);
    letter-spacing: 0.14em;
}

.loader-card h2 {
    font-size: clamp(20px, 4vw, 30px);
}

.loader-card p {
    margin: 0;
    color: #d4b79a;
    font-size: 14px;
}

.sigil {
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    border: 2px solid #e7a35d;
    transform: rotate(45deg);
    box-shadow: inset 0 0 18px rgba(218, 86, 42, 0.45), 0 0 28px rgba(218, 86, 42, 0.28);
}

.loading-line {
    width: 100%;
    height: 3px;
    margin-top: 24px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.09);
}

.loading-line::after {
    display: block;
    width: 42%;
    height: 100%;
    content: "";
    background: #d06a3c;
    animation: loading 1.25s ease-in-out infinite alternate;
}

@keyframes loading {
    from { transform: translateX(-100%); }
    to { transform: translateX(238%); }
}

.fight-card progress {
    width: 100%;
    height: 10px;
    margin-top: 24px;
    accent-color: #cc5d35;
}

.fullscreen {
    position: absolute;
    z-index: 3;
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    display: grid;
    width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    color: #f2c083;
    font-size: 26px;
    line-height: 1;
    border: 1px solid rgba(242, 192, 131, 0.42);
    border-radius: 5px;
    background: rgba(20, 11, 8, 0.72);
}

.status {
    position: absolute;
    z-index: 5;
    left: 50%;
    bottom: max(14px, env(safe-area-inset-bottom));
    max-width: min(720px, 90vw);
    margin: 0;
    padding: 10px 14px;
    color: #f1d1ab;
    text-align: center;
    transform: translateX(-50%);
    border: 1px solid rgba(242, 192, 131, 0.3);
    border-radius: 4px;
    background: rgba(20, 11, 8, 0.84);
}

.status.error {
    color: #ffd4cf;
    border-color: rgba(255, 93, 78, 0.58);
    background: rgba(66, 14, 11, 0.9);
}

.runtime-ready #boot-overlay {
    display: none;
}

@media (orientation: portrait) {
    .loader-card {
        width: min(420px, 92vw);
    }
}

@media (prefers-reduced-motion: reduce) {
    .loading-line::after {
        animation-duration: 2.5s;
    }
}
