/* ==========================================================================
   Survival Multiplayer - Rock-Solid Stylesheet
   Now with a full animation layer (transform/opacity only, GPU-friendly)
   ========================================================================== */

:root {
    --bg-dark: #060309;
    --bg-card: #140b1f;
    --bg-card-border: #3d1f52;
    --accent-gold: #ff2ec4;
    --accent-red: #ff3860;
    --accent-green: #39ff88;
    --accent-blue: #00e5ff;
    --accent-purple: #b026ff;
    --text-primary: #f4f0fa;
    --text-muted: #a894c2;
    --font-heading: 'Chakra Petch', sans-serif;
    --font-body: 'Rubik', sans-serif;

    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-body);
    color: var(--text-primary);
    overscroll-behavior: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: #121214;
    touch-action: none;
}

/* ==========================================================================
   ANIMATION LAYER
   All animations use transform/opacity so they stay on the GPU compositor
   and remain smooth even on lower-end mobile devices.
   ========================================================================== */

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.88) translateY(14px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fadeDown {
    0% { opacity: 0; transform: translateY(-14px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
    0% { opacity: 0; transform: translateY(16px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.96); }
}

@keyframes floatLoop {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes glowPulse {
    0%, 100% { text-shadow: 0 0 16px rgba(255, 46, 196, 0.4); }
    50% { text-shadow: 0 0 28px rgba(255, 46, 196, 0.75), 0 0 6px rgba(255,255,255,0.3); }
}

@keyframes staggerIn {
    0% { opacity: 0; transform: translateY(18px) scale(0.94); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tapPulse {
    0% { transform: scale(1); }
    40% { transform: scale(0.93); }
    100% { transform: scale(1); }
}

@keyframes shakeIn {
    0% { opacity: 0; transform: translateY(10px) rotate(0deg) scale(0.9); }
    30% { transform: translateX(-6px) rotate(-1.5deg) scale(1.01); }
    50% { transform: translateX(5px) rotate(1.2deg); }
    70% { transform: translateX(-3px) rotate(-0.6deg); }
    100% { opacity: 1; transform: translateX(0) rotate(0deg) scale(1); }
}

@keyframes hpLowPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.6); }
    50% { box-shadow: 0 0 22px rgba(239, 68, 68, 1); }
}

@keyframes barContainerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.035); }
}

