:root {
    /* Comic Pop Art Palette */
    --color-primary: #FF0033;
    /* Flashy Red */
    --color-secondary: #0044CC;
    /* Comic Blue */
    --color-accent: #FFD700;
    /* Comic Yellow */
    --color-bg: #FFFFFF;
    /* Pure White for contrast */
    --color-surface: #FFFFFF;
    --color-text: #000000;
    /* Pure Black text */
    --color-text-muted: #333333;
    --color-border: #000000;
    /* Black Borders */

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Comic Effects */
    --shadow-hard: 4px 4px 0px 0px #000000;
    --shadow-pop: 8px 8px 0px 0px rgba(0, 0, 0, 0.2);
    --border-thick: 3px solid #000000;
    --radius-comic: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: #fce7f3;
    /* Very light pink background pattern base */
    background-image: radial-gradient(#FF0033 1px, transparent 1px);
    background-size: 20px 20px;
    /* Polka dot pattern */
    color: var(--color-text);
    line-height: 1.6;
    padding-bottom: 50px;
}

/* Header */
.site-header {
    background: var(--color-primary);
    border-bottom: var(--border-thick);
    padding: var(--spacing-sm) 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-hard);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 900;
    color: white;
    /* White text on Red Header */
    text-decoration: none;
    text-transform: uppercase;
    text-shadow: 2px 2px 0px #000;
    /* Hard shadow text */
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo span {
    background: var(--color-accent);
    color: black;
    padding: 0.2rem 0.5rem;
    border: 2px solid black;
    border-radius: var(--radius-comic);
    transform: rotate(-3deg);
    box-shadow: 2px 2px 0px black;
}

.nav-links {
    display: flex;
    gap: var(--spacing-sm);
}

.nav-link {
    background: white;
    color: black;
    text-decoration: none;
    font-weight: 900;
    font-size: 0.9rem;
    padding: 0.5rem 1.2rem;
    border: 2px solid black;
    border-radius: 999px;
    /* Pill shape */
    box-shadow: 2px 2px 0px black;
    transition: all 0.1s;
}

.nav-link:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0px black;
    background: var(--color-accent);
}

.nav-link:active {
    transform: translate(0px, 0px);
    box-shadow: 0px 0px 0px black;
}

.nav-link.active {
    background: var(--color-secondary);
    color: white;
}

/* Hero Section - Central Thumbnail Style */
.hero-wrapper {
    background: var(--color-accent);
    /* Yellow comic background */
    border-bottom: var(--border-thick);
    padding: var(--spacing-lg) 0;
    position: relative;
    overflow: hidden;
    /* Zigzag pattern maybe? */
    background-image: repeating-linear-gradient(45deg, #FFD700 0, #FFD700 10px, #FFC700 10px, #FFC700 20px);
}

.hero-content {
    /* text-align: center; */
    /* Removed to ensure flex centering works */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    position: relative;
    z-index: 2;
    width: 100%;
    /* Ensure full width */
}

.hero-thumbnail {
    display: inline-block;
    position: relative;
    margin-bottom: var(--spacing-md);
}

/* The Tenpa-kun Image */
.hero-thumbnail img {
    max-height: 350px;
    /* Big central image */
    width: auto;
    filter: drop-shadow(5px 5px 0px rgba(0, 0, 0, 1));
    /* Hard shadow for the image cutout */
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hero-thumbnail img:hover {
    transform: scale(1.05) rotate(2deg);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 900;
    color: var(--color-secondary);
    text-shadow: 3px 3px 0px white, 5px 5px 0px black;
    letter-spacing: -2px;
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* Mobile Header Optimization */
    .header-content {
        flex-direction: column;
        gap: 0.5rem;
    }

    .logo {
        font-size: 1.5rem;
        width: 100%;
        justify-content: center;
        /* Center logo */
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
        flex-wrap: wrap;
        /* Allow wrapping if needed, but try to keep in one row */
    }

    .nav-link {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
        flex: 1;
        /* Distribute space evenly */
        text-align: center;
        white-space: nowrap;
        min-width: auto;
    }

    /* Reduce Header Padding on Mobile */
    .site-header {
        padding: 0.5rem 0;
    }
}

/* Advertising Space */
.ad-footer-space {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    /* Standard mobile banner height */
    background: #f0f0f0;
    border-top: 2px solid black;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    color: #666;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* Adjust body to not hide content behind ad */
body {
    padding-bottom: 110px;
    /* 50px original + 60px ad space */
}

/* Adjust Back to Top to sit above ad */


/* Cards - Pop Art Style */
.card {
    background: var(--color-surface);
    border: var(--border-thick);
    /* Thick black border */
    border-radius: var(--radius-comic);
    box-shadow: var(--shadow-hard);
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
}

.card-header {
    background: #000;
    /* Black header */
    color: #FFF;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: var(--border-thick);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 900;
    /* Super bold */
    color: #FFF;
    /* Yellow text */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i {
    color: var(--color-accent);
}

.card-body {
    padding: var(--spacing-md);
}

/* Schedule List */
.schedule-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm);
    border-bottom: 2px dashed #000;
    /* Dashed line separator */
    transition: background 0.2s;
}

.schedule-item:last-child {
    border-bottom: none;
}

.schedule-item:hover {
    background: #FFFAF0;
    /* Tinted yellow */
}

.date-badge {
    background: var(--color-primary);
    color: white;
    padding: 0.4rem;
    border: 2px solid black;
    border-radius: var(--radius-comic);
    text-align: center;
    min-width: 65px;
    margin-right: var(--spacing-sm);
    font-weight: 900;
    line-height: 1.1;
    box-shadow: 2px 2px 0px black;
    transform: rotate(-2deg);
    /* Slightly tilted */
}

.date-badge .day {
    font-size: 1.4rem;
    display: block;
}

.date-badge .month {
    font-size: 0.7rem;
    text-transform: uppercase;
}

.event-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    color: var(--color-text);
    font-weight: 800;
}

.event-info .store-name {
    color: var(--color-secondary);
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Result Tables */
.result-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: var(--spacing-sm);
}

.result-table th,
.result-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 2px solid black;
}

