/* Brutalist Gopnik / Murino Stylesheet */

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

body {
    background-color: #121417;
    background-image: 
        radial-gradient(circle at 50% 30%, #1e2229 0%, #0d0f12 85%),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 30px 30px, 30px 30px;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

/* Header bar */
.top-bar {
    width: 100%;
    max-width: 540px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #1b1e23;
    border-bottom: 2px solid #2a2e36;
    border-radius: 8px 8px 0 0;
}

.top-bar-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #ffd700;
    text-transform: uppercase;
}

.top-controls {
    display: flex;
    gap: 8px;
}

.btn-ctrl {
    background: #252a32;
    border: 1px solid #3c424d;
    color: #ccc;
    font-size: 11px;
    font-weight: bold;
    padding: 5px 9px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-ctrl:hover {
    background: #333a46;
    color: #fff;
    border-color: #ffd700;
}

.btn-ctrl.god-mode-active {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%) !important;
    color: #000 !important;
    border-color: #fff !important;
    font-weight: 900 !important;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    animation: pulseGold 1.2s infinite alternate;
}

@keyframes pulseGold {
    0% { transform: scale(1); box-shadow: 0 0 8px rgba(255, 215, 0, 0.6); }
    100% { transform: scale(1.05); box-shadow: 0 0 16px rgba(255, 215, 0, 1); }
}

.hud-godmode-badge {
    background: #ffd700;
    color: #000;
    font-size: 11px;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.7);
}

/* Game canvas container */
#gameContainer {
    position: relative;
    width: 100%;
    max-width: 540px;
    background: #000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 2px #282c34;
    overflow: hidden;
    border-radius: 0 0 8px 8px;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: auto;
    cursor: pointer;
}

/* In-game HUD */
#inGameHud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hud-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.score-main {
    font-size: 42px;
    font-weight: 900;
    color: #fff;
    text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 0 4px 10px rgba(0,0,0,0.8);
    font-family: "Impact", "Arial Black", sans-serif;
}

.hud-right-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.rank-badge {
    background: rgba(20, 22, 26, 0.88);
    border: 1px solid #ffd700;
    color: #ffd700;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
}

.high-score-tag {
    font-size: 11px;
    color: #aaa;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 6px;
    border-radius: 3px;
}

