/* Stile per "Il Mister contro tutti" */

html {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: var(--goregrid-vvh, 100dvh);
    background:
        radial-gradient(circle at 18% 12%, rgba(36, 52, 72, 0.45) 0%, transparent 36%),
        radial-gradient(circle at 82% 84%, rgba(58, 43, 53, 0.35) 0%, transparent 40%),
        linear-gradient(180deg, #080d15 0%, #05070c 100%);
    color: #e8eef6;
    font-family: 'Rajdhani', sans-serif;
    overflow: hidden;
    overscroll-behavior: none;
    user-select: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid rgba(231, 244, 255, 0.96);
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(54, 178, 255, 0.22);
}

button,
input,
textarea {
    touch-action: manipulation;
}

body {
    --ui-gap: 12px;
    --ui-shell-bg: rgba(8, 12, 18, 0.84);
    --ui-shell-border: rgba(157, 176, 196, 0.34);
    --ui-shell-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
    --ui-top-pad: calc(12px + env(safe-area-inset-top, 0px));
    --ui-right-pad: calc(14px + env(safe-area-inset-right, 0px));
    --ui-bottom-pad: calc(14px + env(safe-area-inset-bottom, 0px));
    --ui-left-pad: calc(14px + env(safe-area-inset-left, 0px));
    --goregrid-hud-user-scale: 1;
    --goregrid-text-user-scale: 1;
    --hud-font-scale: var(--goregrid-hud-user-scale);
}

#game-container {
    width: 100vw;
    width: var(--goregrid-vvw, 100vw);
    height: 100vh;
    height: 100dvh;
    height: var(--goregrid-vvh, 100dvh);
    min-height: 100vh;
    min-height: 100dvh;
    min-height: var(--goregrid-vvh, 100dvh);
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #0a1018 0%, #05080d 100%);
}

/* Schermata di caricamento */
#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at center, rgba(26, 38, 52, 0.95) 0%, rgba(8, 11, 16, 0.98) 72%),
        #070b11;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    text-align: center;
}

#loading-screen h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 4rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #d8e4f2, #8fa7be);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 12px rgba(151, 175, 198, 0.45));
    letter-spacing: 5px;
}

.loading-bar {
    width: 400px;
    height: 6px;
    background: rgba(8, 12, 18, 0.75);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 30px;
    border: 1px solid rgba(162, 184, 206, 0.2);
}

.loading-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #9db5cc, #5d768f);
    box-shadow: 0 0 15px rgba(120, 145, 170, 0.55);
    animation: loadingAnim 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes loadingAnim {
    0% { width: 0%; transform: translateX(-100%); }
    50% { width: 100%; transform: translateX(0); }
    100% { width: 100%; transform: translateX(100%); }
}

/* Menu principale */
#menu-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(6, 10, 15, 0.84), rgba(5, 8, 12, 0.92));
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 90;
    text-align: center;
}

#menu-screen h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #e7f0fa, #8ea5bc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 16px rgba(140, 163, 186, 0.45));
    text-transform: uppercase;
}

#menu-screen p {
    font-size: 1.8rem;
    margin-bottom: 3rem;
    color: rgba(224, 233, 243, 0.72);
    font-weight: 300;
}

#mode-select {
    width: min(940px, calc(100vw - 40px));
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin: 0 0 1.75rem;
}

.mode-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 180px;
    padding: 22px;
    text-align: left;
    background:
        radial-gradient(circle at top right, rgba(151, 178, 207, 0.16), transparent 42%),
        linear-gradient(180deg, rgba(17, 24, 34, 0.96), rgba(8, 12, 18, 0.96));
    color: #e9f2fb;
    border: 1px solid rgba(141, 166, 190, 0.28);
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.mode-card:hover {
    transform: translateY(-4px);
    border-color: rgba(171, 197, 221, 0.55);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.28);
}

.mode-card--launch {
    box-shadow: 0 0 0 1px rgba(220, 235, 248, 0.16), 0 18px 34px rgba(0, 0, 0, 0.36);
}

.mode-card--launch:focus-visible {
    outline: 2px solid rgba(214, 231, 248, 0.92);
    outline-offset: 3px;
}

.mode-card--accent {
    background:
        radial-gradient(circle at top right, rgba(255, 120, 150, 0.18), transparent 42%),
        linear-gradient(180deg, rgba(36, 16, 24, 0.98), rgba(15, 9, 15, 0.98));
    border-color: rgba(255, 140, 162, 0.34);
}

.mode-card__eyebrow {
    font-size: 0.8rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(187, 208, 228, 0.72);
}

.mode-card__title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #f3f8ff;
}

.mode-card__desc {
    font-size: 1rem;
    line-height: 1.45;
    color: rgba(214, 226, 238, 0.8);
}

.mode-card__meta {
    margin-top: auto;
    padding-top: 12px;
    font-size: 0.88rem;
    color: rgba(208, 220, 233, 0.68);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.menu-action-row {
    display: flex;
    gap: 20px;
    margin: 1.2rem 0 0;
    justify-content: center;
    flex-wrap: wrap;
}

#game-info {
    margin-top: 4rem;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(8, 13, 20, 0.72);
    border-radius: 15px;
    border: 1px solid rgba(149, 170, 190, 0.24);
    text-align: left;
    max-width: 600px;
    max-height: 500px;
    overflow-y: auto;
}

#game-info .control-guide-section {
    margin: 0;
    padding: 10px 0 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

#game-info .control-guide-section:first-of-type {
    border-top: 0;
}

.first-run-brief {
    position: relative;
    z-index: 1;
    width: min(720px, calc(100vw - 36px));
    margin: 0 auto 16px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 77, 96, 0.32);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(255, 77, 96, 0.16), rgba(10, 14, 20, 0.74)),
        rgba(7, 10, 14, 0.84);
    color: rgba(240, 246, 252, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: clamp(0.86rem, 1.5vw, 1rem);
    line-height: 1.28;
}

.first-run-brief span {
    flex: 0 0 auto;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #ff8f9f;
}

.first-run-brief strong {
    font-weight: 700;
    color: #f4f8fc;
}

.founding-event-card {
    position: relative;
    z-index: 1;
    width: min(860px, calc(100vw - 36px));
    margin: 0 auto 18px;
    padding: 14px 16px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    text-align: left;
    border: 1px solid rgba(255, 77, 96, 0.42);
    border-radius: 8px;
    background:
        radial-gradient(circle at top right, rgba(255, 77, 96, 0.2), transparent 44%),
        linear-gradient(135deg, rgba(255, 77, 96, 0.14), rgba(127, 247, 255, 0.08)),
        rgba(7, 10, 16, 0.88);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
}

.founding-event-card__body {
    min-width: 0;
}

.founding-event-card__eyebrow {
    display: block;
    margin-bottom: 5px;
    color: #ff99a6;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.founding-event-card strong {
    display: block;
    color: #fff6f7;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.98rem, 1.8vw, 1.18rem);
    line-height: 1.28;
    letter-spacing: 0;
}

#menu-screen .founding-event-card p {
    max-width: 620px;
    margin: 6px 0 0;
    color: rgba(229, 238, 247, 0.8);
    font-size: 0.94rem;
    line-height: 1.35;
}

.founding-event-card__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.founding-event-card__btn,
.founding-event-card__share,
.founding-event-card__link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.founding-event-card__btn {
    color: #120306;
    border: 1px solid rgba(255, 210, 216, 0.64);
    background: linear-gradient(135deg, #ffeff1, #ff5b70 55%, #d51f36);
    box-shadow: 0 10px 24px rgba(255, 77, 96, 0.26);
    cursor: pointer;
}

.founding-event-card__link {
    color: #e8fbff;
    border: 1px solid rgba(127, 247, 255, 0.38);
    background: rgba(14, 30, 38, 0.76);
}

.founding-event-card__share {
    color: #fff7d2;
    border: 1px solid rgba(255, 214, 104, 0.42);
    background: rgba(255, 214, 104, 0.12);
    cursor: pointer;
}

.founding-event-card__btn:hover,
.founding-event-card__btn:focus-visible,
.founding-event-card__share:hover,
.founding-event-card__share:focus-visible,
.founding-event-card__link:hover,
.founding-event-card__link:focus-visible {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 14px 30px rgba(255, 77, 96, 0.3);
}

#settings-panel {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 126;
    width: min(520px, calc(100vw - 28px));
    max-height: min(64vh, 520px);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 18px;
    border-radius: 10px;
    border: 1px solid rgba(255, 77, 96, 0.3);
    background: linear-gradient(180deg, rgba(13, 16, 22, 0.94), rgba(5, 7, 11, 0.94));
    box-shadow: 0 22px 52px rgba(0, 0, 0, 0.42);
    color: #edf4fb;
    text-align: left;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

#settings-panel[hidden] {
    display: none !important;
}

.settings-control {
    display: grid;
    grid-template-columns: 1fr minmax(150px, 190px);
    align-items: center;
    gap: 12px;
    margin: 10px 0;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.settings-control span {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.settings-control select {
    min-height: 44px;
    color: #edf7ff;
    background: rgba(8, 12, 18, 0.92);
    border: 1px solid rgba(255, 77, 96, 0.32);
    border-radius: 6px;
    padding: 0 10px;
}

.settings-panel__note {
    margin: 12px 0 0 !important;
    color: rgba(232, 239, 248, 0.76) !important;
    font-size: 0.96rem !important;
    line-height: 1.35;
}

#game-info[hidden] {
    display: none !important;
}

.menu-info-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.menu-info-head h2 {
    margin: 0;
    color: #e8f2fb;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.menu-info-close {
    flex: 0 0 38px;
    border: 1px solid rgba(184, 205, 224, 0.28);
    background: rgba(255, 255, 255, 0.06);
    color: #e8f2fb;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    box-sizing: border-box;
    border-radius: 999px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.menu-info-close:hover {
    transform: translateY(-1px);
    border-color: rgba(220, 236, 249, 0.48);
    background: rgba(255, 255, 255, 0.1);
}

#game-info h3 {
    font-family: 'Orbitron', sans-serif;
    color: #c9ddf2;
    margin: 10px 0 8px 0;
    font-size: 1.1rem;
}

#game-info p {
    font-size: 1rem;
    margin: 5px 0;
    color: #b5c2d0;
}

#game-info hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin: 10px 0;
}

/* HUD di gioco */
body #game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "hud"
        "."
        "chat";
    gap: var(--ui-gap);
    padding: var(--ui-top-pad) var(--ui-right-pad) var(--ui-bottom-pad) var(--ui-left-pad);
    box-sizing: border-box;
}

/* Barra HUD superiore – si estende su tutta la larghezza */
body #hud {
    grid-area: hud;
    position: relative;
    display: grid;
    grid-template-columns: minmax(212px, 236px) minmax(420px, 1fr) auto;
    gap: calc(var(--ui-gap) + 2px);
    align-items: start;
    font-size: calc(1rem * var(--hud-font-scale, 1));
}

body #hud-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--ui-gap);
    min-width: 0;
    width: min(236px, 22vw);
    max-width: 100%;
    pointer-events: auto;
}

/* Wrapper vita per label + barra */
body #health-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

body .hud-surface {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--ui-shell-border);
    background:
        linear-gradient(180deg, rgba(22, 31, 42, 0.96), rgba(8, 12, 18, 0.92));
    box-shadow: var(--ui-shell-shadow);
    backdrop-filter: blur(12px);
}

body .hud-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

body .hud-card-head--single {
    justify-content: flex-end;
}

body #health-label,
body #health-value,
body .hud-stat__label,
body #weapon-ammo,
body .hud-card-head--single {
    font-family: 'Orbitron', sans-serif;
    font-size: calc(0.68rem * var(--hud-font-scale, 1));
    color: rgba(220, 235, 255, 0.65);
    text-transform: uppercase;
    letter-spacing: 1px;
}

body #health-value {
    color: #eef6ff;
    white-space: nowrap;
}

body #health-bar {
    width: 100%;
    height: 16px;
    background: rgba(10, 14, 20, 0.85);
    border: 1px solid rgba(157, 176, 196, 0.40);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body #health-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #b73d36, #d86a40 55%, #f2b05d);
    transition: width 0.3s ease;
    border-radius: 999px;
}

body #score-display {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 7px;
    width: min(860px, 62vw, 100%);
    min-height: 88px;
    overflow: visible;
    justify-self: center;
    align-self: start;
    padding: 10px 14px 11px;
}

body #score-display > * {
    width: 100%;
}

body #hud-summary-text,
body #weapon-name {
    font-family: 'Orbitron', sans-serif;
    color: #eef6ff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

body #hud-summary-text {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    color: rgba(232, 240, 248, 0.92);
}

body .hud-stat-pill {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    min-width: 0;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(136, 194, 235, 0.2);
    background: rgba(8, 18, 28, 0.72);
}

body .hud-stat-pill__label {
    font-size: calc(0.58rem * var(--hud-font-scale, 1));
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: rgba(163, 199, 224, 0.76);
}

body .hud-stat-pill__value {
    font-size: clamp(calc(0.8rem * var(--hud-font-scale, 1)), calc(1vw * var(--hud-font-scale, 1)), calc(0.96rem * var(--hud-font-scale, 1)));
    line-height: 1.1;
    color: #f4fbff;
}

body #hud-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

body #hud-progress-text {
    min-width: 0;
    font-family: 'Orbitron', sans-serif;
    font-size: calc(0.64rem * var(--hud-font-scale, 1));
    line-height: 1.35;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(184, 230, 255, 0.76);
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
}

body #pvp-spotlight {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
}

body .hud-pvp-spotlight[hidden] {
    display: none !important;
}

body .pvp-spotlight-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 121, 121, 0.24);
    background: linear-gradient(180deg, rgba(33, 12, 16, 0.92), rgba(15, 20, 30, 0.82));
    color: rgba(255, 228, 228, 0.9);
    font-family: 'Orbitron', sans-serif;
    font-size: calc(0.58rem * var(--hud-font-scale, 1));
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

body .pvp-spotlight-chip--state {
    border-color: rgba(255, 110, 110, 0.48);
    color: #ffd6d6;
}

body .pvp-spotlight-chip--accent {
    border-color: rgba(127, 247, 255, 0.36);
    color: rgba(214, 251, 255, 0.92);
}

body .pvp-spotlight-chip--reward {
    border-color: rgba(255, 214, 92, 0.34);
    color: rgba(255, 239, 191, 0.95);
}

body #hud-exp-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(6, 12, 20, 0.88);
    border: 1px solid rgba(97, 175, 255, 0.28);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