@keyframes waveBadgePop {
    0% { transform: scale(0.7); opacity: 0; }
    60% { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes materialsBounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.3) rotate(-6deg); }
    60% { transform: scale(0.95) rotate(3deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes joystickAppear {
    0% { opacity: 0; transform: scale(0.6); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes ringSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes cardSelected {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1.02); }
}

@keyframes screenShakeSm {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes toastIn {
    0% { opacity: 0; transform: translateY(-16px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
    0% { opacity: 1; transform: translateY(0) scale(1); max-height: 60px; margin-bottom: 8px; }
    100% { opacity: 0; transform: translateY(-8px) scale(0.95); max-height: 0; margin-bottom: 0; }
}

/* Wave Complete transition */
@keyframes scaleIn {
    0% { opacity: 0; transform: scale(0.3) rotate(-25deg); }
    55% { opacity: 1; transform: scale(1.18) rotate(8deg); }
    75% { transform: scale(0.96) rotate(-3deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes fadeInUp {
    0% { opacity: 0; transform: translateY(28px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes progressFill {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes wcBackdropIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.anim-pop-in { animation: popIn 0.38s var(--ease-out-back) both; }
.anim-fade-down { animation: fadeDown 0.45s var(--ease-smooth) both; }
.anim-fade-up { animation: fadeUp 0.45s var(--ease-smooth) both; animation-delay: 0.05s; }
.anim-fade-up.d1 { animation-delay: 0.12s; }
.anim-fade-up.d2 { animation-delay: 0.18s; }
.anim-fade-up.d3 { animation-delay: 0.24s; }
.anim-fade-up.d4 { animation-delay: 0.3s; }
.anim-fade-out { animation: fadeOut 0.2s ease-in both; }
.anim-float { animation: floatLoop 3.2s ease-in-out infinite; will-change: transform; }
.anim-glow { animation: glowPulse 2.4s ease-in-out infinite; }
.anim-tap { animation: tapPulse 0.2s ease-out; }
.anim-shake-in { animation: shakeIn 0.5s var(--ease-smooth) both; }

.anim-stagger {
    opacity: 0;
    animation: staggerIn 0.42s var(--ease-out-back) both;
    animation-delay: var(--d, 0s);
}

/* --- TOAST NOTIFICATIONS (replaces blocking native alert()) --- */
.toast-container {
    position: absolute;
    top: 84px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    width: min(88vw, 420px);
}

.toast {
    pointer-events: auto;
    width: 100%;
    box-sizing: border-box;
    background: rgba(24, 24, 27, 0.96);
    border: 1px solid var(--bg-card-border);
    border-left: 4px solid var(--accent-red);
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13.5px;
    line-height: 1.35;
    color: var(--text-primary);
    text-align: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    will-change: transform, opacity;
    animation: toastIn 0.32s var(--ease-out-back) both,
               toastOut 0.35s ease-in both;
    animation-delay: 0s, var(--toast-life, 3s);
}

.toast.toast-info { border-left-color: var(--accent-blue); }
.toast.toast-success { border-left-color: var(--accent-green); }

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .anim-pop-in, .anim-fade-down, .anim-fade-up, .anim-fade-out,
    .anim-float, .anim-glow, .anim-tap, .anim-shake-in, .anim-stagger,
    .toast {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* --- TOP HUD --- */
#hud {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 50;
}

.hud-left, .hud-right {
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}

.hud-bar-container {
    display: flex;
    align-items: center;
    background: rgba(18, 18, 20, 0.95);
    border: 1px solid var(--bg-card-border);
    border-radius: 8px;
    padding: 6px 10px;
    gap: 8px;
    transition: transform 0.15s var(--ease-out-back);
    will-change: transform;
}

.hud-bar-container.pulse {
    animation: barContainerPulse 0.3s var(--ease-out-back);
}

.bar-label {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 13px;
    color: var(--accent-gold);
}

.bar-track {
    position: relative;
    width: 130px;
    height: 16px;
    background: #27272a;
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    transition: width 0.2s var(--ease-smooth);
    will-change: width;
}

.hp-fill {
    background: linear-gradient(90deg, #dc2626, #ef4444);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.hp-fill.low-hp {
    animation: hpLowPulse 0.9s ease-in-out infinite;
}

.xp-fill {
    background: linear-gradient(90deg, #2563eb, #38bdf8);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hud-wave-badge {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
    color: #ffffff;
    background: rgba(24, 24, 27, 0.95);
    padding: 4px 16px;
    border-radius: 20px;
    border: 1px solid rgba(239, 68, 68, 0.5);
    text-transform: uppercase;
    animation: waveBadgePop 0.4s var(--ease-out-back);
}

.hud-timer-badge {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 22px;
    color: var(--accent-gold);
    text-shadow: 0 0 8px rgba(255, 46, 196, 0.6);
    transition: color 0.2s ease, transform 0.15s ease;
}

.hud-timer-badge.urgent {
    color: var(--accent-red);
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
    animation: tapPulse 1s ease-in-out infinite;
}

.hud-materials-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(18, 18, 20, 0.95);
    border: 1px solid rgba(255, 46, 196, 0.6);
    border-radius: 8px;
    padding: 6px 12px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
    color: var(--accent-gold);
}

.hud-materials-box .mat-icon {
    display: inline-block;
    transform-origin: center;
    will-change: transform;
}

.currency-icon {
    display: inline-block;
    width: 1.15em;
    height: 1.15em;
    object-fit: contain;
    vertical-align: -0.2em;
}

.hud-materials-box .currency-icon {
    width: 1.4em;
    height: 1.4em;
    vertical-align: middle;
}

.wc-stat-icon.currency-icon {
    width: 1.25em;
    height: 1.25em;
    vertical-align: middle;
}

.hud-materials-box.bump .mat-icon {
    animation: materialsBounce 0.4s var(--ease-out-back);
}

.hud-ping {
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--accent-green);
    background: rgba(18, 18, 20, 0.95);
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--bg-card-border);
}

.hud-icon-btn {
    background: rgba(18, 18, 20, 0.95);
    border: 1px solid var(--bg-card-border);
    border-radius: 8px;
    padding: 8px 12px;
    color: #fff;
    cursor: pointer;
    font-size: 15px;
    transition: transform 0.12s var(--ease-out-back), background 0.15s ease;
}

.hud-icon-btn:active {
    transform: scale(0.9);
    background: rgba(255, 46, 196, 0.25);
}

.invite-float-btn {
    animation: bounceInvite 2s ease-in-out infinite;
}

@keyframes bounceInvite {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* --- TEAMMATES STATUS PANEL --- */
.teammates-panel {
    position: absolute;
    top: 75px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 45;
    pointer-events: none;
}

.teammate-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(18, 18, 20, 0.85);
    border: 1px solid var(--bg-card-border);
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 13px;
    animation: fadeDown 0.3s var(--ease-smooth) both;
}

.teammate-hp-bar {
    width: 65px;
    height: 8px;
    background: #27272a;
    border-radius: 4px;
    overflow: hidden;
}

.teammate-hp-fill {
    height: 100%;
    background: var(--accent-blue);
    transition: width 0.2s var(--ease-smooth), background 0.2s ease;
}

/* --- SPECTATOR PANEL (shown while dead, watching a teammate) --- */
.spectate-panel {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 50;
    background: rgba(18, 18, 20, 0.9);
    border: 1px solid var(--bg-card-border);
    border-radius: 999px;
    padding: 8px 16px;
    pointer-events: auto;
    animation: fadeDown 0.3s var(--ease-smooth) both;
}

#spectate-name {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--accent-blue);
    min-width: 160px;
    text-align: center;
}

.spectate-arrow-btn {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.1s ease;
}

.spectate-arrow-btn:hover {
    background: rgba(56, 189, 248, 0.3);
}

.spectate-arrow-btn:active {
    transform: scale(0.88);
}

/* --- MOBILE TOUCH CONTROLS --- */
#touch-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 40;
    touch-action: none;
}

#touch-layer[style*="display: block"] {
    pointer-events: auto;
}

#touch-layer.force-hide-buttons .mobile-action-buttons {
    display: none;
}

.joystick-base {
    position: absolute;
    width: 110px;
    height: 110px;
    margin-left: -55px;
    margin-top: -55px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.25);
    pointer-events: none;
    animation: joystickAppear 0.15s var(--ease-out-back);
    will-change: transform, opacity;
}

.joystick-stick {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    margin-left: -22px;
    margin-top: -22px;
    border-radius: 50%;
    background: var(--accent-gold);
    box-shadow: 0 0 12px rgba(255, 46, 196, 0.7);
    will-change: transform;
    transition: transform 0.06s linear;
}

.mobile-action-buttons {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    pointer-events: auto;
}

.mobile-btn {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(24, 24, 27, 0.9);
    border: 2px solid var(--accent-gold);
    color: #fff;
    font-size: 22px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    touch-action: none;
    transition: transform 0.1s var(--ease-out-back), box-shadow 0.1s ease, background 0.1s ease;
    will-change: transform;
}

.mobile-btn.active,
.mobile-btn:active {
    transform: scale(0.85);
    background: rgba(255, 46, 196, 0.3);
    box-shadow: 0 0 20px rgba(255, 46, 196, 0.6);
}

.mobile-btn small {
    font-size: 9px;
    font-weight: 700;
    color: var(--accent-gold);
    font-family: var(--font-heading);
}

.pause-btn {
    width: 48px;
    height: 48px;
    font-size: 16px;
    border-color: var(--text-muted);
}

/* --- SCREEN OVERLAYS & MODALS --- */
.screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 9, 11, 0.94);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
    overflow-y: auto;
}

.modal-box, .menu-box {
    background: #18181b !important;
    border: 2px solid #3f3f46 !important;
    border-radius: 16px !important;
    padding: 32px 36px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9) !important;
    max-width: 540px;
    width: 100%;
    color: #fff;
}

.menu-box {
    text-align: center;
}

.player-name-input-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    font-family: var(--font-heading);
    pointer-events: auto;
    position: relative;
    z-index: 102;
}

.player-name-input-group input {
    background: #09090b;
    border: 1px solid var(--accent-gold);
    border-radius: 6px;
    padding: 8px 14px;
    color: #fff;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 15px;
    outline: none;
    text-align: center;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.player-name-input-group input:focus {
    box-shadow: 0 0 0 3px rgba(255, 46, 196, 0.3);
    transform: scale(1.02);
}

.game-logo .logo-emoji {
    font-size: 64px;
    margin-bottom: 6px;
}

.logo-title {
    font-family: var(--font-heading);
    font-size: 46px;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--accent-gold);
    text-shadow: 0 0 16px rgba(255, 46, 196, 0.4);
}

.logo-sub {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--text-muted);
    margin-top: -6px;
    margin-bottom: 16px;
}

.menu-tagline {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.menu-actions-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
    position: relative;
    z-index: 102;
}

.controls-guide {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
}

.controls-guide .key {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: 600;
}

.platform-change-link {
    display: inline-block;
    margin-top: 18px;
    background: transparent;
    border: 1px solid var(--bg-card-border);
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    pointer-events: auto;
    position: relative;
    z-index: 102;
}

.platform-change-link:hover,
.platform-change-link:active {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    transform: scale(1.05);
}

.menu-bottom-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
    pointer-events: auto;
    position: relative;
    z-index: 102;
}

