/* Base Styles and Resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #000;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace;
    min-height: 100vh;
    padding: 40px 20px;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
}

/* Header */
.header-logo {
    text-align: center;
    margin-bottom: 25px;
}

.header-logo img {
    max-width: 300px;
    width: 100%;
    height: auto;
    filter: brightness(1.1);
}

/* Medal Dots */
.medal-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 10px;
    margin-bottom: 0;
}

.medal-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s;
}

/* Footer medals stay small */
.medal-dot.footer-medal {
    width: 14px;
    height: 14px;
}

.medal-dot:hover {
    transform: scale(1.2);
}

.medal-dot.bronze {
    background: linear-gradient(135deg, #CD7F32, #B87333);
}

.medal-dot.silver {
    background: linear-gradient(135deg, #C0C0C0, #E5E5E5);
}

.medal-dot.gold {
    background: linear-gradient(135deg, #FFD700, #FFA500);
}

.medal-dot.obsidian {
    background: linear-gradient(135deg, #1a1a1a, #000000);
    border: 1px solid #333;
}

/* Monitoring Address */
.monitoring-address {
    text-align: center;
    margin-bottom: 30px;
    padding: 15px;
    background: #111;
    border: 1px solid #222;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0.8;
}

.monitoring-address .label {
    color: #666;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.monitoring-address .address {
    color: #fff;
    word-break: break-all;
    font-size: 13px;
}

/* Spin Icon Animation */
.spin-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    animation: spin 3s linear infinite;
    opacity: 0.6;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Card Components */
.card {
    background: #111;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 20px;
}

.card-label {
    font-size: 12px;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
    margin-bottom: 8px;
}

.card-value {
    font-size: 20px;
    font-weight: 500;
}

.card-value.large {
    font-size: 32px;
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 12px;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

.status-indicator.active {
    background: #0f0;
}

.status-indicator.inactive {
    background: #f00;
}

/* Loading and Error States */
.loading {
    text-align: center;
    padding: 40px;
    opacity: 0.8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #999;
    font-size: 14px;
}

.error {
    text-align: center;
    padding: 40px;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 8px;
    margin: 20px 0;
}

/* Spin History */
.spin-history-row {
    display: grid;
    grid-template-columns: 24px 70px 30px 75px 70px 70px 1fr 100px;
    align-items: center;
    gap: 8px;
    padding: 10px 10px 10px 0;
    font-family: monospace;
    font-size: 13px;
    opacity: 0.9;
    box-sizing: border-box;
}

.spin-history-row:not(:last-child) {
    border-bottom: 1px solid #222;
}

.spin-history-row:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.02);
}

/* Medal Badges */
.medal-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    letter-spacing: 0.5px;
    text-align: center;
}

.medal-badge.bronze {
    background: linear-gradient(135deg, #CD7F32, #B87333);
    color: white;
}

.medal-badge.silver {
    background: linear-gradient(135deg, #C0C0C0, #B8B8B8);
    color: #333;
}

.medal-badge.gold {
    background: linear-gradient(135deg, #FFD700, #FFC700);
    color: #333;
}

.medal-badge.black,
.medal-badge.blackobsidian {
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    color: white;
    border: 1px solid #666;
}

.medal-badge.none {
    background: rgba(255, 255, 255, 0.1);
    color: #999;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Footer */
.footer {
    margin-top: 60px;
    padding: 30px 20px 20px;
    border-top: 1px solid #222;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.footer-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 14px;
    opacity: 0.8;
}

.footer-row:last-of-type {
    margin-bottom: 15px;
}

.footer-row a {
    color: #d8b4fe;
    text-decoration: none;
    transition: opacity 0.2s;
}

.footer-row a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Gradient animation for ENS names */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.github-link {
    display: flex;
    align-items: center;
    gap: 6px;
}

.github-link svg {
    color: #fff !important;
}

.github-link:hover {
    text-decoration: none !important;
    opacity: 1;
}

.github-link:hover span {
    text-decoration: underline;
}

/* Mobile Base Styles */
@media (max-width: 768px) {
    .medal-stats-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto auto !important;
        gap: 12px 20px !important;
        justify-items: start !important;
        padding: 0 10px !important;
    }

    .medal-stat-item {
        justify-content: flex-start !important;
        width: 100%;
    }

    .grid {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
    }

    .grid .card {
        flex: 1 1 calc(50% - 7.5px);
    }

    .card {
        padding: 15px;
    }

    .spin-icon {
        margin-right: 4px !important;
    }

    .spin-history-row {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        font-size: 11px;
        position: relative;
        padding-right: 35px;
    }

    /* Hide only the time column on mobile */
    .spin-history-row .time-col {
        display: none;
    }

    /* Hide the empty span */
    .spin-history-row > span:last-of-type:not(.medal-badge) {
        display: none;
    }

    .spin-history-row .medal-badge {
        position: absolute;
        right: 5px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 10px;
        padding: 2px 6px;
        min-width: 30px;
    }

    /* Show the gap time in green on mobile */
    .spin-history-row .time-gap {
        color: #4ade80;
        font-size: 11px;
        font-weight: 600;
    }

    /* Mobile card order */
    .card-can-spin { order: 1; }
    .card-total-spins { order: 2; }
    .card-last-spin { order: 3; }
    .card-time-since { order: 4; }
    .card-next-spin { order: 5; }
    .card-time-until { order: 6; }

    /* Description card should come after the main 6 cards */
    .card.description { order: 7; }

    /* Other full-width cards should come after description */
    .card.raffle-status { order: 8; }
    .card.medal-stats { order: 9; }

    /* Mobile medal stats header layout */
    .medal-stats .card-header {
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .medal-stats .medal-total-count {
        text-align: center !important;
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .footer-row {
        margin-bottom: 10px;
    }
}