@import url(https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;900&family=Space+Grotesk:wght@300;400;500;600;700&family=Montserrat:wght@700;900&family=Uncial+Antiqua&family=MedievalSharp&family=UnifrakturMaguntia&display=swap);
:root {
    --primary: #A0523D;
    --primary-light: #D4AF8F;
    --secondary: #1f2937;
    --accent: #10b981;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-game: #1a1f2e;
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f1f5f9;
    --text-dim: #94a3b8;
    --font-main: 'Outfit', sans-serif;
    --font-heading: 'Space Grotesk', 'Outfit', sans-serif;
    --danger: #ef4444;
    --warning: #f59e0b;
}

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

body {
    overflow: hidden;
    font-family: var(--font-main);
    background: #0a0e17;
    color: var(--text-main);
    height: 100vh;
    width: 100vw;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ===== HIDDEN UTILITIES ===== */
/* .hidden = display:none — removes element from layout entirely */
.hidden { display: none !important; }

/* .vis-hidden = invisible but still in layout — used for UNO/CATCH pills so they don't shift layout */
.vis-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* ===== BACKGROUND ===== */
#bg-3d-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -2;
    background: #0a0e17;
}

#menu-glass-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    background: rgba(10, 14, 23, 0.25);
    backdrop-filter: blur(12px);
    transition: opacity 0.5s ease;
}
#menu-glass-overlay.hidden { opacity: 0; pointer-events: none; }

.glass-crack {
    position: absolute;
    width: 300px; height: 300px;
    background-image: url(assets/images/abdbb826a333ca9a.png);
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}
.crack-1 { top: 10%; left: 15%; transform: rotate(15deg); }
.crack-2 { bottom: 15%; right: 10%; transform: rotate(-25deg) scale(0.8); }
.crack-3 { top: 40%; right: 25%; transform: rotate(180deg) scale(0.6); }

/* ===== GLASSMORPHISM ===== */
.glass {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ===== GAME CONTAINER ===== */
#game-container {
    position: fixed;
    inset: 0;
    background: #1a1f2e;
    z-index: 9999;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
#game-container.hidden { display: none !important; }

#game-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 30%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
    z-index: 1;
}

/* The game canvas fills the screen */
#game-canvas {
    width: 100vw;
    height: 100vh;
    display: block;
    background: transparent;
    image-rendering: -webkit-optimize-contrast; /* Fix for mobile canvas rendering */
    image-rendering: crisp-edges;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ===== MENUS ===== */
.menu {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    z-index: 1000;
    width: 88%;
    max-width: 520px;
    animation: menuIn 0.5s cubic-bezier(0.2, 1, 0.3, 1);
}

@keyframes menuIn {
    from { opacity: 0; transform: translate(-50%, -45%) scale(0.95); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

h1.glitch-text {
    font-family: 'Old English Text MT', 'UnifrakturMaguntia', 'Uncial Antiqua', 'Lucida Handwriting', 'Blackletter', serif;
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: 900;
    margin-bottom: 2rem;
    color: var(--primary-light);
    letter-spacing: 0.08em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7), 0 0 10px rgba(212, 175, 143, 0.3);
}

.menu,
.menu button,
.menu p,
.menu span,
.menu label,
.menu input,
.modal-card,
.modal-card button,
.modal-card p,
.modal-card span,
.modal-card label,
.modal-card input,
.text-btn,
.back-link,
.primary-btn,
.secondary-btn,
.room-info h2,
.room-info .label,
.ready-status,
.emoji-option,
.divider,
.code-text,
#waiting-msg,
#current-player-name,
#game-over-subtitle,
#display-room-code,
#join-code-input,
#join-name-input,
#player-name {
    font-family: var(--font-main);
    letter-spacing: 0.02em;
    text-transform: none;
}

.primary-btn,
.secondary-btn,
.text-btn,
.back-link {
    font-weight: 700;
}

.menu h1,
.menu h2,
.menu h3,
.modal-card h1,
.modal-card h2,
.modal-card h3,
.room-info h2,
#game-over-subtitle {
    font-family: var(--font-main);
    letter-spacing: 0.01em;
}

.back-link,
#back-btn1,
#back-btn2,
#back-btn-join,
#back-btn3,
#close-auth-btn,
#leave-room-btn,
#exit-to-menu-btn {
    font-family: 'Space Grotesk', 'Outfit', sans-serif;
    letter-spacing: 0.02em;
    text-transform: none;
    font-weight: 600;
}

