* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #1a1a1a;
    color: #e8d5b0;
    font-family: 'Oswald', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

.screen {
    display: none;
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    justify-content: center;
    align-items: center;
}

.screen.active {
    display: flex;
}

/* Main Menu */
#menu-screen {
    background: radial-gradient(ellipse at center, #2a2a2a 0%, #111 100%);
}

.menu-container {
    text-align: center;
}

.menu-title {
    margin-bottom: 50px;
}

.ball-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 10px;
}

.menu-title h1 {
    font-family: 'Playfair Display', serif;
    font-size: 72px;
    font-weight: 900;
    color: #f0d68a;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 40px rgba(218,165,32,0.15);
    letter-spacing: 4px;
}

.menu-subtitle {
    font-size: 18px;
    color: #a08a60;
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-top: 8px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.menu-btn {
    background: linear-gradient(180deg, #3a3020 0%, #2a2218 100%);
    border: 1px solid #6b5a3a;
    color: #f0d68a;
    font-family: 'Oswald', sans-serif;
    font-size: 20px;
    font-weight: 500;
    padding: 16px 48px;
    cursor: pointer;
    letter-spacing: 2px;
    text-transform: uppercase;
    min-width: 300px;
    transition: all 0.2s;
}

.menu-btn:hover {
    background: linear-gradient(180deg, #4a4030 0%, #3a3228 100%);
    border-color: #d4a843;
    box-shadow: 0 0 20px rgba(218,165,32,0.2);
}

.btn-icon {
    margin-right: 8px;
}

.menu-buttons.hidden {
    display: none !important;
}

.difficulty-header {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    color: #f0d68a;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.diff-btn[data-difficulty="easy"] { border-left: 3px solid #4a8a3a; }
.diff-btn[data-difficulty="medium"] { border-left: 3px solid #d4a843; }
.diff-btn[data-difficulty="hard"] { border-left: 3px solid #c0392b; }
.diff-btn[data-difficulty="pro"] { border-left: 3px solid #8e44ad; }

.back-btn {
    background: transparent !important;
    border-color: #3a3020 !important;
    color: #8a7a5a !important;
    font-size: 16px !important;
    min-width: 200px !important;
    padding: 10px 32px !important;
}

/* Game Screen */
#game-screen {
    flex-direction: column;
    background: #1a1a1a;
}

#hud {
    width: 100%;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, #2a2218 0%, #1a1a1a 100%);
    border-bottom: 1px solid #3a3020;
    min-height: 60px;
    z-index: 5;
}

.hud-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 16px;
    border-radius: 4px;
    transition: all 0.3s;
}

.hud-player.active {
    background: rgba(218,165,32,0.15);
    box-shadow: 0 0 12px rgba(218,165,32,0.2);
}

.hud-player .player-name {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 1px;
}

.hud-player.active .player-name {
    color: #f0d68a;
    text-shadow: 0 0 8px rgba(218,165,32,0.4);
}

.hud-player .ball-type {
    font-size: 13px;
    color: #8a7a5a;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hud-balls {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.hud-ball {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hud-ball.pocketed {
    opacity: 0.25;
}

.hud-ball-num {
    font-size: 9px;
    font-weight: 700;
    color: #111;
    background: rgba(255,255,240,0.85);
    border-radius: 50%;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.hud-center {
    text-align: center;
}

.hud-turn {
    font-size: 14px;
    color: #a08a60;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#canvas-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#pool-canvas {
    display: block;
    cursor: crosshair;
}

/* Power Bar */
#power-bar-container {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 10;
}

#power-bar-container.visible {
    opacity: 1;
}

#power-bar {
    width: 20px;
    height: 200px;
    background: #2a2218;
    border: 1px solid #6b5a3a;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

#power-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(0deg, #4a8a3a, #d4a843, #c0392b);
    transition: height 0.05s;
}

#power-label {
    font-size: 11px;
    color: #a08a60;
    letter-spacing: 3px;
}

/* Toast */
#toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
}

.toast {
    background: rgba(30,25,15,0.95);
    border: 1px solid #6b5a3a;
    color: #f0d68a;
    padding: 12px 32px;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 2px;
    text-align: center;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2s forwards;
    margin-bottom: 8px;
}

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

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Game Controls */
#game-controls {
    position: fixed;
    bottom: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.ctrl-btn {
    background: rgba(30,25,15,0.8);
    border: 1px solid #4a3a20;
    color: #a08a60;
    font-family: 'Oswald', sans-serif;
    font-size: 13px;
    padding: 8px 16px;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s;
}

.ctrl-btn:hover {
    border-color: #d4a843;
    color: #f0d68a;
}

/* Overlay */
#overlay-screen {
    background: rgba(0,0,0,0.85);
    z-index: 50;
}

.overlay-content {
    text-align: center;
}

#overlay-message, #win-message {
    font-family: 'Playfair Display', serif;
    font-size: 36px;
    font-weight: 700;
    color: #f0d68a;
    margin-bottom: 30px;
    line-height: 1.4;
}

#overlay-message .sub {
    font-family: 'Oswald', sans-serif;
    font-size: 18px;
    color: #a08a60;
    font-weight: 400;
    display: block;
    margin-top: 10px;
}

/* Win Screen */
#win-screen {
    background: rgba(0,0,0,0.9);
    z-index: 60;
}

#win-message {
    font-size: 48px;
}

/* Ball-in-hand indicator */
.ball-in-hand-msg {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30,25,15,0.95);
    border: 1px solid #d4a843;
    color: #f0d68a;
    padding: 10px 24px;
    font-size: 15px;
    letter-spacing: 2px;
    z-index: 15;
    text-transform: uppercase;
}

/* AI thinking */
.ai-thinking {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #f0d68a;
    letter-spacing: 2px;
    z-index: 15;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
