:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --primary: #3b82f6;
    --accent: #10b981;
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --neon-shadow: 0 0 10px rgba(16, 185, 129, 0.5), 0 0 20px rgba(16, 185, 129, 0.3);
    --blue-glow: 0 0 15px rgba(59, 130, 246, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 600px;
    padding: 2rem 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header with History Icon */
header {
    width: 100%;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    /* White for better visibility */
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    padding: 0.5rem;
}

.icon-btn:hover {
    color: var(--primary);
    transform: scale(1.1);
}

header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
}

header .highlight {
    color: var(--accent);
    text-shadow: var(--neon-shadow);
}

header p {
    color: var(--text-dim);
    margin-bottom: 2rem;
    font-weight: 500;
}

/* Common Stage Layout */
.stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.stage.hidden {
    display: none;
    opacity: 0;
    transform: scale(0.95);
}

.stage.active {
    opacity: 1;
    transform: scale(1);
    animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Wheel Handling */
.wheel-wrapper {
    position: relative;
    width: 350px;
    height: 350px;
    margin: 0 auto 2rem;
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
}

canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* transition removed for JS animation */
}

/* The pointer arrow */
.pointer {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-size: 3rem;
    color: #ef4444;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

/* Buttons */
.spin-btn {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: var(--blue-glow);
    transition: transform 0.1s, box-shadow 0.2s;
}

.spin-btn:active {
    transform: scale(0.95);
}

.spin-btn:disabled {
    background: #475569;
    cursor: not-allowed;
    box-shadow: none;
}

/* Variation Stage specific */
#selected-activity-display {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-dim);
}

.neon-text {
    color: var(--accent);
    text-shadow: var(--neon-shadow);
    text-transform: uppercase;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    max-width: 90%;
    width: 400px;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.visible .modal-content {
    transform: scale(1);
}

.modal-content h2 {
    color: var(--text-dim);
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.final-result {
    margin-bottom: 2.5rem;
}

.res-item {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 2.5rem;
    color: white;
    text-transform: uppercase;
    line-height: 1.1;
}

#result-activity {
    color: var(--primary);
    text-shadow: var(--blue-glow);
    margin-bottom: 0.5rem;
}

.result-divider {
    font-size: 1rem;
    color: var(--text-dim);
    margin: 0.5rem 0;
    font-style: italic;
}

#result-variation {
    color: var(--accent);
    text-shadow: var(--neon-shadow);
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.reset-btn {
    background: transparent;
    border: 2px solid var(--text-dim);
    color: var(--text-dim);
    padding: 0.8rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    max-width: 250px;
}

.reset-btn:hover {
    border-color: white;
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

/* Order Complete Button */
.action-btn.complete {
    background-color: var(--primary);
    /* Blue */
    color: white;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
    width: 100%;
    max-width: 250px;
}

/* History Modal */
.history-content {
    text-align: left;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.history-header h2 {
    margin-bottom: 0;
    text-align: left;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-dim);
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: white;
}

#history-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.history-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.25rem;
}

.history-label {
    font-weight: 700;
    color: white;
}

.history-val {
    color: var(--accent);
    font-weight: 700;
}

.empty-msg {
    text-align: center;
    color: var(--text-dim);
    font-style: italic;
    margin-top: 2rem;
}

/* Scrollbar styling */
#history-list::-webkit-scrollbar {
    width: 6px;
}

#history-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#history-list::-webkit-scrollbar-thumb {
    background: var(--text-dim);
    border-radius: 3px;
}

/* Timer Styles */
#timer-section {
    margin-bottom: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#timer-section.hidden {
    display: none;
}

#timer-display {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 3.5rem;
    color: var(--text-main);
    letter-spacing: 2px;
    margin-bottom: 1rem;
    font-variant-numeric: tabular-nums;
}

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.action-btn {
    border: none;
    padding: 0.8rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: transform 0.1s, box-shadow 0.2s;
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn.start {
    background-color: var(--accent);
    color: #064e3b;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.action-btn.pause {
    background-color: #f59e0b;
    color: #451a03;
}

.action-btn.hidden {
    display: none;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .wheel-wrapper {
        width: 300px;
        height: 300px;
    }

    .res-item {
        font-size: 2rem;
    }
}
/* Perk System Styles */
.perk-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(251, 191, 36, 0.1);
    color: #f59e0b;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1.25rem;
    border: 1px solid rgba(251, 191, 36, 0.3);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
    animation: fadeIn 0.5s forwards;
    align-self: center; /* Center vertically in header */
}

.perk-badge.hidden {
    display: none;
}

.perk-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.5));
}

.perk-usage-section {
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.perk-usage-section.hidden {
    display: none;
}

.perk-usage-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stepper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.stepper-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--text-dim);
    background: transparent;
    color: white;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.stepper-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(16, 185, 129, 0.1);
}

.stepper-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #334155;
    color: #475569;
}

#perk-spend-amount {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    min-width: 2rem;
}

