@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=MedievalSharp&family=UnifrakturMagdeburg:wght@400;700&family=IM+Fell+English:ital@0;1&family=Creepster&family=Nosifer&family=Almendra+SC&family=Pirata+One&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: url('/assets/cursor.png') 0 0, auto !important;
}

*:hover, *:active, *:focus, *:visited {
    cursor: url('/assets/cursor.png') 0 0, auto !important;
}

button, input, select, textarea, a {
    cursor: url('/assets/cursor.png') 0 0, auto !important;
}

body {
    font-family: 'Cinzel', serif;
    background: #000;
    overflow: hidden;
    cursor: url('/assets/cursor.png') 0 0, auto !important;
    /* Mobile: reduce accidental scroll/zoom bounces. */
    overscroll-behavior: none;
}

#game-container {
    width: 100vw;
    height: 100vh;
    /* Mobile: dynamic viewport height (better fullscreen / address-bar behavior) */
    height: 100dvh;
    position: relative;
    /* Mobile: prevent browser gestures (scroll/pinch) from interfering with gameplay. */
    touch-action: none;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: auto;
}

/* Loading Screen */
#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    display: none;
    align-items: center;
    justify-content: center;
    /* Must sit above in-game overlays (chat/controls) */
    z-index: 20000;
    transition: opacity 0.5s ease-out;
}

#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

#loading-content {
    text-align: center;
    color: #d4af37;
}

#loading-bar-container {
    width: 400px;
    height: 30px;
    background: #000;
    border: 3px solid #d4af37;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3),
                inset 0 0 10px rgba(0, 0, 0, 0.8);
    margin: 0 auto 2rem;
}

#loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #d4af37 0%, #f4e5a1 50%, #d4af37 100%);
    transition: width 0.3s ease-out;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.8),
                inset 0 0 10px rgba(255, 255, 255, 0.3);
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

#loading-text {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    letter-spacing: 0.2rem;
    color: #d4af37;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#hud > * {
    pointer-events: auto;
}

/* Mobile: dock stats + inventory as one top-left cluster */
#hud-left-cluster {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top));
    left: calc(10px + env(safe-area-inset-left));
    display: none;
    flex-direction: column;
    gap: 0;
    pointer-events: none;
    z-index: 130;
    transform-origin: top left;
}

body.bc-mobile #hud-left-cluster {
    display: flex;
}

body.bc-mobile #hud-left-cluster > * {
    pointer-events: auto;
}

body.bc-mobile #hud-left-cluster #player-stats {
    position: relative;
    top: 0;
    left: 0;
    margin: 0;
}

/* Mobile: keep all stat bars the same width by fixing the label column width. */
body.bc-mobile #player-stats .stat-bar span {
    flex: 0 0 64px;
    width: 64px;
    min-width: 64px;
}

#player-stats {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(20, 20, 20, 0.85) 100%);
    border: 2px solid rgba(80, 80, 80, 0.6);
    border-radius: 10px;
    padding: 12px;
    color: #f0e6d2;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
}

.stat-bar {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.stat-bar span {
    margin-right: 8px;
    font-weight: bold;
    font-size: 11px;
    min-width: 50px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.bar {
    flex: 1;
    height: 16px;
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
    border: 2px solid rgba(60, 60, 60, 0.8);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Health bar shows an "outside" floating damage indicator; allow it to render past the bar bounds. */
.bar.health-bar {
    overflow: visible;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(180deg, #ff4757 0%, #c41e3a 50%, #a01828 100%);
    width: 100%;
    transition: width 0.3s ease;
    border-radius: 6px;
    position: relative;
    box-shadow: 0 0 10px rgba(196, 30, 58, 0.5);
}

/* PvP K/D (top-left HUD) */
#player-stats .pvp-kd {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    font-size: 11px;
    color: rgba(240, 230, 210, 0.92);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

#player-stats .pvp-kd-label {
    font-weight: 800;
    letter-spacing: 0.02em;
    opacity: 0.95;
}

#player-stats .pvp-kd-item {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

#player-stats .pvp-kd-sep {
    opacity: 0.65;
}

#player-stats .pvp-kd-k {
    color: rgba(212, 175, 55, 0.95);
    font-weight: 800;
}

#player-stats .pvp-kd-d {
    color: rgba(255, 71, 87, 0.95);
    font-weight: 800;
}

.bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
    border-radius: 6px 6px 0 0;
}

.bar-damage-text {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translate(100%, -50%);
    color: #ff3333;
    font-weight: 900;
    font-size: 22px;
    letter-spacing: 0.2px;
    text-shadow:
        0 0 14px rgba(255, 51, 51, 0.65),
        2px 2px 4px rgba(0, 0, 0, 0.9);
    opacity: 0;
    pointer-events: none;
    user-select: none;
}

.bar-value-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.92);
    font-weight: 900;
    font-size: 11px;
    letter-spacing: 0.4px;
    text-shadow:
        0 0 10px rgba(0, 0, 0, 0.65),
        2px 2px 4px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    mix-blend-mode: normal;
}

.bar-damage-text.show {
    animation: hudDamagePop 1300ms ease-out forwards;
}

@keyframes hudDamagePop {
    0% {
        opacity: 0;
        transform: translate(100%, -50%) translateY(-45%);
        filter: blur(0.0px);
    }
    15% {
        opacity: 1;
        transform: translate(100%, -50%) translateY(-50%);
    }
    100% {
        opacity: 0;
        transform: translate(100%, -50%) translateY(-135%);
        filter: blur(0.2px);
    }
}

.stamina-bar .bar-fill {
    background: linear-gradient(180deg, #66ff66 0%, #4caf50 50%, #3d8b40 100%);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.magic-bar .bar-fill {
    background: linear-gradient(180deg, #6699ff 0%, #4169e1 50%, #2a4a9a 100%);
    box-shadow: 0 0 10px rgba(65, 105, 225, 0.5);
}

.stat-info {
    font-size: 11px;
}

#currency-display {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(20, 20, 20, 0.85) 100%);
    border: 2px solid rgba(80, 80, 80, 0.6);
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f0e6d2;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
}

.currency-icon {
    width: 20px;
    height: 20px;
}

/* Panels */
#inventory-panel {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    border: 3px solid #8b7355;
    padding: 20px;
    color: #f0e6d2;
}

#inventory-panel h3 {
    margin-bottom: 15px;
    color: #d4af37;
    border-bottom: 2px solid #8b7355;
    padding-bottom: 5px;
}

#inventory-panel {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
}

#inventory-grid {
    display: grid;
    grid-template-columns: repeat(4, 60px);
    grid-template-rows: repeat(3, 60px);
    gap: 5px;
}

.inventory-slot {
    width: 60px;
    height: 60px;
    background: rgba(42, 42, 42, 0.8);
    border: 2px solid #666;
    position: relative;
}

.inventory-slot:hover {
    border-color: #d4af37;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

/* Login Screen */
#login-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow-y: auto;
    /* Safe-area aware padding for notched devices */
    padding: calc(20px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
    cursor: url('/assets/cursor.png') 0 0, auto !important;
    /* Mobile: discourage pinch/double-tap zoom gestures on login */
    touch-action: manipulation;
}

#login-screen * {
    cursor: url('/assets/cursor.png') 0 0, auto !important;
}

.game-logo {
    max-width: 750px;
    max-height: 320px;
    margin-bottom: 10px;
    display: block;
    position: relative;
    z-index: 2;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 100%;
    max-width: min(480px, 94vw);
    background: rgba(10, 10, 10, 0.95);
    padding: 50px 45px;
    border: 1px solid rgba(180, 180, 180, 0.3);
    border-radius: 1px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 2;
}

.login-form label {
    color: #c0c0c0;
    font-size: 13px;
    font-weight: 400;
    margin-bottom: -15px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Cinzel', serif;
    text-align: center;
}