.menu-bottom-links .platform-change-link {
    margin-top: 0;
}

/* --- PLATFORM SELECTION SCREEN --- */
.platform-box {
    max-width: 560px !important;
}

.platform-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 6px;
}

.platform-card {
    background: #27272a;
    border: 2px solid #3f3f46;
    border-radius: 14px;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #fff;
    font-family: var(--font-body);
    transition: transform 0.15s var(--ease-out-back), border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    will-change: transform;
    pointer-events: auto;
    position: relative;
    z-index: 102;
}

.platform-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 46, 196, 0.2);
}

.platform-card:active {
    transform: scale(0.95);
}

.platform-card.is-selected {
    border-color: var(--accent-green);
    background: rgba(34, 197, 94, 0.12);
    animation: cardSelected 0.3s var(--ease-out-back) both;
}

.platform-icon {
    font-size: 34px;
    line-height: 1;
}

.platform-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    margin-top: 4px;
}

.platform-desc {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.35;
}

.platform-hint {
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* --- ORIENTATION CHOICE (shown after picking Mobile / Touch) --- */
.orientation-panel {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--bg-card-border);
}

.orientation-title {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 12px;
}

.orientation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.orientation-card {
    background: #27272a;
    border: 2px solid #3f3f46;
    border-radius: 14px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: #fff;
    font-family: var(--font-body);
    transition: transform 0.15s var(--ease-out-back), border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    will-change: transform;
}

.orientation-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(56, 189, 248, 0.2);
}

.orientation-card:active {
    transform: scale(0.95);
}

.orientation-card.is-selected {
    border-color: var(--accent-green);
    background: rgba(34, 197, 94, 0.12);
    animation: cardSelected 0.3s var(--ease-out-back) both;
}

/* The "Landscape" card's icon is rotated 90° so it visually mirrors the
   orientation it represents next to the upright "Portrait" icon. */
.orientation-card[data-orientation="landscape"] .orientation-icon {
    display: inline-block;
    transform: rotate(90deg);
}

.orientation-icon {
    font-size: 30px;
    line-height: 1;
}

.orientation-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    margin-top: 4px;
}

.orientation-desc {
    font-size: 10.5px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
}

/* Orientation quick-links (menu & pause) only make sense once a mobile
   platform is active; PlatformManager toggles this via inline display. */
.mobile-only-link {
    display: none;
}

/* --- CHARACTER SELECT SCREEN (FULL WIDTH & VISIBLE) --- */
.select-modal {
    max-width: 1050px !important;
    width: 95% !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
    background: #18181b !important;
    border: 2px solid #3f3f46 !important;
    border-radius: 16px !important;
    padding: 24px 30px !important;
    box-sizing: border-box !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #3f3f46;
    padding-bottom: 12px;
    width: 100%;
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 26px;
    color: var(--accent-gold);
}

.char-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 16px !important;
    overflow-y: auto !important;
    padding: 10px 4px !important;
    min-height: 380px !important;
    max-height: 65vh !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.char-card {
    background: #27272a !important;
    border: 2px solid #3f3f46 !important;
    border-radius: 12px !important;
    padding: 18px 14px !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
    transition: transform 0.15s var(--ease-out-back), border-color 0.15s ease;
    will-change: transform;
}

.char-card:hover {
    border-color: var(--accent-gold) !important;
    transform: translateY(-5px) scale(1.015);
}

.char-avatar {
    font-size: 48px;
    margin-bottom: 8px;
    transition: transform 0.2s var(--ease-out-back);
}

.char-card:hover .char-avatar {
    transform: scale(1.15) rotate(-4deg);
}

.char-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, #30303a 0%, #202027 58%, #18181b 100%) !important;
    border-color: rgba(255, 46, 196, 0.42) !important;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.char-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, #ff2ec4, #7c3aed, #22d3ee);
    opacity: 0.9;
}

.char-card:hover {
    border-color: #ff2ec4 !important;
    box-shadow: 0 12px 30px rgba(255, 46, 196, 0.28), 0 0 0 2px rgba(255, 46, 196, 0.18) !important;
}

.char-avatar {
    display: grid;
    place-items: center;
    min-width: 82px;
    min-height: 82px;
    margin: 2px 0 12px;
    border-radius: 22px;
    background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.22), rgba(124, 58, 237, 0.2) 42%, rgba(255, 46, 196, 0.12));
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 22px rgba(124, 58, 237, 0.24);
}

.char-name {
    text-shadow: 0 0 12px rgba(255, 46, 196, 0.35);
}