body #hud-exp-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #1bc6ff 0%, #2fffd4 52%, #7cff83 100%);
    box-shadow: 0 0 12px rgba(27, 198, 255, 0.35);
    transition: width 0.24s ease;
}

body #weapon-display {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(157, 176, 196, 0.16);
}

body #weapon-ammo {
    color: rgba(227, 240, 255, 0.82);
}

body #weapon-name {
    font-size: calc(1rem * var(--hud-font-scale, 1));
    line-height: 1.15;
}

body #run-status {
    display: none !important;
}

/* Chat */
body #chat-container {
    grid-area: chat;
    position: relative;
    align-self: end;
    width: min(340px, 100%);
    pointer-events: auto;
}

body #game-ui[data-session-type='singleplayer'] #chat-container {
    display: none;
}

body #game-ui[data-session-type='singleplayer'] #hud-matchmaking-btn {
    display: none;
}

#chat-messages {
    height: 150px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px 10px 0 0;
    padding: 10px;
    display: flex;
    flex-direction: column-reverse;
}

.chat-msg {
    margin: 2px 0;
    font-size: 0.9rem;
}

.chat-msg .name { font-weight: bold; color: #00ffff; }

#chat-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 10px;
    color: #fff;
    border-radius: 0 0 10px 10px;
    font-family: inherit;
}

/* Leaderboard e Stats – posizionato sotto la barra #hud */
body #leaderboard {
    display: none !important;
}

body[data-input-mode='touch'] #leaderboard,
body[data-input-mode='touch'] #chat-container,
body #game-ui.pvp-status-active #leaderboard {
    display: none !important;
}

body #hud-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    justify-self: end;
    justify-content: flex-end;
    align-self: start;
    flex-wrap: wrap;
    max-width: min(212px, 20vw);
}

body #game-ui[data-session-type='singleplayer'] #hud-actions {
    justify-content: flex-end;
    gap: 8px;
    max-width: min(212px, 20vw);
}

body #game-ui[data-session-type='singleplayer'] .hud-action-btn {
    min-width: 92px;
    padding: 9px 10px;
    font-size: calc(0.68rem * var(--hud-font-scale, 1));
    letter-spacing: 0.1em;
}

body #game-ui[data-session-type='singleplayer'] #hud-ranks-btn {
    border-color: rgba(136, 194, 235, 0.18);
    background: rgba(8, 18, 28, 0.68);
    color: rgba(222, 238, 250, 0.84);
}

body #game-ui[data-session-type='singleplayer'] #shop-btn-game {
    background: linear-gradient(180deg, rgba(255, 186, 92, 0.18), rgba(127, 247, 255, 0.10));
    border-color: rgba(255, 186, 92, 0.36);
}

body #game-ui[data-session-type='singleplayer'][data-world-state='dungeon'] #hud-actions {
    opacity: 0.92;
}

body .hud-action-btn {
    border: 1px solid rgba(127, 247, 255, 0.24);
    background: rgba(127, 247, 255, 0.07);
    color: #eaf7ff;
    padding: 10px 12px;
    border-radius: 14px;
    font-family: 'Orbitron', sans-serif;
    font-size: calc(0.72rem * var(--hud-font-scale, 1));
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

body .hud-action-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(127, 247, 255, 0.44);
    background: rgba(127, 247, 255, 0.12);
}

body .hud-action-btn--accent {
    background: linear-gradient(180deg, rgba(255, 77, 109, 0.18), rgba(127, 247, 255, 0.12));
    border-color: rgba(255, 77, 109, 0.34);
}

#leaderboard h3 {
    margin: 0 0 10px 0;
    color: #c6d9ed;
    text-transform: uppercase;
    font-size: 1.2rem;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(171, 188, 205, 0.17);
    font-size: 0.9rem;
}

.leaderboard-entry:nth-child(1) {
    color: #f3ce77;
    font-weight: bold;
}

.leaderboard-entry:nth-child(2) {
    color: #d5dbe3;
}

.leaderboard-entry:nth-child(3) {
    color: #cd9663;
}

.player-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-score {
    color: #9dd8a7;
    margin-left: 10px;
}

/* Notifiche di kill */
.kill-notification {
    position: fixed;
    top: 200px;
    right: 20px;
    background: linear-gradient(to right, rgba(106, 33, 33, 0.88), rgba(136, 57, 38, 0.88));
    color: #fff;
    padding: 15px 20px;
    border-radius: 5px;
    font-family: 'Orbitron', sans-serif;
    animation: slideIn 0.3s ease, slideOut 0.3s ease 2.7s;
    z-index: 99;
}

@keyframes slideIn {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(400px); opacity: 0; }
}

@keyframes blink-hint {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.15; }
}

/* ============================================
   PLAYER HEALTH BAR — Independent from storyline HUD
   ============================================ */
#player-health-bar-wrapper {
    position: fixed !important;
    top: 10px !important;
    left: 230px !important;   /* 10px gap after storyline HUD: 10 + 210 + 10 = 230 */
    width: 160px !important;
    z-index: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

#health-label {
    font-size: 10px;
    color: #ff6666;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    white-space: nowrap;
}

#health-bar-bg {
    flex: 1;
    height: 10px;
    background: rgba(80, 0, 0, 0.6);
    border-radius: 2px;
    overflow: hidden;
}

#health-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #cc0000, #ff4444);
    border-radius: 2px;
    transition: width 0.2s ease;
    /* width is set dynamically via JS as percentage */
}

#health-text {
    font-size: 10px;
    color: #cccccc;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    min-width: 55px;
}

/* Indicatore munizioni */
body #ammo-indicator {
    display: none !important;
}

/* Il canvas Phaser deve stare SOTTO i menu HTML (z-index 10, i menu sono 90/100) */
#game-container canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 10 !important;
    touch-action: none;
}

/* Cursore visibile nei menu, nascosto solo durante il gioco */
body.game-playing {
    cursor: none;
}

#storyline-hud-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 5px 8px !important;
    background: rgba(140, 0, 0, 0.85) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-height: 26px !important;
}

#storyline-hud-body[style*="display: none"] {
    padding: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

#storyline-dialogue-box {
    bottom: 100px !important; 
}

body #combat-overview {
    gap: 10px;
    pointer-events: auto;
}

body #storyline-hud {
    position: absolute;
    left: 0;
    bottom: 0;
    width: min(382px, calc(100vw - 20px));
    z-index: 3;
    display: none;
    gap: 0;
    padding: 0;
    overflow: hidden;
    pointer-events: auto;
    max-width: 100%;
    border-color: rgba(229, 104, 104, 0.34);
    background:
        radial-gradient(circle at top right, rgba(158, 44, 44, 0.2), transparent 44%),
        linear-gradient(180deg, rgba(25, 13, 17, 0.97), rgba(7, 11, 15, 0.97));
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.32), inset 0 0 0 1px rgba(122, 213, 255, 0.04);
}

body #mission-hud-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: min(300px, 24vw);
    display: none;
    gap: 8px;
    padding: 9px 11px;
    pointer-events: auto;
    z-index: 2;
    border-color: rgba(118, 164, 191, 0.22);
    background:
        radial-gradient(circle at top left, rgba(34, 132, 176, 0.16), transparent 46%),
        linear-gradient(180deg, rgba(12, 18, 28, 0.95), rgba(7, 11, 18, 0.92));
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

body #mission-hud-panel.is-visible {
    display: flex;
}

body .onboarding-guide {
    position: fixed;
    right: var(--ui-right-pad);
    bottom: calc(var(--ui-bottom-pad) + 14px);
    z-index: 1180;
    width: min(360px, calc(100vw - 28px));
    max-height: min(46dvh, 380px);
    overflow-y: auto;
    padding: 12px 14px;
    box-sizing: border-box;
    border-radius: 8px;
    border: 1px solid rgba(255, 77, 96, 0.32);
    background:
        linear-gradient(180deg, rgba(19, 21, 27, 0.9), rgba(7, 9, 13, 0.88)),
        rgba(6, 8, 12, 0.9);
    color: #edf5fb;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.34);
    pointer-events: auto;
    backdrop-filter: blur(12px);
}

body .onboarding-guide.is-complete {
    border-color: rgba(99, 255, 151, 0.44);
    background:
        radial-gradient(circle at top right, rgba(99, 255, 151, 0.14), transparent 46%),
        linear-gradient(180deg, rgba(19, 21, 27, 0.94), rgba(7, 9, 13, 0.9)),
        rgba(6, 8, 12, 0.9);
}

body .onboarding-guide[hidden] {
    display: none !important;
}

body .onboarding-guide__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

body .onboarding-guide__head span {
    color: #ff8597;
    font-family: 'Orbitron', sans-serif;
    font-size: calc(0.58rem * var(--goregrid-text-user-scale, 1));
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

body .onboarding-guide__head strong {
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-size: calc(0.76rem * var(--goregrid-text-user-scale, 1));
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

body .onboarding-guide__steps {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 6px;
}

body .onboarding-guide__steps li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(230, 238, 246, 0.8);
    font-size: calc(0.9rem * var(--goregrid-text-user-scale, 1));
    line-height: 1.22;
}

body .onboarding-guide__steps li::before {
    content: '';
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.08);
}

body .onboarding-guide__steps li.is-complete {
    color: #dcffe8;
}

body .onboarding-guide__steps li.is-complete::before {
    border-color: rgba(99, 255, 151, 0.72);
    background: #63ff97;
    box-shadow: 0 0 12px rgba(99, 255, 151, 0.4);
}

body .onboarding-guide__steps li.is-current {
    color: #ffffff;
    font-weight: 700;
}

body .onboarding-guide__steps li.is-current::before {
    border-color: rgba(255, 77, 96, 0.8);
    background: #ff4d60;
    box-shadow: 0 0 12px rgba(255, 77, 96, 0.42);
}

body .onboarding-guide__progress {
    margin-top: 10px;
    padding: 9px 10px;
    border-radius: 7px;
    border: 1px solid rgba(127, 247, 255, 0.16);
    background: rgba(127, 247, 255, 0.055);
}

body .onboarding-guide__progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
    font-family: 'Orbitron', sans-serif;
}

body .onboarding-guide__progress-head span,
body .onboarding-guide__progress-head strong {
    font-size: calc(0.62rem * var(--goregrid-text-user-scale, 1));
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

body .onboarding-guide__progress-head span {
    color: rgba(127, 247, 255, 0.76);
}

body .onboarding-guide__progress-head strong {
    color: #ffffff;
}

body .onboarding-guide__track {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

body .onboarding-guide__track span {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff4d60, #7ff7ff, #63ff97);
    transition: width 0.24s ease;
}

body .onboarding-guide__current {
    margin: 9px 0 0 !important;
    color: rgba(255, 255, 255, 0.86) !important;
    font-size: calc(0.82rem * var(--goregrid-text-user-scale, 1)) !important;
    line-height: 1.22;
}

body .onboarding-guide__tip {
    margin: 8px 0 0 !important;
    padding: 8px 9px;
    border-radius: 7px;
    border: 1px solid rgba(255, 77, 96, 0.18);
    background: rgba(255, 77, 96, 0.075);
    color: rgba(255, 244, 246, 0.9) !important;
    font-size: calc(0.78rem * var(--goregrid-text-user-scale, 1)) !important;
    line-height: 1.25;
}

body .onboarding-guide__reward {
    margin-top: 8px;
    padding: 7px 9px;
    border-radius: 7px;
    border: 1px solid rgba(255, 214, 118, 0.18);
    background: rgba(255, 214, 118, 0.07);
    color: rgba(255, 232, 169, 0.92);
    font-family: 'Rajdhani', sans-serif;
    font-size: calc(0.78rem * var(--goregrid-text-user-scale, 1));
    font-weight: 700;
    line-height: 1.22;
}

body .onboarding-guide__next {
    margin: 10px 0 0 !important;
    color: rgba(232, 240, 248, 0.82) !important;
    font-size: calc(0.88rem * var(--goregrid-text-user-scale, 1)) !important;
    line-height: 1.28;
}

body .onboarding-guide.is-complete .onboarding-guide__next {
    color: #dcffe8 !important;
}

body .onboarding-guide__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

body .onboarding-guide__actions button,
body .onboarding-guide__actions a {
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 77, 96, 0.38);
    background: rgba(255, 77, 96, 0.12);
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: calc(0.62rem * var(--goregrid-text-user-scale, 1));
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
}

body .onboarding-guide.is-complete #onboarding-guide-pvp {
    color: #140305;
    border-color: rgba(255, 224, 228, 0.68);
    background: linear-gradient(135deg, #fff2f4, #ff6378 58%, #d92238);
}

body .onboarding-guide__dismiss {
    color: rgba(232, 240, 248, 0.74) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    background: rgba(255, 255, 255, 0.045) !important;
}

body #mission-hud-panel.is-collapsed {
    gap: 0;
    padding-bottom: 8px;
}

body .mission-hud__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
}

body .mission-hud__header-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

body #mission-hud-toggle {
    border-color: rgba(164, 221, 255, 0.18);
    background: rgba(70, 156, 255, 0.08);
    color: #d7f1ff;
}

body .mission-hud__eyebrow,
body #mission-hud-summary,
body .mission-hud__status,
body .mission-hud__reward {
    font-family: 'Orbitron', sans-serif;
    font-size: calc(0.62rem * var(--hud-font-scale, 1));
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

body .mission-hud__eyebrow {
    color: rgba(180, 221, 246, 0.78);
}

body #mission-hud-summary {
    color: rgba(239, 248, 255, 0.92);
}

body #mission-hud-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(26vh, 240px);
    overflow-y: auto;
}

body #mission-hud-panel.is-collapsed #mission-hud-list {
    display: none;
}

body .mission-hud__row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 9px;
    border-radius: 12px;
    border: 1px solid rgba(143, 189, 214, 0.14);
    background: rgba(8, 16, 26, 0.68);
}

body .mission-hud__row.is-complete {
    border-color: rgba(112, 226, 140, 0.24);
    background: linear-gradient(180deg, rgba(12, 28, 20, 0.78), rgba(8, 16, 14, 0.74));
}

body .mission-hud__row-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

body .mission-hud__title {
    min-width: 0;
    font-family: 'Orbitron', sans-serif;
    font-size: calc(0.72rem * var(--hud-font-scale, 1));
    line-height: 1.25;
    color: #edf7ff;
}

body .mission-hud__status {
    flex-shrink: 0;
    color: rgba(158, 219, 255, 0.82);
}

