:root {
    /* Color Palette */
    --color-base-blue: #1B76FF;
    --color-accent-yellow: #FFDA1B;
    --color-glow-purple: #9D1BFF;
    --color-bg-dark: #0A0F1A;
    --color-text-white: #FFFFFF;

    /* Spacing & Sizing */
    --border-radius-btn: 10px;
    --border-radius-card: 12px;

    /* Fonts */
    --font-family-main: 'Inter', 'Noto Sans JP', sans-serif;
}

h3,
h4,
h5,
h6 {
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Utilities */
.container {
    max-width: 820px;
    /* Mobile/Tablet focused */
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.text-glow {
    text-shadow: 0 0 10px var(--color-glow-purple);
}

.card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-card);
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius-btn);
    background-color: var(--color-base-blue);
    color: white;
    text-decoration: none;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 5px var(--color-base-blue);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px var(--color-base-blue);
}

.btn-accent {
    background-color: var(--color-accent-yellow);
    color: var(--color-bg-dark);
    text-shadow: none;
}

.btn-accent:hover {
    box-shadow: 0 0 15px var(--color-accent-yellow);
}

/* Modal Overlay */
.modal-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: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--color-bg-dark);
    padding: 2rem;
    border-radius: var(--border-radius-card);
    max-width: 90%;
    width: 500px;
    border: 2px solid var(--color-base-blue);
    box-shadow: 0 0 20px var(--color-base-blue);
    max-height: 90vh;
    overflow-y: auto;
}

/* SPA Screen Utilities */
.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Screen 37: Loading */
#screen-loading {
    display: none;
    /* Hidden by default, toggled via JS */
    justify-content: center;
    align-items: center;
    flex-direction: column;
    height: 100vh;
    text-align: center;
}

#screen-loading.active {
    display: flex;
}

.loading-logo {
    font-size: 3rem;
    margin-bottom: 2rem;
    animation: pulse 1.5s infinite alternate;
}

.loading-bar-container {
    width: 80%;
    max-width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: var(--color-base-blue);
    box-shadow: 0 0 10px var(--color-base-blue);
    animation: loadProgress 2s ease-in-out forwards;
}

@keyframes pulse {
    from {
        text-shadow: 0 0 10px var(--color-glow-purple);
        transform: scale(1);
    }

    to {
        text-shadow: 0 0 25px var(--color-glow-purple), 0 0 5px white;
        transform: scale(1.05);
    }
}

@keyframes loadProgress {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

/* Screen 3: Home (Dashboard) */
#screen-home {
    padding-bottom: 80px;
    /* Space for footer nav */
}

.home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 50px;
    height: 50px;
    background: #333;
    border-radius: 50%;
    border: 2px solid var(--color-base-blue);
}

.rank-badge {
    background: var(--color-base-blue);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.stage-map {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.stage-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 100px;
    border-left: 5px solid var(--color-base-blue);
}

.stage-info h3 {
    margin-bottom: 0.5rem;
    color: var(--color-accent-yellow);
}

/* Footer Navigation */
.footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 15, 26, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    padding: 0.8rem 0;
    z-index: 100;
}

.nav-item {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 15px var(--color-accent-yellow);
}

/* Modal Overlay */
.modal-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: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--color-bg-dark);
    padding: 2rem;
    border-radius: var(--border-radius-card);
    max-width: 90%;
    width: 500px;
    border: 2px solid var(--color-base-blue);
    box-shadow: 0 0 20px var(--color-base-blue);
    max-height: 90vh;
    overflow-y: auto;
}

/* SPA Screen Utilities */
.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Screen 37: Loading */
#screen-loading {
    display: none;
    /* Hidden by default, toggled via JS */
    justify-content: center;
    align-items: center;
    flex-direction: column;
    height: 100vh;
    text-align: center;
}

#screen-loading.active {
    display: flex;
}

.loading-logo {
    font-size: 3rem;
    margin-bottom: 2rem;
    animation: pulse 1.5s infinite alternate;
}

.loading-bar-container {
    width: 80%;
    max-width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: var(--color-base-blue);
    box-shadow: 0 0 10px var(--color-base-blue);
    animation: loadProgress 2s ease-in-out forwards;
}

@keyframes pulse {
    from {
        text-shadow: 0 0 10px var(--color-glow-purple);
        transform: scale(1);
    }

    to {
        text-shadow: 0 0 25px var(--color-glow-purple), 0 0 5px white;
        transform: scale(1.05);
    }
}

@keyframes loadProgress {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

/* Screen 3: Home (Dashboard) */
#screen-home {
    padding-bottom: 80px;
    /* Space for footer nav */
}