.menu p,
.modal-card p,
.menu span,
.modal-card span,
.room-info .label,
.ready-status,
.divider,
.text-btn,
.back-link {
    font-size: 0.95rem;
}

.menu input,
.modal-card input {
    font-family: var(--font-main);
    letter-spacing: 0.02em;
    text-transform: none;
}

.menu input::placeholder,
.modal-card input::placeholder {
    font-family: var(--font-main);
    letter-spacing: 0.02em;
    text-transform: none;
}

#settings-modal .modal-card,
#settings-modal .modal-card * {
    font-family: var(--font-main);
    letter-spacing: normal;
    text-transform: none;
}

#settings-modal .modal-card h1,
#settings-modal .modal-card h2,
#settings-modal .modal-card h3 {
    font-family: var(--font-main);
    letter-spacing: normal;
    text-transform: none;
    font-weight: 700;
}

#settings-modal .modal-card p,
#settings-modal .modal-card li,
#settings-modal .modal-card span,
#settings-modal .modal-card button,
#settings-modal .modal-card input,
#settings-modal .modal-card label {
    font-family: var(--font-main);
    letter-spacing: normal;
    text-transform: none;
}

#settings-modal #how-to-play-btn,
#settings-modal #exit-to-menu-btn,
#settings-modal #close-settings-btn {
    font-family: var(--font-main);
    letter-spacing: normal;
    text-transform: none;
    font-weight: 600;
}

#settings-modal .rules-container,
#settings-modal .rules-container p,
#settings-modal .rules-container li {
    font-family: var(--font-main);
    letter-spacing: normal;
    text-transform: none;
}

/* ===== MULTIPLAYER & JOIN ROOM — normal body text, deathnote headings ===== */
/* Keep headings in Death Note style (already handled by .menu h1/.menu h2 rules above) */

/* Override body elements in multiplayer-menu to normal/professional */
#multiplayer-menu button,
#multiplayer-menu .divider,
#multiplayer-menu .back-link,
#join-room-panel button,
#join-room-panel input,
#join-room-panel input::placeholder,
#join-room-panel .emoji-selector p,
#join-room-panel .back-link {
    font-family: var(--font-main);
    letter-spacing: 0.02em;
    text-transform: none;
    font-weight: 600;
}

/* Restore normal casing for these specific buttons */
#create-room-btn,
#join-hub-btn,
#confirm-join-btn,
#back-btn2,
#back-btn-join {
    text-transform: none;
    letter-spacing: 0.03em;
    font-family: var(--font-main);
    font-weight: 700;
}

/* Keep input placeholder readable */
#join-code-input::placeholder,
#join-name-input::placeholder {
    text-transform: none;
    letter-spacing: 0.02em;
    font-family: var(--font-main);
    font-weight: 400;
}

/* Make divider "OR" text clean */
#multiplayer-menu .divider span {
    font-family: var(--font-main);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 500;
    font-size: 0.85rem;
}