body .mission-hud__row.is-complete .mission-hud__status {
    color: #85f6a7;
}

body .mission-hud__desc {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.35;
    color: rgba(188, 212, 229, 0.76);
}

body .mission-hud__track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(4, 10, 18, 0.9);
    border: 1px solid rgba(92, 147, 173, 0.22);
}

body .mission-hud__fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2dc4ff, #7cff9d);
    box-shadow: 0 0 10px rgba(45, 196, 255, 0.24);
}

body .mission-hud__row.is-complete .mission-hud__fill {
    background: linear-gradient(90deg, #59e386, #9ff7b2);
    box-shadow: 0 0 10px rgba(89, 227, 134, 0.22);
}

body .mission-hud__reward {
    color: rgba(245, 211, 142, 0.82);
}

body .mission-hud__daily-goals {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 9px;
    border-radius: 8px;
    border: 1px solid rgba(255, 214, 104, 0.24);
    background:
        radial-gradient(circle at top right, rgba(255, 214, 104, 0.14), transparent 52%),
        linear-gradient(180deg, rgba(24, 20, 10, 0.82), rgba(9, 14, 20, 0.78));
}

body .mission-hud__daily-head,
body .mission-hud__goal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

body .mission-hud__daily-head span,
body .mission-hud__goal-title,
body .mission-hud__goal-reward,
body .mission-hud__goal-meta {
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

body .mission-hud__daily-head span {
    color: #ffd66d;
    font-size: calc(0.6rem * var(--hud-font-scale, 1));
}

body .mission-hud__daily-head button {
    min-height: 44px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 214, 104, 0.35);
    background: rgba(255, 214, 104, 0.12);
    color: #fff3c7;
    font-family: 'Orbitron', sans-serif;
    font-size: calc(0.52rem * var(--hud-font-scale, 1));
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}

body .mission-hud__goal-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 7px;
    border-radius: 7px;
    border: 1px solid rgba(255, 214, 104, 0.12);
    background: rgba(6, 12, 18, 0.66);
}

body .mission-hud__goal-title {
    min-width: 0;
    color: #fff9df;
    font-size: calc(0.56rem * var(--hud-font-scale, 1));
}

body .mission-hud__goal-reward,
body .mission-hud__goal-meta {
    flex-shrink: 0;
    color: rgba(255, 219, 128, 0.84);
    font-size: calc(0.54rem * var(--hud-font-scale, 1));
}

body .mission-hud__goal-row p {
    margin: 0;
    color: rgba(236, 229, 196, 0.76);
    font-size: calc(0.66rem * var(--hud-font-scale, 1));
    line-height: 1.3;
}

body .mission-hud__goal-track {
    width: 100%;
    height: 5px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(255, 214, 104, 0.18);
    background: rgba(5, 8, 12, 0.9);
}

body .mission-hud__goal-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ffbe48, #fff1a8);
    box-shadow: 0 0 10px rgba(255, 214, 104, 0.22);
}

body .mission-hud__pvp-bridge {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 99, 120, 0.32);
    background:
        radial-gradient(circle at top right, rgba(255, 77, 96, 0.18), transparent 48%),
        linear-gradient(180deg, rgba(27, 12, 18, 0.86), rgba(8, 12, 18, 0.82));
}

body .mission-hud__bridge-kicker {
    color: #ff91a0;
    font-family: 'Orbitron', sans-serif;
    font-size: calc(0.58rem * var(--hud-font-scale, 1));
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

body .mission-hud__pvp-bridge strong {
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-size: calc(0.74rem * var(--hud-font-scale, 1));
    line-height: 1.24;
}

body .mission-hud__pvp-bridge p {
    margin: 0;
    color: rgba(234, 242, 248, 0.8);
    font-size: calc(0.72rem * var(--hud-font-scale, 1));
    line-height: 1.34;
}

body .mission-hud__bridge-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

body .mission-hud__bridge-actions button,
body .mission-hud__bridge-actions a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 6px;
    border-radius: 6px;
    border: 1px solid rgba(255, 99, 120, 0.36);
    background: rgba(255, 77, 96, 0.12);
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-size: calc(0.54rem * var(--hud-font-scale, 1));
    letter-spacing: 0.06em;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
}

body .mission-hud__bridge-actions button:first-child {
    color: #1a0508;
    border-color: rgba(255, 221, 226, 0.72);
    background: linear-gradient(135deg, #fff0f2, #ff6378 58%, #d92d41);
}

body #storyline-hud.is-visible {
    display: flex;
}

body #storyline-hud.is-minimized #storyline-hud-body {
    display: none !important;
}

body #storyline-hud.is-minimized #storyline-hud-header {
    border-bottom: none !important;
}

body #storyline-hud-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    width: 100% !important;
    min-height: 0 !important;
    padding: 10px 12px !important;
    box-sizing: border-box !important;
    background: linear-gradient(90deg, rgba(114, 23, 23, 0.94), rgba(63, 15, 27, 0.9)) !important;
    border-bottom: 1px solid rgba(233, 106, 106, 0.18) !important;
    cursor: pointer;
}

body .storyline-hud__heading {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

body #storyline-chapter-title {
    min-width: 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.76rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fff3f3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body #storyline-minimize-btn,
body #mission-hud-toggle {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(255, 224, 224, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: #ffe6e6;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

body #storyline-minimize-btn:hover,
body #mission-hud-toggle:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 224, 224, 0.24);
}

body #storyline-hud-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: min(31vh, 300px);
    overflow-y: auto;
    padding: 10px 12px 12px !important;
}

body #storyline-chapter-subtitle {
    font-size: 0.6rem;
    color: rgba(255, 190, 190, 0.82);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

body .storyline-briefing-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 137, 137, 0.14);
    background: rgba(255, 255, 255, 0.045);
}

body .storyline-briefing-card--log {
    border-color: rgba(155, 204, 255, 0.12);
    background: rgba(8, 16, 28, 0.46);
}

body .storyline-section-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.56rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 177, 177, 0.56);
}

body #storyline-directive-title {
    font-size: 0.84rem;
    line-height: 1.35;
    color: #fff2f2;
}

body #storyline-directive-progress {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.66rem;
    line-height: 1.35;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(132, 231, 255, 0.86);
}

body #storyline-directive-trigger {
    font-size: 0.68rem;
    line-height: 1.4;
    color: rgba(236, 210, 214, 0.78);
}

body #storyline-directive-route {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.62rem;
    line-height: 1.4;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 214, 214, 0.78);
}

body #storyline-directive-target {
    font-size: 0.68rem;
    line-height: 1.45;
    color: rgba(223, 234, 247, 0.78);
}

body #storyline-directive-route.is-empty,
body #storyline-directive-progress.is-empty,
body #storyline-directive-trigger.is-empty,
body #storyline-directive-target.is-empty {
    display: none;
}

body #storyline-field-log {
    font-size: 0.74rem;
    line-height: 1.5;
    color: rgba(225, 235, 247, 0.82);
}

body #storyline-chapter-progress {
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 143, 143, 0.14);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 225, 225, 0.78);
}

body #storyline-quests-main,
body #storyline-quests-secondary {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

body #storyline-quests-secondary[hidden] {
    display: none;
}

body #storyline-side-toggle {
    align-self: flex-start;
    border: none;
    padding: 0;
    background: none;
    color: rgba(255, 164, 164, 0.72);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.64rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
}

body #storyline-side-toggle.is-hidden {
    display: none;
}

body .storyline-quest {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
}

body .storyline-quest--main {
    border-color: rgba(255, 122, 122, 0.18);
    background: linear-gradient(180deg, rgba(114, 23, 23, 0.18), rgba(255, 255, 255, 0.03));
}

body .storyline-quest--current {
    border-color: rgba(120, 211, 255, 0.26);
    box-shadow: inset 0 0 0 1px rgba(120, 211, 255, 0.1);
    background:
        radial-gradient(circle at top right, rgba(76, 173, 255, 0.12), transparent 42%),
        linear-gradient(180deg, rgba(14, 35, 52, 0.5), rgba(255, 255, 255, 0.03));
    border-left: 3px solid rgba(120, 211, 255, 0.72);
}

body .storyline-quest--status {
    border-style: dashed;
    border-color: rgba(255, 183, 123, 0.2);
    background: linear-gradient(180deg, rgba(54, 31, 18, 0.46), rgba(255, 255, 255, 0.03));
}

body .storyline-quest__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

body .storyline-quest__title {
    flex: 1 1 160px;
    min-width: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff4f4;
    line-height: 1.25;
}

body .storyline-quest__count {
    flex-shrink: 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.68rem;
    color: rgba(255, 208, 208, 0.78);
    letter-spacing: 0.08em;
}

body .storyline-quest__step {
    flex-shrink: 0;
    padding: 2px 5px;
    border-radius: 6px;
    border: 1px solid rgba(255, 211, 136, 0.18);
    background: rgba(44, 31, 16, 0.58);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.54rem;
    line-height: 1;
    color: rgba(255, 224, 168, 0.86);
    letter-spacing: 0.06em;
    white-space: nowrap;
}

body .storyline-quest__tag {
    flex-shrink: 0;
    padding: 2px 5px;
    border-radius: 6px;
    border: 1px solid rgba(120, 211, 255, 0.2);
    background: rgba(12, 32, 48, 0.62);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.54rem;
    line-height: 1;
    color: rgba(157, 226, 255, 0.84);
    letter-spacing: 0.08em;
}

body .storyline-quest__desc {
    font-size: 0.72rem;
    line-height: 1.45;
    color: rgba(244, 220, 220, 0.68);
}

body .storyline-quest__meta {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.58rem;
    line-height: 1.35;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(169, 224, 255, 0.72);
}

body .storyline-quest__bar {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

body .storyline-quest__bar-fill {
    display: block;
    height: 100%;
    width: var(--quest-progress, 0%);
    border-radius: inherit;
    background: linear-gradient(90deg, #ff6868 0%, #ff9c6b 60%, #ffd88a 100%);
    box-shadow: 0 0 10px rgba(255, 104, 104, 0.28);
}

body .storyline-empty-state {
    font-size: 0.72rem;
    line-height: 1.45;
    color: rgba(241, 215, 215, 0.56);
    font-style: italic;
}

body .storyline-banner {
    position: fixed;
    top: calc(var(--ui-top-pad) + 12px);
    left: 50%;
    transform: translateX(-50%);
    width: min(560px, calc(100vw - 32px));
    z-index: 1000;
    pointer-events: none;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(7, 9, 12, 0.92);
    box-shadow: 0 18px 28px rgba(0, 0, 0, 0.28);
    opacity: 1;
    transition: opacity 0.4s ease;
}

body .storyline-banner__eyebrow {
    display: block;
    margin-bottom: 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.56rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.72;
}

body .storyline-banner__message {
    display: block;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.76rem;
    line-height: 1.4;
    letter-spacing: 0.05em;
}

body .storyline-banner--quest {
    border-color: rgba(120, 219, 139, 0.24);
    background: linear-gradient(180deg, rgba(10, 25, 16, 0.96), rgba(8, 12, 18, 0.94));
    color: #c9ffd2;
}

body .storyline-banner--chapter,
body .storyline-banner--boss {
    border-color: rgba(255, 120, 120, 0.26);
    background: linear-gradient(180deg, rgba(34, 12, 17, 0.96), rgba(8, 12, 18, 0.94));
    color: #ffe3e3;
}

body.storyline-paused #game-ui::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 860;
    pointer-events: none;
    background:
        radial-gradient(circle at center, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.34));
}

body #storyline-dialogue-box {
    position: fixed !important;
    left: 50% !important;
    bottom: max(12px, calc(var(--ui-bottom-pad) + 12px)) !important;
    transform: translateX(-50%) !important;
    width: min(680px, calc(100vw - 28px)) !important;
    z-index: 900 !important;
    padding: 16px 18px 14px !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255, 116, 116, 0.18) !important;
    background:
        radial-gradient(circle at top right, rgba(142, 34, 34, 0.16), transparent 44%),
        linear-gradient(180deg, rgba(15, 18, 25, 0.97), rgba(7, 9, 12, 0.97)) !important;
    box-shadow: 0 24px 32px rgba(0, 0, 0, 0.34) !important;
    box-sizing: border-box !important;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.24s ease;
}

body #storyline-dialogue-box.is-visible {
    opacity: 1;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #storyline-dialogue-box {
    bottom: calc(150px + env(safe-area-inset-bottom, 0px)) !important;
    width: min(520px, calc(100vw - 22px)) !important;
    max-height: min(34dvh, 232px) !important;
    padding: 11px 13px 10px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border-radius: 12px !important;
    box-shadow: 0 18px 26px rgba(0, 0, 0, 0.32) !important;
    scrollbar-width: thin;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] .storyline-dialogue__eyebrow {
    margin-bottom: 5px;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] .storyline-dialogue__speaker {
    margin-bottom: 6px;
    font-size: 0.86rem;
    letter-spacing: 0.09em;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] .storyline-dialogue__text {
    font-size: 1.08rem;
    line-height: 1.5;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] .storyline-dialogue__hint {
    margin-top: 7px;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
}

body[data-input-mode='touch'].storyline-paused #hud,
body[data-input-mode='touch'].storyline-paused #touch-controls,
body[data-input-mode='touch'].starting-village-paused #hud,
body[data-input-mode='touch'].starting-village-paused #touch-controls {
    display: none !important;
}

body[data-input-mode='touch'].storyline-paused #game-ui {
    padding: 0 !important;
}

body[data-input-mode='touch'].storyline-paused #game-ui[data-session-type='singleplayer'] #storyline-dialogue-box {
    top: 50% !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: min(540px, calc(100vw - 28px)) !important;
    max-height: min(58dvh, 360px) !important;
    padding: 14px 15px 12px !important;
}

body[data-input-mode='touch'].storyline-paused .run-banner:not(.run-banner--pvp-match) {
    display: none !important;
}

body[data-input-mode='touch'].starting-village-paused .run-banner:not(.run-banner--pvp-match) {
    display: none !important;
}

body[data-input-mode='touch'].starting-village-paused #mission-hud-panel {
    display: none !important;
}

body .storyline-dialogue__eyebrow {
    display: block;
    margin-bottom: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 167, 167, 0.52);
}

body .storyline-dialogue__speaker {
    display: block;
    margin-bottom: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #ffb4b4;
}

body .storyline-dialogue__text {
    font-size: 0.98rem;
    line-height: 1.7;
    color: rgba(242, 244, 249, 0.9);
}

