:root {
    --primary: #ff3a5e;
    --secondary: #ffca28;
    --tertiary: #1e88e5;
    --background: #ffffff;
    --card-bg: #ffffff;
    --text: #333333;
    --text-secondary: #555555;
    --border: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.1);
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
    --radius: 16px;
    --tent-color1: #ff3a5e;
    --tent-color2: #ffca28;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--background);
    color: var(--text);
    background-image: radial-gradient(var(--secondary) 10%, transparent 11%),
                      radial-gradient(var(--secondary) 10%, transparent 11%);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
    background-repeat: repeat;
    min-height: 100vh;
    padding: 20px;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
}

.circus-tent {
    position: relative;
    background-color: white;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px var(--shadow);
    overflow: hidden;
    padding-top: 80px;
}

.tent-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: repeating-linear-gradient(
        90deg,
        var(--tent-color1),
        var(--tent-color1) 50px,
        var(--tent-color2) 50px,
        var(--tent-color2) 100px
    );
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.tent-top:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-bottom: 20px solid white;
}

header {
    text-align: center;
    padding: 30px 20px 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

h1 {
    font-size: 2.8rem;
    color: var(--primary);
    margin-bottom: 10px;
    text-shadow: 2px 2px 0 var(--secondary);
}

.title-decoration {
    display: inline-block;
    transform: rotate(10deg);
    animation: wiggle 3s infinite;
}

.title-decoration:last-child {
    transform: rotate(-10deg);
}

@keyframes wiggle {
    0%, 100% { transform: rotate(10deg); }
    50% { transform: rotate(15deg); }
}

.subtitle {
    font-size: 1.2rem;
    color: var(--tertiary);
    font-weight: 700;
}

.calculator-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 5px 15px var(--shadow);
    padding: 25px;
    border: 3px solid var(--primary);
    position: relative;
    flex: 1;
    min-width: 300px;
}

.card:before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    z-index: -1;
    border-radius: var(--radius);
    background: repeating-linear-gradient(
        45deg,
        var(--primary),
        var(--primary) 10px,
        var(--secondary) 10px,
        var(--secondary) 20px
    );
    filter: blur(5px);
    opacity: 0.3;
}

h2 {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.emoji {
    font-size: 1.6rem;
    display: inline-block;
    animation: spin 10s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.parameter-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

input[type="range"] {
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    appearance: none;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 25px;
    height: 25px;
    background: var(--tertiary);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.slider-value {
    font-weight: 700;
    color: var(--primary);
    min-width: 50px;
    text-align: center;
}

.percentage-input {
    width: 60px;
    padding: 5px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    text-align: center;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9rem;
}

.percentage-input:focus {
    border-color: var(--tertiary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(30, 136, 229, 0.3);
}

body.night-mode .percentage-input {
    background-color: #252525;
    color: var(--text);
    border-color: var(--tertiary);
}

input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--primary);
    border-radius: 25px;
    outline: none;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    background-color: white;
    transition: all 0.3s;
}

input[type="number"]:focus {
    border-color: var(--tertiary);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.3);
}

.input-with-suggestions {
    margin-bottom: 10px;
}

.suggestions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.suggestion-btn, .points-btn {
    background-color: var(--secondary);
    color: var(--text);
    border: none;
    border-radius: 15px;
    padding: 5px 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.suggestion-btn:hover, .points-btn:hover {
    background-color: var(--primary);
    color: white;
    transform: scale(1.05);
}

.points-input .suggestions {
    margin-top: 10px;
}

.threshold-input .suggestions {
    margin-top: 10px;
}

.input-with-button {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-with-button input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--primary);
    border-radius: 25px;
    outline: none;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    background-color: white;
    transition: all 0.3s;
}

.input-with-button input:focus {
    border-color: var(--tertiary);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.3);
}

.action-btn {
    background-color: var(--tertiary);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 15px var(--shadow);
}

.action-btn:hover {
    background-color: #0066cc;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px var(--shadow);
}

body.night-mode .input-with-button input {
    background-color: #252525;
    color: var(--text);
    border-color: var(--tertiary);
}

.wallet-input {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--border);
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--tertiary);
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

body.night-mode .loading-spinner {
    border-color: rgba(255, 255, 255, 0.1);
    border-top-color: var(--tertiary);
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.balloon-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    z-index: 1;
    transition: all 0.3s;
    box-shadow: 0 5px 15px var(--shadow);
}

.balloon-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    z-index: -1;
    transform: translateY(100%);
    transition: all 0.3s;
}

.balloon-btn:hover:before {
    transform: translateY(0);
}

.balloon-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px var(--shadow);
}

.reset-btn {
    background-color: var(--warning);
    color: white;
}

.calculate-btn {
    background-color: var(--tertiary);
    color: white;
}

.save-btn {
    background-color: var(--success);
    color: white;
}

.results-card {
    background-color: #f9f9f9;
}

