/* ===================================================
   RYZE.HU — Style System
   =================================================== */

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --font: 'Outfit', system-ui, -apple-system, sans-serif;
    --accent: #6C5CE7;
    --accent-light: #A29BFE;
    --accent-glow: rgba(108, 92, 231, 0.4);
    --danger: #FF6B6B;
    --success: #51CF66;
    --gold: #FFC107;
    --wood: #8D6E46;
    --stone: #78909C;
    --food: #E91E63;
    --panel-bg: rgba(15, 15, 25, 0.82);
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-blur: 18px;
    --text: #F0F0F5;
    --text-dim: rgba(240, 240, 245, 0.55);
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font);
    background: #0a0a14;
    color: var(--text);
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
}

.hidden {
    display: none !important;
}

/* ===================================================
   START SCREEN
   =================================================== */
#start-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 30%, #1a1a2e 0%, #0a0a14 70%);
}



#start-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

#logo-container {
    position: relative;
}

#game-title {
    font-size: clamp(4rem, 12vw, 8rem);
    font-weight: 900;
    letter-spacing: -3px;
    color: #fff;
    line-height: 1;
}

#game-title .dot {
    color: var(--accent);
}

#game-title .hu {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}



#game-tagline {
    font-size: 1.15rem;
    font-weight: 400;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: var(--text-dim);
}

#name-input-container {
    display: flex;
    gap: 0;
    margin-top: 12px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

#player-name {
    width: 260px;
    padding: 16px 22px;
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 500;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    outline: none;
    transition: background var(--transition);
}

#player-name::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

#player-name:focus {
    background: rgba(255, 255, 255, 0.1);
}

#play-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #8B5CF6);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

#play-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 30%, rgba(255, 255, 255, 0.15) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

#play-btn:hover::before {
    transform: translateX(100%);
}

#play-btn:hover {
    filter: brightness(1.15);
    transform: scale(1.02);
}

#play-btn:active {
    transform: scale(0.98);
}

.btn-icon {
    font-size: 0.9rem;
}

#controls-hint {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 8px;
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-dim);
}

.hint-item kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

#online-players {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 4px;
}

#online-count {
    color: var(--success);
    font-weight: 700;
}

/* ===================================================
   GAME CANVAS
   =================================================== */
#game-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* ===================================================
   GAME UI — Common Panel Styles
   =================================================== */
#game-ui {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

#game-ui > * {
    pointer-events: auto;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(var(--panel-blur));
    -webkit-backdrop-filter: blur(var(--panel-blur));
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}


/* ===================================================
   RESOURCE BAR (Bottom Center)
   =================================================== */
#resource-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: var(--panel-bg);
    backdrop-filter: blur(var(--panel-blur));
    -webkit-backdrop-filter: blur(var(--panel-blur));
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.res-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    transition: background var(--transition), transform var(--transition);
}

.res-item:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-2px);
}

.res-item.flash {
    animation: resFlash 0.4s ease;
}

@keyframes resFlash {
    0% { background: rgba(255, 255, 255, 0.2); transform: scale(1.08); }
    100% { background: rgba(255, 255, 255, 0.03); transform: scale(1); }
}

.res-icon-wrap {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.res-info {
    display: flex;
    flex-direction: column;
}

.res-count {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.1;
    color: #fff;
}

.res-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===================================================
   ACTION BUTTONS & BUILD MENU
   =================================================== */
#action-buttons {
    position: absolute;
    bottom: 90px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#build-toggle,
#gun-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    background: var(--panel-bg);
    backdrop-filter: blur(var(--panel-blur));
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all var(--transition);
}

#build-toggle:hover,
#gun-toggle:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

#build-toggle.active {
    background: linear-gradient(135deg, var(--accent), #8B5CF6);
    border-color: transparent;
}

#gun-toggle.active {
    background: linear-gradient(135deg, #E17055, #D63031);
    border-color: transparent;
}

#build-toggle kbd,
#gun-toggle kbd {
    font-family: var(--font);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