body .storyline-dialogue__hint {
    display: block;
    margin-top: 10px;
    text-align: right;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(196, 208, 223, 0.5);
    animation: blink-hint 1.5s step-end infinite;
}

/* CUSTOMIZZAZIONE SCHERMATA */
#customize-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

#customize-container {
    background: linear-gradient(135deg, #1a0033 0%, #0d001a 100%);
    border: 2px solid #ff00ff;
    border-radius: 20px;
    padding: 30px;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 50px rgba(255, 0, 255, 0.5);
}

#customize-container h1 {
    font-family: 'Orbitron', sans-serif;
    color: #ff00ff;
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 0, 0, 0.8);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #ff0000;
    transform: scale(1.1);
}

#customize-content {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

#customize-preview {
    flex: 0 0 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: rgba(0, 255, 255, 0.05);
    border: 2px solid #00ffff;
    border-radius: 15px;
    padding: 20px;
}

#preview-canvas {
    background: radial-gradient(circle, #1a1a2e, #0f0f1e);
    border: 2px solid #00ff00;
    border-radius: 10px;
    display: block;
}

#player-stats {
    text-align: center;
    width: 100%;
}

#player-stats p {
    margin: 5px 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

#customize-categories {
    flex: 1;
}

.customize-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.tab-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #ff00ff;
    color: #ff00ff;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    white-space: nowrap;
}

.tab-btn:hover {
    background: #ff00ff;
    color: #000;
    transform: scale(1.05);
}

.tab-btn.active {
    background: linear-gradient(45deg, #ff00ff, #00ffff);
    border-color: #00ffff;
    color: #000;
    font-weight: bold;
}

#tab-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.cosmetic-item {
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid #00ffff;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}

.cosmetic-item:hover {
    background: rgba(0, 255, 255, 0.2);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.cosmetic-item.selected {
    border-color: #ff00ff;
    background: rgba(255, 0, 255, 0.2);
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
}

.cosmetic-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #666;
}

.cosmetic-item.locked::after {
    content: '🔒';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1.2rem;
}

.cosmetic-emoji {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.cosmetic-name {
    font-family: 'Rajdhani', sans-serif;
    color: #00ffff;
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.cosmetic-cost {
    font-size: 0.8rem;
    color: #ffff00;
    font-family: 'Orbitron', sans-serif;
}

.cosmetic-cost.unlocked {
    color: #00ff00;
    font-weight: bold;
}

#customize-screen {
    --customize-bg: linear-gradient(145deg, rgba(6, 12, 19, 0.98), rgba(14, 24, 37, 0.98));
    --customize-panel: linear-gradient(180deg, rgba(18, 30, 45, 0.96), rgba(8, 14, 22, 0.96));
    --customize-card: linear-gradient(180deg, rgba(28, 42, 59, 0.96), rgba(13, 20, 31, 0.96));
    --customize-card-hover: linear-gradient(180deg, rgba(38, 58, 79, 0.98), rgba(18, 28, 40, 0.98));
    --customize-border: rgba(132, 169, 197, 0.32);
    --customize-border-strong: rgba(132, 208, 255, 0.54);
    --customize-accent: #84d0ff;
    --customize-accent-2: #ffd166;
    --customize-text: #f2f7fc;
    --customize-muted: #9db3c8;
}

#customize-screen,
#customize-screen * {
    box-sizing: border-box;
}

#customize-screen #customize-container {
    position: relative;
    width: min(1240px, calc(100vw - 48px));
    max-height: min(calc(100dvh - 32px), 980px);
    padding: 24px;
    border: 1px solid var(--customize-border-strong);
    border-radius: 18px;
    background: var(--customize-bg);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    overflow: auto;
    scrollbar-gutter: stable both-edges;
}

#customize-screen #customize-container::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 20px;
    background:
        radial-gradient(circle at top left, rgba(132, 208, 255, 0.14), transparent 32%),
        radial-gradient(circle at bottom right, rgba(255, 209, 102, 0.12), transparent 28%);
}

#customize-screen #customize-container h1 {
    margin: 0 0 10px;
    color: var(--customize-text);
    letter-spacing: 0.04em;
    font-size: clamp(1.75rem, 3vw, 2.35rem);
}

#customize-screen #customize-subtitle {
    margin: 0 0 22px;
    text-align: center;
    color: var(--customize-muted);
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.08rem;
    letter-spacing: 0.04em;
}

#customize-screen .close-btn {
    top: 18px;
    right: 18px;
    z-index: 8;
    border: 1px solid rgba(255, 107, 107, 0.4);
    background: rgba(136, 24, 24, 0.72);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
    touch-action: manipulation;
}

#customize-screen .close-btn:hover {
    transform: translateY(-1px);
    background: rgba(176, 36, 36, 0.92);
}

#customize-screen #customize-content {
    display: grid;
    grid-template-columns: minmax(286px, 336px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

#customize-screen #customize-preview {
    position: sticky;
    top: 8px;
    display: grid;
    gap: 16px;
    align-self: start;
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--customize-border);
    border-radius: 16px;
    background:
        radial-gradient(circle at top left, rgba(132, 208, 255, 0.10), transparent 32%),
        radial-gradient(circle at bottom right, rgba(255, 209, 102, 0.08), transparent 28%),
        var(--customize-panel);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 20px 44px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

#customize-screen .customize-preview-head {
    display: grid;
    gap: 6px;
}

#customize-screen .customize-preview-kicker {
    margin: 0;
    color: var(--customize-accent-2);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

#customize-screen .customize-preview-title {
    margin: 0;
    color: var(--customize-text);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    letter-spacing: 0.05em;
}

#customize-screen .customize-preview-copy {
    margin: 0;
    color: var(--customize-muted);
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    line-height: 1.38;
}

#customize-screen .customize-preview-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 318px;
    padding: 18px;
    border: 1px solid rgba(132, 208, 255, 0.18);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(7, 16, 25, 0.98), rgba(4, 8, 14, 0.98)),
        radial-gradient(circle at center, rgba(132, 208, 255, 0.10), transparent 60%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.03),
        0 18px 36px rgba(0, 0, 0, 0.20);
    overflow: hidden;
    isolation: isolate;
}

#customize-screen .customize-preview-stage::before,
#customize-screen .customize-preview-stage::after {
    content: '';
    position: absolute;
    pointer-events: none;
}

#customize-screen .customize-preview-stage::before {
    inset: 12px;
    border-radius: 20px;
    border: 1px solid rgba(132, 208, 255, 0.12);
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.03), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.03)),
        repeating-linear-gradient(
            90deg,
            rgba(132, 208, 255, 0.05) 0,
            rgba(132, 208, 255, 0.05) 1px,
            transparent 1px,
            transparent 28px
        );
    z-index: 0;
}

#customize-screen .customize-preview-stage::after {
    inset: 0;
    border-radius: inherit;
    box-shadow:
        inset 0 0 0 1px rgba(255, 209, 102, 0.08),
        inset 0 -48px 70px rgba(255, 77, 109, 0.06);
    z-index: 0;
}

#customize-screen .customize-preview-stage-glow {
    position: absolute;
    left: 18%;
    right: 18%;
    bottom: 10px;
    height: 58px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 77, 109, 0.24), rgba(255, 77, 109, 0.08) 38%, transparent 72%);
    filter: blur(16px);
    pointer-events: none;
    z-index: 0;
}

#customize-screen #preview-canvas {
    position: relative;
    z-index: 1;
    width: min(100%, 262px);
    max-width: 262px;
    height: auto;
    border: 1px solid rgba(132, 208, 255, 0.22);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(7, 16, 25, 0.98), rgba(4, 9, 14, 0.98));
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 18px 28px rgba(0, 0, 0, 0.26),
        0 0 26px rgba(132, 208, 255, 0.08);
}

#customize-screen .customize-preview-note {
    margin: -2px 0 0;
    padding: 11px 13px;
    border-radius: 8px;
    border-left: 2px solid rgba(255, 209, 102, 0.34);
    background: rgba(255, 255, 255, 0.03);
    color: var(--customize-muted);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.96rem;
    line-height: 1.34;
}

#customize-screen #player-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    text-align: left;
}

#customize-screen #player-stats p {
    margin: 0;
    min-height: 62px;
    padding: 12px 14px;
    border-radius: 8px;
    display: flex;
    align-items: flex-end;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(132, 169, 197, 0.12);
    color: var(--customize-text);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
    line-height: 1.18;
    text-shadow: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

#customize-screen #player-stats p .customize-stat-label,
#customize-screen #player-stats p .customize-stat-value {
    display: block;
}

#customize-screen #player-stats p .customize-stat-label {
    margin-bottom: 7px;
    color: var(--customize-muted);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

#customize-screen #player-stats p .customize-stat-value {
    color: var(--customize-text);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.04rem;
    letter-spacing: 0.04em;
}

#customize-screen #player-stats p:nth-child(3) .customize-stat-value {
    color: var(--customize-accent-2);
}

#customize-screen #player-stats p:nth-child(5) .customize-stat-value,
#customize-screen #player-stats p:nth-child(6) .customize-stat-value {
    color: var(--customize-accent);
}

#customize-screen #customize-categories {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

#customize-screen .customize-tabs {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 0;
    padding: 10px;
    border: 1px solid var(--customize-border);
    border-radius: 12px;
    background: var(--customize-panel);
    flex-wrap: wrap;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: min(210px, calc(var(--goregrid-vvh, 100dvh) * 0.36));
    overscroll-behavior: contain;
}

#customize-screen .tab-btn {
    min-width: 0;
    min-height: 48px;
    padding: 8px 12px;
    display: grid;
    gap: 4px;
    align-content: center;
    border: 1px solid rgba(132, 169, 197, 0.28);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--customize-muted);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    flex: 1 1 92px;
}

#customize-screen .tab-btn__label,
#customize-screen .tab-btn__meta {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

#customize-screen .tab-btn__meta {
    color: rgba(214, 227, 240, 0.68);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.74rem;
    letter-spacing: 0;
    text-transform: none;
}

#customize-screen .tab-btn:hover {
    background: rgba(132, 208, 255, 0.12);
    color: var(--customize-text);
    border-color: rgba(132, 208, 255, 0.46);
    transform: translateY(-1px);
}

#customize-screen .tab-btn.active {
    background: linear-gradient(135deg, rgba(132, 208, 255, 0.24), rgba(255, 209, 102, 0.26));
    border-color: rgba(255, 209, 102, 0.46);
    color: var(--customize-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#customize-screen #tab-content {
    display: block;
    min-width: 0;
}

#customize-screen .customize-category-panel,
#customize-screen .face-customization-container {
    border: 1px solid var(--customize-border);
    border-radius: 14px;
    padding: 22px;
    background: var(--customize-panel);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

#customize-screen .customize-category-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(200px, 220px);
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

#customize-screen .customize-category-copy {
    min-width: 0;
}

#customize-screen .customize-category-copy h3 {
    margin: 0;
    color: var(--customize-text);
    font-size: 1.55rem;
    letter-spacing: 0.04em;
}

#customize-screen .customize-kicker {
    margin: 0 0 6px;
    color: var(--customize-accent-2);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

#customize-screen .customize-category-description {
    margin: 10px 0 0;
    max-width: 62ch;
    color: var(--customize-muted);
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    line-height: 1.45;
}

#customize-screen .customize-category-summary {
    display: grid;
    gap: 10px;
    min-width: 0;
    align-self: start;
}

#customize-screen .customize-category-summary span {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(132, 169, 197, 0.16);
    color: var(--customize-text);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
}

#customize-screen .customize-upgrade-strip {
    margin: 0 0 18px;
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid rgba(255, 209, 102, 0.2);
    border-radius: 10px;
    background:
        linear-gradient(135deg, rgba(255, 209, 102, 0.08), rgba(132, 208, 255, 0.06)),
        rgba(255, 255, 255, 0.03);
}

#customize-screen .customize-upgrade-strip__copy {
    min-width: 0;
}

#customize-screen .customize-upgrade-strip__kicker,
#customize-screen .customize-upgrade-strip strong,
#customize-screen .customize-upgrade-strip p {
    display: block;
}

#customize-screen .customize-upgrade-strip__kicker {
    margin-bottom: 4px;
    color: var(--customize-accent-2);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

#customize-screen .customize-upgrade-strip strong {
    color: var(--customize-text);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
}

#customize-screen .customize-upgrade-strip p {
    margin: 5px 0 0;
    color: var(--customize-muted);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.96rem;
    line-height: 1.32;
}

#customize-screen .customize-credit-cta {
    min-width: 148px;
    padding: 11px 14px;
    border: 1px solid rgba(255, 209, 102, 0.42);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(255, 209, 102, 0.22), rgba(132, 208, 255, 0.16));
    color: var(--customize-text);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

#customize-screen .customize-credit-cta:hover {
    border-color: rgba(255, 209, 102, 0.72);
    background: linear-gradient(135deg, rgba(255, 209, 102, 0.3), rgba(132, 208, 255, 0.22));
    transform: translateY(-1px);
}

#customize-screen .customize-filter-bar {
    margin: 0 0 10px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    touch-action: pan-x;
    padding-bottom: 2px;
}

#customize-screen .customize-filter-btn {
    min-width: 86px;
    min-height: 40px;
    padding: 7px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid rgba(132, 169, 197, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--customize-muted);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.92rem;
    cursor: pointer;
    flex: 0 0 auto;
}

#customize-screen .customize-filter-btn strong {
    min-width: 24px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(132, 208, 255, 0.12);
    color: var(--customize-text);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.68rem;
}

#customize-screen .customize-filter-btn.active {
    border-color: rgba(255, 209, 102, 0.46);
    background: rgba(255, 209, 102, 0.12);
    color: var(--customize-text);
}

#customize-screen .customize-result-summary {
    margin: 0 0 12px;
    color: #b7c8d8;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.94rem;
}

#customize-screen .customize-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));
    gap: 14px;
}

#customize-screen .cosmetic-item {
    appearance: none;
    width: 100%;
    min-height: 250px;
    padding: 18px 16px 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
    border: 1px solid rgba(132, 169, 197, 0.18);
    border-radius: 10px;
    background: var(--customize-card);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.16);
    color: inherit;
    font: inherit;
    cursor: pointer;
}

#customize-screen .cosmetic-item:hover {
    transform: translateY(-3px);
    background: var(--customize-card-hover);
    border-color: rgba(132, 208, 255, 0.44);
    box-shadow: 0 20px 34px rgba(0, 0, 0, 0.2);
}

