:root {
    /* Dark Theme (Default) */
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #818cf8;
    --gold: #fbbf24;
    --silver: #e2e8f0;
    --bronze: #b45309;
    --toggle-bg: rgba(255, 255, 255, 0.1);
    --banner-border: rgba(255, 255, 255, 0.15);
    --text-muted: #94a3b8;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
}

[data-theme="light"] {
    /* Light Theme */
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-border: rgba(0, 0, 0, 0.05);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-color: #4f46e5;
    --gold: #d97706;
    --silver: #94a3b8;
    --bronze: #92400e;
    --toggle-bg: rgba(0, 0, 0, 0.05);
    --banner-border: rgba(0, 0, 0, 0.1);
    --text-muted: #64748b;
    --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Pretendard', sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 10% 10%, rgba(99, 102, 241, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(236, 72, 153, 0.18) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(79, 70, 229, 0.12) 0%, transparent 60%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.3s, color 0.3s;
}

/* Vibrant Space Effects - High Contrast Nebula */
.background-glob {
    position: fixed;
    width: 100vw;
    height: 100vw;
    max-width: 1200px;
    max-height: 1200px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, rgba(129, 140, 248, 0) 70%);
    top: -20%;
    left: -20%;
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
    animation: floatBackground 30s infinite alternate ease-in-out;
}

.background-glob.two {
    top: auto;
    left: auto;
    bottom: -20%;
    right: -20%;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.25) 0%, rgba(236, 72, 153, 0) 70%);
    animation: floatBackground 35s infinite alternate-reverse ease-in-out;
}

@keyframes floatBackground {
    0% {
        transform: translate(-5%, -5%) scale(1) rotate(0deg);
    }

    100% {
        transform: translate(10%, 10%) scale(1.2) rotate(10deg);
    }
}

/* Multi-layered Animated Star Field */
body::before,
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    z-index: -2;
    pointer-events: none;
}

body::before {
    background-image:
        radial-gradient(2.5px 2.5px at 20px 30px, #fff, rgba(255, 255, 255, 0)),
        radial-gradient(1.5px 1.5px at 100px 70px, #fff, rgba(255, 255, 255, 0)),
        radial-gradient(3px 3px at 50px 160px, #fff, rgba(255, 255, 255, 0)),
        radial-gradient(1px 1px at 80px 120px, #fff, rgba(255, 255, 255, 0));
    background-size: 300px 300px;
    animation: dramaticTwinkle 3s infinite ease-in-out, moveStars 200s linear infinite;
    opacity: 0.5;
}

body::after {
    background-image:
        radial-gradient(1.5px 1.5px at 100px 100px, #fff, rgba(255, 255, 255, 0)),
        radial-gradient(2px 2px at 150px 250px, #fff, rgba(255, 255, 255, 0)),
        radial-gradient(4px 4px at 300px 50px, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
    background-size: 500px 500px;
    animation: dramaticTwinkle 5s infinite ease-in-out reverse, moveStars 350s linear infinite;
    opacity: 0.4;
}

@keyframes dramaticTwinkle {

    0%,
    100% {
        opacity: 0.3;
        filter: brightness(1) blur(0px);
    }

    50% {
        opacity: 1;
        filter: brightness(2) blur(1px);
    }
}

@keyframes moveStars {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(-150px, -150px);
    }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    position: relative;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

/* Floating Theme Toggle (FAB Style) */
.theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 2000;
    background: var(--accent-gradient);
    border: none;
    color: white;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.4rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.6);
}

.theme-toggle:active {
    transform: scale(0.9);
}


h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0;
    display: block;
}

.date-display {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-secondary);
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    margin-top: 0.5rem;
    letter-spacing: 0.5px;
}

.date-display::before,
.date-display::after {
    content: "✦";
    color: var(--gold);
    font-size: 0.8rem;
    opacity: 0.8;
}

.ranking-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* Card Link Styling */
.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    border-radius: 24px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-link:hover {
    transform: translateY(-8px) scale(1.02);
}

.card-link:active {
    transform: scale(0.98);
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    /* Changed to column for better internal layout control */
    gap: 0;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: fadeInUp 0.5s ease-out forwards;
    position: relative;
    overflow: hidden;
}


.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.card.rank-1 {
    border: 1px solid rgba(251, 191, 36, 0.5);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.05), var(--card-bg));
}

.card.rank-2 {
    border: 1px solid rgba(226, 232, 240, 0.5);
    background: linear-gradient(135deg, rgba(226, 232, 240, 0.05), var(--card-bg));
}

.card.rank-3 {
    border: 1px solid rgba(180, 83, 9, 0.5);
    background: linear-gradient(135deg, rgba(180, 83, 9, 0.05), var(--card-bg));
}

.ad-banner-container {
    width: 100%;
    margin: 3rem 0 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.ad-banner-container.mid-list {
    margin: 1rem 0;
}


.ad-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    width: 100%;
    max-width: 728px;
    text-align: right;
    margin-bottom: 0.25rem;
    opacity: 0.7;
}

.ad-banner-img {
    width: 100%;
    max-width: 728px;
    height: auto;
    aspect-ratio: 728/90;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--banner-border);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.zodiac-icon-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--card-border);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

.card-main-info {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
    position: relative;
    padding-bottom: 1.25rem;
}


.card-details {
    padding-top: 0.5rem;
}


.card-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}


.zodiac-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.zodiac-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.card-stats {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
}


.message {
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
    word-break: keep-all;
}


.lucky-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.85rem;
    margin: 0 -1.5rem;
    /* Expanded to full width */
    padding: 1.25rem 1.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    /* Stronger divider */
}