.result-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.result-item {
    margin-bottom: 20px;
}

h3 {
    font-size: 1.3rem;
    color: var(--tertiary);
    margin-bottom: 15px;
}

.ticket-result {
    background-color: white;
    border: 2px dashed var(--primary);
    border-radius: 12px;
    padding: 15px;
    position: relative;
}

.ticket-result:before {
    content: '';
    position: absolute;
    top: -10px;
    left: 20px;
    width: 20px;
    height: 20px;
    background-color: var(--secondary);
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.ticket-result:after {
    content: '';
    position: absolute;
    top: -10px;
    right: 20px;
    width: 20px;
    height: 20px;
    background-color: var(--secondary);
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.result-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--text);
}

.result-row:last-child {
    margin-bottom: 0;
}

.result-row span:first-child {
    color: var(--text-secondary);
}

.highlight {
    color: var(--success) !important;
    font-size: 1.2rem;
}

.highlight span:first-child {
    color: var(--success) !important;
}

.divider {
    height: 2px;
    background-color: var(--border);
    margin: 15px 0;
}

.burn-scenario {
    background-color: rgba(255, 152, 0, 0.1);
    padding: 10px;
    border-radius: 8px;
}

.scenario-header {
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--warning);
}

.input-group {
    margin-bottom: 15px;
}

.extra-features {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.feature-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    background-color: var(--secondary);
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.feature-btn:hover {
    transform: scale(1.05);
    background-color: var(--primary);
    color: white;
}

#confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: left;
}