#customize-screen .cosmetic-item.selected {
    border-color: rgba(255, 209, 102, 0.54);
    background: linear-gradient(180deg, rgba(52, 45, 26, 0.96), rgba(21, 19, 12, 0.96));
    box-shadow: 0 20px 34px rgba(0, 0, 0, 0.24);
}

#customize-screen .cosmetic-item:focus-visible,
#customize-screen .customize-filter-btn:focus-visible,
#customize-screen .tab-btn:focus-visible,
#customize-screen .customize-credit-cta:focus-visible {
    outline: 2px solid rgba(231, 244, 255, 0.96);
    outline-offset: 3px;
}

#customize-screen .cosmetic-item.tier-epic,
#customize-screen .cosmetic-item.tier-legendary {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 18px 34px rgba(0, 0, 0, 0.22),
        0 0 24px color-mix(in srgb, var(--cosmetic-a, #84d0ff) 12%, transparent);
}

#customize-screen .cosmetic-item.tier-legendary {
    border-color: rgba(255, 209, 102, 0.36);
}

#customize-screen .cosmetic-item.locked {
    opacity: 1;
    border-color: rgba(120, 135, 151, 0.22);
    background: linear-gradient(180deg, rgba(24, 31, 40, 0.94), rgba(12, 17, 23, 0.94));
    cursor: pointer;
}

#customize-screen .cosmetic-item.available {
    border-color: rgba(255, 209, 102, 0.34);
}

#customize-screen .cosmetic-item.cant-afford {
    border-color: rgba(255, 129, 112, 0.28);
}

#customize-screen .cosmetic-item.locked::after {
    content: none;
}

#customize-screen .cosmetic-badge {
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(132, 208, 255, 0.14);
    color: var(--customize-accent);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#customize-screen .cosmetic-item.selected .cosmetic-badge {
    background: rgba(255, 209, 102, 0.18);
    color: var(--customize-accent-2);
}

#customize-screen .cosmetic-item.locked .cosmetic-badge {
    background: rgba(121, 136, 149, 0.12);
    color: #9aa9b5;
}

#customize-screen .cosmetic-card-visual {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#customize-screen .cosmetic-swatch {
    width: 62px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background:
        linear-gradient(135deg, var(--cosmetic-a, #84d0ff), var(--cosmetic-b, #111a24));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 0 18px color-mix(in srgb, var(--cosmetic-a, #84d0ff) 28%, transparent);
}

#customize-screen .cosmetic-tier {
    min-width: 82px;
    padding: 5px 8px;
    border-radius: 8px;
    text-align: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(132, 169, 197, 0.14);
    color: #dbeaff;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#customize-screen .cosmetic-emoji {
    margin: 0;
    font-size: 2rem;
}

#customize-screen .cosmetic-name {
    margin: 0;
    color: var(--customize-text);
    font-size: 1.04rem;
    overflow-wrap: anywhere;
}

#customize-screen .cosmetic-live-read {
    margin-top: -5px;
    color: var(--customize-accent);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.64rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#customize-screen .cosmetic-flavor {
    min-height: 54px;
    color: var(--customize-muted);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#customize-screen .cosmetic-impact {
    width: 100%;
    margin-top: -2px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(132, 169, 197, 0.11);
}

#customize-screen .cosmetic-impact span {
    color: var(--customize-muted);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#customize-screen .cosmetic-impact strong {
    color: var(--customize-accent-2);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.86rem;
}

#customize-screen .cosmetic-cost {
    margin-top: auto;
    min-height: 32px;
    color: #cde9ff;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

#customize-screen .cosmetic-cost.unlocked {
    color: #80f1af;
}

#customize-screen .cosmetic-cost.available {
    color: var(--customize-accent-2);
}

#customize-screen .cosmetic-requirement {
    color: #8ea4b7;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#customize-screen .face-customization-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(220px, 260px);
    gap: 18px;
    align-items: start;
}

#customize-screen .face-upload-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#customize-screen .face-upload-area {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

#customize-screen .upload-btn,
#customize-screen .remove-btn {
    padding: 12px 18px;
    border-radius: 14px;
    border: 1px solid rgba(132, 169, 197, 0.22);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
}

#customize-screen .upload-btn {
    background: rgba(132, 208, 255, 0.14);
    color: var(--customize-text);
}

#customize-screen .upload-btn:hover {
    background: rgba(132, 208, 255, 0.24);
    box-shadow: none;
}

#customize-screen .remove-btn {
    background: rgba(255, 107, 107, 0.12);
    color: #ffdede;
    border-color: rgba(255, 107, 107, 0.22);
}

#customize-screen .remove-btn:hover {
    background: rgba(255, 107, 107, 0.22);
}

#customize-screen .face-description {
    margin: 0;
    color: var(--customize-muted);
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    line-height: 1.45;
}

#customize-screen .face-info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

#customize-screen .face-info-card {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(132, 169, 197, 0.12);
}

#customize-screen .face-info-card strong,
#customize-screen .face-info-card span {
    display: block;
}

#customize-screen .face-info-card strong {
    margin-bottom: 6px;
    color: var(--customize-accent-2);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#customize-screen .face-info-card span {
    color: var(--customize-text);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.94rem;
}

#customize-screen .face-preview-container {
    padding: 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(132, 169, 197, 0.14);
    text-align: center;
}

#customize-screen .face-preview-container h4 {
    margin: 0 0 12px;
    color: var(--customize-text);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.92rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#customize-screen #face-preview-box {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(9, 16, 24, 0.96), rgba(4, 8, 14, 0.98));
    border: 1px dashed rgba(132, 208, 255, 0.22);
}

#customize-screen .face-preview-img {
    max-width: 100%;
    max-height: 190px;
    object-fit: cover;
    border-radius: 8px;
}

#customize-screen .customize-empty-state {
    grid-column: 1 / -1;
    min-height: 140px;
    display: grid;
    place-content: center;
    gap: 8px;
    padding: 24px;
    border: 1px dashed rgba(132, 169, 197, 0.28);
    border-radius: 10px;
    color: var(--customize-muted);
    text-align: center;
    font-family: 'Rajdhani', sans-serif;
}

#customize-screen .customize-empty-state strong {
    color: var(--customize-text);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.06em;
}

#customize-screen .face-preview-placeholder {
    padding: 0 18px;
    color: var(--customize-muted);
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
}

@media (max-width: 1024px) {
    #customize-screen #customize-content {
        grid-template-columns: 1fr;
    }

    #customize-screen #customize-preview {
        position: static;
    }

    #customize-screen .customize-category-head,
    #customize-screen .face-customization-layout {
        grid-template-columns: 1fr;
        display: grid;
    }

    #customize-screen .customize-upgrade-strip {
        grid-template-columns: 1fr;
    }

    #customize-screen .customize-credit-cta {
        width: 100%;
    }
}

@media (max-width: 720px) {
    #customize-screen #customize-container {
        width: calc(100vw - 20px);
        max-height: calc(var(--goregrid-vvh, 100dvh) - 20px);
        padding: 16px 12px;
    }

    #customize-screen .customize-preview-stage {
        min-height: 248px;
        padding: 10px;
    }

    #customize-screen .customize-preview-title {
        font-size: 1.25rem;
    }

    #customize-screen .customize-preview-copy,
    #customize-screen .customize-preview-note {
        font-size: 0.9rem;
    }

    #customize-screen #player-stats,
    #customize-screen .face-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #customize-screen #player-stats p {
        min-height: 54px;
        padding: 10px;
    }

    #customize-screen .tab-btn {
        flex-basis: 82px;
    }

    #customize-screen .customize-category-panel,
    #customize-screen .face-customization-container {
        padding: 16px 12px;
    }

    #customize-screen .customize-items-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 380px) {
    #customize-screen #player-stats,
    #customize-screen .face-info-grid {
        grid-template-columns: 1fr;
    }

    #customize-screen #customize-container h1 {
        font-size: 1.5rem;
    }
}

@media (pointer: coarse) and (max-height: 520px) {
    #customize-screen {
        padding: 6px;
    }

    #customize-screen #customize-container {
        width: calc(var(--goregrid-vvw, 100vw) - 12px);
        max-height: calc(var(--goregrid-vvh, 100dvh) - 12px);
        padding: 10px;
        border-radius: 12px;
    }

    #customize-screen .customize-brand,
    #customize-screen #customize-subtitle,
    #customize-screen .customize-preview-head,
    #customize-screen .customize-preview-note {
        display: none;
    }

    #customize-screen #customize-container h1 {
        margin-bottom: 8px;
        font-size: 1.18rem;
        letter-spacing: 0.05em;
    }

    #customize-screen #customize-content {
        gap: 10px;
    }

    #customize-screen #customize-preview {
        display: none;
    }

    #customize-screen .customize-tabs {
        padding: 6px;
        gap: 5px;
        border-radius: 10px;
    }

    #customize-screen .tab-btn {
        flex-basis: 70px;
        min-height: 38px;
        padding: 6px 8px;
        font-size: 0.72rem;
    }

    #customize-screen .tab-btn__meta,
    #customize-screen .customize-category-description,
    #customize-screen .customize-category-summary {
        display: none;
    }

    #customize-screen .customize-upgrade-strip {
        display: flex;
        margin: 0 0 8px;
        padding: 6px;
        border-radius: 8px;
    }

    #customize-screen .customize-upgrade-strip__copy {
        display: none;
    }

    #customize-screen .customize-credit-cta {
        min-height: 36px;
        width: 100%;
        padding: 7px 10px;
        font-size: 0.62rem;
        letter-spacing: 0.05em;
    }

    #customize-screen .customize-category-panel,
    #customize-screen .face-customization-container {
        padding: 10px;
        border-radius: 10px;
    }

    #customize-screen .customize-category-head,
    #customize-screen .face-customization-layout {
        gap: 10px;
    }

    #customize-screen .customize-category-copy h3 {
        font-size: 1.05rem;
    }
}

/* NOTIFICA SBLOCCO */
.unlock-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: linear-gradient(135deg, #ff00ff, #00ffff);
    color: #fff;
    padding: 20px;
    border-radius: 15px;
    font-family: 'Orbitron', sans-serif;
    z-index: 500;
    animation: slideIn 0.3s ease;
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.8);
}

.unlock-content h2 {
    margin: 0 0 10px 0;
    font-size: 1.5rem;
    text-transform: uppercase;
}

.unlock-content p {
    margin: 5px 0;
    font-size: 1.1rem;
}

.unlock-category {
    font-size: 0.9rem;
    opacity: 0.9;
    color: #000;
}

/* PULSANTE SHOP IN GIOCO */
body .shop-btn-game {
    background: linear-gradient(180deg, rgba(255, 77, 109, 0.18), rgba(127, 247, 255, 0.12));
    border-color: rgba(255, 77, 109, 0.34);
}

body .shop-btn-game:hover {
    box-shadow: none;
}

.run-banner {
    position: fixed;
    top: 102px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 280px;
    max-width: min(760px, calc(100vw - 32px));
    padding: 14px 18px;
    border-radius: 16px;
    border: 1px solid rgba(196, 214, 231, 0.4);
    background:
        linear-gradient(180deg, rgba(34, 47, 61, 0.96), rgba(10, 15, 22, 0.96));
    color: #f2f7fc;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 1px;
    z-index: 1800;
    pointer-events: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.32);
    animation: runBannerIn 0.22s ease-out;
}

.run-banner strong {
    display: block;
    margin-bottom: 4px;
    color: #ffffff;
    font-size: 1.05rem;
}

.run-banner--pvp-match {
    top: 50%;
    transform: translate(-50%, -50%);
    animation: runBannerCenterIn 0.22s ease-out;
}

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

@keyframes runBannerCenterIn {
    from { transform: translate(-50%, calc(-50% - 10px)); opacity: 0; }
    to { transform: translate(-50%, -50%); opacity: 1; }
}

/* PULSANTI MENU */
.menu-btn {
    padding: 15px 40px;
    font-size: 1.5rem;
    font-family: 'Orbitron', sans-serif;
    background: linear-gradient(180deg, #3d4f63 0%, #243445 100%);
    color: #ecf4ff;
    border: 1px solid #8ca8c3;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.menu-btn:hover {
    background: linear-gradient(180deg, #4a6078 0%, #304659 100%);
    color: #ffffff;
    box-shadow: 0 0 30px rgba(147, 175, 203, 0.35);
    transform: scale(1.05);
}

@keyframes slideIn {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(400px); opacity: 0; }
}

/* ===================================================
   GAME OVER SCREEN DEDICATO
   =================================================== */
#game-over-screen {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.90);
    backdrop-filter: blur(10px);
    z-index: 600;
    pointer-events: auto;
}