.tag {
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    background: rgba(125, 125, 125, 0.1);
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.tag strong {
    color: var(--text-primary);
    font-weight: 600;
}

.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.archive-nav {
    margin: 2rem auto 3rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
    width: 100%;
}

.archive-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    width: 100%;
    text-align: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.archive-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.03);
    display: block;
}

.archive-link:hover {
    color: var(--text-primary);
    background: var(--toggle-bg);
    padding-left: 1.5rem;
}

.archive-link.active {
    color: var(--accent-color);
    font-weight: 700;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--accent-color);
}

footer {
    text-align: center;
    margin-top: 4rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding-bottom: 3rem;
}

.footer-legal-links {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.footer-link {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--text-secondary);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Service Info Button (Footer) */
.footer-cta {
    display: inline-block;
    margin: 0;
    /* Control spacing via container */
    padding: 0.8rem 2rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    border-radius: 50px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
    letter-spacing: 0.5px;
}

.footer-cta:hover {
    background: var(--accent-gradient);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    border-color: transparent;
}


/* Rank Styling */
.rank-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 4rem;
}

.rank-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-muted);
    min-width: 3.5rem;
    text-align: center;
    font-family: 'Outfit', sans-serif;
    opacity: 0.5;
    line-height: 1;
}

.rank-change {
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 4px;
    letter-spacing: -0.5px;
}

.rank-up {
    color: #ff4d4d;
    text-shadow: 0 0 5px rgba(255, 77, 77, 0.3);
}

.rank-down {
    color: #4da6ff;
    text-shadow: 0 0 5px rgba(77, 166, 255, 0.3);
}

.rank-same {
    color: var(--text-muted);
    opacity: 0.5;
}

.card.rank-1 .rank-number {
    color: var(--gold);
    opacity: 1;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.card.rank-2 .rank-number {
    color: var(--silver);
    opacity: 1;
    text-shadow: 0 0 10px rgba(226, 232, 240, 0.5);
}

.card.rank-3 .rank-number {
    color: var(--bronze);
    opacity: 1;
    text-shadow: 0 0 10px rgba(180, 83, 9, 0.5);
}

/* Detail View Layout */
.detail-view {
    max-width: 800px;
    margin: 0 auto 40px;
    animation: fadeInUp 0.8s ease-out;
}

.detail-card {
    padding: 3rem !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2rem;
}

.rank-badge {
    background: var(--accent-gradient);
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
}

.zodiac-icon-img.large {
    width: 160px;
    height: 160px;
    margin: 0 auto;
    /* Ensure centering */
    display: block;
    /* Ensure centering */
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.2));
}

.zodiac-title {
    font-size: 2.8rem;
    font-weight: 800;
    margin: 0;
    font-family: 'Outfit', sans-serif;
}

.score-container {
    width: 100%;
    max-width: 500px;
    margin: 1.5rem auto;
}

.score-bar-bg {
    height: 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.score-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
    border-radius: 12px;
    transition: width 1.5s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.score-value {
    margin-top: 0.5rem;
    font-weight: 800;
    font-size: 1.8rem;
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(129, 140, 248, 0.5);
    font-family: 'Outfit', sans-serif;
}

.detailed-message {
    font-size: 1.35rem;
    line-height: 1.8;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    padding: 3.5rem 2.5rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin: 2rem 0;
    text-align: left;
    word-break: keep-all;
}

.lucky-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.25rem;
    width: 100%;
}

.lucky-box {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--card-border);
}

.lucky-box .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
}

.lucky-box .value {
    font-weight: 700;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Interaction Section */
.interaction-container {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: 100%;
}

.interaction-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
}

.interaction-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.vote-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    min-width: 120px;
}

.vote-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 600;
}

.vote-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.vote-btn.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.vote-btn .count {
    font-size: 0.9rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 10px;
    border-radius: 20px;
}

.remedy-tip {
    text-align: left;
    width: 100%;
    padding: 2rem;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 24px;
    border: 1px dashed rgba(99, 102, 241, 0.3);
    margin-top: 1rem;
}

.remedy-tip h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.remedy-tip p {
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Today Return Button */
.today-btn {
    display: inline-block;
    margin-top: 0.8rem;
    padding: 0.6rem 1.2rem;
    background: var(--card-bg);
    border: 1px solid var(--accent-color);
    border-radius: 30px;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.today-btn:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
}


/* Responsive Adjustments */
@media (max-width: 768px) {
    .card {
        flex-direction: column;
        align-items: stretch;
    }

    .card-main-info {
        padding-bottom: 1rem;
        display: flex;
        align-items: center;
        width: 100%;
    }


    .rank-number {
        font-size: 1.6rem;
        min-width: 1.8rem;
        opacity: 0.9;
    }

    .zodiac-icon-img {
        width: 48px;
        height: 48px;
    }

    .card-header {
        display: flex;
        flex-direction: column;
        /* Back to original stacked layout */
        flex: 1;
        gap: 0.2rem;
        position: relative;
        /* For positioning stats */
    }

    .card-stats {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        margin-top: 0;
    }

    .zodiac-name {
        font-size: 1.1rem;
    }

    .theme-toggle {
        bottom: 24px;
        right: 24px;
        width: 50px;
        height: 50px;
    }

    h1 {
        font-size: 2.1rem;
    }
}

@media (max-width: 600px) {
    .detail-card {
        padding: 1.5rem !important;
    }

    .zodiac-title {
        font-size: 2rem;
    }

    .detailed-message {
        font-size: 1.1rem;
        padding: 1.5rem;
    }

    .zodiac-icon-img.large {
        width: 120px;
        height: 120px;
    }
}