.char-card .btn-select {
    background: linear-gradient(135deg, #ff2ec4, #9333ea) !important;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(255, 46, 196, 0.3);
}

.char-card .btn-select:hover {
    filter: brightness(1.15);
    box-shadow: 0 8px 22px rgba(255, 46, 196, 0.48);
}

.char-card.selected {
    border-color: #a1a1aa !important;
    background: linear-gradient(145deg, #3f3f46, #27272a) !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.char-card.selected .btn-select,
.char-card .btn-select:disabled {
    background: #52525b !important;
    border-color: #71717a !important;
    color: #d4d4d8 !important;
    box-shadow: none !important;
    cursor: not-allowed;
    opacity: 1;
}

.char-card.selected .btn-select:hover,
.char-card .btn-select:disabled:hover {
    filter: none;
    transform: none;
}

.char-name {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.char-title {
    font-size: 12px;
    color: var(--accent-gold);
    margin-bottom: 8px;
}

.char-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 16px;
    flex-grow: 1;
}

/* --- MULTIPLAYER LOBBY MODAL --- */
.lobby-modal {
    max-width: 820px !important;
    width: 95% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    background: #18181b !important;
    border: 2px solid #3f3f46 !important;
    border-radius: 16px !important;
    padding: 24px 30px !important;
}

.room-code-badge {
    font-family: var(--font-heading);
    font-size: 16px;
    color: var(--accent-gold);
    margin-top: 4px;
}

.lobby-controls-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    background: #27272a;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--bg-card-border);
    width: 100%;
}

.btn-online {
    background: linear-gradient(135deg, #22d3ee 0%, #0284c7 52%, #2563eb 100%) !important;
    color: #effaff !important;
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}

.btn-online:hover,
.btn-quick-join:hover {
    filter: brightness(1.14) saturate(1.12);
    box-shadow: 0 11px 30px rgba(14, 165, 233, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-2px);
}

.btn-quick-join {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 55%, #0369a1 100%) !important;
    color: #f0f9ff !important;
    box-shadow: 0 5px 16px rgba(14, 165, 233, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.join-code-group {
    display: flex;
    gap: 6px;
}

.join-code-group input {
    background: #09090b;
    border: 1px solid var(--bg-card-border);
    border-radius: 6px;
    padding: 8px 12px;
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    width: 140px;
    text-transform: uppercase;
    text-align: center;
    transition: box-shadow 0.15s ease;
}

.join-code-group input:focus {
    box-shadow: 0 0 0 3px rgba(255, 46, 196, 0.3);
    outline: none;
}

.lobby-players-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
    gap: 14px !important;
    min-height: 120px !important;
    margin: 8px 0 !important;
    width: 100% !important;
}

.lobby-player-card {
    background: #27272a !important;
    border: 2px solid #3f3f46 !important;
    border-radius: 12px !important;
    padding: 16px !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px !important;
    animation: staggerIn 0.3s var(--ease-out-back) both;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.lobby-self-card {
    position: relative;
    overflow: hidden;
    border-color: rgba(255, 46, 196, 0.72) !important;
    background: linear-gradient(145deg, rgba(255, 46, 196, 0.16), rgba(124, 58, 237, 0.16) 48%, #27272a 100%) !important;
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.28), 0 10px 28px rgba(124, 58, 237, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.lobby-self-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, #ff2ec4, #7c3aed, #22d3ee);
}

.lobby-hero-prompt {
    color: #67e8f9;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.55);
}

.lobby-self-card .lobby-player-avatar {
    display: grid;
    place-items: center;
    min-width: 82px;
    min-height: 72px;
    border-radius: 18px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2), rgba(124, 58, 237, 0.22) 48%, rgba(255, 46, 196, 0.12));
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 22px rgba(255, 46, 196, 0.24);
}

.lobby-change-hero-btn {
    width: 100%;
    margin-top: 3px;
    background: linear-gradient(135deg, #22d3ee, #0284c7 55%, #2563eb) !important;
    color: #effaff !important;
    border: 1px solid rgba(125, 211, 252, 0.75) !important;
    box-shadow: 0 6px 18px rgba(14, 165, 233, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.lobby-change-hero-btn:hover {
    filter: brightness(1.14);
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.lobby-change-hero-btn span {
    margin-left: 4px;
    opacity: 0.82;
    font-size: 10px;
}

.lobby-player-card.ready {
    border-color: var(--accent-green) !important;
    background: rgba(34, 197, 94, 0.15) !important;
    animation: cardSelected 0.3s var(--ease-out-back) both;
}

.lobby-player-avatar {
    font-size: 40px;
    animation: floatLoop 3s ease-in-out infinite;
}

.lobby-player-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
}

.lobby-player-status {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
}

.lobby-player-status.ready {
    background: var(--accent-green);
    color: #09090b;
}

.lobby-player-status.waiting {
    background: #52525b;
    color: #f4f4f5;
}

.lobby-footer {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 10px;
}

/* --- INVITE PANEL (lobby screen: invite other online players into your room) --- */
.invite-panel {
    width: 100%;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--bg-card-border);
    animation: fadeUp 0.35s var(--ease-smooth) both;
}

.invite-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 190px;
    overflow-y: auto;
    margin-top: 8px;
}

.invite-empty {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 10px 0;
}

.invite-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #27272a;
    border: 1px solid var(--bg-card-border);
    border-radius: 8px;
    padding: 8px 12px;
    transition: transform 0.15s var(--ease-out-back), border-color 0.2s ease;
}

.invite-row:hover {
    border-color: var(--accent-blue);
}

.invite-player-name {
    font-weight: 600;
    font-size: 14px;
}

.invite-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* --- INVITE POPUP (toast variant with Accept/Decline actions) --- */
.invite-toast {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    border-left-color: var(--accent-blue);
}

.invite-toast-text {
    font-size: 13.5px;
}

.invite-toast-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* --- BUTTONS --- */
.btn {
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: transform 0.12s var(--ease-out-back), background 0.15s ease-in-out, box-shadow 0.15s ease;
    text-transform: uppercase;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    will-change: transform;
}

.btn-press:active {
    transform: scale(0.94);
}

.btn-primary {
    background: var(--accent-gold);
    color: #09090b;
}

.btn-primary:hover {
    #c400a0
}

.btn-secondary {
    background: #27272a;
    color: #f4f4f5;
    border: 1px solid #3f3f46;
}

.btn-secondary:hover {
    background: #3f3f46;
}

.btn-mega {
    font-size: 18px;
    padding: 12px 30px;
    background: linear-gradient(135deg, #ff2ec4, #c400a0);
    color: #09090b;
    box-shadow: 0 8px 20px rgba(255, 46, 196, 0.4);
}

.btn-mega:hover {
    box-shadow: 0 10px 26px rgba(255, 46, 196, 0.55);
    transform: translateY(-2px);
}

.btn-sm {
    font-size: 11px;
    padding: 6px 12px;
}

/* --- SHOP SCREEN --- */
.shop-container {
    width: 100%;
    max-width: 1200px;
    max-height: 94vh;
    background: #18181b;
    border: 2px solid #3f3f46;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3f3f46;
    padding-bottom: 12px;
}

.shop-title {
    font-family: var(--font-heading);
    font-size: 24px;
    color: var(--accent-gold);
}

.shop-materials-display {
    font-size: 15px;
    color: var(--text-muted);
}

.shop-materials-count {
    transition: color 0.3s ease, transform 0.3s ease;
}

.shop-materials-count.deducting {
    color: #ef4444;
    transform: scale(1.2);
    animation: moneyDeduct 0.5s ease-out;
}

@keyframes moneyDeduct {
    0% { transform: scale(1.2); color: #ef4444; }
    50% { transform: scale(0.9); color: #f87171; }
    100% { transform: scale(1); color: inherit; }
}

.gold-text {
    color: var(--accent-gold);
    font-size: 18px;
}

.shop-header-actions {
    display: flex;
    gap: 12px;
}

.btn-reroll {
    background: #3f3f46;
    color: #f4f4f5;
}

.btn-go-wave {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-size: 16px;
}

.shop-body {
    display: grid;
    grid-template-columns: 1.3fr 1.1fr 0.9fr;
    gap: 18px;
}

.column-title {
    font-family: var(--font-heading);
    font-size: 16px;
    color: #fff;
    margin-bottom: 10px;
}

.shop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.shop-card {
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: staggerIn 0.3s var(--ease-out-back) both;
    transition: transform 0.15s var(--ease-out-back), border-color 0.15s ease;
}

.shop-card:hover:not(.bought) {
    transform: translateY(-3px);
    border-color: var(--accent-gold);
}

.shop-card.bought {
    position: relative;
    border-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, #27272a 60%);
    pointer-events: none;
    overflow: hidden;
}

.shop-card.bought.sold-locked {
    animation: soldLockIn 0.55s var(--ease-out-back) both;
}

.shop-card.bought:hover {
    transform: none;
}

.sold-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    border-radius: inherit;
    background: rgba(9, 9, 11, 0.25);
}

.sold-chain {
    position: absolute;
    top: 50%;
    width: 42%;
    height: 6px;
    background: repeating-linear-gradient(
        90deg,
        #71717a 0px,
        #71717a 6px,
        #a1a1aa 6px,
        #a1a1aa 10px
    );
    border-radius: 3px;
    transform: translateY(-50%);
    opacity: 0;
    animation: chainDrop 0.45s 0.15s var(--ease-out-back) forwards;
}

.sold-chain-left {
    left: 4%;
    transform: translateY(-50%) rotate(-8deg);
}

.sold-chain-right {
    right: 4%;
    transform: translateY(-50%) rotate(8deg);
}

.sold-lock-icon {
    font-size: 28px;
    z-index: 3;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
    opacity: 0;
    transform: scale(0.3) translateY(-20px);
    animation: lockDrop 0.5s 0.25s var(--ease-out-back) forwards;
}

.sold-stamp {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;
    background: #ef4444;
    color: #450a0a;
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 2px;
    padding: 5px 14px;
    border-radius: 5px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.6) rotate(-10deg);
    animation: soldStampIn 0.35s 0.4s var(--ease-out-back) forwards;
}

@keyframes soldLockIn {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.25); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes chainDrop {
    0% { opacity: 0; transform: translateY(-80%) rotate(var(--chain-rot, 0deg)); }
    100% { opacity: 0.85; transform: translateY(-50%) rotate(var(--chain-rot, 0deg)); }
}

.sold-chain-left { --chain-rot: -8deg; }
.sold-chain-right { --chain-rot: 8deg; }

@keyframes lockDrop {
    0% { opacity: 0; transform: scale(0.3) translateY(-20px); }
    70% { transform: scale(1.15) translateY(2px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes soldStampIn {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(1.6) rotate(-10deg); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-10deg); }
}

.shop-card.bought .shop-card-actions .btn-buy:disabled {
    background: #991b1b;
    color: #fecaca;
    font-weight: 700;
}

.shop-card.bought .shop-card-actions .btn-lock:disabled {
    background: #ca8a04;
    color: #09090b;
    border-color: #ca8a04;
    opacity: 1;
}

.shop-card.locked {
    border-color: #eab308;
    background: rgba(234, 179, 8, 0.1);
}

.shop-card.shake-insufficient {
    animation: shakeInsufficient 0.5s ease-in-out;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

@keyframes shakeInsufficient {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shop-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shop-item-tags {
    display: flex;
    gap: 4px;
    align-items: center;
}

.shop-weapon-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: #3b82f6;
    color: #fff;
}

.shop-item-icon {
    font-size: 24px;
}

.shop-tier-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    color: #09090b;
}

.shop-item-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
}

.shop-item-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
    min-height: 30px;
}

.shop-item-stats {
    font-size: 10px;
    color: var(--accent-gold);
    font-weight: 600;
}

.shop-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.btn-buy {
    flex-grow: 1;
    background: var(--accent-gold);
    color: #09090b;
    font-size: 12px;
    padding: 6px;
    transition: transform 0.12s var(--ease-out-back), background 0.15s ease;
}

.btn-buy.insufficient-funds {
    background: #52525b;
    border-color: #71717a;
    color: #d4d4d8;
}

.btn-buy.insufficient-funds:hover {
    background: #3f3f46;
}

.btn-buy:active:not(:disabled) {
    transform: scale(0.92);
}

.btn-buy:disabled {
    background: #52525b;
    color: #a1a1aa;
    cursor: not-allowed;
}

.btn-lock {
    background: #18181b;
    color: var(--text-muted);
    font-size: 11px;
    padding: 6px 8px;
    border: 1px solid #3f3f46;
    transition: transform 0.12s var(--ease-out-back), background 0.15s ease;
}

.btn-lock:active {
    transform: scale(0.9);
}

.btn-lock.active {
    background: #ca8a04;
    color: #09090b;
    border-color: #ca8a04;
}

/* Weapons Inventory Slots */
.weapons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.weapon-inventory-slot {
    background: #27272a;
    border: 2px solid #3f3f46;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    animation: staggerIn 0.3s var(--ease-out-back) both;
}

.weapon-inventory-slot.empty {
    border-style: dashed;
    justify-content: center;
    min-height: 80px;
}

.empty-slot-text {
    font-size: 12px;
    color: #71717a;
}

.weapon-slot-icon {
    font-size: 20px;
}

.weapon-slot-name {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
}

.weapon-slot-actions {
    display: flex;
    gap: 4px;
    width: 100%;
}

.btn-combine-sm, .btn-sell-sm {
    flex-grow: 1;
    font-size: 10px;
    padding: 4px 2px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    transition: transform 0.12s var(--ease-out-back);
}

.btn-combine-sm:active, .btn-sell-sm:active {
    transform: scale(0.9);
}

.btn-combine-sm {
    background: #3b82f6;
    color: #fff;
}

.btn-sell-sm {
    background: #dc2626;
    color: #fff;
}

.help-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
    line-height: 1.4;
}

/* Stats Sheet Column */
.stats-sheet {
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    padding: 10px;
    max-height: 380px;
    overflow-y: auto;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(63, 63, 70, 0.3);
}

.stat-row .val {
    font-weight: 700;
    font-family: var(--font-heading);
    color: #fafafa;
}

.stat-row .val.green { color: var(--accent-green); }
.stat-row .val.red { color: var(--accent-red); }

/* --- GAME OVER & VICTORY --- */
.game-over-emoji, .victory-emoji {
    font-size: 64px;
    margin-bottom: 8px;
}

.game-over-title {
    font-family: var(--font-heading);
    font-size: 38px;
    color: var(--accent-red);
    margin-bottom: 8px;
}

.victory-title {
    font-family: var(--font-heading);
    font-size: 38px;
    color: var(--accent-gold);
    margin-bottom: 8px;
}

.game-over-sub, .victory-sub {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.run-stats {
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.6;
}

/* --- WAVE COMPLETE TRANSITION --- */
/* Translucent (not opaque) backdrop so the arena keeps animating behind it -
   the game's draw() loop stays running during this screen so the moment
   feels alive instead of freezing on a flat modal. */
.wave-complete-overlay {
    background: rgba(9, 9, 11, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: wcBackdropIn 0.25s var(--ease-smooth) both;
    pointer-events: none;
}

.wave-complete-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
}

.wc-wave-number {
    font-family: var(--font-heading);
    font-size: 96px;
    font-weight: 900;
    line-height: 1;
    color: var(--accent-gold);
    text-shadow: 0 0 30px rgba(255, 46, 196, 0.65), 0 4px 0 rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.6s var(--ease-out-back) both;
}

.wc-wave-number::before {
    content: 'WAVE';
    display: block;
    font-size: 20px;
    letter-spacing: 6px;
    color: var(--text-muted);
    text-shadow: none;
    margin-bottom: 2px;
}

.wc-cleared-text {
    font-family: var(--font-heading);
    font-size: 34px;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--accent-green);
    text-shadow: 0 0 18px rgba(57, 255, 136, 0.6);
    margin-top: 4px;
    animation: fadeInUp 0.5s var(--ease-smooth) both;
    animation-delay: 0.25s;
}

.wc-stats-row {
    display: flex;
    gap: 14px;
    margin-top: 22px;
    animation: fadeInUp 0.5s var(--ease-smooth) both;
    animation-delay: 0.4s;
}

.wc-stat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(24, 24, 27, 0.9);
    border: 1px solid var(--bg-card-border);
    border-radius: 999px;
    padding: 8px 18px;
    font-family: var(--font-heading);
}

.wc-stat-icon {
    font-size: 18px;
}

.wc-stat-value {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.wc-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wc-progress-track {
    width: 220px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
    margin-top: 28px;
    animation: fadeInUp 0.5s var(--ease-smooth) both;
    animation-delay: 0.5s;
}

.wc-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-green));
    animation: progressFill 2.5s linear forwards;
}