#email-input {
    padding: 14px 18px;
    /* iOS: <16px can trigger automatic zoom on focus. */
    font-size: 16px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(150, 150, 150, 0.25);
    color: #e8e8e8;
    font-family: 'Cinzel', serif;
    font-weight: 400;
    border-radius: 1px;
    transition: all 0.2s;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
    text-align: center;
    cursor: url('/assets/cursor.png') 0 0, auto !important;
}

#email-input:focus {
    cursor: url('/assets/cursor.png') 0 0, text !important;
}

#email-input:-webkit-autofill {
    cursor: url('/assets/cursor.png') 0 0, auto !important;
}

#email-input::placeholder {
    color: rgba(150, 150, 150, 0.5);
    font-weight: normal;
    text-align: center;
}

#email-input:focus {
    outline: none;
    border-color: rgba(200, 200, 200, 0.6);
    background: rgba(0, 0, 0, 0.8);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

#login-btn {
    padding: 15px;
    font-size: 15px;
    background: linear-gradient(180deg, #b0b0b0 0%, #808080 100%);
    border: 1px solid #c0c0c0;
    color: #0a0a0a;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-weight: 400;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 1px;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-align: center;
}

#login-btn:hover {
    background: linear-gradient(180deg, #d0d0d0 0%, #a0a0a0 100%);
    transform: translateY(-1px);
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#login-btn:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Character Creation Screen */
#character-creation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
    cursor: url('/assets/cursor.png') 0 0, auto !important;
}

#character-creation * {
    cursor: url('/assets/cursor.png') 0 0, auto !important;
}

.character-form {
    max-width: 1200px;
    width: 100%;
    background: rgba(10, 10, 10, 0.95);
    padding: 60px 40px 40px 40px;
    border: 2px solid rgba(180, 180, 180, 0.4);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.character-form h2 {
    color: #d4af37;
    font-size: 36px;
    text-align: center;
    margin-bottom: 10px;
    font-family: 'Cinzel', serif;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.subtitle {
    color: #f0f0f0;
    font-size: 16px;
    text-align: center;
    margin-bottom: 30px;
    font-family: 'Pirata One', cursive;
    position: relative;
    z-index: 10;
    text-shadow: 3px 3px 8px rgba(0, 0, 0, 1), 0 0 10px rgba(255, 255, 255, 0.3);
    font-weight: bold;
}

.character-creation-layout {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .character-creation-layout {
        grid-template-columns: 1fr;
    }
}

.preview-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.character-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#character-preview {
    border: 2px solid rgba(212, 175, 55, 0.5);
    border-radius: 8px;
    background: #1a1a1a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.preview-hint {
    color: rgba(192, 192, 192, 0.6);
    font-size: 12px;
    font-family: 'Pirata One', cursive;
    margin-top: 10px;
}

.customization-section {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.customization-category {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(150, 150, 150, 0.2);
    border-radius: 6px;
    padding: 20px;
}

.customization-category h3 {
    color: #d4af37;
    font-size: 18px;
    margin-bottom: 15px;
    font-family: 'Pirata One', cursive;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    padding-bottom: 8px;
}

.customization-grid-basic {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.customization-grid-colors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.customization-option {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.customization-option label {
    color: #c0c0c0;
    font-size: 13px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Pirata One', cursive;
}

.color-option label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-preview {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(200, 200, 200, 0.4);
    display: inline-block;
}

.customization-option input[type="text"],
.customization-option select {
    padding: 12px 15px;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(150, 150, 150, 0.25);
    color: #e8e8e8;
    font-family: 'Pirata One', cursive;
    border-radius: 4px;
    transition: all 0.2s;
}

.customization-option input[type="color"] {
    height: 45px;
    width: 100%;
    border: 1px solid rgba(150, 150, 150, 0.25);
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.customization-option input[type="color"]:hover {
    border-color: rgba(212, 175, 55, 0.5);
    transform: translateY(-1px);
}

.customization-option input[type="text"]:focus,
.customization-option select:focus {
    outline: none;
    border-color: rgba(212, 175, 55, 0.6);
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

#create-character-btn {
    width: 100%;
    padding: 18px;
    font-size: 18px;
    background: linear-gradient(180deg, #d4af37 0%, #b8941f 100%);
    border: 2px solid #e0c350;
    color: #0a0a0a;
    cursor: pointer;
    font-family: 'Pirata One', cursive;
    font-weight: 700;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 6px;
    box-shadow: 
        0 4px 12px rgba(212, 175, 55, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#create-character-btn:hover {
    background: linear-gradient(180deg, #e0c350 0%, #d4af37 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(212, 175, 55, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

#create-character-btn:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(212, 175, 55, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#create-character-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 480px;
    background: rgba(10, 10, 10, 0.95);
    padding: 50px 45px;
    border: 1px solid rgba(180, 180, 180, 0.3);
    border-radius: 1px;
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 2;
}

.character-form h2 {
    color: #c0c0c0;
    font-size: 24px;
    font-weight: 400;
    margin-bottom: 5px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-family: 'Cinzel', serif;
}

.character-form p {
    text-align: center;
    font-size: 13px;
    font-style: italic;
    color: #888;
}

.character-form label {
    color: #c0c0c0;
    font-size: 13px;
    font-weight: 400;
    margin-bottom: -10px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Pirata One', cursive;
    text-align: center;
}

#character-name,
#character-gender,
#character-description {
    padding: 14px 18px;
    font-size: 15px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(150, 150, 150, 0.25);
    color: #e8e8e8;
    font-family: 'Pirata One', cursive;
    font-weight: 400;
    border-radius: 1px;
    transition: all 0.2s;
    text-align: center;
}

#character-skin {
    height: 50px;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(150, 150, 150, 0.25);
    border-radius: 1px;
    cursor: pointer;
    transition: all 0.2s;
}

#character-skin::-webkit-color-swatch-wrapper {
    padding: 0;
}

#character-skin::-webkit-color-swatch {
    border: 1px solid rgba(150, 150, 150, 0.25);
    border-radius: 1px;
}

#character-skin:focus {
    outline: none;
    border-color: rgba(200, 200, 200, 0.6);
}

#character-name::placeholder,
#character-description::placeholder {
    color: rgba(150, 150, 150, 0.5);
    text-align: center;
}

#character-name:focus,
#character-gender:focus,
#character-description:focus {
    outline: none;
    border-color: rgba(200, 200, 200, 0.6);
    background: rgba(0, 0, 0, 0.8);
}

#create-avatar-btn,
#skip-avatar-btn,
#create-character-btn {
    padding: 15px;
    font-size: 14px;
    color: #0a0a0a;
    cursor: pointer;
    font-family: 'Pirata One', cursive;
    font-weight: 400;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 1px;
    text-align: center;
}

