/* CSS Stylesheet for Robo-Stacker 3D */
:root {
    --bg-dark: #090d16;
    --card-dark: rgba(31, 41, 55, 0.75);
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --accent: #ffd200;
    --accent-dark: #eab308;
    --text-white: #f9fafb;
    --text-gray: #94a3b8;
    --border: rgba(255, 255, 255, 0.12);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Quicksand', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    font-family: var(--font-body);
    color: var(--text-white);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#game-container {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
    background: #000;
}

/* Header HUD */
.hud-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0) 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
    pointer-events: none;
}

.hud-header * {
    pointer-events: auto;
}

.back-link {
    color: var(--text-gray);
    text-decoration: none;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
}

.back-link:hover {
    color: var(--primary-light);
    border-color: var(--primary);
}

.hud-timer {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.3rem;
    color: var(--text-white);
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border);
    padding: 8px 18px;
    border-radius: 14px;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.hud-timer i {
    color: var(--primary-light);
}

.hud-level-badge {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.1rem;
    color: var(--text-white);
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 14px;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.hud-level-badge span:first-child {
    color: var(--text-gray);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.hud-level-badge #level-val {
    color: var(--accent);
}

.hud-counters {
    display: flex;
    gap: 8px;
}

.counter-badge {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1rem;
    padding: 8px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.badge-red {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
}

.badge-green {
    background: rgba(34, 197, 94, 0.25);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.4);
}

.badge-blue {
    background: rgba(59, 130, 246, 0.25);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.4);
}

.hud-btn {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border);
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
}

.hud-btn:hover {
    background: var(--primary);
    border-color: var(--primary-light);
}

/* 3D Canvas Container */
#canvas-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Overlay Screen */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 13, 22, 0.82);
    backdrop-filter: blur(16px);
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay-screen.active {
    display: flex;
    opacity: 1;
}

.screen-content {
    text-align: center;
    max-width: 420px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    padding: 35px 30px;
    border-radius: 28px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3);
}

.game-subtitle {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    color: var(--primary-light);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.game-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.1;
    color: var(--text-white);
    margin-bottom: 15px;
}

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

.game-description {
    font-size: 0.88rem;
    color: var(--text-gray);
    line-height: 1.6;
    margin-bottom: 25px;
}

.mode-selection {
    width: 100%;
    margin-bottom: 22px;
}

.mode-selection h3 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 10px;
    letter-spacing: 0.05em;
    text-align: center;
}

.mode-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
}

.btn-mode {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 16px;
    color: var(--text-gray);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-mode:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-mode.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary);
    color: var(--text-white);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.25);
}

.how-to-play {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    width: 100%;
    margin-bottom: 28px;
}

.how-to-play h3 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 12px;
    letter-spacing: 0.05em;
    text-align: center;
}

.controls-grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    text-align: left;
}

.control-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-gray);
}

.control-col strong {
    color: var(--text-white);
    font-family: var(--font-heading);
    font-size: 0.82rem;
    margin-bottom: 4px;
    display: block;
}

.control-col span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-col i {
    color: var(--primary-light);
    width: 16px;
    text-align: center;
}

.p2-controls {
    border-left: 1px solid var(--border);
    padding-left: 20px;
}

.mobile-note {
    margin-top: 14px;
    font-size: 0.78rem;
    color: var(--text-gray);
    border-top: 1px solid var(--border);
    padding-top: 10px;
    text-align: center;
}

.mobile-note i {
    color: var(--accent);
}

.btn-play-game {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #0f172a;
    border: none;
    border-radius: 14px;
    padding: 16px 32px;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.1s, box-shadow 0.1s, filter 0.2s;
    width: 100%;
    justify-content: center;
}

.btn-play-game:hover {
    filter: brightness(1.08);
}

.btn-play-game:active {
    transform: translateY(3px);
    box-shadow: none;
}

/* Victory Screen Details */
.victory-icon {
    font-size: 4rem;
    color: var(--accent);
    margin-bottom: 15px;
    filter: drop-shadow(0 0 15px rgba(253, 224, 71, 0.3));
    animation: pulse 2s infinite ease-in-out;
}

.screen-title-win {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 900;
    color: #22c55e;
    margin-bottom: 12px;
    text-shadow: 0 0 12px rgba(34, 197, 94, 0.2);
}

.score-report {
    font-size: 0.95rem;
    color: var(--text-gray);
    margin-bottom: 6px;
}

.final-score {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 30px;
}

.screen-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.btn-secondary-game {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--text-white) !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
}

.btn-secondary-game:hover {
    background: rgba(255, 255, 255, 0.14) !important;
}

/* Mobile Controls Overlay */
#touch-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 220px;
    z-index: 10;
    display: none;
    pointer-events: none;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 30px 40px 30px;
}

#touch-overlay * {
    pointer-events: auto;
}

/* Virtual Joystick */
#joystick-container {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#joystick-base {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
}

#joystick-handle {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    border: 2px solid var(--text-white);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    cursor: pointer;
    transition: background-color 0.2s;
}

#joystick-handle:active {
    background-color: var(--primary);
}

/* Action Button */
#action-container {
    display: flex;
    align-items: center;
}

.action-btn {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    transition: all 0.1s;
}

.action-btn:active {
    background: var(--primary);
    border-color: var(--primary-light);
    transform: scale(0.92);
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

/* Responsive Viewports */
@media (max-width: 768px) {
    #touch-overlay {
        display: flex;
    }
}