#build-menu {
    position: absolute;
    right: 20px;
    bottom: 145px;
    width: 280px;
    padding: 16px;
    background: var(--panel-bg);
    backdrop-filter: blur(var(--panel-blur));
    -webkit-backdrop-filter: blur(var(--panel-blur));
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: slideInRight 0.25s ease-out;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

#build-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

#build-menu-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

#build-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.06);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
}

#build-close:hover {
    color: var(--danger);
    background: rgba(255, 107, 107, 0.15);
}

#build-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.build-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}

.build-option:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--panel-border);
}

.build-option.selected {
    background: rgba(108, 92, 231, 0.15);
    border-color: var(--accent);
}

.build-option.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.build-opt-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    flex-shrink: 0;
}
.build-opt-icon svg {
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));

}

.build-opt-info {
    flex: 1;
    min-width: 0;
}

.build-opt-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.build-opt-cost {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 1px;
}

.build-opt-key {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 7px;
    border-radius: 4px;
}

/* ===================================================
   CHAT (Bottom Left)
   =================================================== */
#chat-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--panel-bg);
    backdrop-filter: blur(var(--panel-blur));
    -webkit-backdrop-filter: blur(var(--panel-blur));
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
}

#chat-messages {
    height: 180px;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

#chat-messages::-webkit-scrollbar {
    width: 4px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 4px;
}

.chat-msg {
    font-size: 0.78rem;
    line-height: 1.35;
    animation: killFadeIn 0.2s ease-out;
}

.chat-msg .chat-name {
    font-weight: 700;
    margin-right: 4px;
}

.chat-msg.system {
    color: var(--accent-light);
    font-style: italic;
    font-size: 0.72rem;
}

.chat-msg.error {
    color: var(--danger);
    font-size: 0.72rem;
}

.chat-msg.command {
    color: var(--success);
    font-size: 0.72rem;
}

#chat-input-row {
    display: flex;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

#chat-input {
    flex: 1;
    padding: 10px 14px;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 400;
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
    border: none;
    outline: none;
    transition: background var(--transition);
}

#chat-input::placeholder {
    color: rgba(255,255,255,0.2);
}

#chat-input:focus {
    background: rgba(255, 255, 255, 0.08);
}

#chat-send {
    padding: 10px 16px;
    font-size: 1rem;
    color: var(--accent-light);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}

#chat-send:hover {
    color: #fff;
    background: rgba(108, 92, 231, 0.2);
}

/* ===================================================
   KILL FEED (Top Left)
   =================================================== */
#kill-feed {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 300px;
    pointer-events: none;
}

.kill-msg {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text);
    background: rgba(0, 0, 0, 0.55);
    border-radius: 8px;
    animation: killFadeIn 0.3s ease-out;
    white-space: nowrap;
}

@keyframes killFadeIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.kill-msg.fade-out {
    animation: killFadeOut 0.5s ease forwards;
}

@keyframes killFadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}


/* ===================================================
   HINT TOAST
   =================================================== */
#hint-toast {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    background: rgba(0, 0, 0, 0.65);
    border-radius: 20px;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
    animation: fadeInUp 0.3s ease;
}

/* ===================================================
   DEATH SCREEN
/* ===================================================
   ESC MENU
   =================================================== */
#esc-menu {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 20, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: fadeIn 0.2s ease;
}

#esc-menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: fadeInUp 0.3s ease-out;
}

#esc-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
}

#esc-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 260px;
}

.esc-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition);
}

.esc-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.esc-btn.primary {
    background: linear-gradient(135deg, var(--accent), #8B5CF6);
    border-color: transparent;
    color: #fff;
}

.esc-btn.primary:hover {
    filter: brightness(1.15);
}

.esc-btn.danger {
    color: var(--danger);
}

.esc-btn.danger:hover {
    background: rgba(255, 107, 107, 0.15);
    border-color: rgba(255, 107, 107, 0.3);
}

.esc-btn-icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
}

.esc-btn-text {
    flex: 1;
}

/* ===================================================
   HOTBAR (Minecraft-style)
   =================================================== */
