html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: linear-gradient(160deg, #0f2a24 0%, #1a4a3c 42%, #0d1f2d 100%);
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    color: #f4f7f5;
}

body {
    position: fixed;
    inset: 0;
    padding:
        var(--safe-top, 0px)
        var(--safe-right, 0px)
        var(--safe-bottom, 0px)
        var(--safe-left, 0px);
    box-sizing: border-box;
}

#game-wrapper {
    width: 100%;
    height: 100%;
    height: var(--app-height, 100dvh);
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: radial-gradient(circle at 20% 18%, rgba(72, 187, 120, 0.18), transparent 34%),
        radial-gradient(circle at 82% 78%, rgba(56, 178, 172, 0.14), transparent 32%),
        linear-gradient(160deg, #0f2a24 0%, #1a4a3c 42%, #0d1f2d 100%);
}

#unity-container,
#unity-container.unity-desktop,
#unity-container.unity-mobile {
    position: relative;
    background: #102820;
    border-radius: clamp(8px, 1.2vw, 18px);
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
    left: auto;
    top: auto;
    transform: none;
}

#unity-canvas,
.unity-mobile #unity-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    background: #102820;
}

#unity-warning {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 20;
    display: none;
}

#unity-loading-bar {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: clamp(10px, 3vw, 24px) !important;
    box-sizing: border-box !important;
    z-index: 10 !important;
    background: rgba(8, 24, 20, 0.92);
}

#unity-loading-bar.unity-loading-visible {
    display: flex !important;
}

#unity-loading-bar.unity-loading-hidden {
    display: none !important;
}

#wi-loading-card {
    width: min(86%, 420px);
    text-align: center;
    padding: 22px 20px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

#wi-loading-title {
    font-size: clamp(22px, 3.2vw, 30px);
    font-weight: 800;
    letter-spacing: 0.02em;
    margin-bottom: 8px;
    color: #f7faf8;
}

#wi-loading-text {
    font-size: clamp(14px, 2vw, 17px);
    font-weight: 600;
    color: #d7ebe2;
    margin-bottom: 18px;
}

#unity-progress-bar-empty {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    overflow: hidden;
}

#unity-progress-bar-full {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #38b2ac, #68d391);
}

#wi-prestart-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
        calc(16px + var(--safe-top, 0px))
        calc(16px + var(--safe-right, 0px))
        calc(16px + var(--safe-bottom, 0px))
        calc(16px + var(--safe-left, 0px));
    box-sizing: border-box;
    background: rgba(6, 18, 16, 0.78);
}

#wi-prestart-overlay.wi-prestart-hidden {
    display: none;
}

#wi-prestart-card {
    width: min(90%, 440px);
    text-align: center;
    padding: 28px 24px;
    border-radius: 18px;
    background: #12352c;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

#wi-prestart-title {
    font-size: clamp(24px, 4vw, 34px);
    font-weight: 800;
    color: #f7faf8;
    margin-bottom: 10px;
}

#wi-prestart-text {
    font-size: clamp(15px, 2.2vw, 18px);
    font-weight: 600;
    color: #d7ebe2;
    margin-bottom: 22px;
    line-height: 1.4;
}

#wi-prestart-button {
    min-height: 52px;
    min-width: 160px;
    padding: 12px 28px;
    border: 0;
    border-radius: 12px;
    background: #38b2ac;
    color: #06201c;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
}

#wi-prestart-button:focus-visible {
    outline: 3px solid #f6e05e;
    outline-offset: 3px;
}

#wi-prestart-button:hover {
    background: #4fd1c5;
}

#wi-startup-error {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 3vw, 28px);
    box-sizing: border-box;
    background: rgba(6, 18, 16, 0.9);
}

#wi-startup-error.wi-startup-error-hidden {
    display: none;
}

#wi-startup-error-card {
    width: min(90%, 440px);
    text-align: center;
    padding: 28px 24px;
    border-radius: 18px;
    background: #12352c;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

#wi-startup-error-title {
    font-size: clamp(20px, 3.2vw, 28px);
    font-weight: 800;
    color: #f7faf8;
    margin-bottom: 10px;
}

#wi-startup-error-text {
    font-size: clamp(14px, 2vw, 17px);
    font-weight: 600;
    color: #d7ebe2;
    margin-bottom: 22px;
    line-height: 1.4;
}

#wi-startup-error-reload {
    min-height: 52px;
    min-width: 160px;
    padding: 12px 28px;
    border: 0;
    border-radius: 12px;
    background: #38b2ac;
    color: #06201c;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
}

#wi-startup-error-reload:focus-visible {
    outline: 3px solid #f6e05e;
    outline-offset: 3px;
}

#wi-startup-error-reload:hover {
    background: #4fd1c5;
}

#wi-orientation-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
    pointer-events: auto;
}

#wi-orientation-overlay.wi-orientation-hidden {
    display: none;
}

body.wi-orientation-blocked #unity-canvas {
    pointer-events: none;
}

.wi-orientation-card {
    width: min(86%, 420px);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    padding: 18px 20px;
    text-align: center;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}

.wi-orientation-title {
    color: #12352c;
    font-weight: 800;
    font-size: clamp(18px, 2.5vw, 24px);
    margin-bottom: 8px;
}

.wi-orientation-body {
    color: #2f4f46;
    font-weight: 700;
    font-size: clamp(13px, 1.9vw, 16px);
    line-height: 1.35;
}