.home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 50px;
    height: 50px;
    background: #333;
    border-radius: 50%;
    border: 2px solid var(--color-base-blue);
}

.rank-badge {
    background: var(--color-base-blue);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.stage-map {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.stage-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 100px;
    border-left: 5px solid var(--color-base-blue);
}

.stage-info h3 {
    margin-bottom: 0.5rem;
    color: var(--color-accent-yellow);
}

/* Footer Navigation */
.footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 15, 26, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    padding: 0.8rem 0;
    z-index: 100;
}

.nav-item {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: color 0.3s;
}

.nav-item.active {
    color: var(--color-base-blue);
    text-shadow: 0 0 5px var(--color-base-blue);
}

/* --- Phase 9: User Manual --- */
.manual-card {
    margin-bottom: 1.5rem;
    text-align: center;
    border: 2px solid var(--color-base-blue);
    background: rgba(0, 0, 0, 0.4);
}

.manual-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px var(--color-accent-yellow);
}

.manual-card h3 {
    color: var(--color-accent-yellow);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.manual-card p {
    font-size: 1rem;
    line-height: 1.6;
}

/* --- Phase 11: Chat --- */
.chat-message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-avatar {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    border-radius: 50%;
}

.chat-bubble {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.8rem;
    border-radius: 12px;
    max-width: 80%;
    line-height: 1.5;
}

.chat-message.ai .chat-bubble {
    justify-content: center;
    align-items: center;
    flex-direction: column;
    height: 100vh;
    text-align: center;
}

#screen-loading.active {
    display: flex;
}

.loading-logo {
    font-size: 3rem;
    margin-bottom: 2rem;
    animation: pulse 1.5s infinite alternate;
}

.loading-bar-container {
    width: 80%;
    max-width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: var(--color-base-blue);
    box-shadow: 0 0 10px var(--color-base-blue);
    animation: loadProgress 2s ease-in-out forwards;
}

@keyframes pulse {
    from {
        text-shadow: 0 0 10px var(--color-glow-purple);
        transform: scale(1);
    }

    to {
        text-shadow: 0 0 25px var(--color-glow-purple), 0 0 5px white;
        transform: scale(1.05);
    }
}

@keyframes loadProgress {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

/* Screen 3: Home (Dashboard) */
#screen-home {
    padding-bottom: 80px;
    /* Space for footer nav */
}

.home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 50px;
    height: 50px;
    background: #333;
    border-radius: 50%;
    border: 2px solid var(--color-base-blue);
}

.rank-badge {
    background: var(--color-base-blue);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.stage-map {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.stage-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 100px;
    border-left: 5px solid var(--color-base-blue);
}

.stage-info h3 {
    margin-bottom: 0.5rem;
    color: var(--color-accent-yellow);
}

/* Footer Navigation */
.footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 15, 26, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    padding: 0.8rem 0;
    z-index: 100;
}

.nav-item {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: color 0.3s;
}

.nav-item.active {
    color: var(--color-base-blue);
    text-shadow: 0 0 5px var(--color-base-blue);
}

/* --- Phase 9: User Manual --- */
.manual-card {
    margin-bottom: 1.5rem;
    text-align: center;
    border: 2px solid var(--color-base-blue);
    background: rgba(0, 0, 0, 0.4);
}

.manual-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px var(--color-accent-yellow);
}

.manual-card h3 {
    color: var(--color-accent-yellow);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.manual-card p {
    font-size: 1rem;
    line-height: 1.6;
}

/* --- Phase 11: Chat --- */
.chat-message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-avatar {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    border-radius: 50%;
}

.chat-bubble {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.8rem;
    border-radius: 12px;
    max-width: 80%;
    line-height: 1.5;
}

.chat-message.ai .chat-bubble {
    background: rgba(27, 118, 255, 0.3);
    /* Base Blue tint */
    border-top-left-radius: 0;
}

.chat-message.user .chat-bubble {
    background: rgba(255, 218, 27, 0.3);
    /* Accent Yellow tint */
    border-top-right-radius: 0;
}

/* --- Phase 12: Search Simulator --- */
.search-result-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-result-title {
    color: #4db8ff;
    font-size: 1.2rem;
    font-weight: bold;
    text-decoration: none;
    display: block;
    margin-bottom: 0.3rem;
}

.search-result-title:hover {
    text-decoration: underline;
}

.search-result-url {
    color: #88c188;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.search-result-snippet {
    color: #ddd;
    font-size: 0.9rem;
    line-height: 1.5;
}