.game-over-content {
    background: linear-gradient(135deg, #1a0000 0%, #0d0000 100%);
    border: 2px solid #cc0000;
    border-radius: 20px;
    padding: 44px 64px;
    text-align: center;
    box-shadow:
        0 0 60px rgba(204, 0, 0, 0.55),
        0 0 120px rgba(100, 0, 0, 0.30),
        inset 0 1px 0 rgba(255, 80, 80, 0.15);
    max-width: 520px;
    width: 90%;
    animation: gameOverAppear 0.45s cubic-bezier(0.17, 0.89, 0.32, 1.28) both;
}

@keyframes gameOverAppear {
    from { transform: scale(0.75); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.game-over-title {
    font-family: 'Orbitron', sans-serif;
    color: #ff2222;
    font-size: clamp(1.8rem, 5vw, 3rem);
    margin: 0 0 24px;
    text-transform: uppercase;
    text-shadow: 0 0 24px rgba(255, 0, 0, 0.75), 0 0 48px rgba(180, 0, 0, 0.40);
    letter-spacing: 4px;
    animation: goTitlePulse 1.6s ease-in-out infinite;
}

@keyframes goTitlePulse {
    0%, 100% { text-shadow: 0 0 24px rgba(255,0,0,0.75), 0 0 48px rgba(180,0,0,0.40); }
    50%       { text-shadow: 0 0 36px rgba(255,50,50,1),  0 0 70px rgba(200,0,0,0.65); }
}

.game-over-content p {
    color: #e8f0ff;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.9rem, 2.5vw, 1.15rem);
    margin: 10px 0;
    letter-spacing: 1px;
}

.game-over-buttons {
    display: flex;
    gap: 18px;
    justify-content: center;
    margin-top: 34px;
    flex-wrap: wrap;
}

.game-over-btn {
    padding: 14px 36px;
    font-size: clamp(0.85rem, 2.2vw, 1.05rem);
    font-family: 'Orbitron', sans-serif;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 160px;
    position: relative;
    overflow: hidden;
}

.game-over-btn--primary {
    background: linear-gradient(135deg, #cc0000 0%, #880000 100%);
    color: #ffffff;
    border: 1px solid #ff4444;
    box-shadow: 0 4px 18px rgba(200, 0, 0, 0.45);
}

.game-over-btn--primary:hover {
    background: linear-gradient(135deg, #ff2222 0%, #cc0000 100%);
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 28px rgba(255, 0, 0, 0.65);
}

.game-over-btn--primary:active {
    transform: translateY(0) scale(0.98);
}

.game-over-btn--secondary {
    background: linear-gradient(135deg, #1e3048 0%, #12202e 100%);
    color: #c8dff2;
    border: 1px solid #4a7ba0;
    box-shadow: 0 4px 14px rgba(74, 123, 160, 0.30);
}

.game-over-btn--secondary:hover {
    background: linear-gradient(135deg, #2a4260 0%, #1a2e40 100%);
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 24px rgba(74, 123, 160, 0.55);
}

.game-over-btn--secondary:active {
    transform: translateY(0) scale(0.98);
}

@media (max-width: 520px) {
    .game-over-content {
        padding: 28px 22px;
    }
    .game-over-buttons {
        flex-direction: column;
        align-items: center;
    }
    .game-over-btn {
        width: 100%;
        min-width: unset;
    }
}
/* ===== fine GAME OVER SCREEN ===== */

/* Effetti neon */
.neon-text {
    text-shadow: 0 0 5px currentColor, 0 0 10px currentColor, 0 0 15px currentColor;
}

@keyframes neon-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.neon-flicker {
    animation: neon-flicker 2s infinite;
}

/* ============================================
   NATURE ANIMATION EFFECTS
   ============================================ */

/* Leaf falling animation */
@keyframes leaf-fall {
    0% {
        transform: translateY(-20px) rotate(0deg) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

.nature-leaf {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    animation: leaf-fall linear forwards;
}

/* Pollen floating animation */
@keyframes pollen-float {
    0%, 100% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0.6;
    }
    25% {
        transform: translateY(-15px) translateX(10px) scale(1.2);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-5px) translateX(-5px) scale(0.9);
        opacity: 0.5;
    }
    75% {
        transform: translateY(-20px) translateX(15px) scale(1.1);
        opacity: 0.7;
    }
}

.nature-pollen {
    position: fixed;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, #ffff99 0%, #ffdd44 100%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 999;
    animation: pollen-float 4s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(255, 221, 68, 0.6);
}

/* Firefly glow animation */
@keyframes firefly-glow {
    0%, 100% {
        opacity: 0.2;
        transform: scale(0.8);
        box-shadow: 0 0 4px rgba(255, 255, 68, 0.3);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.3);
        box-shadow: 0 0 12px rgba(255, 255, 68, 0.8), 0 0 20px rgba(255, 200, 0, 0.4);
    }
}

@keyframes firefly-drift {
    0% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(30px, -20px);
    }
    50% {
        transform: translate(-15px, -40px);
    }
    75% {
        transform: translate(20px, -10px);
    }
    100% {
        transform: translate(0, 0);
    }
}

.nature-firefly {
    position: fixed;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, #ffff44 0%, #ffaa00 100%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1001;
    animation: 
        firefly-glow 2s ease-in-out infinite,
        firefly-drift 8s ease-in-out infinite;
}

/* Butterfly wing animation */
@keyframes butterfly-wing {
    0%, 100% {
        transform: scaleX(1);
    }
    50% {
        transform: scaleX(0.3);
    }
}

@keyframes butterfly-fly {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(40px, -30px) rotate(15deg);
    }
    50% {
        transform: translate(-20px, -50px) rotate(-10deg);
    }
    75% {
        transform: translate(30px, -20px) rotate(20deg);
    }
    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

.nature-butterfly {
    position: fixed;
    pointer-events: none;
    z-index: 1002;
    animation: butterfly-fly 12s ease-in-out infinite;
}

.nature-butterfly::before,
.nature-butterfly::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 16px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: butterfly-wing 0.15s ease-in-out infinite;
}

.nature-butterfly::before {
    left: -10px;
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    transform-origin: right center;
}

.nature-butterfly::after {
    right: -10px;
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    transform-origin: left center;
    animation-delay: 0.075s;
}

/* Dew drop sparkle animation */
@keyframes dew-sparkle {
    0%, 100% {
        opacity: 0.4;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
        box-shadow: 0 0 8px rgba(170, 238, 255, 0.8);
    }
}

.nature-dew {
    position: fixed;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, #aaeeff 0%, #66ccff 100%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 998;
    animation: dew-sparkle 3s ease-in-out infinite;
}

/* Wind sway animation for UI elements */
@keyframes wind-sway {
    0%, 100% {
        transform: rotate(-2deg) translateX(0);
    }
    25% {
        transform: rotate(1deg) translateX(3px);
    }
    50% {
        transform: rotate(2deg) translateX(-2px);
    }
    75% {
        transform: rotate(-1deg) translateX(4px);
    }
}

.nature-sway {
    animation: wind-sway 4s ease-in-out infinite;
}

/* Seasonal color shift */
@keyframes seasonal-shift {
    0% {
        filter: hue-rotate(0deg) saturate(1);
    }
    25% {
        filter: hue-rotate(30deg) saturate(1.2);
    }
    50% {
        filter: hue-rotate(60deg) saturate(0.8);
    }
    75% {
        filter: hue-rotate(90deg) saturate(1.1);
    }
    100% {
        filter: hue-rotate(0deg) saturate(1);
    }
}

.nature-seasonal {
    animation: seasonal-shift 20s linear infinite;
}

/* Growth animation for plants */
@keyframes plant-grow {
    0% {
        transform: scale(0) translateY(20px);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) translateY(-5px);
        opacity: 1;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.nature-grow {
    animation: plant-grow 0.8s ease-out forwards;
}

/* Ripple effect for water */
@keyframes water-ripple {
    0% {
        transform: scale(0);
        opacity: 0.8;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

.nature-ripple {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(74, 144, 226, 0.6);
    border-radius: 50%;
    animation: water-ripple 2s ease-out forwards;
    pointer-events: none;
}

/* Particle burst effect */
@keyframes particle-burst {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(180deg);
        opacity: 0;
    }
}

.nature-burst {
    animation: particle-burst 0.6s ease-out forwards;
}

/* Ambient glow effect */
@keyframes ambient-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(100, 200, 100, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(100, 200, 100, 0.6), 0 0 30px rgba(50, 150, 50, 0.3);
    }
}

.nature-glow {
    animation: ambient-glow 3s ease-in-out infinite;
}

/* Fog drift animation */
@keyframes fog-drift {
    0% {
        transform: translateX(-100%) scaleX(1);
        opacity: 0;
    }
    10% {
        opacity: 0.15;
    }
    90% {
        opacity: 0.1;
    }
    100% {
        transform: translateX(100vw) scaleX(1.5);
        opacity: 0;
    }
}

.nature-fog {
    position: fixed;
    width: 300px;
    height: 100px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.1) 20%, 
        rgba(255, 255, 255, 0.15) 50%, 
        rgba(255, 255, 255, 0.1) 80%, 
        transparent 100%
    );
    pointer-events: none;
    z-index: 997;
    animation: fog-drift 15s linear infinite;
}

/* Snow fall animation */
@keyframes snow-fall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.nature-snow {
    position: fixed;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1000;
    animation: snow-fall linear forwards;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}

/* Sand dust animation */
@keyframes sand-drift {
    0% {
        transform: translateX(0) translateY(0) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: translateX(50px) translateY(-20px) scale(1.2);
        opacity: 0.5;
    }
    100% {
        transform: translateX(100px) translateY(0) scale(0.8);
        opacity: 0;
    }
}

.nature-sand {
    position: fixed;
    width: 3px;
    height: 3px;
    background: #c4a574;
    border-radius: 50%;
    pointer-events: none;
    z-index: 999;
    animation: sand-drift 6s ease-out forwards;
}

/* Mushroom spore animation */
@keyframes spore-float {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-30px) scale(1.3);
        opacity: 0.7;
    }
    100% {
        transform: translateY(-60px) scale(0.6);
        opacity: 0;
    }
}

.nature-spore {
    position: fixed;
    width: 3px;
    height: 3px;
    background: radial-gradient(circle, #88ff88 0%, #44aa44 100%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 998;
    animation: spore-float 4s ease-out forwards;
    box-shadow: 0 0 4px rgba(136, 255, 136, 0.5);
}

/* ============================================
   RESPONSIVE HUD & LAYOUT
   ============================================ */

@media (max-width: 1180px) {
    body {
        --ui-gap: 10px;
    }

    body #hud {
        grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
    }

    body #score-display {
        width: 100%;
        max-width: none;
        justify-self: stretch;
    }

    body #hud-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
        max-width: none;
    }
}

@media (max-width: 768px) {
    #loading-screen h1 { font-size: 2.2rem; }
    #menu-screen h1 { font-size: 2.8rem; }
    #mode-select { grid-template-columns: 1fr; width: min(620px, calc(100vw - 32px)); }

    body {
        --ui-gap: 9px;
        --ui-top-pad: calc(10px + env(safe-area-inset-top, 0px));
        --ui-right-pad: calc(12px + env(safe-area-inset-right, 0px));
        --ui-bottom-pad: calc(12px + env(safe-area-inset-bottom, 0px));
        --ui-left-pad: calc(12px + env(safe-area-inset-left, 0px));
    }

    body #hud {
        grid-template-columns: 1fr;
    }

    body #hud-actions {
        justify-content: stretch;
        flex-wrap: wrap;
    }

    body #game-ui[data-session-type='singleplayer'] #hud-actions {
        max-width: none;
    }

    body .hud-action-btn {
        flex: 1 1 160px;
        text-align: center;
    }

    body #storyline-hud-body {
        padding: 11px 12px 12px !important;
    }

    body #mission-hud-panel {
        padding: 11px 12px;
    }

    body .mission-hud__title {
        font-size: 0.72rem;
    }

    body .mission-hud__desc,
    body .mission-hud__reward {
        font-size: 0.66rem;
    }

    body .storyline-quest__row {
        gap: 8px;
    }

    body #health-bar { height: 16px; }
    body #hud-summary-text { gap: 6px; }
    body #hud-progress-text { font-size: 0.62rem; }
    body .hud-stat-pill {
        padding: 5px 8px;
        gap: 5px;
    }
    body .hud-stat-pill__label { font-size: 0.5rem; }
    body .hud-stat-pill__value { font-size: 0.72rem; }
}

@media (max-width: 520px) {
    #loading-screen h1 { font-size: 1.6rem; }
    #menu-screen h1 { font-size: 1.9rem; }
    #menu-screen p { font-size: 1.1rem; margin-bottom: 1.5rem; }
    .mode-card { min-height: unset; padding: 14px; }
    .mode-card__title { font-size: 0.9rem; }
    .mode-card__desc { font-size: 0.9rem; }
    .mode-card__meta { font-size: 0.74rem; }
    .menu-action-row { gap: 12px; }

    body {
        --ui-gap: 8px;
        --ui-top-pad: calc(8px + env(safe-area-inset-top, 0px));
        --ui-right-pad: calc(10px + env(safe-area-inset-right, 0px));
        --ui-bottom-pad: calc(10px + env(safe-area-inset-bottom, 0px));
        --ui-left-pad: calc(10px + env(safe-area-inset-left, 0px));
    }

    body #hud {
        grid-template-columns: 1fr;
    }

    body #score-display {
        min-height: auto;
    }

    body #health-label,
    body #health-value,
    body #hud-summary-text,
    body .hud-stat-pill__value {
        font-size: 0.58rem;
    }

    body #health-bar { height: 14px; }
    body #hud-summary-text {
        line-height: 1.5;
    }
    body #storyline-hud-header {
        padding: 10px 11px !important;
    }
    body #storyline-chapter-title {
        font-size: 0.68rem;
    }
    body .storyline-quest {
        padding: 8px 9px;
    }
    body .storyline-quest__title {
        font-size: 0.74rem;
    }
    body .storyline-quest__desc {
        font-size: 0.68rem;
    }
    body #storyline-dialogue-box {
        width: min(680px, calc(100vw - 18px)) !important;
        padding: 14px 14px 12px !important;
    }
    body #mission-hud-panel {
        padding: 10px 11px;
    }
    body .mission-hud__title {
        font-size: 0.68rem;
    }
    body .mission-hud__desc,
    body .mission-hud__reward,
    body .mission-hud__status,
    body .mission-hud__eyebrow,
    body #mission-hud-summary {
        font-size: 0.58rem;
    }
    body .hud-stat-pill {
        padding: 4px 7px;
        gap: 4px;
    }
    body .hud-stat-pill__label {
        font-size: 0.46rem;
        letter-spacing: 0.08em;
    }
    body #hud-progress-text {
        font-size: 0.54rem;
        letter-spacing: 0.05em;
    }
    body #hud-exp-track {
        height: 6px;
    }
    body #hud-actions {
        gap: 6px;
    }
    body .hud-action-btn {
        flex: 1 1 calc(50% - 6px);
        font-size: 0.66rem;
        padding: 10px 10px;
    }
}

@media (pointer: coarse) {
    body #leaderboard,
    body #chat-container {
        display: none !important;
    }
}

body #touch-controls {
    position: fixed;
    right: var(--ui-right-pad);
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    left: var(--ui-left-pad);
    z-index: 1450;
    display: none;
    grid-template-columns: minmax(96px, 150px) minmax(156px, 360px) minmax(96px, 150px);
    align-items: end;
    justify-content: space-between;
    gap: clamp(8px, 2vw, 18px);
    height: clamp(118px, 21dvh, 168px);
    pointer-events: none;
}

body[data-input-mode='touch'] #game-ui {
    padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px));
}

body[data-input-mode='touch'] #game-ui #touch-controls {
    display: grid;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] .touch-action-btn--chat {
    display: none;
}

body[data-input-mode='touch'] #hud {
    align-items: start;
}

body[data-input-mode='touch'] #score-display {
    min-height: 74px;
    padding: 9px 10px;
}

body[data-input-mode='touch'] #hud-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    max-width: none;
}

body[data-input-mode='touch'] #game-ui.pvp-match-active #hud-actions {
    display: none;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-input-mode='touch'] .hud-action-btn {
    min-height: 40px;
    padding: 8px 9px;
    border-radius: 10px;
    font-size: calc(0.58rem * var(--hud-font-scale, 1));
    letter-spacing: 0.08em;
}

