* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #0b0f19;
    color: #f8fafc;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    margin: 0;
    transition: background 0.3s ease;
    overflow: hidden;
}

/* TÉMATA POZADÍ AKTIVOVANÁ Z OBCHODU */
body.bg-space { background: radial-gradient(circle at center, #1e1b4b 0%, #090d16 100%); }
body.bg-fire { background: radial-gradient(circle at center, #451a03 0%, #090d16 100%); }
body.bg-cyber { background: radial-gradient(circle at center, #831843 0%, #090d16 100%); }
body.bg-gold { background: radial-gradient(circle at center, #78350f 0%, #090d16 100%); }

/* HLAVNÍ KONTAJNER APLIKACE S RÁMEČKEM LÍCUJÍCÍM K OKRAJŮM */
.app-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: 900px;
    max-height: 100%;
    background: #111827;
    border-radius: 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    border: 2px solid rgba(255, 255, 255, 0.15);
    position: relative;
    overflow: hidden;
    display: flex;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

@media (min-width: 900px) and (min-height: 600px) {
    .app-container {
        height: 92vh;
        max-height: 580px;
        border-radius: 20px;
    }
}

/* RÁMEČKY Z OBCHODU */
.app-container.frame-gold { border-color: #fbbf24; box-shadow: 0 0 25px rgba(251, 191, 36, 0.5); }
.app-container.frame-neon { border-color: #38bdf8; box-shadow: 0 0 25px rgba(56, 189, 248, 0.5); }
.app-container.frame-ruby { border-color: #ef4444; box-shadow: 0 0 25px rgba(239, 68, 68, 0.5); }
.app-container.frame-emerald { border-color: #10b981; box-shadow: 0 0 25px rgba(16, 185, 129, 0.5); }

.app-container.frame-rainbow {
    border: 3px solid transparent;
    border-image: linear-gradient(45deg, red, orange, yellow, green, blue, indigo, violet) 1;
    animation: rainbowBorder 3s linear infinite;
    box-shadow: 0 0 30px rgba(236, 72, 153, 0.6);
}

.app-container.frame-void {
    border-color: #a855f7;
    box-shadow: 0 0 35px #a855f7, inset 0 0 15px #a855f7;
    animation: voidPulse 2s infinite alternate;
}

@keyframes voidPulse {
    0% { box-shadow: 0 0 20px #a855f7; }
    100% { box-shadow: 0 0 45px #ec4899; }
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    padding: 16px;
    background: #111827;
    overflow: hidden;
}

.screen.active {
    display: flex;
}

/* TOP BAR */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    width: 100%;
    flex-shrink: 0;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-area h1 {
    font-size: 1.3rem;
    letter-spacing: 1px;
    font-weight: 800;
}

.user-panel {
    display: flex;
    align-items: center;
}

.user-info-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
}

#logged-user-display { color: #38bdf8; font-weight: 600; }
#coins-display { color: #fbbf24; font-weight: 600; }

/* TLAČÍTKA */
.icon-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    color: #cbd5e1;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.action-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: 0.2s;
    white-space: nowrap;
}

.shop-btn { background: #2563eb; color: #fff; }
.shop-btn:hover { background: #1d4ed8; }

.login-btn { background: #3b82f6; color: #fff; }
.login-btn:hover { background: #2563eb; }

.logout-btn {
    width: 28px; height: 28px; font-size: 0.75rem;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}
.logout-btn:hover { background: rgba(239, 68, 68, 0.4); color: #fff; }

/* MENU OBSAH A SÍŇ SLÁVY */
.menu-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 0;
    justify-content: space-between;
}

.history-box {
    flex: 1;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 14px;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.history-box h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #f1f5f9;
    text-align: center;
}

.menu-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    flex-shrink: 0;
}

.menu-btn {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.15);
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.primary-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6); }

.secondary-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #cbd5e1;
}
.secondary-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }

.equipped-btn {
    background: #10b981 !important;
    color: #fff !important;
}

/* FORMULÁŘE NASTAVENÍ */
.centered-setup-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
}

.setup-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.setup-form label {
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: left;
}

.custom-input {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 10px 14px;
    border-radius: 10px;
    color: #fff;
    font-size: 0.9rem;
    width: 100%;
    text-align: center;
}
.custom-input:focus { outline: none; border-color: #3b82f6; }

.setup-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    width: 100%;
    max-width: 400px;
}
.setup-actions button { flex: 1; }

#players-names-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 90px;
    overflow-y: auto;
    width: 100%;
}

/* HERNÍ PLOCHY */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: bold;
}

.game-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 1; min-height: 0; }
.game-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; flex: 1; min-height: 0; }
.game-grid-4 { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 10px; flex: 1; min-height: 0; }

.player-box {
    background: rgba(255,255,255,0.03);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    user-select: none;
    transition: 0.1s;
}

.player-box .p-info {
    position: absolute;
    top: 10px;
    display: flex;
    justify-content: space-between;
    width: 85%;
    font-size: 0.9rem;
}

/* ZNAKY A VELKÁ PÍSMENA */
.target-key {
    font-size: 6.5rem;
    font-weight: 900;
    color: #334155;
    transition: 0.15s;
    text-transform: uppercase;
    line-height: 1;
}

.target-key.show-key {
    color: #38bdf8;
    text-shadow: 0 0 35px rgba(56, 189, 248, 0.9), 0 0 10px #38bdf8;
}

body.font-neon .target-key.show-key { color: #22c55e !important; text-shadow: 0 0 35px rgba(34, 197, 94, 0.9) !important; }
body.font-gold .target-key.show-key { color: #fbbf24 !important; text-shadow: 0 0 35px rgba(251, 191, 36, 0.9) !important; }
body.font-pink .target-key.show-key { color: #ec4899 !important; text-shadow: 0 0 35px rgba(236, 72, 153, 0.9) !important; }

.target-key.winner-glow {
    color: #22c55e !important;
    text-shadow: 0 0 45px rgba(34, 197, 94, 1) !important;
    transform: scale(1.15);
}

/* TRÉNINKOVÁ PLOCHA S KOLEČKY */
.solo-target-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.25);
    border-radius: 16px;
    border: 2px dashed rgba(255,255,255,0.15);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

#solo-target {
    font-size: 7.5rem;
    line-height: 1;
}

/* NÁHODNÁ KOLEČKA V TRÉNINKU */
.target-circle {
    position: absolute;
    width: 90px;
    height: 90px;
    background: radial-gradient(circle, #38bdf8 0%, #0284c7 100%);
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: popIn 0.15s ease-out;
}

@keyframes popIn {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* TRÉNINK - PENALIZACE */
.penalty-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(220, 38, 38, 0.92);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 20;
}

/* OBCHOD SE SKINY & BOOSTY */
.shop-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 12px;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    overflow-y: auto;
    padding-right: 5px;
    flex: 1;
}

.shop-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    transition: 0.2s;
}

.shop-item-info h4 {
    font-size: 0.85rem;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.shop-item-info p {
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1.2;
}

.stats-box {
    background: rgba(0,0,0,0.3);
    padding: 14px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    font-size: 0.85rem;
}

/* MODÁLNÍ OKNA */
.modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-box {
    background: #1f2937;
    padding: 18px;
    border-radius: 14px;
    width: 90%;
    max-width: 350px;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 15px 30px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.modal-actions button { flex: 1; }

/* HERNÍ NOTIFIKACE */
.game-notification {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%) translateY(50px);
    background: #1e293b;
    border: 1px solid #38bdf8;
    color: #fff;
    padding: 8px 16px;
    border-radius: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 200;
    opacity: 0;
    transition: 0.3s ease;
    pointer-events: none;
}

.game-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* MOBILNÍ / NÍZKÉ DISPLEJE */
body.is-landscape-mobile {
    padding: 0 !important;
    overflow: hidden !important;
}

body.is-landscape-mobile .app-container {
    height: 100vh !important;
    height: 100dvh !important;
    border-radius: 0 !important;
}

body.is-landscape-mobile .screen {
    padding: 8px 12px !important;
}

body.is-landscape-mobile .top-bar {
    margin-bottom: 4px !important;
}

body.is-landscape-mobile .target-key {
    font-size: 3.5rem !important;
}

body.is-landscape-mobile #solo-target {
    font-size: 4rem !important;
}

body.is-landscape-mobile .target-circle {
    width: 70px !important;
    height: 70px !important;
}
