* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1e293b;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

.top-nav {
    width: 100%;
    max-width: 820px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
    flex-wrap: wrap;
}

.back-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: color 0.15s;
}
.back-link:hover { color: #f8fafc; }

.mode-switcher {
    display: flex;
    background: #0f172a;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid #334155;
}

.mode-btn {
    background: transparent;
    color: #94a3b8;
    border: none;
    padding: 5px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.15s;
}
.mode-btn.active {
    background: #eab308;
    color: #0f172a;
}

.nav-center {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timer-pill {
    display: none;
    background: #dc2626;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    padding: 6px 14px;
    border-radius: 999px;
    margin: 0; /* Removes the upward bump */
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.record-badge {
    font-size: 0.85rem;
    color: #facc15;
    font-weight: 700;
    background: #0f172a;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #334155;
}

.mute-btn {
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid #334155;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.15s;
}
.mute-btn:hover { border-color: #eab308; }
.mute-btn.muted {
    color: #94a3b8;
    border-color: #334155;
}

.header {
    text-align: center;
    margin-bottom: 16px;
}

.timer-pill {
    display: none;
    background: #dc2626;
    color: #ffffff;
    font-weight: 800;
    font-size: 1.15rem;
    padding: 5px 18px;
    border-radius: 999px;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}
.timer-pill.urgent {
    animation: pulseRed 0.6s infinite alternate;
}

@keyframes pulseRed {
    from { transform: scale(1); background: #dc2626; }
    to   { transform: scale(1.06); background: #ef4444; }
}

.counter {
    font-size: 2.8rem;
    font-weight: 800;
    color: #4ade80;
    text-shadow: 0 2px 12px rgba(74, 222, 128, 0.35);
}

.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    font-size: 0.9rem;
    color: #cbd5e1;
    margin-top: 6px;
}
.stats-bar span {
    background: #0f172a;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid #334155;
}

.game-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: stretch;
    justify-content: center;
    max-width: 820px;
    width: 100%;
}

.machine-container {
    position: relative;
    width: 380px;
    max-width: 100%;
    height: 460px;
    background: #0f172a;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    border: 2px solid #334155;
    overflow: hidden;
}

.mode-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(4px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    z-index: 10;
}
.mode-overlay h2 {
    margin: 0 0 8px 0;
    color: #facc15;
    font-size: 1.5rem;
}
.mode-overlay p {
    color: #cbd5e1;
    margin: 0 0 20px 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.start-rush-btn {
    background: #22c55e;
    color: #0f172a;
    border: none;
    padding: 12px 24px;
    font-size: 1.05rem;
    font-weight: 800;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.4);
    transition: transform 0.15s, background 0.15s;
}
.start-rush-btn:hover {
    background: #4ade80;
    transform: scale(1.04);
}

svg { width: 100%; height: 100%; }

#top-cog {
    cursor: pointer;
    transform-origin: 145px 118px;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s;
}
#top-cog:hover { filter: drop-shadow(0 0 10px rgba(250, 204, 21, 0.7)); }
#top-cog:active { filter: drop-shadow(0 0 16px rgba(250, 204, 21, 1)); }

#bottom-cog {
    transform-origin: 236px 198px;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.money {
    position: absolute;
    font-size: 26px;
    left: 185px;
    top: 375px;
    pointer-events: none;
    user-select: none;
    animation: dropMoney 1.3s ease-in forwards;
}

.float-text {
    position: absolute;
    font-weight: bold;
    font-size: 1.1rem;
    color: #4ade80;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    left: 175px;
    top: 365px;
    pointer-events: none;
    user-select: none;
    animation: floatUp 1s ease-out forwards;
}

@keyframes dropMoney {
    0%   { transform: translateY(0) rotate(0deg) scale(0.5); opacity: 0; }
    20%  { opacity: 1; transform: translateY(12px) rotate(15deg) scale(1); }
    100% { transform: translateY(95px) rotate(180deg) scale(1.1); opacity: 0; }
}

@keyframes floatUp {
    0%   { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-45px); opacity: 0; }
}

.shop-panel {
    flex: 1;
    min-width: 300px;
    background: #0f172a;
    border-radius: 16px;
    padding: 20px;
    border: 2px solid #334155;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.shop-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin: 0 0 14px 0;
    color: #f8fafc;
    border-bottom: 1px solid #1e293b;
    padding-bottom: 10px;
}

.upgrade-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upgrade-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 12px 14px;
    color: #f8fafc;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}
.upgrade-btn:hover:not(:disabled) {
    background: #273549;
    border-color: #eab308;
    transform: translateY(-1px);
}
.upgrade-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.upg-info strong {
    display: block;
    font-size: 1rem;
    color: #f8fafc;
}
.upg-info small {
    color: #94a3b8;
    font-size: 0.82rem;
}

.upg-cost {
    background: #15803d;
    color: #dcfce7;
    font-weight: bold;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    white-space: nowrap;
    margin-left: 10px;
}
.upgrade-btn:disabled .upg-cost {
    background: #334155;
    color: #94a3b8;
}

.reset-form {
    margin-top: 20px;
    text-align: right;
}

.reset-btn {
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}
.reset-btn:hover {
    background: #ef4444;
    color: white;
}

.coin-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    background: radial-gradient(circle at 30% 30%, #fde047, #eab308 70%, #ca8a04) !important;
    color: #713f12 !important;
    border: 2px solid #fef08a !important;
    border-radius: 50% !important;
    padding: 0 !important;
    font-size: 0.72em;
    font-weight: 900;
    line-height: 1;
    vertical-align: 0.08em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
    text-shadow: none;
    user-select: none;
}


