/* ===== CSS Variables ===== */
:root {
    /* Mystic/Aurora Dark Theme */
    --bg-primary: #080912;
    --bg-secondary: #0f111a;
    --bg-card: rgba(16, 18, 28, 0.7);
    --bg-card-hover: rgba(26, 28, 45, 0.85);

    --text-primary: #e0e0e0;
    --text-secondary: #aab;
    --text-muted: #667;

    /* Cool & Mysterious Accents */
    --accent-primary: #ff6b35;
    /* Orange (Restored) */
    --accent-secondary: #facc15;
    /* Yellow */
    --accent-blue: #3b82f6;
    --accent-green: #2dd4bf;
    /* Teal */
    --accent-purple: #818cf8;
    /* Indigo */
    --accent-fire: #fb7185;
    /* Soft Red/Rose */
    --accent-cyan: #22d3ee;

    --gradient-fire: linear-gradient(135deg, #ff6b35 0%, #fb7185 100%);
    /* Changed to cool gradient for title */
    --gradient-water: linear-gradient(135deg, #3b82f6 0%, #2dd4bf 100%);
    --gradient-ice: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    --gradient-element: linear-gradient(135deg, #fb7185 0%, #f472b6 100%);
    --gradient-armor: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-dark: linear-gradient(180deg, #111827 0%, #030712 100%);

    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-glow: 0 0 25px rgba(255, 107, 53, 0.2);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: 80px;
    /* Space for Nav (60px) + buffer */
}

/* ===== Background Effects (Misty Aurora) ===== */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 50% 10%, #1a1c2e 0%, transparent 60%);
}

.glow {
    position: absolute;
    /* Irregular blob shape via border-radius */
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    filter: blur(100px);
    /* Increased blur for more atmospheric feel */
    opacity: 0.25;
    /* Reduced from 0.4 */
    animation: aurora-float 25s ease-in-out infinite alternate, hue-cycle 80s linear infinite;
    mix-blend-mode: screen;
}

/* 3 Distinct Hues - Aurora Curtains */
.glow-1 {
    width: 100vw;
    height: 80vh;
    /* Softer linear gradient with more transparency */
    background: linear-gradient(135deg, transparent 20%, rgba(255, 0, 85, 0.5) 50%, transparent 80%);
    top: -30%;
    left: -30%;
    transform: rotate(25deg) skewX(30deg);
    animation-delay: 0s, 0s;
}

.glow-2 {
    width: 100vw;
    height: 90vh;
    background: linear-gradient(45deg, transparent 20%, rgba(0, 85, 255, 0.5) 50%, transparent 80%);
    bottom: -20%;
    right: -30%;
    transform: rotate(-20deg) skewY(15deg);
    animation-delay: -7s, -30s;
}

.glow-3 {
    width: 70vw;
    height: 70vh;
    background: radial-gradient(circle at 50% 50%, rgba(0, 255, 85, 0.3) 0%, transparent 70%);
    top: 20%;
    left: 10%;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    opacity: 0.15;
    animation-delay: -12s, -50s;
}

/* Layer 1: Triangle Mesh (Slow, Background) */
/* Shared Settings for Patterns */
.background-effects::before {
    content: "";
    position: absolute;
    top: -100px;
    left: -100px;
    width: calc(100% + 200px);
    height: calc(100% + 200px);
    opacity: 0.4;
    z-index: 0;
}

/* Pattern: Diamond (Original) */
.background-effects.diamond::before {
    background-image: url("data:image/svg+xml,%3Csvg width='48' height='28' viewBox='0 0 48 28' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0 L24 28 L48 0 M0 28 L24 0 L48 28' stroke='%2338bdf8' stroke-width='1' stroke-opacity='0.15' fill='none'/%3E%3C/svg%3E");
    background-size: 48px 28px;
}

/* Pattern: Hexagon (Honeycomb) */
.background-effects.hexagon::before {
    /* Honeycomb Pattern (Scaled to 40x70 for true 1px stroke rendering) */
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='70' viewBox='0 0 40 70' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 46.5 L0 35 L0 11.5 L20 0 L40 11.5 L40 35 Z' fill='none' stroke='%2338bdf8' stroke-width='1.2' stroke-opacity='0.25'/%3E%3Cpath d='M20 46.5 L20 70' fill='none' stroke='%2338bdf8' stroke-width='1.2' stroke-opacity='0.25'/%3E%3Cpath d='M0 35 L0 11.5' fill='none' stroke='%2338bdf8' stroke-width='1.2' stroke-opacity='0.25'/%3E%3Cpath d='M40 35 L40 11.5' fill='none' stroke='%2338bdf8' stroke-width='1.2' stroke-opacity='0.25'/%3E%3C/svg%3E");
    background-size: 40px 70px;
}

/* Layer 2: Horizontal Lines (Vertical Move + Blink) */
.background-effects::after {
    content: "";
    position: absolute;
    top: -100px;
    left: -100px;
    width: calc(100% + 200px);
    height: calc(100% + 200px);
    /* Horizontal Line Pattern SVG (Matches horizontal line of previous mesh) */
    background-image: url("data:image/svg+xml,%3Csvg width='48' height='28' viewBox='0 0 48 28' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 14 H48' stroke='%2338bdf8' stroke-width='1' stroke-opacity='0.5' fill='none'/%3E%3C/svg%3E");
    background-size: 48px 28px;
    opacity: 0.4;
    /* mix-blend-mode: overlay; */
    animation: geo-scan 4s linear infinite, blink-flicker 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
    will-change: background-position, opacity;
}

@keyframes aurora-float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(30px, -20px) scale(1.1);
    }

    100% {
        transform: translate(-20px, 40px) scale(0.95);
    }
}

@keyframes hue-cycle {
    0% {
        filter: blur(80px) hue-rotate(0deg);
    }

    100% {
        filter: blur(80px) hue-rotate(360deg);
    }
}

@keyframes geo-scan {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 28px;
    }

    /* Vertical scrolling loop */
}