.menu h2 {
    color: var(--primary-light);
    font-size: clamp(1.4rem, 4vw, 2rem);
    margin-bottom: 1.5rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

/* ===== BUTTONS ===== */
.primary-btn {
    background: url(assets/images/b9bb52438b99a99e.png) center/cover, linear-gradient(135deg, #C9844F 0%, #A0523D 50%, #8B4513 100%);
    background-blend-mode: overlay;
    color: #f1f5f9;
    padding: clamp(0.8rem, 2vw, 1.2rem) clamp(1.5rem, 4vw, 2.5rem);
    border-radius: 0.75rem;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-weight: 600;
    width: 100%;
    box-shadow: 0 8px 16px rgba(160, 82, 61, 0.4), inset 0 1px 0 rgba(212, 175, 143, 0.3);
    transition: 0.2s ease;
    border: 2px solid #6B3410;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.primary-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(90deg, rgba(139, 69, 19, 0.1) 0px, transparent 2px, transparent 4px);
    pointer-events: none;
}
.primary-btn:hover {
    background: url(assets/images/b9bb52438b99a99e.png) center/cover, linear-gradient(135deg, #D4AF8F 0%, #B8860B 50%, #A0523D 100%);
    background-blend-mode: overlay;
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(160, 82, 61, 0.5), inset 0 1px 0 rgba(212, 175, 143, 0.5);
}
.primary-btn:active { transform: translateY(0); }

.secondary-btn {
    background: url(assets/images/b9bb52438b99a99e.png) center/cover, linear-gradient(135deg, #B8860B 0%, #A0523D 50%, #704a1f 100%);
    background-blend-mode: overlay;
    color: var(--text-main);
    padding: clamp(0.8rem, 2vw, 1.2rem) clamp(1.5rem, 4vw, 2.5rem);
    border-radius: 0.75rem;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-weight: 600;
    width: 100%;
    transition: 0.2s;
    border: 2px solid #6B3410;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(112, 74, 31, 0.3), inset 0 1px 0 rgba(184, 134, 11, 0.2);
    position: relative;
    overflow: hidden;
}
.secondary-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(90deg, rgba(107, 52, 16, 0.1) 0px, transparent 2px, transparent 4px);
    pointer-events: none;
}
.secondary-btn:hover {
    background: url(assets/images/b9bb52438b99a99e.png) center/cover, linear-gradient(135deg, #D4AF8F 0%, #C9844F 50%, #A0523D 100%);
    background-blend-mode: overlay;
    transform: translateY(-2px);
    box-shadow: 0 10px 16px rgba(160, 82, 61, 0.4), inset 0 1px 0 rgba(212, 175, 143, 0.3);
}

#quit-btn { margin-top: 1rem; }

.image-btn {
    background: transparent !important;
    padding: 0 !important;
    border: 2px solid #6B3410 !important;
    box-shadow: 0 8px 16px rgba(160, 82, 61, 0.4) !important;
    width: 100%;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    border-radius: 0.75rem;
    position: relative;
    overflow: hidden;
}

.image-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(160, 82, 61, 0.5) !important;
}

.image-btn:active {
    transform: translateY(0);
}

.menu-btn-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    object-position: center;
    transform: scale(1.06);
    pointer-events: none;
    user-select: none;
}

#start-game-btn .menu-btn-image {
    max-width: none;
}

#quit-btn .menu-btn-image {
    max-width: none;
}

.text-btn {
    background: none; border: none;
    color: var(--text-dim);
    cursor: pointer; font-size: 0.95rem;
    padding: 0.5rem; transition: 0.2s;
}
.text-btn:hover { color: var(--text-main); }

.back-link {
    background: none; border: none;
    color: var(--text-dim);
    cursor: pointer; font-size: 0.9rem;
    padding: 0.5rem; transition: 0.2s;
    margin-top: 0.5rem;
    display: inline-block;
}
.back-link:hover { color: var(--text-main); }

.mode-btn {
    background: transparent;
    border: 2px solid #6B3410;
    padding: 0;
    display: flex; 
    flex-direction: column;
    align-items: stretch; 
    justify-content: stretch;
    gap: 0;
    color: var(--text-main); 
    transition: 0.2s; 
    cursor: pointer;
    aspect-ratio: 1;
    max-width: 220px;
    width: 100%;
    border-radius: 0.75rem;
    box-shadow: 0 8px 16px rgba(160, 82, 61, 0.4), inset 0 1px 0 rgba(212, 175, 143, 0.3);
    position: relative;
    overflow: hidden;
}
.mode-btn:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 12px 20px rgba(160, 82, 61, 0.5);
}
.mode-btn .icon { font-size: 3rem; }

.mode-btn-image {
    width: 100%;
    height: 100%;
    object-fit: fill;
    object-position: center;
    transform: scale(1.06);
    border-radius: 0.75rem;
    display: block;
    pointer-events: none;
    user-select: none;
    position: relative;
    z-index: 0;
}

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0; }
.menu-actions { display: flex; flex-direction: column; gap: 1rem; margin: 1.5rem 0; }
.menu-actions.vertical { gap: 1rem; }