.danger-tag {
    align-self: center;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.danger-normal {
    background: rgba(24, 27, 32, 0.8);
    color: #bbb;
    border: 1px solid #3a414d;
}

.danger-high {
    background: rgba(180, 20, 20, 0.95);
    color: #fff;
    border: 1px solid #ffd700;
    animation: flashDanger 0.7s infinite alternate;
}

@keyframes flashDanger {
    0% { transform: scale(1); box-shadow: 0 0 5px rgba(255, 0, 0, 0.7); }
    100% { transform: scale(1.04); box-shadow: 0 0 16px rgba(255, 0, 0, 1); }
}

/* Modals & Overlays */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(12, 14, 18, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 20;
    backdrop-filter: blur(4px);
}

.hidden {
    display: none !important;
}

/* Start Screen */
.start-content {
    max-width: 420px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.game-logo-title {
    font-size: 28px;
    font-weight: 900;
    color: #ffd700;
    text-transform: uppercase;
    text-shadow: 3px 3px 0 #942b2b, 5px 5px 12px rgba(0,0,0,0.9);
    letter-spacing: 1px;
}

.game-sub-title {
    font-size: 13px;
    color: #b0b8c2;
    line-height: 1.4;
}

.features-box {
    background: #181b20;
    border: 1px solid #2d333e;
    border-radius: 6px;
    padding: 12px 14px;
    text-align: left;
    font-size: 12px;
    line-height: 1.6;
    color: #cfd6df;
}

.features-box ul {
    list-style: none;
    margin-top: 6px;
}

.features-box li {
    margin-bottom: 4px;
}

.features-box li::before {
    content: "■ ";
    color: #ffd700;
}

.nick-input-group {
    display: flex;
    gap: 6px;
}

.input-pacanchik {
    flex: 1;
    background: #20242c;
    border: 2px solid #3b4250;
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    padding: 10px 14px;
    border-radius: 6px;
    outline: none;
}

.input-pacanchik:focus {
    border-color: #ffd700;
    background: #252b36;
}

.btn-dice {
    background: #2d3440;
    border: 2px solid #454e60;
    color: #ffd700;
    font-size: 13px;
    padding: 0 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.btn-dice:hover {
    background: #3b4454;
    border-color: #ffd700;
}

.btn-start {
    background: linear-gradient(180deg, #d32f2f 0%, #9a1b1b 100%);
    border: 2px solid #ffd700;
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    padding: 14px 20px;
    border-radius: 6px;
    text-transform: uppercase;
    cursor: pointer;
    letter-spacing: 1.5px;
    box-shadow: 0 6px 16px rgba(211, 47, 47, 0.4);
    transition: transform 0.1s ease, filter 0.1s ease;
}

.btn-start:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
}

.btn-start:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: #22262e;
    border: 1px solid #3c4352;
    color: #cfd7e3;
    font-size: 13px;
    font-weight: bold;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-secondary:hover {
    background: #2d333e;
    border-color: #ffd700;
    color: #fff;
}

/* Game Over Modal */
.gameover-box {
    max-width: 440px;
    width: 100%;
    background: #191c22;
    border: 2px solid #4a5160;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.9);
}

.go-header {
    text-align: center;
}

.go-title {
    font-size: 26px;
    font-weight: 900;
    color: #ff3333;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 2px 2px 0 #000;
}

.go-reason {
    font-size: 13px;
    color: #f1c40f;
    font-weight: bold;
    margin-top: 4px;
    background: rgba(0, 0, 0, 0.4);
    padding: 5px 8px;
    border-radius: 4px;
}

.go-score-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: #21252d;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #333a46;
}

.go-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.go-score-label {
    font-size: 11px;
    color: #9aa2b0;
    text-transform: uppercase;
}

.go-score-val {
    font-size: 24px;
    font-weight: 900;
    color: #fff;
}

.go-patsan-rank-box {
    background: #14161a;
    border-left: 4px solid #ffd700;
    padding: 10px 14px;
    border-radius: 0 4px 4px 0;
}

.go-rank-title {
    font-size: 15px;
    font-weight: 900;
    color: #ffd700;
}

.go-rank-quote {
    font-size: 12px;
    color: #b8c1ce;
    font-style: italic;
    margin-top: 4px;
    line-height: 1.4;
}

.go-submit-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.go-submit-result {
    font-size: 12px;
    color: #70db70;
    text-align: center;
    min-height: 16px;
}

.go-btn-row {
    display: flex;
    gap: 8px;
}

.go-btn-row .btn-start, .go-btn-row .btn-secondary {
    flex: 1;
}

/* Leaderboard Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #1a1d24;
    border: 2px solid #ffd700;
    border-radius: 8px;
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 40px rgba(0,0,0,0.9);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 2px solid #2d3340;
    background: #14161c;
}

.modal-title {
    font-size: 17px;
    font-weight: 900;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-close {
    background: #2c323e;
    border: 1px solid #444d5e;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-close:hover {
    background: #d32f2f;
    border-color: #ffd700;
}

.modal-body {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

/* Table styles */
.patsan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: left;
}

.patsan-table th {
    background: #242933;
    color: #a4afc1;
    font-weight: 800;
    padding: 10px 8px;
    border-bottom: 2px solid #373f4e;
    text-transform: uppercase;
    font-size: 11px;
}

.patsan-table td {
    padding: 8px;
    border-bottom: 1px solid #252b36;
    color: #d8e0eb;
}

.patsan-table tr:hover td {
    background: #222732;
}

.col-rank { width: 50px; text-align: center; font-weight: bold; }
.col-nick { color: #ffd700; }
.col-score { width: 60px; text-align: center; }
.score-badge {
    background: #b22222;
    color: #fff;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: bold;
}
.col-title { font-size: 11px; color: #a0aec0; }
.col-death { font-size: 11px; color: #8893a4; }
.col-missiles { font-size: 11px; color: #64b5f6; }
.col-date { font-size: 10px; color: #697486; }

/* Responsive adjustments */
@media (max-width: 480px) {
    .patsan-table th:nth-child(5),
    .patsan-table td:nth-child(5),
    .patsan-table th:nth-child(6),
    .patsan-table td:nth-child(6),
    .patsan-table th:nth-child(7),
    .patsan-table td:nth-child(7) {
        display: none;
    }
}