#hotbar-wrap {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
#hotbar-resources {
    display: flex;
    gap: 6px;
}
.res-pill {
    background: rgba(0,0,0,0.55);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    color: #ccc;
    border: 1px solid rgba(255,255,255,0.06);
}
.res-pill b { color: #fff; font-weight: 700; }
#hotbar {
    display: flex;
    gap: 3px;
    background: rgba(0,0,0,0.5);
    padding: 4px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.08);
}
.hotbar-slot {
    width: 48px;
    height: 48px;
    background: rgba(20,20,30,0.85);
    border: 2px solid rgba(255,255,255,0.06);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: border-color 0.15s;
}
.hotbar-slot:hover { border-color: rgba(255,255,255,0.2); }
.hotbar-slot.active { border-color: #F1C40F; box-shadow: 0 0 8px rgba(241,196,15,0.3); }
.hotbar-icon { font-size: 1.2rem; line-height: 1; }
.hotbar-label {
    font-size: 0.45rem;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 1px;
}
.hotbar-key {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.5rem;
    color: #555;
    font-weight: 700;
}
.hotbar-slot.empty .hotbar-icon { opacity: 0.15; }

/* SVG icons in hotbar */
.hotbar-icon svg {
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.res-pill-icon {
    display: inline-flex;
    vertical-align: middle;
    margin-right: 2px;
}
.res-pill-icon svg {
    display: block;
    filter: drop-shadow(0 0 1px rgba(0,0,0,0.2));
}
/* Shop SVG icons */
.shop-icon svg {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* ===================================================
   WEAPON SHOP
   =================================================== */
#shop-menu {
    position: fixed;
    inset: 0;
    z-index: 450;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
}
#shop-close-btn {
    float: right;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1.2rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
#shop-close-btn:hover, #shop-close-btn:active {
    background: rgba(255,100,100,0.3);
    border-color: #FF6B6B;
}
#shop-content {
    background: #12121e;
    border: 1px solid #2a2a40;
    border-radius: 14px;
    padding: 24px 28px;
    min-width: 320px;
    max-width: 400px;
}
#shop-title {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#shop-gold-display {
    font-size: 0.85rem;
    color: #F1C40F;
    font-weight: 600;
}
#shop-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.shop-item {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    grid-template-rows: auto auto;
    gap: 0 10px;
    align-items: center;
    padding: 10px 14px;
    background: #1a1a2e;
    border: 1px solid #2a2a40;
    border-radius: 10px;
    cursor: pointer;
    color: #fff;
    text-align: left;
    font-family: inherit;
    transition: all 0.15s;
}
.shop-item:hover { background: #252545; border-color: #6C5CE7; }
.shop-item.owned { opacity: 0.4; pointer-events: none; }
.shop-item .shop-icon { font-size: 1.5rem; grid-row: 1 / 3; }
.shop-item .shop-name { font-weight: 700; font-size: 0.9rem; }
.shop-item .shop-desc { font-size: 0.7rem; color: #666; grid-column: 2; }
.shop-item .shop-price { font-size: 0.75rem; color: #F1C40F; font-weight: 600; grid-row: 1 / 3; white-space: nowrap; }
#shop-hint {
    text-align: center;
    color: #555;
    font-size: 0.75rem;
    margin-top: 14px;
}
#shop-hint b { color: #888; }

   /* ===================================================
   DEATH SCREEN
   =================================================== */
#death-screen {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
}

#death-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

#death-skull {
    font-size: 3rem;
}

#death-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #e55;
}

#death-killer {
    font-size: 0.9rem;
    color: #888;
}

#death-stats {
    display: flex;
    gap: 28px;
    margin: 4px 0;
}

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

.death-stat-val {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
}

.death-stat-lbl {
    font-size: 0.65rem;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#death-respawn-text {
    margin-top: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #777;
}

#death-countdown {
    color: #fff;
    font-weight: 700;
}

/* ===================================================
   AUTH SCREEN
   =================================================== */
#auth-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a14;
}

#auth-bg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#auth-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    max-width: 380px;
    width: 90%;
}

#auth-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 4px;
}

.auth-tab {
    padding: 10px 24px;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition);
}

.auth-tab.active {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 2px 12px var(--accent-glow);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.auth-form.active {
    display: flex;
}

.auth-form input {
    width: 100%;
    padding: 14px 18px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 500;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    outline: none;
    transition: all var(--transition);
}

.auth-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.auth-form input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.auth-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #8B5CF6);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 20px var(--accent-glow);
    margin-top: 4px;
}