.divider {
    display: flex; align-items: center;
    text-align: center; margin: 1rem 0; color: var(--text-dim);
}
.divider::before, .divider::after {
    content: ''; flex: 1;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.divider:not(:empty)::before { margin-right: .5em; }
.divider:not(:empty)::after  { margin-left: .5em; }

.google-signin-square {
    width: 60px;
    height: 60px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #D4A574, #C9844F);
    border: 2px solid #6B3410;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s ease;
    box-shadow: 0 6px 15px rgba(160, 82, 61, 0.4), inset 0 1px 0 rgba(212, 175, 143, 0.2);
}

.google-signin-square:hover {
    background: linear-gradient(135deg, #E5B89D, #D4A574);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(160, 82, 61, 0.5), inset 0 1px 0 rgba(212, 175, 143, 0.3);
}

.google-signin-square:active {
    transform: translateY(0);
}

.google-signin-square svg {
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
}

.room-info { margin-bottom: 2rem; }
.room-info h2 { color: var(--primary-light); letter-spacing: 4px; font-size: 2.5rem; font-family: var(--font-heading); text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); }

.players-list-container {
    text-align: left;
    background: rgba(0,0,0,0.2);
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
}
.players-list-container p { font-weight: bold; margin-bottom: 1rem; }
#waiting-players-list { list-style: none; display: flex; flex-direction: column; gap: 0.8rem; }
#waiting-players-list li {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(255,255,255,0.05);
    padding: 0.8rem 1.2rem; border-radius: 0.6rem;
}
.player-info-tag { display: flex; align-items: center; gap: 1rem; }
.ready-status {
    font-size: 0.75rem; font-weight: bold;
    padding: 4px 10px; border-radius: 4px; letter-spacing: 0.5px;
}
.ready-status.not-ready { color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.05); }
.ready-status.is-ready  { color: #10b981; background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.2); }
#ready-btn.active { background: #10b981; color: white; border-color: #10b981; }

/* ===== INPUTS ===== */
input[type="text"] {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    padding: clamp(0.8rem, 2vw, 1.2rem);
    border-radius: 0.75rem;
    color: white;
    font-size: clamp(0.9rem, 2vw, 1rem);
    width: 100%; outline: none; transition: 0.2s;
    font-family: var(--font-main);
}
input[type="text"]:focus { border-color: var(--primary); background: rgba(255,255,255,0.1); }
input[type="text"]::placeholder { color: var(--text-dim); }
.input-wrap.horizontal { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }

/* ===== EMOJI PICKER ===== */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 0.75rem; margin: 1.5rem 0;
    background: rgba(255,255,255,0.03);
    padding: 1rem; border-radius: 0.75rem;
}
.emoji-option {
    font-size: clamp(2rem, 4vw, 2.5rem); cursor: pointer; transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
    border-radius: 0.75rem; padding: 0.5rem; aspect-ratio: 1;
    background: rgba(255,255,255,0.05); border: 1px solid transparent;
}
.emoji-option:hover  { background: rgba(255,255,255,0.12); transform: scale(1.15); }
.emoji-option.selected { background: var(--primary); transform: scale(1.1); border-color: var(--primary-light); box-shadow: 0 0 12px rgba(160, 82, 61, 0.4); }

/* ===== SETTINGS ICON BUTTON ===== */
.icon-btn {
    background: rgba(255,255,255,0.08);
    width: clamp(44px, 8vw, 56px);
    height: clamp(44px, 8vw, 56px);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-main);
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    border: 1px solid var(--glass-border);
    transition: 0.2s; cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: rgba(255,255,255,0.15); transform: scale(1.1); }

/* Settings gear - top right */
.hud-right {
    position: fixed;
    top: calc(20px + env(safe-area-inset-top));
    right: calc(20px + env(safe-area-inset-right));
    z-index: 10006;
    pointer-events: auto;
    display: flex; gap: 10px;
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: transparent;
    display: flex; align-items: center; justify-content: center;
    z-index: 10010; padding: 1rem;
    pointer-events: none;
}
.modal-overlay:not(.hidden) {
    background: rgba(0,0,0,0.82);
    pointer-events: auto;
}
.modal-card {
    width: 90%; max-width: 500px;
    padding: clamp(2rem, 5vw, 3rem);
    border-radius: 1rem; text-align: center;
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    max-height: 90vh; overflow-y: auto;
}
.modal-card h1, .modal-card h2 { font-size: clamp(1.5rem, 4vw, 2rem); margin-bottom: 1rem; color: var(--text-main); }
.modal-card p { font-size: clamp(0.9rem, 2vw, 1rem); color: var(--text-dim); margin-bottom: 1rem; }