#create-avatar-btn,
#create-character-btn {
    background: linear-gradient(180deg, #b0b0b0 0%, #808080 100%);
    border: 1px solid #c0c0c0;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#create-avatar-btn:hover,
#create-character-btn:hover {
    background: linear-gradient(180deg, #d0d0d0 0%, #a0a0a0 100%);
    transform: translateY(-1px);
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#create-avatar-btn:disabled,
#create-character-btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    opacity: 0.5;
}

#skip-avatar-btn {
    background: rgba(60, 60, 60, 0.8);
    border: 1px solid rgba(120, 120, 120, 0.3);
}

#skip-avatar-btn:hover {
    background: rgba(80, 80, 80, 0.9);
    transform: translateY(-1px);
}
#generation-status {
    color: #c0c0c0;
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
    font-family: 'Pirata One', cursive;
}

.game-footer {
    position: absolute;
    bottom: 30px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(192, 192, 192, 0.5);
    font-size: 11px;
    font-family: 'Pirata One', cursive;
    letter-spacing: 1px;
    z-index: 2;
}
#minimap {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 250px;
    height: 250px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(180, 180, 180, 0.4);
    border-radius: 50%;
    overflow: hidden;
}

#minimap-canvas {
    width: 100%;
    height: 100%;
}

/* -----------------------------
   Mobile-only HUD tweaks
   Gate by coarse pointer and small-ish screens to avoid touching desktop.
------------------------------ */
@media (pointer: coarse) and (max-width: 980px) {
    /* Login: treat footer as a real footer so it can't get covered */
    #login-screen {
        justify-content: flex-start;
        gap: 14px;
    }

    .game-footer {
        position: static;
        bottom: auto;
        left: auto;
        right: auto;
        margin-top: auto;
        padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
    }

    /* Ensure long emails or status text never bleed off the modal */
    .login-form p {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* Make HUD easier to read but less intrusive on mobile */
    #player-stats {
        top: calc(6px + env(safe-area-inset-top));
        left: calc(6px + env(safe-area-inset-left));
        padding: clamp(4px, 0.9vw, 6px);
        min-width: clamp(118px, 28vw, 150px);
        max-width: calc(100vw - 12px);
    }

    .stat-bar {
        margin-bottom: clamp(3px, 0.8vw, 5px);
    }

    .stat-bar span {
        font-size: clamp(8px, 2.0vw, 10px);
        min-width: clamp(34px, 10vw, 42px);
    }

    .bar {
        height: clamp(8px, 2.2vw, 10px);
        border-width: 1px;
    }

    .bar-value-text {
        font-size: clamp(8px, 1.9vw, 10px);
    }

    .bar-damage-text {
        font-size: clamp(12px, 3.3vw, 16px);
    }

    #player-stats .pvp-kd {
        font-size: clamp(8px, 2.0vw, 10px);
        margin-top: 0;
    }

    #currency-display {
        bottom: calc(6px + env(safe-area-inset-bottom));
        right: calc(6px + env(safe-area-inset-right));
        padding: 6px 10px;
        font-size: 12px;
        max-width: calc(100vw - 12px);
    }

    .currency-icon {
        width: 18px;
        height: 18px;
    }

    /* Minimap: shrink on mobile; keep it top-right but smaller */
    #minimap {
        top: calc(6px + env(safe-area-inset-top));
        right: calc(6px + env(safe-area-inset-right));
        width: 100px;
        height: 100px;
    }

    /* Mobile: hide desktop keyboard hint bar */
    #controls-bar {
        display: none !important;
    }

    /* Login: keep things within the viewport */
    .game-logo {
        max-width: min(520px, 92vw);
        max-height: 220px;
    }

    .login-form {
        padding: 22px 16px;
        gap: 16px;
    }
}