.auth-submit:hover {
    transform: scale(1.03);
    filter: brightness(1.15);
}

.auth-submit:active {
    transform: scale(0.97);
}

#auth-error {
    min-height: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--danger);
    text-align: center;
}

/* ===================================================
   WELCOME USER (Start Screen)
   =================================================== */
#welcome-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-dim);
}

#welcome-user strong {
    color: var(--accent-light);
    font-weight: 700;
}

#logout-btn {
    padding: 6px 10px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition);
}

#logout-btn:hover {
    background: rgba(255, 80, 80, 0.2);
    border-color: rgba(255, 80, 80, 0.3);
}

/* ===================================================
   MOBILE CONTROLS
   =================================================== */
#mobile-controls {
    pointer-events: none;
}

#joystick-zone {
    position: absolute;
    bottom: 100px;
    left: 24px;
    pointer-events: auto;
    touch-action: none;
}

#joystick-base {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#joystick-handle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(108, 92, 231, 0.5);
    border: 2px solid rgba(162, 155, 254, 0.6);
    box-shadow: 0 0 15px rgba(108, 92, 231, 0.3);
    position: absolute;
    transition: none;
}

#mobile-buttons {
    position: absolute;
    bottom: 110px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: auto;
}

.mobile-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 15, 25, 0.8);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

.mobile-btn:active {
    transform: scale(0.9);
    background: rgba(108, 92, 231, 0.4);
    border-color: var(--accent);
}

.mobile-btn.small {
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
}

/* ===================================================
   MOBILE CHAT HAMBURGER (hidden on desktop)
   =================================================== */
#mobile-chat-hamburger {
    display: none;
}

/* ===================================================
   RESPONSIVE
   =================================================== */