.wc-progress-label {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    animation: fadeInUp 0.5s var(--ease-smooth) both;
    animation-delay: 0.5s;
}

body.orientation-landscape .wc-wave-number,
body.platform-mobile .wc-wave-number {
    font-size: 64px;
}

body.orientation-landscape .wc-wave-number::before,
body.platform-mobile .wc-wave-number::before {
    font-size: 15px;
    letter-spacing: 4px;
}

body.orientation-landscape .wc-cleared-text,
body.platform-mobile .wc-cleared-text {
    font-size: 24px;
}

body.orientation-landscape .wc-stats-row,
body.platform-mobile .wc-stats-row {
    margin-top: 14px;
    gap: 10px;
}

body.orientation-landscape .wc-stat-pill,
body.platform-mobile .wc-stat-pill {
    padding: 6px 14px;
}

body.orientation-landscape .wc-progress-track,
body.platform-mobile .wc-progress-track {
    width: 170px;
    margin-top: 18px;
}

/* --- RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 900px) {
    .shop-body {
        grid-template-columns: 1fr;
    }
    .shop-grid {
        grid-template-columns: 1fr 1fr;
    }
    .hud-bar-container .bar-track {
        width: 80px;
    }
    .hud-materials-box {
        padding: 4px 8px;
        font-size: 13px;
    }
    .platform-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .platform-card {
        padding: 16px 10px;
    }
    .platform-icon {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .menu-box, .modal-box {
        padding: 22px 18px !important;
    }
    .logo-title {
        font-size: 34px;
    }
    .platform-grid {
        grid-template-columns: 1fr;
    }
    .menu-actions-col {
        gap: 16px;
    }
    .btn-mega {
        padding: 14px 24px;
        font-size: 16px;
    }
}

/* On touch devices, disable hover-only transform effects that can get
   "stuck" after a tap (no mouseleave event fires on mobile browsers) */