.rules-container {
    text-align: left; margin: 1.5rem 0;
    max-height: 250px; overflow-y: auto;
    padding: 1rem;
    background: rgba(0,0,0,0.3); border-radius: 0.75rem;
    font-size: clamp(0.85rem, 1.8vw, 0.95rem);
    line-height: 1.6; color: var(--text-dim);
}
.rules-container ul { list-style-position: inside; }
.rules-container li { margin-bottom: 0.5rem; }

/* ===== COLOR CHOOSER ===== */
#color-chooser {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 40px 100px rgba(0,0,0,0.8);
    border-radius: 2rem;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 10020;
    padding: 3rem;
    animation: modalScaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}
#color-chooser:not(.hidden) { pointer-events: auto; }

@keyframes modalScaleIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
#color-chooser h3 {
    font-size: 1.8rem; margin-bottom: 2rem; color: white;
    font-family: var(--font-heading); font-weight: 800;
    text-transform: uppercase; letter-spacing: 2px;
}
.color-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem; width: 100%; max-width: 400px;
}
.color-option {
    height: 120px; border-radius: 1.5rem; cursor: pointer;
    transition: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    border: 4px solid rgba(255,255,255,0.1);
    position: relative; overflow: hidden; aspect-ratio: 1;
}
.color-option::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
}
.color-option:hover {
    transform: translateY(-8px) scale(1.05);
    border-color: white;
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
}
.color-option[data-color="red"]    { background: linear-gradient(135deg, #ff1744, #b71c1c); }
.color-option[data-color="green"]  { background: linear-gradient(135deg, #00e676, #1b5e20); }
.color-option[data-color="blue"]   { background: linear-gradient(135deg, #2979ff, #0d47a1); }
.color-option[data-color="yellow"] { background: linear-gradient(135deg, #ffea00, #f57f17); }

/* ===== GAME HUD - Top left ===== */
#game-hud {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top));
    left: calc(10px + env(safe-area-inset-left));
    display: flex; align-items: center; gap: 10px;
    z-index: 600;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    pointer-events: none;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.06);
}

#penalty-counter {
    background: linear-gradient(135deg, #ef4444, #991b1b);
    color: white;
    padding: 4px 12px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 1.1rem;
    display: flex; align-items: center; gap: 2px;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%   { transform: scale(1);    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5); }
    50%  { transform: scale(1.05); box-shadow: 0 0 25px rgba(239, 68, 68, 0.8); }
    100% { transform: scale(1);    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5); }
}

.current-player-display {
    display: flex; align-items: center; gap: 10px;
}
#player-color-circle {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* Timer circle */
.timer-box {
    width: 46px; height: 46px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 900; font-size: 1.3rem;
    background: rgba(255,255,255,0.1);
    pointer-events: none; flex-shrink: 0;
}

#current-player-name {
    font-size: 1rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 1px;
    color: white; pointer-events: none; margin: 0;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.hud-emoji-img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: inline-block;
    flex-shrink: 0;
}

/* ===== ACTION CONTROLS ===== */
#action-controls {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    left: calc(24px + env(safe-area-inset-left));
    display: flex; align-items: center;
    pointer-events: auto; z-index: 10005;
}
.action-controls-right {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: calc(24px + env(safe-area-inset-right));
    display: flex; align-items: center;
    pointer-events: auto; z-index: 10005;
}

/* ===== ACTION PILLS ===== */
.action-pill {
    pointer-events: auto;
    min-width: 110px; height: 56px;
    border-radius: 999px;
    font-weight: 900; font-size: 1rem;
    border: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    transition: opacity 0.2s ease, transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.1), box-shadow 0.18s ease;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-main);
    text-transform: uppercase; letter-spacing: 1px;
    flex-shrink: 0; padding: 0 20px;
}