@keyframes blink-flicker {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.05;
    }
}



/* ===== Container ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== Header ===== */
.header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

.title {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: 700;
    background: var(--gradient-fire);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.title-logo {
    height: 1em;
    width: auto;
    display: block;
    filter: drop-shadow(0 0 5px rgba(255, 107, 53, 0.5));
}

.title-suffix {
    font-size: 0.6em;
    margin-left: 8px;
    color: var(--text-secondary);
    font-weight: 700;
}

.title-icon {
    font-size: 1.2em;
    -webkit-text-fill-color: initial;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===== Cards (Common) ===== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 25px;
    margin-bottom: 20px;
    transition: var(--transition-normal);
    animation: fadeIn 0.5s ease-out;
}

@media (hover: hover) {
    .card:hover {
        background: var(--bg-card-hover);
        border-color: rgba(255, 107, 53, 0.3);
        box-shadow: var(--shadow-glow);
    }
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.section-icon {
    font-size: 1.3em;
}

/* ===== Common Buttons ===== */
.action-btn {
    padding: 12px 24px;
    border-radius: 30px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.action-btn.primary {
    background: var(--gradient-fire);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.action-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.action-btn.register {
    background: var(--gradient-water);
    color: white;
    box-shadow: 0 4px 15px rgba(53, 167, 255, 0.4);
    border: none;
}

/* ===== View Management ===== */
.view-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.view-content.active {
    display: block;
}

.page-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-left: 10px;
    border-left: 4px solid var(--accent-primary);
}

.page-title.small {
    font-size: 1.2rem;
    margin-bottom: 0;
    border: none;
    padding: 0;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    /* heightは設定しない - コンテンツに合わせて自動調整 */
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(18, 18, 26, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-sizing: border-box;
}

/* モバイル端末では広告スペースなし */

/* ===== Update Notification ===== */
#update-notification {
    display: none;
    position: fixed;
    bottom: 80px;
    /* bottom-navの上に表示 */
    left: 20px;
    right: 20px;
    background-color: var(--primary-color);
    color: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out;
}

#update-notification.show {
    display: flex;
}

#update-message {
    font-size: 0.9rem;
    font-weight: 500;
}

#update-btn {
    background-color: white;
    color: var(--primary-color);
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 16px;
    transition: background-color 0.2s;
}

#update-btn:hover {
    background-color: #f0f0f0;
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Removed ::after pseudo-element as height handles coverage now */

.nav-item {
    background: none;
    border: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 8px 0;
    width: 100%;
    transition: all 0.2s ease;
}

.nav-item.active {
    color: var(--accent-primary);
}

.nav-icon {
    font-size: 1.2rem;
}

.nav-text {
    font-size: 0.7rem;
    font-weight: 600;
}

/* ===== Responsive & Animations ===== */
.mobile-only {
    display: none;
}

@media (max-width: 600px) {
    .mobile-only {
        display: inline;
        margin-top: 4px;
        /* Slight spacing for the break */
    }

    .container {
        padding: 10px;
    }

    .header {
        padding: 15px 15px 10px 15px;
        /* Compact padding */
        margin-bottom: 0px;
    }

    .title {
        flex-direction: row;
        align-items: baseline;
        justify-content: center;
        gap: 5px;
        font-size: 1.4rem;
        /* Smaller for mobile to fit in one line */
        white-space: nowrap;
        /* Try to keep one line */
    }

    .subtitle {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    .card {
        padding: 15px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card:nth-child(2) {
    animation-delay: 0.1s;
}

.card:nth-child(3) {
    animation-delay: 0.15s;
}

.card:nth-child(4) {
    animation-delay: 0.2s;
}

.card:nth-child(5) {
    animation-delay: 0.25s;
}

.card:nth-child(6) {
    animation-delay: 0.3s;
}

.card:nth-child(7) {
    animation-delay: 0.35s;
}

.card:nth-child(8) {
    animation-delay: 0.4s;
}

.loading {
    color: var(--text-secondary);
    text-align: center;
    padding: 30px;
    font-size: 1rem;
    animation: pulse 1.5s infinite;
}

/* ===== Desktop Navigation Scaling (1.8x) ===== */
@media (min-width: 769px) {
    body {
        padding-bottom: 130px;
    }

    /* .bottom-nav { height removed to follow content } */

    .nav-item {
        gap: 8px;
    }

    .nav-icon {
        font-size: 2.2rem;
    }

    .nav-text {
        font-size: 1.2rem;
    }

    /* Ensure modals are handled correctly in dedicated CSS, 
       but container sizing is global */
    .container {
        max-width: 900px;
    }
}