@media (hover: none) {
    .char-card:hover,
    .platform-card:hover,
    .shop-card:hover:not(.bought) {
        transform: none;
        box-shadow: inherit;
    }
    .btn-mega:hover {
        transform: none;
    }
}

/* --- MOBILE PORTRAIT TUNE-UP ---
   Vertical phone play gets its own pass: bigger, easier-to-hit touch controls,
   safe-area padding so buttons never sit under a notch/home-indicator, and a
   HUD that keeps its footprint small so more of the tall viewport is arena.
   Gated to body:not(.orientation-landscape) so a player who explicitly chose
   Landscape gets the landscape tune-up below instead, even on a narrow device. */
@media (max-width: 600px) and (orientation: portrait) {
    body:not(.orientation-landscape) #touch-layer {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    body:not(.orientation-landscape) .mobile-action-buttons {
        bottom: calc(32px + env(safe-area-inset-bottom, 0px));
        right: 24px;
        gap: 28px;
    }

    body:not(.orientation-landscape) .menu-actions-col {
        gap: 18px;
    }

    body:not(.orientation-landscape) .btn-mega {
        padding: 16px 28px;
        font-size: 17px;
    }

    body:not(.orientation-landscape) .menu-bottom-links {
        gap: 12px;
    }

    body:not(.orientation-landscape) .platform-change-link {
        padding: 8px 16px;
        font-size: 13px;
    }

    body:not(.orientation-landscape) .platform-grid {
        gap: 16px;
    }

    body:not(.orientation-landscape) .platform-card {
        padding: 18px 12px;
    }

    body:not(.orientation-landscape) .orientation-grid {
        gap: 16px;
    }

    body:not(.orientation-landscape) .orientation-card {
        padding: 16px 10px;
    }

    body:not(.orientation-landscape) .lobby-controls-bar {
        gap: 16px;
        padding: 16px;
    }

    body:not(.orientation-landscape) .lobby-players-grid {
        gap: 16px;
    }

    body:not(.orientation-landscape) .char-grid {
        gap: 18px;
    }

    body:not(.orientation-landscape) .shop-grid {
        gap: 12px;
    }

    body:not(.orientation-landscape) .join-code-group {
        gap: 8px;
    }

    body:not(.orientation-landscape) .join-code-group input {
        width: 160px;
    }

    body:not(.orientation-landscape) .lobby-footer {
        gap: 20px;
    }

    body:not(.orientation-landscape) .shop-header-actions {
        gap: 16px;
    }

    body:not(.orientation-landscape) .shop-card-actions {
        gap: 8px;
    }

    body:not(.orientation-landscape) .weapons-grid {
        gap: 10px;
    }

    body:not(.orientation-landscape) .stat-row {
        padding: 6px 0;
    }

    body:not(.orientation-landscape) .controls-guide {
        gap: 20px;
        margin-top: 28px;
    }

    body:not(.orientation-landscape) .mobile-btn {
        width: 78px;
        height: 78px;
        font-size: 25px;
        border-width: 3px;
    }

    body:not(.orientation-landscape) .mobile-btn small {
        font-size: 10px;
    }

    body:not(.orientation-landscape) .pause-btn {
        width: 54px;
        height: 54px;
        font-size: 18px;
    }

    body:not(.orientation-landscape) .joystick-base {
        width: 128px;
        height: 128px;
        margin-left: -64px;
        margin-top: -64px;
    }

    body:not(.orientation-landscape) .joystick-stick {
        width: 52px;
        height: 52px;
        margin-left: -26px;
        margin-top: -26px;
    }

    body:not(.orientation-landscape) #hud {
        top: calc(10px + env(safe-area-inset-top, 0px));
        left: calc(10px + env(safe-area-inset-left, 0px));
        right: calc(10px + env(safe-area-inset-right, 0px));
        gap: 6px;
    }

    body:not(.orientation-landscape) .hud-bar-container .bar-track {
        width: 64px;
        height: 13px;
    }

    body:not(.orientation-landscape) .hud-wave-badge {
        font-size: 13px;
        padding: 3px 10px;
    }

    body:not(.orientation-landscape) .hud-timer-badge {
        font-size: 18px;
    }

    body:not(.orientation-landscape) .hud-materials-box {
        font-size: 12px;
        padding: 4px 8px;
    }

    body:not(.orientation-landscape) .hud-icon-btn {
        padding: 10px 12px;
        font-size: 18px;
        min-width: 44px;
        min-height: 44px;
    }

    body:not(.orientation-landscape) .teammates-panel {
        top: calc(64px + env(safe-area-inset-top, 0px));
    }

    body:not(.orientation-landscape) .menu-box,
    body:not(.orientation-landscape) .modal-box,
    body:not(.orientation-landscape) .lobby-modal,
    body:not(.orientation-landscape) .select-modal,
    body:not(.orientation-landscape) .shop-container {
        padding-top: calc(22px + env(safe-area-inset-top, 0px)) !important;
        padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* --- MOBILE LANDSCAPE TUNE-UP ---
   Applies when the player chose Landscape (class set by PlatformManager) and
   also naturally when any phone is physically rotated wide - short viewport
   height means the HUD and touch controls need to hug the edges instead of
   stacking, so more of the limited vertical space stays arena. */
@media (max-height: 520px) and (orientation: landscape),
       (orientation: landscape) and (max-width: 900px) {
    body.orientation-landscape #touch-layer,
    body.platform-mobile #touch-layer {
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }

    body.orientation-landscape .mobile-action-buttons,
    body.platform-mobile .mobile-action-buttons {
        bottom: 20px;
        right: calc(24px + env(safe-area-inset-right, 0px));
        flex-direction: row;
        gap: 20px;
    }

    body.orientation-landscape .mobile-btn,
    body.platform-mobile .mobile-btn {
        width: 64px;
        height: 64px;
        font-size: 20px;
    }

    body.orientation-landscape .pause-btn,
    body.platform-mobile .pause-btn {
        width: 46px;
        height: 46px;
        font-size: 15px;
    }

    body.orientation-landscape .joystick-base,
    body.platform-mobile .joystick-base {
        width: 104px;
        height: 104px;
        margin-left: -52px;
        margin-top: -52px;
    }

    body.orientation-landscape .joystick-stick,
    body.platform-mobile .joystick-stick {
        width: 42px;
        height: 42px;
        margin-left: -21px;
        margin-top: -21px;
    }

    /* Short viewport: keep the HUD to a single slim row, hugging the safe area. */
    body.orientation-landscape #hud,
    body.platform-mobile #hud {
        top: calc(6px + env(safe-area-inset-top, 0px));
        left: calc(8px + env(safe-area-inset-left, 0px));
        right: calc(8px + env(safe-area-inset-right, 0px));
    }

    body.orientation-landscape .hud-bar-container .bar-track,
    body.platform-mobile .hud-bar-container .bar-track {
        width: 70px;
        height: 12px;
    }

    body.orientation-landscape .hud-icon-btn,
    body.platform-mobile .hud-icon-btn {
        padding: 8px 10px;
        font-size: 16px;
        min-width: 40px;
        min-height: 40px;
    }

    body.orientation-landscape .hud-wave-badge,
    body.platform-mobile .hud-wave-badge {
        font-size: 12px;
        padding: 2px 8px;
    }

    body.orientation-landscape .hud-timer-badge,
    body.platform-mobile .hud-timer-badge {
        font-size: 16px;
    }

    body.orientation-landscape .teammates-panel,
    body.platform-mobile .teammates-panel {
        top: calc(48px + env(safe-area-inset-top, 0px));
        left: calc(8px + env(safe-area-inset-left, 0px));
    }

    /* Full-screen modals (menu, shop, lobby, char-select) get a scrollable,
       shorter-padded box instead of fighting a squeezed vertical viewport. */
    body.orientation-landscape .screen-overlay,
    body.platform-mobile .screen-overlay {
        padding: 10px calc(14px + env(safe-area-inset-right, 0px)) 10px calc(14px + env(safe-area-inset-left, 0px));
        align-items: flex-start;
    }

    body.orientation-landscape .menu-box,
    body.orientation-landscape .modal-box,
    body.platform-mobile .menu-box,
    body.platform-mobile .modal-box {
        margin-top: env(safe-area-inset-top, 0px);
        padding: 18px 22px !important;
        max-height: 92vh;
        overflow-y: auto;
    }

    body.orientation-landscape .logo-emoji,
    body.platform-mobile .logo-emoji {
        font-size: 40px;
        margin-bottom: 2px;
    }

    body.orientation-landscape .logo-title,
    body.platform-mobile .logo-title {
        font-size: 30px;
    }

    body.orientation-landscape .platform-grid,
    body.orientation-landscape .orientation-grid,
    body.platform-mobile .platform-grid,
    body.platform-mobile .orientation-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    body.orientation-landscape .menu-actions-col,
    body.platform-mobile .menu-actions-col {
        gap: 14px;
    }

    body.orientation-landscape .btn-mega,
    body.platform-mobile .btn-mega {
        padding: 12px 24px;
        font-size: 16px;
    }

    body.orientation-landscape .menu-bottom-links,
    body.platform-mobile .menu-bottom-links {
        gap: 8px;
    }

    body.orientation-landscape .platform-change-link,
    body.platform-mobile .platform-change-link {
        padding: 6px 12px;
        font-size: 11px;
    }

    body.orientation-landscape .platform-grid,
    body.platform-mobile .platform-grid {
        gap: 12px;
    }

    body.orientation-landscape .platform-card,
    body.platform-mobile .platform-card {
        padding: 14px 10px;
    }

    body.orientation-landscape .orientation-grid,
    body.platform-mobile .orientation-grid {
        gap: 12px;
    }

    body.orientation-landscape .orientation-card,
    body.platform-mobile .orientation-card {
        padding: 12px 8px;
    }

    body.orientation-landscape .lobby-controls-bar,
    body.platform-mobile .lobby-controls-bar {
        gap: 14px;
        padding: 12px;
    }

    body.orientation-landscape .lobby-players-grid,
    body.platform-mobile .lobby-players-grid {
        gap: 12px;
    }

    body.orientation-landscape .char-grid,
    body.platform-mobile .char-grid {
        gap: 14px;
    }

    body.orientation-landscape .shop-grid,
    body.platform-mobile .shop-grid {
        gap: 10px;
    }

    body.orientation-landscape .join-code-group,
    body.platform-mobile .join-code-group {
        gap: 6px;
    }

    body.orientation-landscape .join-code-group input,
    body.platform-mobile .join-code-group input {
        width: 120px;
    }

    body.orientation-landscape .lobby-footer,
    body.platform-mobile .lobby-footer {
        gap: 16px;
    }

    body.orientation-landscape .shop-header-actions,
    body.platform-mobile .shop-header-actions {
        gap: 14px;
    }

    body.orientation-landscape .shop-card-actions,
    body.platform-mobile .shop-card-actions {
        gap: 6px;
    }

    body.platform-mobile:not(.orientation-landscape) .shop-item-tags {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    body.platform-mobile:not(.orientation-landscape) .shop-tier-badge,
    body.platform-mobile:not(.orientation-landscape) .shop-weapon-badge {
        font-size: 9px;
        padding: 1px 4px;
    }

    body.orientation-landscape .weapons-grid,
    body.platform-mobile .weapons-grid {
        gap: 8px;
    }

    body.orientation-landscape .stat-row,
    body.platform-mobile .stat-row {
        padding: 5px 0;
    }

    body.orientation-landscape .controls-guide,
    body.platform-mobile .controls-guide {
        gap: 18px;
        margin-top: 24px;
    }
}

