:root {
--red: #B22234;
--dark-red: #8B0000;
--blue: #1A3A6E;
--dark-blue: #0d1f3e;
--gold: #FFD700;
--gold2: #FFA500;
--white: #F5F0E8;
--bg: #0a1628;
--card: #111d35;
--border: #FFD700;
}

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

body {
background: var(--bg);
color: var(--white);
font-family: 'Barlow Condensed', sans-serif;
min-height: 100vh;
overflow-x: hidden;
background-image:
    radial-gradient(ellipse at 20% 50%, rgba(178,34,52,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(26,58,110,0.15) 0%, transparent 60%);
}

#bg-canvas {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 0;
}

#trump-rain-container {
position: fixed;
inset: 0;
pointer-events: none;
z-index: 2;
overflow: hidden;
display: none;
}

#trump-rain-container.active {
display: block;
}

.trump-rain-face {
position: absolute;
width: 60px;
height: 60px;
object-fit: contain;
pointer-events: none;
user-select: none;
will-change: transform;
filter: drop-shadow(0 0 8px rgba(255,215,0,0.8));
}

.maga-flash {
position: fixed;
inset: 0;
background: radial-gradient(ellipse at center, rgba(255,215,0,0.35) 0%, rgba(178,34,52,0.2) 50%, transparent 80%);
pointer-events: none;
z-index: 3;
animation: magaFlash 0.8s ease-out forwards;
}

@keyframes magaFlash {
0%   { opacity: 1; transform: scale(0.8); }
40%  { opacity: 1; transform: scale(1.05); }
100% { opacity: 0; transform: scale(1.2); }
}