/* UNO pill */
.uno-pill {
    background: #f0f0f0; color: #111;
    font-size: 1.1rem;
}
.uno-pill:hover:not(.vis-hidden) { background: #fff; transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,0,0,0.35); }
.uno-pill:active:not(.vis-hidden) { transform: scale(0.97); }

/* CATCH UNO pill */
.catch-pill {
    background: #f0f0f0; color: #111;
    font-size: 0.85rem; line-height: 1.2;
    text-align: center; flex-direction: column; gap: 0;
}
.catch-pill:hover:not(.vis-hidden) { background: #fff; transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,0,0,0.35); }
.catch-pill:active:not(.vis-hidden) { transform: scale(0.97); }

/* ===== GAME ALERT ===== */
#game-alert {
    position: fixed; top: 30%;
    left: 50%; transform: translateX(-50%);
    background: transparent;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 0.75rem;
    padding: 0.8rem 2rem;
    color: white;
    font-size: clamp(1.1rem, 2.5vw, 1.8rem);
    font-weight: 800; text-align: center;
    z-index: 10030;
    box-shadow: 0 0 20px rgba(212, 175, 143, 0.2);
    max-width: 90%;
    pointer-events: none;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
}
/* When vis-hidden is removed it shows */
#game-alert:not(.vis-hidden) { pointer-events: auto; }

/* ===== COLOR INDICATOR (glow overlay) ===== */
.color-glow {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 320px; height: 320px;
    border-radius: 50%; filter: blur(60px);
    opacity: 0.07; z-index: 0;
    transition: background-color 1s ease;
    pointer-events: none;
}

/* ===== FULLSCREEN ===== */
#game-container.fullscreen {
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 9999;
}
#game-container.fullscreen #game-canvas {
    width: 100vw; height: 100vh;
}

/* ===== RESPONSIVE ===== */


/* ===== RESPONSIVE ===== */

/* Portrait mobile */
@media (max-width: 479px) {
    body { font-size: 14px; }
    .menu { padding: 1.5rem; border-radius: 1rem; }
    h1.glitch-text { font-size: 1.8rem; }
    .primary-btn, .secondary-btn { padding: 0.7rem 1.2rem; font-size: 0.85rem; }
    .mode-btn { padding: 0; gap: 0; }
    .mode-btn .icon { font-size: 2rem; }
    /* Center mode buttons when stacked in single-column layout on small screens */
    .menu-grid { grid-template-columns: 1fr; gap: 0.75rem; justify-items: center; }
    .menu-grid .mode-btn { width: 75vw; max-width: 220px; }
    .modal-card { max-width: 95vw; padding: 1.5rem; }

    #color-chooser {
        padding: 1.5rem;
        width: 90%;
    }
    .color-grid {
        gap: 1rem;
    }
    .color-option {
        height: 90px;
    }
}

@media (max-width: 768px) {
    .menu { width: 95%; max-width: none; padding: 2rem; }
    h1.glitch-text { font-size: 2.2rem; }
    .primary-btn, .secondary-btn { padding: 0.9rem 1.5rem; font-size: 0.95rem; }
    .menu-btn-image {
        width: 100%;
        height: 100%;
        max-width: none;
    }
    .menu-grid { gap: 1rem; }
    .modal-card { max-width: 90%; padding: 2rem; }
    .color-grid { gap: 1.2rem; }

    /* HUD on mobile */
    #game-hud {
        top: calc(8px + env(safe-area-inset-top));
        left: calc(8px + env(safe-area-inset-left));
        padding: 6px 10px; gap: 8px;
    }
    .timer-box { width: 38px; height: 38px; font-size: 1rem; }
    #current-player-name { font-size: 0.8rem; }
    #player-color-circle { width: 14px; height: 14px; }

    .hud-right {
        top: calc(10px + env(safe-area-inset-top));
        right: calc(10px + env(safe-area-inset-right));
        gap: 8px;
    }
    .icon-btn { width: 42px; height: 42px; font-size: 1rem; }

    /* Action pills on mobile */
    #action-controls {
        bottom: calc(16px + env(safe-area-inset-bottom));
        left: calc(12px + env(safe-area-inset-left));
    }
    .action-controls-right {
        bottom: calc(16px + env(safe-area-inset-bottom));
        right: calc(12px + env(safe-area-inset-right));
    }
    .action-pill { min-width: 85px; height: 50px; font-size: 0.85rem; padding: 0 14px; }
    .uno-pill { font-size: 0.9rem; }
    .catch-pill { font-size: 0.72rem; }

    /* Show fullscreen btn on mobile */
    #fullscreen-btn { display: flex !important; }
}