.twitter-credit {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.twitter-link {
    color: var(--tertiary);
    font-weight: bold;
    text-decoration: none;
    position: relative;
    transition: all 0.3s;
}

.twitter-link:hover {
    color: #1da1f2;
}

.twitter-link:hover::after {
    content: '🐦';
    position: absolute;
    top: -15px;
    right: -15px;
    animation: flyAway 1s forwards;
}

@keyframes flyAway {
    0% { transform: translate(0, 0) scale(0.8); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(15px, -15px) scale(1.2); opacity: 0; }
}

.emoji-animate {
    display: inline-block;
    animation: twinkle 1.5s infinite;
}

@keyframes twinkle {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.night-mode-toggle {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    gap: 8px;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    background-color: #ccc;
    border-radius: 34px;
    transition: all 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s;
}

input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

input[type="checkbox"]:checked + .toggle-slider {
    background-color: var(--tertiary);
}

input[type="checkbox"]:checked + .toggle-slider:before {
    transform: translateX(26px);
}

/* Dark Mode / Night Circus */
body.night-mode {
    --primary: #ff5e7d;
    --secondary: #ffd54f;
    --tertiary: #42a5f5;
    --background: #121212;
    --card-bg: #1e1e1e;
    --text: #f5f5f5;
    --text-secondary: #aaaaaa;
    --border: #333333;
    --shadow: rgba(0, 0, 0, 0.3);
}

body.night-mode .circus-tent {
    background-color: var(--card-bg);
}

body.night-mode .tent-top:after {
    border-bottom-color: var(--card-bg);
}

body.night-mode .ticket-result {
    background-color: #252525;
}

body.night-mode input[type="number"] {
    background-color: #252525;
    color: var(--text);
    border-color: var(--tertiary);
}

/* Responsive Styles */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .calculator-container {
        flex-direction: column;
        padding: 10px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .button-group, .extra-features {
        flex-direction: column;
    }
    
    .balloon-btn, .feature-btn {
        width: 100%;
        margin-bottom: 10px;
        padding: 14px 20px; /* Larger tap target */
    }
    
    .card {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    /* Improved spacing for form elements */
    .parameter-group {
        margin-bottom: 25px;
    }
    
    /* Table improvements for mobile */
    .top-earners-table {
        font-size: 0.85rem;
    }
    
    .top-earners-table th,
    .top-earners-table td {
        padding: 8px 5px;
    }
    
    /* Improved table scrolling for mobile */
    .top-earners-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Better stat cards on mobile */
    .total-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .stat-card {
        padding: 10px;
    }
    
    .stat-value {
        font-size: 1.5rem;
        margin: 5px 0;
    }
    
    /* Better form elements on mobile */
    input[type="number"],
    input[type="text"] {
        font-size: 0.9rem;
        padding: 12px;
        height: 46px; /* Easier to tap */
    }
    
    .percentage-input {
        width: 50px;
        font-size: 0.85rem;
        height: 40px;
    }
    
    /* Navigation improvements */
    .navigation-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .navigation-buttons a,
    .navigation-buttons button {
        width: 100%;
    }
    
    /* Optimize buttons to show only icons on very small screens */
    @media (max-width: 360px) {
        .feature-btn .btn-text {
            display: none;
        }
        
        .feature-btn i {
            font-size: 1.5rem;
            margin: 0;
        }
        
        .feature-btn {
            justify-content: center;
            padding: 12px;
        }
        
        .extra-features {
            flex-direction: row;
            flex-wrap: wrap;
            justify-content: space-between;
        }
        
        .extra-features .feature-btn {
            width: 48%;
            margin-bottom: 8px;
        }
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    .app-container {
        padding: 10px 5px;
    }
    
    .tent-top {
        height: 60px;
    }
    
    .wallet-address {
        font-size: 0.8rem;
    }
    
    footer {
        flex-direction: column;
        gap: 15px;
        padding: 15px 10px;
    }
    
    .footer-content {
        text-align: center;
    }
    
    .result-row {
        font-size: 0.9rem;
    }
    
    .highlight {
        font-size: 1rem;
    }
    
    /* Better button tap targets */
    .suggestion-btn, 
    .points-btn,
    .threshold-btn {
        padding: 10px 12px;
        margin: 3px;
        min-width: 44px; /* Minimum tap target size */
    }
    
    /* Adjust spacing */
    .suggestions {
        gap: 5px;
    }
    
    /* Improve results display */
    .ticket-result {
        padding: 10px;
    }
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    overflow: auto;
    justify-content: center;
    align-items: center;
}

.modal-content {
    position: relative;
    background-color: white;
    width: 90%;
    max-width: 600px;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px var(--shadow);
    overflow: hidden;
    padding-top: 60px;
    animation: bounceIn 0.6s;
    border: 3px solid var(--primary);
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.modal-tent-top {
    height: 60px;
    top: 0;
}

.modal-body {
    padding: 20px 30px;
}

.modal-body p {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.modal-body ol {
    margin-left: 20px;
    margin-bottom: 20px;
}

.modal-body li {
    margin-bottom: 10px;
    font-size: 1.05rem;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    padding: 0 30px 30px;
}

.modal-buttons button {
    flex: 1;
}

.disclaimer {
    font-style: italic;
    font-size: 0.9rem !important;
    color: var(--text-secondary);
    padding: 10px;
    border: 1px dashed var(--primary);
    border-radius: 8px;
    background-color: rgba(255, 58, 94, 0.05);
}

body.night-mode .modal-content {
    background-color: var(--card-bg);
}

body.night-mode .modal-tent-top:after {
    border-bottom-color: var(--card-bg);
}

/* Media Queries */
@media (max-width: 768px) {
    .calculator-container {
        flex-direction: column;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .button-group, .extra-features {
        flex-direction: column;
    }
    
    .balloon-btn, .feature-btn {
        width: 100%;
    }
}

/* Mobile card layout for top earners */
.mobile-cards-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.mobile-wallet-card {
    background-color: white;
    border-radius: 12px;
    border: 2px solid var(--primary);
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.wallet-card-header {
    background-color: var(--primary);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
}

.wallet-rank {
    font-size: 1.2rem;
}

.wallet-card-body {
    padding: 15px;
}

.wallet-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.wallet-card-row:last-child {
    border-bottom: none;
}

.wallet-card-row.highlight {
    font-weight: 700;
    color: var(--tertiary);
    font-size: 1.1rem;
}

.wallet-card-label {
    color: var(--text-secondary);
}

.wallet-card-value {
    font-weight: 700;
}

body.night-mode .mobile-wallet-card {
    background-color: var(--card-bg);
    border-color: var(--tertiary);
}

body.night-mode .wallet-card-header {
    background-color: var(--tertiary);
}

body.night-mode .wallet-card-row {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

/* Media query adjustments */
@media (max-width: 576px) {
    .top-earners-table {
        display: none; /* Hide table completely on small screens */
    }
    
    .mobile-wallet-card {
        margin-bottom: 5px;
    }
    
    .wallet-card-row {
        padding: 10px 0;
    }
    
    /* Make stat cards more prominent on mobile */
    .total-stats {
        margin-bottom: 25px;
    }
    
    .stat-card {
        border-width: 3px;
    }
    
    .stat-value {
        font-size: 2rem;
    }
}

/* Floating refresh button for mobile */
.floating-refresh-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--tertiary);
    color: white;
    font-size: 1.5rem;
    border: none;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    cursor: pointer;
    transition: all 0.3s ease;
}

.floating-refresh-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.floating-refresh-btn.spinning i {
    animation: spin 1s linear;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

body.night-mode .floating-refresh-btn {
    background-color: var(--primary);
}

/* Media query adjustments */
@media (max-width: 576px) {
    .top-earners-table {
        display: none; /* Hide table completely on small screens */
    }
    
    .mobile-wallet-card {
        margin-bottom: 5px;
    }
    
    .wallet-card-row {
        padding: 10px 0;
    }
    
    /* Make stat cards more prominent on mobile */
    .total-stats {
        margin-bottom: 25px;
    }
    
    .stat-card {
        border-width: 3px;
    }
    
    .stat-value {
        font-size: 2rem;
    }
} 