/* --- CODEX / COMPENDIUM MODAL --- */
.btn-codex {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.15);
    font-size: 15px;
    letter-spacing: 0.5px;
}
.btn-codex:hover {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(14, 165, 233, 0.3));
    border-color: #38bdf8;
    color: #e0f2fe;
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.3);
}

.shop-safety-tip {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    padding: 8px 14px;
    margin: 8px 0 12px;
    font-size: 13px;
    color: #a7f3d0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.codex-overlay {
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 105;
}

.codex-container {
    background: linear-gradient(145deg, #18181b, #09090b);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    width: 94%;
    max-width: 1080px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(56, 189, 248, 0.15);
    overflow: hidden;
}

.codex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(24, 24, 27, 0.6);
}

.codex-title {
    font-size: 22px;
    font-weight: 800;
    color: #f4f4f5;
    margin: 0;
    letter-spacing: 0.5px;
}

.codex-sub {
    font-size: 13px;
    color: #a1a1aa;
    margin-top: 3px;
    display: block;
}

.codex-close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e4e4e7;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.codex-close-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
    transform: scale(1.05);
}

.codex-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(18, 18, 20, 0.8);
    flex-wrap: wrap;
}

.codex-tabs {
    display: flex;
    gap: 8px;
}

.codex-tab {
    background: rgba(39, 39, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #a1a1aa;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.codex-tab:hover {
    color: #fff;
    background: rgba(63, 63, 70, 0.8);
}
.codex-tab.active {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
}

.codex-search-box {
    display: flex;
    align-items: center;
    background: rgba(24, 24, 27, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 6px 12px;
    gap: 8px;
    min-width: 260px;
}
.codex-search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: #f4f4f5;
    font-size: 13px;
    width: 100%;
}
.codex-search-box input::placeholder {
    color: #71717a;
}

.codex-body {
    padding: 20px 24px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 16px;
    max-height: calc(88vh - 150px);
}

.codex-card {
    background: rgba(24, 24, 27, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.codex-card:hover {
    transform: translateY(-2px);
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.codex-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.codex-card-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.codex-card-title-group {
    flex: 1;
}

.codex-card-name {
    font-size: 16px;
    font-weight: 700;
    color: #f4f4f5;
}

.codex-card-type {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 2px;
}
.codex-type-weapon {
    background: rgba(234, 88, 12, 0.2);
    color: #fb923c;
    border: 1px solid rgba(234, 88, 12, 0.3);
}
.codex-type-item {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.codex-card-desc {
    font-size: 13px;
    color: #d4d4d8;
    line-height: 1.45;
}

.codex-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.codex-stat-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.codex-stat-chip strong {
    color: #38bdf8;
}

.codex-tiers-table {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 6px;
    background: rgba(9, 9, 11, 0.4);
    border-radius: 6px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}
.codex-tier-col {
    text-align: center;
    font-size: 11px;
}
.codex-tier-name {
    font-weight: 700;
    margin-bottom: 2px;
}
.codex-tier-val {
    color: #e4e4e7;
}

@media (max-width: 640px) {
    .codex-body {
        grid-template-columns: 1fr;
        padding: 14px;
    }
    .codex-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .codex-search-box {
        min-width: 100%;
    }
}