/* Portrait orientation optimization to prevent overlap */
@media (orientation: portrait) {
    .hud-right {
        top: calc(10px + env(safe-area-inset-top));
        right: calc(10px + env(safe-area-inset-right));
        gap: 6px;
    }
    .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    #game-hud {
        top: calc(10px + env(safe-area-inset-top));
        left: calc(10px + env(safe-area-inset-left));
        max-width: 140px;
        padding: 5px 10px;
        gap: 6px;
    }
    .timer-box {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }
    #action-controls, .action-controls-right {
        bottom: calc(12px + env(safe-area-inset-bottom));
    }
    .action-pill {
        min-width: 70px;
        height: 40px;
        font-size: 0.75rem;
        padding: 0 10px;
    }
    .catch-pill { font-size: 0.65rem; line-height: 1.1; }
    .menu-btn-image {
        width: 100%;
        height: 100%;
        max-width: none;
    }
}

/* Landscape on small screens — critical layout fix */
@media (orientation: landscape) and (max-height: 600px) {
    #game-hud {
        top: calc(6px + env(safe-area-inset-top));
        left: calc(6px + env(safe-area-inset-left));
        padding: 4px 8px;
        gap: 6px;
    }
    .timer-box { width: 34px; height: 34px; font-size: 0.9rem; }
    #current-player-name { font-size: 0.7rem; }
    #player-color-circle { width: 12px; height: 12px; }

    .hud-right {
        top: calc(6px + env(safe-area-inset-top));
        right: calc(6px + env(safe-area-inset-right));
        gap: 6px;
    }
    .icon-btn { width: 36px; height: 36px; font-size: 0.9rem; }

    #action-controls {
        bottom: calc(8px + env(safe-area-inset-bottom));
        left: calc(8px + env(safe-area-inset-left));
    }
    .action-controls-right {
        bottom: calc(8px + env(safe-area-inset-bottom));
        right: calc(8px + env(safe-area-inset-right));
    }
    .action-pill { min-width: 72px; height: 40px; font-size: 0.7rem; padding: 0 10px; }
}

/* Very short landscape */
@media (orientation: landscape) and (max-height: 420px) {
    #current-player-name { display: none; }
    .action-pill { min-width: 60px; height: 36px; font-size: 0.65rem; padding: 0 8px; }
}

/* Color Chooser layout for landscape mobile */
@media (max-width: 900px) and (orientation: landscape) {
    #color-chooser {
        padding: 1.5rem;
        flex-direction: row;
        flex-wrap: wrap;
        width: 90%;
        max-width: none;
    }
    #color-chooser h3 {
        width: 100%;
        text-align: center;
        margin-bottom: 0.8rem;
        font-size: 1.2rem;
    }
    .color-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.8rem;
        max-width: 100%;
    }
    .color-option {
        height: 70px;
    }
}

@media (min-width: 1200px) {
    .menu { max-width: 550px; }
    h1.glitch-text { font-size: 3.2rem; }
}

@media print {
    body, .menu, .modal-overlay, #game-container, #game-hud, #action-controls { display: none; }
}

/* ===== MULTIPLAYER HUD ===== */
.hud-left { display: none; }

#room-display {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
}
#room-display .label {
    font-size: 10px; color: rgba(255, 255, 255, 0.5);
    font-weight: bold; letter-spacing: 1px;
}
.code-text {
    font-family: "Space Mono", monospace;
    font-size: 18px; color: #3b82f6;
    font-weight: bold; letter-spacing: 2px;
}

/* ===== SCOREBOARD STYLING ===== */
#scoreboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 1rem 0;
}

#scoreboard-list div:first-child {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.05) 100%) !important;
    border: 2px solid rgba(255, 215, 0, 0.5) !important;
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    transform: scale(1.02);
}

#scoreboard-list div:nth-child(2) {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.1) 0%, rgba(192, 192, 192, 0.03) 100%) !important;
    border: 1.5px solid rgba(192, 192, 192, 0.4) !important;
    box-shadow: 0 4px 12px rgba(192, 192, 192, 0.1) !important;
}

#scoreboard-list div:nth-child(3) {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.1) 0%, rgba(205, 127, 50, 0.03) 100%) !important;
    border: 1.5px solid rgba(205, 127, 50, 0.35) !important;
    box-shadow: 0 4px 12px rgba(205, 127, 50, 0.1) !important;
}

#game-over-subtitle {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    font-size: 1.2em;
    letter-spacing: 1px;
}

/*# sourceMappingURL=main.css.map*/