.maga-text-burst {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(0);
font-family: 'Bebas Neue', sans-serif;
font-size: clamp(3rem, 8vw, 6rem);
letter-spacing: 8px;
color: var(--gold);
text-shadow: 0 0 40px rgba(255,165,0,1), 0 0 80px rgba(255,215,0,0.6), 4px 4px 0 rgba(178,34,52,0.8);
pointer-events: none;
z-index: 9998;
white-space: nowrap;
animation: magaTextBurst 2.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes magaTextBurst {
0%   { opacity: 0; transform: translate(-50%, -50%) scale(0) rotate(-10deg); }
20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.2) rotate(2deg); }
40%  { transform: translate(-50%, -50%) scale(0.95) rotate(-1deg); }
60%  { transform: translate(-50%, -50%) scale(1.05) rotate(0deg); opacity: 1; }
85%  { opacity: 1; }
100% { opacity: 0; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

header {
background: linear-gradient(135deg, var(--dark-blue) 0%, #1a0a0a 50%, var(--dark-blue) 100%);
border-bottom: 3px solid var(--gold);
padding: 10px 20px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
z-index: 10;
}

header h1 {
font-family: 'Bebas Neue', sans-serif;
font-size: clamp(1.6rem, 4vw, 2.4rem);
letter-spacing: 4px;
background: linear-gradient(to right, var(--gold), #fff, var(--gold));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
text-shadow: none;
}

.flag-stripe {
height: 4px;
background: repeating-linear-gradient(90deg, var(--red) 0px, var(--red) 33.3%, white 33.3%, white 66.6%, var(--blue) 66.6%, var(--blue) 100%);
}

.game-wrapper {
display: grid;
grid-template-columns: 1fr 320px 1fr;
gap: 0;
max-width: 1200px;
margin: 0 auto;
padding: 20px 16px;
position: relative;
z-index: 1;
}

.left-panel {
padding: 16px;
display: flex;
flex-direction: column;
gap: 12px;
}

.stat-card {
background: var(--card);
border: 1px solid rgba(255,215,0,0.3);
border-radius: 4px;
padding: 14px 16px;
position: relative;
overflow: hidden;
}

.stat-card::before {
content: '';
position: absolute;
top: 0; left: 0; right: 0;
height: 2px;
background: linear-gradient(90deg, var(--red), var(--gold), var(--blue));
}

.stat-label {
font-family: 'Bebas Neue', sans-serif;
letter-spacing: 2px;
font-size: 0.75rem;
color: var(--gold);
opacity: 0.8;
text-transform: uppercase;
}

.stat-value {
font-family: 'Bebas Neue', sans-serif;
font-size: 2rem;
letter-spacing: 1px;
color: var(--white);
line-height: 1;
margin-top: 2px;
}

.stat-sub {
font-size: 0.7rem;
color: rgba(245,240,232,0.5);
margin-top: 2px;
}

.maga-meter {
background: var(--card);
border: 1px solid rgba(255,215,0,0.3);
border-radius: 4px;
padding: 14px 16px;
}

.meter-label {
font-family: 'Bebas Neue', sans-serif;
letter-spacing: 2px;
font-size: 0.75rem;
color: var(--gold);
margin-bottom: 8px;
}

.meter-bar {
background: rgba(255,255,255,0.08);
border-radius: 2px;
height: 18px;
overflow: hidden;
position: relative;
}

.meter-fill {
height: 100%;
background: linear-gradient(90deg, var(--red), var(--gold));
border-radius: 2px;
transition: width 0.3s ease;
position: relative;
width: 0%;
}

.meter-fill::after {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 100%);
}

.center-panel {
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
padding: 16px 8px;
}

.score-display {
text-align: center;
}

.score-main {
font-family: 'Bebas Neue', sans-serif;
font-size: clamp(2.5rem, 5vw, 3.5rem);
letter-spacing: 2px;
background: linear-gradient(to bottom, var(--gold), var(--gold2));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
line-height: 1;
}

.score-label {
font-family: 'Bebas Neue', sans-serif;
letter-spacing: 4px;
font-size: 0.65rem;
color: rgba(245,240,232,0.4);
text-transform: uppercase;
}

.click-area {
position: relative;
width: 240px;
height: 240px;
cursor: pointer;
user-select: none;
-webkit-user-select: none;
}

.trump-btn {
width: 240px;
height: 240px;
border-radius: 50%;
border: 4px solid var(--gold);
background: radial-gradient(circle at 40% 35%, #1e3a6e 0%, #0d1f3e 60%, #060f1e 100%);
box-shadow:
    0 0 0 2px rgba(255,215,0,0.3),
    0 0 30px rgba(255,165,0,0.3),
    0 8px 32px rgba(0,0,0,0.6),
    inset 0 -4px 12px rgba(0,0,0,0.3);
display: flex;
align-items: flex-end;
justify-content: center;
transition: transform 0.08s ease, box-shadow 0.08s ease;
overflow: hidden;
position: relative;
cursor: pointer;
}

.trump-img {
width: 210px;
height: 210px;
object-fit: contain;
object-position: center bottom;
pointer-events: none;
user-select: none;
-webkit-user-select: none;
filter: drop-shadow(0 4px 12px rgba(0,0,0,0.7));
transition: transform 0.08s ease;
}

.trump-btn:active, .trump-btn.clicked {
transform: scale(0.93);
box-shadow:
    0 0 0 2px rgba(255,215,0,0.5),
    0 0 50px rgba(255,165,0,0.5),
    0 2px 8px rgba(0,0,0,0.6),
    inset 0 4px 12px rgba(0,0,0,0.4);
}

.trump-btn:active .trump-img, .trump-btn.clicked .trump-img {
transform: scale(0.96) translateY(4px);
}

.click-ripple {
position: absolute;
border-radius: 50%;
border: 2px solid var(--gold);
animation: ripple 0.6s ease-out forwards;
pointer-events: none;
}

@keyframes ripple {
0% { width: 0; height: 0; top: 50%; left: 50%; opacity: 1; transform: translate(-50%, -50%); }
100% { width: 280px; height: 280px; top: 50%; left: 50%; opacity: 0; transform: translate(-50%, -50%); }
}

.float-text {
position: fixed;
font-family: 'Bebas Neue', sans-serif;
font-size: 1.4rem;
color: var(--gold);
pointer-events: none;
animation: floatUp 1.2s ease-out forwards;
z-index: 9999;
text-shadow: 0 0 10px rgba(255,165,0,0.8), 0 2px 4px rgba(0,0,0,0.8);
white-space: nowrap;
}

@keyframes floatUp {
0% { opacity: 1; transform: translateY(0) scale(1); }
50% { opacity: 1; transform: translateY(-50px) scale(1.1); }
100% { opacity: 0; transform: translateY(-100px) scale(0.8); }
}

.per-stats {
display: flex;
gap: 16px;
font-family: 'Bebas Neue', sans-serif;
}

.per-stat {
text-align: center;
background: rgba(255,215,0,0.08);
border: 1px solid rgba(255,215,0,0.2);
border-radius: 4px;
padding: 6px 12px;
min-width: 80px;
}

.per-stat-val {
font-size: 1.2rem;
color: var(--gold);
}

.per-stat-label {
font-size: 0.55rem;
color: rgba(245,240,232,0.4);
letter-spacing: 1px;
}

.catchphrase {
font-family: 'Bebas Neue', sans-serif;
letter-spacing: 3px;
font-size: 0.75rem;
color: var(--red);
text-align: center;
animation: pulse-red 2s ease-in-out infinite;
}

@keyframes pulse-red {
0%, 100% { opacity: 0.7; }
50% { opacity: 1; color: var(--gold); }
}

.right-panel {
padding: 16px;
display: flex;
flex-direction: column;
gap: 8px;
position: sticky;
top: 0;
height: 100vh;
overflow: hidden;
}

.tab-bar {
display: flex;
gap: 4px;
margin-bottom: 4px;
}

.tab-btn {
flex: 1;
font-family: 'Bebas Neue', sans-serif;
font-size: 0.75rem;
letter-spacing: 2px;
padding: 6px 4px;
background: rgba(255,255,255,0.05);
border: 1px solid rgba(255,215,0,0.2);
border-radius: 3px;
color: rgba(245,240,232,0.5);
cursor: pointer;
transition: all 0.15s ease;
text-align: center;
}

.tab-btn:hover { color: var(--gold); border-color: rgba(255,215,0,0.5); }

.tab-btn.active {
background: rgba(255,215,0,0.1);
border-color: var(--gold);
color: var(--gold);
box-shadow: 0 0 8px rgba(255,215,0,0.15);
}

.tab-content { display: none; flex: 1; overflow: hidden; flex-direction: column; }
.tab-content.active { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

.panel-title {
font-family: 'Bebas Neue', sans-serif;
font-size: 1.1rem;
letter-spacing: 4px;
color: var(--gold);
border-bottom: 1px solid rgba(255,215,0,0.3);
padding-bottom: 8px;
margin-bottom: 4px;
}

.upgrades-list {
display: flex;
flex-direction: column;
gap: 6px;
overflow-y: auto;
flex: 1;
padding-right: 4px;
padding-bottom: 60px;
scrollbar-width: thin;
scrollbar-color: var(--gold) rgba(255,255,255,0.05);
}

.upgrades-list::-webkit-scrollbar {
width: 6px;
}

.upgrades-list::-webkit-scrollbar-track {
background: rgba(255,255,255,0.05);
border-radius: 3px;
}

.upgrades-list::-webkit-scrollbar-thumb {
background: var(--gold);
border-radius: 3px;
opacity: 0.6;
}

.upgrade-card {
background: var(--card);
border: 1px solid rgba(255,215,0,0.15);
border-radius: 4px;
padding: 13px 14px;
cursor: pointer;
transition: all 0.15s ease;
position: relative;
overflow: hidden;
display: flex;
align-items: center;
gap: 10px;
min-height: 72px;
flex-shrink: 0;
}

.upgrade-card::before {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(135deg, rgba(178,34,52,0.05) 0%, transparent 100%);
pointer-events: none;
}

.upgrade-card:hover:not(.locked) {
border-color: rgba(255,215,0,0.5);
background: #1a2a45;
transform: translateX(-2px);
}

.upgrade-card.locked {
opacity: 0.4;
cursor: not-allowed;
}

.upgrade-card.affordable {
border-color: rgba(255,215,0,0.4);
box-shadow: 0 0 8px rgba(255,215,0,0.1);
}

.upgrade-card.affordable:hover {
border-color: var(--gold);
box-shadow: 0 0 16px rgba(255,215,0,0.2);
}

.upgrade-icon {
font-size: 2rem;
flex-shrink: 0;
width: 40px;
text-align: center;
}

.upgrade-info {
flex: 1;
min-width: 0;
}

.upgrade-name {
font-family: 'Bebas Neue', sans-serif;
font-size: 1rem;
letter-spacing: 1px;
color: var(--white);
line-height: 1.1;
}

.upgrade-desc {
font-size: 0.65rem;
color: rgba(245,240,232,0.45);
margin-top: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.upgrade-right {
text-align: right;
flex-shrink: 0;
}

.upgrade-cost {
font-family: 'Bebas Neue', sans-serif;
font-size: 0.85rem;
color: var(--gold);
}

.upgrade-owned {
font-size: 0.6rem;
color: rgba(245,240,232,0.4);
margin-top: 1px;
}

.upgrade-bought {
animation: buyFlash 0.3s ease;
}

@keyframes buyFlash {
0% { background: rgba(255,215,0,0.4); }
100% { background: var(--card); }
}

.achievement-popup {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%) translateY(100px);
background: linear-gradient(135deg, var(--dark-blue), #1a0a10);
border: 2px solid var(--gold);
border-radius: 6px;
padding: 12px 20px;
display: flex;
align-items: center;
gap: 12px;
z-index: 9999;
transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
min-width: 280px;
box-shadow: 0 0 30px rgba(255,215,0,0.3);
}

.achievement-popup.show {
transform: translateX(-50%) translateY(0);
}

.ach-icon { font-size: 2rem; }

.ach-text { flex: 1; }

.ach-title {
font-family: 'Bebas Neue', sans-serif;
letter-spacing: 2px;
font-size: 0.65rem;
color: var(--gold);
}

.ach-name {
font-family: 'Bebas Neue', sans-serif;
font-size: 1rem;
color: var(--white);
}

.total-bar {
background: var(--card);
border-top: 1px solid rgba(255,215,0,0.2);
padding: 8px 16px;
display: flex;
justify-content: center;
gap: 30px;
font-family: 'Bebas Neue', sans-serif;
font-size: 0.75rem;
letter-spacing: 2px;
color: rgba(245,240,232,0.4);
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 10;
}

.total-bar span { color: var(--gold); }

@media (max-width: 900px) {
.game-wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
}
.left-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.right-panel {
    order: 3;
    position: relative;
    height: 600px;
}
}