body .touch-stick {
    position: relative;
    width: clamp(96px, 18vmin, 138px);
    aspect-ratio: 1;
    align-self: end;
    border: 1px solid rgba(168, 203, 235, 0.38);
    border-radius: 50%;
    background:
        linear-gradient(180deg, rgba(24, 34, 48, 0.72), rgba(8, 12, 18, 0.58));
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.38),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    pointer-events: auto;
    touch-action: none;
}

body .touch-stick--move {
    justify-self: start;
}

body .touch-stick--aim {
    justify-self: end;
    border-color: rgba(255, 190, 106, 0.44);
}

body .touch-stick.is-active {
    border-color: rgba(127, 247, 255, 0.58);
    background:
        linear-gradient(180deg, rgba(28, 54, 68, 0.78), rgba(10, 18, 24, 0.64));
}

body .touch-stick__label {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(229, 242, 255, 0.78);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
}

body .touch-stick__knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 42%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background:
        linear-gradient(180deg, rgba(231, 242, 255, 0.88), rgba(135, 165, 190, 0.62));
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
    transform: translate(-50%, -50%);
    transition: transform 0.08s linear;
    pointer-events: none;
}

body .touch-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(54px, 1fr));
    align-self: end;
    justify-self: center;
    gap: 8px;
    width: min(360px, 38vw);
    pointer-events: auto;
}

body .touch-action-btn {
    min-width: 0;
    min-height: 46px;
    padding: 8px 10px;
    border: 1px solid rgba(127, 247, 255, 0.28);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(21, 34, 48, 0.88), rgba(8, 13, 20, 0.78));
    color: #eef8ff;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.58rem;
    line-height: 1.05;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
    pointer-events: auto;
    touch-action: none;
}

body .touch-action-btn.is-active,
body .touch-action-btn:active {
    border-color: rgba(255, 190, 106, 0.62);
    background:
        linear-gradient(180deg, rgba(83, 55, 32, 0.9), rgba(24, 20, 16, 0.82));
}

body.touch-chat-open #game-ui[data-session-type='pvp'] #chat-container {
    display: block !important;
    position: fixed;
    left: var(--ui-left-pad);
    bottom: calc(clamp(168px, 23dvh, 196px) + env(safe-area-inset-bottom, 0px));
    width: min(420px, calc(100vw - 28px));
    z-index: 1700;
    pointer-events: auto;
}

body.touch-chat-open #game-ui[data-session-type='pvp'] #chat-messages {
    max-height: min(28dvh, 150px);
    touch-action: pan-y;
}

body.touch-chat-open #game-ui[data-session-type='pvp'] #chat-input {
    user-select: text;
    touch-action: manipulation;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud {
    grid-template-columns: minmax(156px, 222px) minmax(74px, 108px);
    gap: 7px;
    align-items: start;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud-sidebar {
    width: min(222px, 58vw);
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #score-display {
    display: none;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #combat-overview {
    padding: 8px 10px;
    gap: 6px;
    border-radius: 12px;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #health-container,
body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #weapon-display {
    gap: 5px;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #weapon-display {
    padding-top: 6px;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #health-bar {
    height: 12px;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #weapon-name {
    font-size: calc(0.82rem * var(--hud-font-scale, 1));
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    max-width: 108px;
    justify-self: end;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] .hud-action-btn {
    min-width: 0;
    min-height: 38px;
    padding: 7px 8px;
    border-radius: 10px;
}

body[data-input-mode='touch'][data-session-type='singleplayer'] .run-banner:not(.run-banner--pvp-match) {
    top: calc(var(--ui-top-pad) + 112px);
    bottom: auto;
    left: var(--ui-left-pad);
    min-width: 0;
    width: min(230px, calc(100vw - 24px));
    padding: 7px 10px;
    border-radius: 12px;
    font-size: 0.62rem;
    line-height: 1.22;
    letter-spacing: 0.06em;
    text-align: left;
    transform: none;
    opacity: 0.92;
}

body[data-input-mode='touch'][data-session-type='singleplayer'] .run-banner:not(.run-banner--pvp-match) strong {
    font-size: 0.72rem;
    margin-bottom: 2px;
}

body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud-actions {
    display: none;
}

@media (pointer: coarse) and (min-width: 641px) {
    body[data-input-mode='touch'][data-session-type='singleplayer'] .run-banner:not(.run-banner--pvp-match) {
        top: calc(var(--ui-top-pad) + 112px);
        left: 50%;
        width: min(340px, calc(100vw - 32px));
        text-align: center;
        transform: translateX(-50%);
    }
}

@media (max-width: 640px) and (pointer: coarse) {
    body[data-input-mode='touch'] {
        --hud-font-scale: 0.9;
    }

    body[data-input-mode='touch'] #game-ui {
        padding-bottom: calc(144px + env(safe-area-inset-bottom, 0px));
    }

    body[data-input-mode='touch'] #hud {
        grid-template-columns: 1fr;
    }

    body[data-input-mode='touch'] #hud-sidebar {
        width: 100%;
    }

    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud {
        grid-template-columns: minmax(150px, 1fr) minmax(74px, 96px);
    }

    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud-sidebar {
        width: min(218px, 62vw);
    }

    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud-ranks-btn {
        display: none;
    }

    body[data-input-mode='touch'] #score-display {
        min-height: 0;
        padding: 8px 9px;
    }

    body[data-input-mode='touch'] .hud-stat-pill:nth-child(4),
    body[data-input-mode='touch'] .hud-stat-pill:nth-child(5) {
        display: none;
    }

    body[data-input-mode='touch'] #hud-progress-row {
        display: none;
    }

    body[data-input-mode='touch'] #hud-actions,
    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body[data-input-mode='touch'][data-session-type='singleplayer'] .run-banner:not(.run-banner--pvp-match) {
        top: calc(var(--ui-top-pad) + 112px);
    }

    body #touch-controls {
        grid-template-columns: 98px minmax(132px, 1fr) 98px;
        height: 132px;
        gap: 6px;
    }

    body .touch-stick {
        width: 96px;
    }

    body .touch-stick__label {
        top: 8px;
        font-size: 0.5rem;
    }

    body .touch-actions {
        grid-template-columns: repeat(2, minmax(48px, 1fr));
        gap: 6px;
        width: min(232px, 44vw);
    }

    body .touch-action-btn {
        min-height: 42px;
        padding: 6px 7px;
        font-size: 0.52rem;
        letter-spacing: 0.05em;
    }

    body.touch-chat-open #game-ui[data-session-type='pvp'] #chat-container {
        bottom: calc(144px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 380px) and (pointer: coarse) {
    body[data-input-mode='touch'] {
        --hud-font-scale: 0.84;
        --ui-left-pad: calc(8px + env(safe-area-inset-left, 0px));
        --ui-right-pad: calc(8px + env(safe-area-inset-right, 0px));
    }

    body[data-input-mode='touch'] #game-ui {
        padding-bottom: calc(130px + env(safe-area-inset-bottom, 0px));
    }

    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud {
        grid-template-columns: minmax(138px, 1fr) minmax(68px, 88px);
        gap: 5px;
    }

    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud-sidebar {
        width: min(196px, 64vw);
    }

    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #combat-overview {
        padding: 7px 8px;
    }

    body[data-input-mode='touch'][data-session-type='singleplayer'] .run-banner:not(.run-banner--pvp-match) {
        width: min(288px, calc(100vw - 18px));
        padding: 7px 10px;
        font-size: 0.62rem;
    }

    body #touch-controls {
        grid-template-columns: 84px minmax(118px, 1fr) 84px;
        height: 120px;
        gap: 5px;
    }

    body .touch-stick {
        width: 84px;
    }

    body .touch-stick__label {
        top: 7px;
        font-size: 0.46rem;
    }

    body .touch-actions {
        width: min(188px, 37vw);
        grid-template-columns: repeat(2, minmax(44px, 1fr));
        gap: 5px;
    }

    body .touch-action-btn {
        min-height: 40px;
        padding: 5px 5px;
        font-size: 0.46rem;
        letter-spacing: 0.035em;
    }

    body.touch-chat-open #game-ui[data-session-type='pvp'] #chat-container {
        bottom: calc(132px + env(safe-area-inset-bottom, 0px));
        width: min(320px, calc(100vw - 18px));
    }
}

@media (pointer: coarse) and (orientation: portrait) and (max-height: 720px) {
    body[data-input-mode='touch'] {
        --hud-font-scale: 0.82;
        --ui-top-pad: calc(7px + env(safe-area-inset-top, 0px));
        --ui-left-pad: calc(8px + env(safe-area-inset-left, 0px));
        --ui-right-pad: calc(8px + env(safe-area-inset-right, 0px));
    }

    body[data-input-mode='touch'] #game-ui {
        padding-bottom: calc(114px + env(safe-area-inset-bottom, 0px));
    }

    body[data-input-mode='touch'] #hud-sidebar,
    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud-sidebar {
        width: min(188px, 56vw);
    }

    body[data-input-mode='touch'] #combat-overview,
    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #combat-overview {
        padding: 6px 8px;
        gap: 4px;
    }

    body[data-input-mode='touch'] #health-container,
    body[data-input-mode='touch'] #weapon-display {
        gap: 4px;
    }

    body[data-input-mode='touch'] #weapon-display {
        padding-top: 5px;
    }

    body[data-input-mode='touch'][data-session-type='singleplayer'] .run-banner:not(.run-banner--pvp-match) {
        display: none !important;
    }

    body #touch-controls {
        grid-template-columns: 82px minmax(138px, 1fr) 82px;
        height: 106px;
        gap: 5px;
    }

    body .touch-stick {
        width: 82px;
    }

    body .touch-actions {
        width: min(204px, 100%);
        grid-template-columns: repeat(3, minmax(44px, 1fr));
        gap: 5px;
    }

    body .touch-action-btn {
        min-height: 40px;
        padding: 5px 5px;
        font-size: 0.45rem;
        letter-spacing: 0.035em;
    }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 540px) {
    body[data-input-mode='touch'] {
        --hud-font-scale: 0.82;
    }

    body[data-input-mode='touch'] #game-ui {
        padding-bottom: calc(94px + env(safe-area-inset-bottom, 0px));
    }

    body[data-input-mode='touch'] #hud {
        grid-template-columns: minmax(170px, 210px) minmax(0, 1fr) minmax(84px, 110px);
        gap: 7px;
    }

    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud {
        grid-template-columns: minmax(168px, 210px) minmax(74px, 102px);
    }

    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud-sidebar {
        width: min(210px, 28vw);
    }

    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud-ranks-btn {
        display: none;
    }

    body[data-input-mode='touch'][data-session-type='singleplayer'] .run-banner:not(.run-banner--pvp-match) {
        display: none !important;
    }

    body[data-input-mode='touch'] #game-ui.pvp-match-active #hud {
        grid-template-columns: minmax(158px, 210px) minmax(0, 1fr);
    }

    body[data-input-mode='touch'] #game-ui.pvp-match-active #hud-actions {
        display: none;
    }

    body[data-input-mode='touch'] #game-ui.pvp-match-active #combat-overview {
        padding: 7px 9px;
        gap: 6px;
    }

    body[data-input-mode='touch'] #game-ui.pvp-match-active #health-container,
    body[data-input-mode='touch'] #game-ui.pvp-match-active #weapon-display {
        gap: 5px;
    }

    body[data-input-mode='touch'] #score-display {
        min-height: 0;
        padding: 7px 9px;
    }

    body[data-input-mode='touch'] #hud-progress-row {
        display: none;
    }

    body[data-input-mode='touch'] #hud-actions,
    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud-actions {
        grid-column: auto;
        grid-template-columns: 1fr;
        gap: 5px;
    }

    body #touch-controls {
        grid-template-columns: 84px minmax(150px, 286px) 84px;
        height: 94px;
        gap: 7px;
    }

    body .touch-stick {
        width: 82px;
    }

    body .touch-stick__label {
        display: none;
    }

    body .touch-actions {
        grid-template-columns: repeat(3, minmax(44px, 1fr));
        gap: 5px;
        width: min(286px, 34vw);
    }

    body .touch-action-btn {
        min-height: 40px;
        padding: 5px 6px;
        font-size: 0.46rem;
        letter-spacing: 0.04em;
    }

    body.touch-chat-open #game-ui[data-session-type='pvp'] #chat-container {
        bottom: calc(108px + env(safe-area-inset-bottom, 0px));
        width: min(340px, calc(100vw - 24px));
    }

    body.touch-chat-open #game-ui[data-session-type='pvp'] #chat-messages {
        max-height: 54px;
        padding: 8px;
    }

    body.touch-chat-open #game-ui[data-session-type='pvp'] #chat-input {
        padding: 8px;
    }
}

@media (pointer: coarse) and (orientation: portrait) and (max-width: 300px) {
    body[data-input-mode='touch'] {
        --ui-left-pad: calc(6px + env(safe-area-inset-left, 0px));
        --ui-right-pad: calc(6px + env(safe-area-inset-right, 0px));
    }

    body[data-input-mode='touch'] #game-ui {
        padding-bottom: calc(138px + env(safe-area-inset-bottom, 0px));
    }

    body #touch-controls {
        grid-template-columns: 64px minmax(120px, 1fr) 64px;
        height: 132px;
        gap: 3px;
    }

    body .touch-stick {
        width: 64px;
    }

    body .touch-stick__label {
        display: none;
    }

    body .touch-actions {
        width: min(96px, 100%);
        grid-template-columns: repeat(2, minmax(44px, 1fr));
        gap: 3px;
    }

    body .touch-action-btn {
        min-height: 40px;
        padding: 4px 3px;
        border-radius: 8px;
        font-size: 0.38rem;
        letter-spacing: 0.02em;
    }

    body[data-input-mode='touch'] #game-ui[data-session-type='singleplayer'] #hud-sidebar,
    body[data-input-mode='touch'] #game-ui.pvp-match-active #hud-sidebar,
    body[data-input-mode='touch'] #game-ui.pvp-match-active #hud {
        width: min(164px, 62vw);
    }

    body[data-input-mode='touch'][data-session-type='singleplayer'] .run-banner:not(.run-banner--pvp-match) {
        top: calc(var(--ui-top-pad) + 86px);
        width: min(190px, calc(100vw - 16px));
    }

    body.touch-chat-open #game-ui[data-session-type='pvp'] #chat-container {
        bottom: calc(148px + env(safe-area-inset-bottom, 0px));
        width: min(250px, calc(100vw - 12px));
    }

    body.touch-chat-open #game-ui[data-session-type='pvp'] #chat-messages {
        max-height: 84px;
    }
}