@media (max-width: 768px) {
    /* ── Login Screen ── */
    #game-title { font-size: clamp(2.5rem, 10vw, 4rem); letter-spacing: -1px; }
    #game-tagline { font-size: 0.7rem; letter-spacing: 3px; }
    #start-content { gap: 16px; padding: 0 16px; width: 100%; }
    #name-input-container {
        flex-direction: column;
        width: 100%;
        border-radius: 12px;
    }
    #player-name {
        width: 100%;
        padding: 14px 18px;
        font-size: 1rem;
        text-align: center;
        border-radius: 12px 12px 0 0;
    }
    #play-btn {
        width: 100%;
        justify-content: center;
        padding: 14px;
        border-radius: 0 0 12px 12px;
    }
    #controls-hint { gap: 6px; flex-wrap: wrap; justify-content: center; padding: 0 12px; }
    .hint-item { font-size: 0.65rem; padding: 3px 6px; }
    .hint-item kbd { font-size: 0.55rem; padding: 1px 4px; }
    #login-box { max-width: 100%; padding: 20px 16px; margin: 0 12px; }
    #auth-tabs button { padding: 8px 16px; font-size: 0.8rem; }

    /* ── Hide online badge on mobile ── */
    #mp-status { display: none !important; }

    /* ── Hotbar ── */
    #hotbar-wrap { bottom: 6px; gap: 2px; }
    #hotbar-resources { gap: 3px; }
    .res-pill { padding: 1px 5px; font-size: 0.6rem; border-radius: 8px; }
    .res-pill-icon svg { width: 10px; height: 10px; }
    #hotbar { gap: 2px; padding: 2px; border-radius: 6px; border-width: 1px; }
    .hotbar-slot { width: 36px; height: 36px; border-radius: 4px; border-width: 1px; }
    .hotbar-icon svg { width: 16px !important; height: 16px !important; }
    .hotbar-label { font-size: 0.35rem; }
    .hotbar-key { font-size: 0.4rem; top: 1px; right: 2px; }
    .hotbar-slot.active { border-width: 2px; }

    /* ── Resource Bar (old) ── */
    #resource-bar { gap: 2px; padding: 5px 6px; border-radius: 12px; bottom: 12px; }
    .res-item { padding: 5px 6px; gap: 4px; }
    .res-icon-wrap { width: 24px; height: 24px; font-size: 0.85rem; }
    .res-count { font-size: 0.8rem; }
    .res-label { font-size: 0.55rem; }

    /* ── Action Buttons ── */
    #action-buttons { bottom: 48px; right: 8px; }
    #action-buttons button { padding: 6px 12px; font-size: 0.7rem; }

    /* ── Build Menu — left side below hamburger on mobile ── */
    #build-menu {
        position: fixed;
        top: 54px;
        left: 8px;
        right: auto;
        bottom: auto;
        width: auto;
        min-width: 48px;
        max-width: 56px;
        max-height: 60vh;
        overflow-y: auto;
        border-radius: 8px;
        padding: 4px;
    }
    #build-menu-header { display: none; }
    #build-options {
        display: flex !important;
        flex-direction: column !important;
        gap: 3px;
    }
    .build-option {
        flex-direction: column;
        padding: 4px;
        gap: 1px;
        align-items: center;
        text-align: center;
        border-radius: 6px;
    }
    .build-opt-icon { width: 24px; height: 24px; }
    .build-opt-icon svg { width: 16px; height: 16px; }
    .build-opt-info { display: none; }
    .build-opt-key { display: none; }

    /* ── Weapon Shop ── */
    #shop-menu { padding: 12px; }
    #shop-content { width: 90vw; max-width: 320px; padding: 16px; }
    #shop-title { font-size: 1.1rem; }
    .shop-item { padding: 8px 10px; gap: 8px; }
    .shop-icon svg { width: 24px; height: 24px; }
    .shop-name { font-size: 0.8rem; }
    .shop-desc { font-size: 0.6rem; }
    .shop-price { font-size: 0.65rem; }

    /* ── Death Screen ── */
    #death-screen h1 { font-size: 2.5rem; }
    .death-stats { gap: 16px; }

    /* ── Chat ── */
    #chat-container { width: 220px; max-height: 150px; }
    #chat-messages { max-height: 80px; font-size: 0.65rem; }
    #chat-input { font-size: 0.75rem; padding: 6px 8px; }

    /* ── Hint Toast ── */
    #hint-toast {
        font-size: 0.65rem;
        padding: 4px 10px;
        bottom: 52px;
        top: auto;
        white-space: normal;
        max-width: 70vw;
        border-radius: 12px;
    }

    /* ── Escape Menu ── */
    .esc-menu-panel { width: 85vw; max-width: 300px; padding: 20px; }

    /* ── Mobile Controls ── */
    #mobile-controls { display: flex !important; }

    /* ── Mobile Chat Hamburger ── */
    #mobile-chat-hamburger {
        display: flex;
        position: fixed;
        top: 12px; left: 12px;
        z-index: 500;
        width: 36px; height: 36px;
        align-items: center; justify-content: center;
        font-size: 1rem; border-radius: 10px;
        background: rgba(0, 0, 0, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.08);
        color: var(--text); cursor: pointer; pointer-events: auto;
        transition: all var(--transition); touch-action: manipulation;
    }
    #mobile-chat-hamburger:active {
        transform: scale(0.9);
        background: rgba(108, 92, 231, 0.3);
        border-color: var(--accent);
    }
    #mobile-chat-hamburger.chat-open {
        background: rgba(108, 92, 231, 0.25);
        border-color: var(--accent);
    }
    #chat-container {
        bottom: auto; top: 54px; left: 12px; width: 240px;
        transition: opacity 0.25s ease, transform 0.25s ease;
    }
    #chat-container.mobile-hidden {
        opacity: 0; pointer-events: none; transform: translateY(-10px);
    }
}

/* ── Extra small phones ── */
@media (max-width: 400px) {
    #game-title { font-size: 2.2rem; }
    .hotbar-slot { width: 30px; height: 30px; }
    .hotbar-icon svg { width: 13px !important; height: 13px !important; }
    .hotbar-label { display: none; }
    #hotbar { gap: 1px; padding: 2px; }
    .res-pill { font-size: 0.5rem; padding: 1px 4px; }
    #chat-container { width: 180px; }
    #build-menu { width: 170px; }
}