.result-table th {
    background: var(--color-accent);
    color: black;
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 900;
    border-top: 2px solid black;
}

.result-table th:first-child {
    border-left: 2px solid black;
    border-top-left-radius: 8px;
}

.result-table th:last-child {
    border-right: 2px solid black;
    border-top-right-radius: 8px;
}

.result-table td:first-child {
    border-left: 2px solid black;
}

.result-table td:last-child {
    border-right: 2px solid black;
}

.result-table tr:last-child td {
    border-bottom: 2px solid black;
}

.result-table tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

.result-table tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}


.result-table tr:hover td {
    background: #E0F7FA;
}

.rank-badge {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    background: black;
    color: white;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 900;
    border: 2px solid white;
    box-shadow: 1px 1px 0px black;
}

.rank-1 {
    background: #FFD700;
    color: black;
    transform: scale(1.2);
    border-color: black;
}

.rank-2 {
    background: #C0C0C0;
    color: black;
    border-color: black;
}

.rank-3 {
    background: #CD7F32;
    color: white;
    border-color: black;
}

.diff-positive {
    color: var(--color-primary);
    font-weight: 900;
}

.diff-negative {
    color: var(--color-secondary);
    font-weight: 700;
}

/* Animations */
@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    80% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.animate-fade-in {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid black;
    transition: all 0.15s;
    box-shadow: var(--shadow-hard);
    text-transform: uppercase;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: #ff3355;
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0px black;
}

.btn-primary:active {
    transform: translate(0, 0);
    box-shadow: 0 0 0 black;
}

/* Admin Toolbar */
.admin-toolbar {
    background: #111;
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
    font-family: monospace;
    display: flex;
    justify-content: flex-end;
    border-bottom: 2px solid #333;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 100px;
    /* Slightly larger area */
    height: 100px;
    cursor: pointer;
    z-index: 999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s, bottom 0.3s;
    opacity: 0;
    pointer-events: none;
    filter: drop-shadow(4px 4px 0px rgba(0, 0, 0, 0.5));
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    bottom: 90px;
    /* Above 60px ad + spacing */
}

.back-to-top:hover {
    transform: scale(1.1) rotate(-5deg);
}

.back-to-top img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.speech-bubble {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 3px solid black;
    padding: 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 900;
    white-space: nowrap;
    text-align: center;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
    line-height: 1.2;
}

/* Little triangle for speech bubble */
.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: black transparent transparent transparent;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -6px;
    /* Overlay to hide border thickness */
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: white transparent transparent transparent;
    z-index: 1;
}

/* Login Screen */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-comic);
    border: 4px solid black;
    box-shadow: 10px 10px 0 var(--color-primary);
    width: 90%;
    max-width: 400px;
    text-align: center;
    background-image: radial-gradient(#ddd 1px, transparent 1px);
    background-size: 10px 10px;
    position: relative;
}

.login-card h2 {
    color: black;
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 2rem;
    text-transform: uppercase;
    text-shadow: 2px 2px 0 var(--color-accent);
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 900;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.form-input {
    width: 100%;
    padding: 0.8rem;
    border: 3px solid black;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    background: #fffbe0;
    box-shadow: 4px 4px 0 var(--color-secondary);
}

.close-login {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close-login:hover {
    color: black;
}