@media (pointer: coarse) and (max-width: 980px) and (orientation: portrait) {
    /* In portrait, HUD stays smaller; overlay will normally block play. */
    #minimap {
        width: 86px;
        height: 86px;
    }
}

/* Fullscreen overlay (mobile prompt gate) */
#fullscreen-overlay,
#turn-phone-overlay {
    position: absolute;
    inset: 0;
    z-index: 18000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(18px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left));
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

.orientation-card {
    width: min(520px, 92vw);
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(180, 180, 180, 0.3);
    border-radius: 10px;
    padding: 18px 16px;
    color: #f0e6d2;
    text-align: center;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.7);
}

.orientation-card h2 {
    color: #d4af37;
    font-size: 20px;
    margin-bottom: 10px;
}

.orientation-card p {
    color: rgba(240, 230, 210, 0.92);
    font-size: 14px;
    line-height: 1.35;
    margin-bottom: 12px;
}

#fullscreen-enter-btn,
#fullscreen-continue-btn {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    border-radius: 8px;
    font-family: 'Cinzel', serif;
}

#fullscreen-enter-btn {
    background: rgba(212, 175, 55, 0.2);
    border: 2px solid #d4af37;
    color: #d4af37;
}

#fullscreen-continue-btn.secondary {
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(180, 180, 180, 0.35);
    color: rgba(240, 230, 210, 0.92);
}

.orientation-hint {
    margin-top: 10px;
    font-size: 12px;
    opacity: 0.8;
}

#turn-phone-try-lock-btn {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    background: rgba(212, 175, 55, 0.2);
    border: 2px solid #d4af37;
    color: #d4af37;
    border-radius: 8px;
    font-family: 'Cinzel', serif;
}