.ambient-menu-media {
    position: absolute;
    inset: 0;
    z-index: 40;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transform: scale(1.02);
    transition: opacity 0.45s ease, transform 0.8s ease;
}

.ambient-menu-media.is-active {
    opacity: 1;
    transform: scale(1);
}

.ambient-menu-media > * {
    position: absolute;
    inset: 0;
}

.ambient-menu-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.24) saturate(0.82) contrast(1.08);
    transform: scale(1.06);
    animation: ambient-menu-drift 18s ease-in-out infinite alternate;
}

.ambient-menu-media[data-surface='customize'] .ambient-menu-video {
    filter: brightness(0.18) blur(1px) saturate(0.7) contrast(1.02);
}

.ambient-menu-tint {
    background:
        radial-gradient(circle at 18% 14%, rgba(123, 214, 255, 0.14), transparent 26%),
        radial-gradient(circle at 82% 78%, rgba(255, 87, 127, 0.16), transparent 28%),
        linear-gradient(180deg, rgba(3, 6, 10, 0.18) 0%, rgba(3, 6, 10, 0.52) 100%);
}

.ambient-menu-grid {
    background:
        linear-gradient(rgba(139, 224, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 224, 255, 0.08) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.7) 18%, #000 100%);
    opacity: 0.45;
}

.ambient-menu-glow {
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 92, 132, 0.2), transparent 32%),
        radial-gradient(circle at 25% 100%, rgba(123, 214, 255, 0.12), transparent 28%);
}

.ambient-menu-vignette {
    background: radial-gradient(circle at center, transparent 38%, rgba(2, 3, 6, 0.7) 100%);
}

.ambient-menu-scanlines {
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.035),
        rgba(255, 255, 255, 0.035) 1px,
        transparent 1px,
        transparent 4px
    );
    mix-blend-mode: soft-light;
    opacity: 0.4;
}

@keyframes ambient-menu-drift {
    0% {
        transform: scale(1.06) translate3d(0, 0, 0);
    }

    100% {
        transform: scale(1.1) translate3d(-1.2%, 1%, 0);
    }
}

.goregrid-logo {
    display: block;
    height: auto;
    max-width: 100%;
    pointer-events: none;
    user-select: none;
}

#menu-screen {
    justify-content: flex-start !important;
    padding: clamp(28px, 5vh, 52px) 20px 34px;
    box-sizing: border-box;
    overflow-y: auto;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    background: linear-gradient(180deg, rgba(3, 6, 10, 0.18), rgba(3, 6, 10, 0.72));
    backdrop-filter: blur(8px);
}

.menu-brand {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: min(840px, 100%);
    margin: 0 auto 24px;
}

.menu-brand__eyebrow {
    color: rgba(245, 196, 120, 0.9);
    font-size: 0.78rem;
    letter-spacing: 0.34em;
    text-transform: uppercase;
}

.goregrid-logo--menu {
    width: min(580px, 78vw);
    filter:
        drop-shadow(0 20px 32px rgba(0, 0, 0, 0.44))
        drop-shadow(0 0 22px rgba(139, 224, 255, 0.12));
}

#menu-screen h1 {
    margin: 0;
    font-size: clamp(2.8rem, 6.5vw, 5rem);
    letter-spacing: 0.18em;
}

.menu-brand p {
    margin: 0;
    max-width: 760px;
    color: rgba(224, 233, 243, 0.78);
    font-size: clamp(1.05rem, 2.2vw, 1.35rem);
    line-height: 1.35;
}

#mode-select,
.menu-action-row,
#game-info {
    position: relative;
    z-index: 1;
}

#mode-select {
    width: min(980px, 100%);
    margin: 0 0 1.35rem;
}

.mode-card {
    backdrop-filter: blur(14px);
    background:
        radial-gradient(circle at top right, rgba(151, 178, 207, 0.2), transparent 42%),
        linear-gradient(180deg, rgba(10, 16, 24, 0.82), rgba(7, 10, 15, 0.9));
    border-color: rgba(174, 205, 231, 0.3);
}

.mode-card--accent {
    background:
        radial-gradient(circle at top right, rgba(255, 120, 150, 0.22), transparent 42%),
        linear-gradient(180deg, rgba(32, 12, 18, 0.84), rgba(13, 8, 14, 0.9));
}

#game-info {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(760px, 100%);
    margin-top: 0;
    padding: 18px 18px 20px;
    max-height: min(58vh, 520px);
    background: linear-gradient(180deg, rgba(6, 12, 18, 0.7), rgba(6, 10, 14, 0.82));
    border: 1px solid rgba(168, 191, 214, 0.22);
    backdrop-filter: blur(18px);
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.22);
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    z-index: 125;
}

#game-info .menu-info-head {
    position: sticky;
    top: 0;
    z-index: 2;
    order: 0;
    margin: -2px 0 0;
    padding-bottom: 8px;
    background: linear-gradient(180deg, rgba(6, 12, 18, 0.94), rgba(6, 12, 18, 0.74));
    backdrop-filter: blur(12px);
}

#game-info .control-guide-section {
    padding: 10px 12px 12px;
    border: 1px solid rgba(168, 191, 214, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
}

#game-info .control-guide-section h3 {
    margin-top: 0;
}

#game-info .control-guide-section[data-control-group='keyboard'] { order: 1; }
#game-info .control-guide-section[data-control-group='paths'] { order: 2; }
#game-info .control-guide-section[data-control-group='community'] { order: 3; }
#game-info .control-guide-section[data-control-group='controller'] { order: 4; }
#game-info .control-guide-section[data-control-group='touch'] { order: 5; }
#game-info .control-guide-section[data-control-group='systems'] { order: 6; }
#game-info .control-guide-section[data-control-group='weapons'] { order: 7; }
#game-info .control-guide-section[data-control-group='resources'] { order: 8; }
#game-info .control-guide-section[data-control-group='powerups'] { order: 9; }

body[data-input-mode='touch'] #game-info .control-guide-section[data-control-group='touch'],
body[data-input-mode='pointer'] #game-info .control-guide-section[data-control-group='keyboard'] {
    border-color: rgba(127, 247, 255, 0.42);
    background: linear-gradient(180deg, rgba(24, 52, 66, 0.5), rgba(8, 16, 24, 0.38));
    box-shadow: inset 0 0 0 1px rgba(127, 247, 255, 0.12);
}

body[data-input-mode='touch'] #game-info .control-guide-section[data-control-group='touch'] { order: 1; }
body[data-input-mode='touch'] #game-info .control-guide-section[data-control-group='paths'] { order: 2; }
body[data-input-mode='touch'] #game-info .control-guide-section[data-control-group='community'] { order: 3; }
body[data-input-mode='touch'] #game-info .control-guide-section[data-control-group='controller'] { order: 4; }
body[data-input-mode='touch'] #game-info .control-guide-section[data-control-group='keyboard'] { order: 5; }

#game-info.is-open {
    animation: menu-info-reveal 0.22s ease;
}

@keyframes menu-info-reveal {
    from {
        opacity: 0;
        transform: translate(-50%, 12px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

#customize-screen {
    padding: 24px;
    box-sizing: border-box;
    overflow-y: auto;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(180deg, rgba(3, 6, 10, 0.22), rgba(3, 6, 10, 0.68));
    backdrop-filter: blur(10px);
}

#customize-screen .customize-brand {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 6px auto 18px;
    pointer-events: none;
}

.goregrid-logo--customize {
    width: min(300px, 52vw);
    filter:
        drop-shadow(0 18px 34px rgba(0, 0, 0, 0.38))
        drop-shadow(0 0 18px rgba(132, 208, 255, 0.14));
}

.customize-brand__eyebrow {
    color: var(--customize-accent-2);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.76rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

#customize-screen #customize-container {
    isolation: isolate;
}

#customize-screen #customize-subtitle {
    max-width: 660px;
    margin-left: auto;
    margin-right: auto;
}

.discord-community-card {
    position: relative;
    z-index: 1;
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin: 18px auto 0;
    padding: 18px 20px;
    box-sizing: border-box;
    text-align: left;
    border: 1px solid rgba(114, 137, 218, 0.44);
    border-radius: 14px;
    background:
        radial-gradient(circle at top right, rgba(114, 137, 218, 0.24), transparent 42%),
        linear-gradient(180deg, rgba(14, 18, 32, 0.88), rgba(7, 10, 18, 0.92));
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
}

.discord-community-card__body {
    min-width: 0;
}

.discord-community-card__eyebrow {
    display: block;
    margin-bottom: 5px;
    color: #aebcff;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.discord-community-card h2 {
    margin: 0 0 6px;
    color: #f4f7ff;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1rem, 2vw, 1.28rem);
    letter-spacing: 0;
}

#menu-screen .discord-community-card p {
    max-width: 680px;
    margin: 0;
    color: rgba(229, 237, 255, 0.82);
    font-size: 0.98rem;
    line-height: 1.45;
}

.discord-community-card__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.discord-community-card__pills span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border: 1px solid rgba(174, 188, 255, 0.24);
    border-radius: 999px;
    color: #dce5ff;
    background: rgba(114, 137, 218, 0.16);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.discord-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(180, 192, 255, 0.46);
    border-radius: 10px;
    color: #ffffff;
    background: linear-gradient(135deg, #5865f2, #7b4dff);
    box-shadow: 0 10px 24px rgba(88, 101, 242, 0.26);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.discord-link:hover,
.discord-link:focus-visible {
    transform: translateY(-1px);
    filter: brightness(1.08);
    box-shadow: 0 14px 30px rgba(88, 101, 242, 0.36);
}

.discord-link--primary {
    min-height: 44px;
    padding: 0 18px;
    font-size: 0.86rem;
}

.discord-link--compact {
    min-height: 36px;
    padding: 0 13px;
    font-size: 0.78rem;
}

.control-guide-section--community {
    border-color: rgba(114, 137, 218, 0.34) !important;
    background:
        radial-gradient(circle at top right, rgba(114, 137, 218, 0.16), transparent 46%),
        rgba(255, 255, 255, 0.045) !important;
}

.control-guide-section--community .discord-link {
    margin-top: 10px;
}

.matchmaking-community-note {
    max-width: 420px;
    margin: 12px auto 8px;
    color: rgba(231, 238, 255, 0.82);
    font-size: 0.95rem;
    line-height: 1.4;
}

.matchmaking-content .discord-link {
    margin-bottom: 12px;
}

.game-over-community {
    margin: 20px auto 0;
    padding: 14px 16px;
    max-width: 560px;
    border: 1px solid rgba(114, 137, 218, 0.38);
    border-radius: 12px;
    background:
        radial-gradient(circle at top right, rgba(114, 137, 218, 0.18), transparent 46%),
        rgba(8, 12, 22, 0.72);
}

.game-over-community strong,
.game-over-community span {
    display: block;
    color: #f4f7ff;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 0;
}

.game-over-community strong {
    font-size: 1.05rem;
}

.game-over-community span {
    margin-top: 4px;
    color: rgba(231, 238, 255, 0.8);
    font-size: 0.94rem;
    line-height: 1.35;
}

.game-over-community .discord-link {
    margin-top: 12px;
}

@media (max-width: 960px) {
    #game-info {
        width: min(760px, calc(100vw - 24px));
    }

    .goregrid-logo--customize {
        width: min(260px, 64vw);
    }
}

@media (max-width: 720px) {
    #menu-screen {
        padding: 22px 14px 24px;
    }

    .menu-brand {
        gap: 8px;
        margin-bottom: 18px;
    }

    .menu-brand__eyebrow,
    .customize-brand__eyebrow {
        font-size: 0.66rem;
        letter-spacing: 0.24em;
    }

    .goregrid-logo--menu {
        width: min(360px, 88vw);
    }

    .goregrid-logo--customize {
        width: min(220px, 74vw);
    }

    .menu-brand p {
        font-size: 1rem;
    }

    .founding-event-card {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px;
    }

    .founding-event-card__actions {
        justify-content: stretch;
    }

    .founding-event-card__btn,
    .founding-event-card__link {
        flex: 1 1 150px;
    }

    .discord-community-card {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 15px;
    }

    .discord-link--primary {
        width: 100%;
    }

    #game-info {
        padding: 16px;
        bottom: 12px;
        width: calc(100vw - 20px);
        max-height: min(62vh, 540px);
    }

    #customize-screen {
        padding: 10px;
    }
}

@media (max-width: 520px) {
    .founding-event-card {
        margin-bottom: 14px;
    }

    .founding-event-card strong {
        font-size: 0.92rem;
    }

    #menu-screen .founding-event-card p {
        font-size: 0.86rem;
    }

    .founding-event-card__btn,
    .founding-event-card__link {
        width: 100%;
        flex-basis: 100%;
    }

    .discord-community-card {
        margin-top: 14px;
    }

    .discord-community-card h2 {
        font-size: 0.95rem;
    }

    #menu-screen .discord-community-card p {
        font-size: 0.9rem;
    }

    .discord-community-card__pills span {
        font-size: 0.68rem;
        min-height: 24px;
    }

    .game-over-community {
        padding: 12px;
    }
}

@media (max-width: 640px) {
    .first-run-brief {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
        text-align: left;
    }

    .settings-control {
        grid-template-columns: 1fr;
    }
}

body[data-input-mode='touch'] .onboarding-guide {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: calc(var(--ui-bottom-pad) + 142px);
    width: min(330px, calc(100vw - 24px));
    max-height: min(36dvh, 320px);
}

body[data-input-mode='touch'][data-session-type='pvp'] .onboarding-guide {
    display: none !important;
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 540px) {
    body[data-input-mode='touch'] .onboarding-guide {
        right: var(--ui-right-pad);
        left: auto;
        transform: none;
        bottom: calc(var(--ui-bottom-pad) + 92px);
        width: min(300px, 40vw);
        padding: 9px 10px;
    }

    body[data-input-mode='touch'] .onboarding-guide__steps li {
        font-size: calc(0.78rem * var(--goregrid-text-user-scale, 1));
    }

    body[data-input-mode='touch'] .onboarding-guide__tip,
    body[data-input-mode='touch'] .onboarding-guide__reward {
        padding: 6px 8px;
        font-size: calc(0.72rem * var(--goregrid-text-user-scale, 1)) !important;
    }
}
