@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Noto+Sans+JP:wght@400;500;700&display=swap');

:root {
    /* Brand Colors from landing.html */
    --bg-dark: #0A1A14;
    --bg-deep: #0D2118;
    --bg-surface: rgba(13, 33, 24, 0.7);
    --bg-card: rgba(20, 67, 47, 0.4);

    --green-primary: #1B5E40;
    --lime-accent: #7FD858;
    --emerald-accent: #2ECC71;

    --text-primary: #F0F5F2;
    --text-secondary: #C8D8CC;
    --text-muted: #8FA893;

    --glass-border: rgba(127, 216, 88, 0.2);
    --accent-glow: rgba(127, 216, 88, 0.3);

    /* Subject Colors (Kept for identification, but desaturated slightly to fit) */
    --subject-english: #ea4aaa;
    --subject-math: #3fb950;
    --subject-science: #f2cc60;
    --subject-social: #f59e0b;
    /* Updated to Orange */
    --subject-japanese: #8B6CB5;
    /* 藤色 Fuji Purple (和風) */

    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Noto Sans JP', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Forest Digital Mesh Gradient */
.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(at 0% 0%, rgba(27, 94, 64, 0.2) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(127, 216, 88, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(46, 204, 113, 0.15) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(13, 33, 24, 0.5) 0px, transparent 50%);
    animation: meshScroll 20s ease infinite alternate;
}

@keyframes meshScroll {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.1);
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 24px;
    position: relative;
}

/* Hero Section */
header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInUp 1s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-area {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.logo-img {
    height: 48px;
    /* Logo is likely green based, so we let it shine or add subtle drop shadow */
    filter: drop-shadow(0 0 10px rgba(127, 216, 88, 0.2));
}

.logo-text {
    font-size: 0.63rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    color: var(--lime-accent);
    text-transform: uppercase;
    margin-top: 8px;
    opacity: 0.9;
    text-shadow: 0 0 10px rgba(127, 216, 88, 0.4);
}

h1.hub-title {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 8px;
    /* Gradient text: White to Lime */
    background: linear-gradient(135deg, #fff 10%, var(--lime-accent) 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    filter: drop-shadow(0 0 20px rgba(127, 216, 88, 0.2));
}

.hub-catchphrase {
    font-size: 0.77rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--lime-accent);
    margin-bottom: 8px;
    opacity: 0.9;
}

.hub-subtitle {
    font-size: 1.2rem;
    color: var(--text-primary);
    max-width: 700px;
    margin: 0 auto;
    font-weight: 500;
    /* Subtle green tint overlay */
    background: linear-gradient(180deg, #fff 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0.9;
}

/* Futuristic Controls (Forest Style) */
.dashboard-controls {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 20px;
    padding: 30px;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--card-shadow);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.toggle-switch {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid rgba(127, 216, 88, 0.1);
}

.toggle-option {
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-muted);
}

.toggle-option:hover {
    color: var(--lime-accent);
}

.toggle-option.active {
    background: var(--green-primary);
    color: #fff;
    box-shadow: 0 0 15px var(--accent-glow);
    border: 1px solid var(--lime-accent);
}

/* Grid System */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 32px;
}

/* Subject Card Redesign (Organic Tech) */
.subject-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

/* Hover Glow Effect */
.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(800px circle at var(--mouse-x) var(--mouse-y), rgba(127, 216, 88, 0.08), transparent 40%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.subject-card:hover::before {
    opacity: 1;
}

.subject-card:hover {
    transform: translateY(-8px) scale(1.02);
    /* Subtle subject accent on hover */
    border-color: var(--subj-accent);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(var(--subj-rgb), 0.4);
}

.card-header-btn {
    width: 100%;
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    transition: background 0.3s;
}

.card-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Subject Icons - Keep color but mute background */
.subject-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--subj-rgb), 0.1);
    border: 1px solid rgba(var(--subj-rgb), 0.2);
    border-radius: 16px;
    font-size: 1.8rem;
    transition: transform 0.3s;
    color: var(--subj-accent);
}

.subject-card:hover .subject-icon {
    transform: scale(1.1) rotate(-5deg);
    background: rgba(var(--subj-rgb), 0.2);
    box-shadow: 0 0 15px rgba(var(--subj-rgb), 0.3);
}

.subject-text h2 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.subject-text span {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.chevron {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.3s;
    font-size: 0.7rem;
}

.subject-card.expanded .chevron {
    transform: rotate(180deg);
    background: var(--lime-accent);
    color: var(--bg-dark);
}

/* Card Content & Links */
.card-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(0, 0, 0, 0.3);
}

.subject-card.expanded .card-content {
    max-height: 1000px;
    border-top: 1px solid var(--glass-border);
}

.module-list {
    padding: 24px;
    display: grid;
    gap: 12px;
}

.module-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    text-decoration: none;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    transition: all 0.3s;
}

.module-link:hover {
    background: rgba(127, 216, 88, 0.08);
    /* Lime tint */
    border-color: rgba(127, 216, 88, 0.3);
    transform: scale(1.02);
    color: var(--text-primary);
}

.module-title {
    font-size: 1rem;
    font-weight: 500;
}

.module-tag {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--subj-accent);
    /* Keep original subject color for tag for differentiation */
    background: rgba(var(--subj-rgb), 0.1);
    padding: 4px 10px;
    border-radius: 20px;
}

/* Category Accents (RGB for calculations) */
.accent-english {
    --subj-accent: var(--subject-english);
    --subj-rgb: 234, 74, 170;
}

.accent-english-grammar {
    --subj-accent: #4f46e5;
    /* Indigo/Blue for Grammar */
    --subj-rgb: 79, 70, 229;
}

.accent-math {
    --subj-accent: var(--subject-math);
    --subj-rgb: 63, 185, 80;
}

.accent-science {
    --subj-accent: var(--subject-science);
    --subj-rgb: 242, 204, 96;
}

.accent-social {
    --subj-accent: var(--subject-social);
    --subj-rgb: 245, 158, 11;
}

.accent-japanese {
    --subj-accent: var(--subject-japanese);
    --subj-rgb: 139, 108, 181;
    /* 藤色 Fuji Purple */
}

.accent-special {
    --subj-accent: var(--lime-accent);
    --subj-rgb: 127, 216, 88;
}


/* View Mode Toggle Pill */
.view-mode-toggle {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(13, 33, 24, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--lime-accent);
    padding: 6px;
    border-radius: 30px;
    display: flex;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.toggle-item {
    padding: 10px 24px;
    border-radius: 24px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-item.active {
    background: var(--lime-accent);
    color: var(--bg-dark);
}

/* Animations & Responsive */
@media (max-width: 768px) {
    .container {
        padding: 40px 16px;
    }

    .dashboard-controls {
        flex-direction: column;
        gap: 24px;
        padding: 20px;
    }

    header {
        margin-bottom: 24px;
    }

    h1.hub-title {
        font-size: 2.0rem;
        margin-bottom: 4px;
    }

    .subject-grid {
        grid-template-columns: 1fr;
    }

    .hub-title {
        font-size: 2.2rem;
    }

    .view-mode-toggle {
        bottom: 20px;
        width: 90%;
        justify-content: space-around;
    }
}

.hidden {
    display: none !important;
}

/* List Mode Section Headers */
.section-header {
    grid-column: 1 / -1;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 40px 0 10px;
    padding-left: 20px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header::before {
    content: '';
    position: absolute;
    left: 0;
    width: 4px;
    height: 1.2rem;
    background: var(--lime-accent);
    border-radius: 4px;
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Vision Link (Dashboard Bottom) */
.vision-link {
    display: inline-block;
    padding: 16px 40px;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.1em;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.vision-link:hover {
    color: var(--lime-accent);
    border-color: var(--lime-accent);
    background: rgba(20, 67, 47, 0.6);
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 15px var(--accent-glow);
}

/* Floating Message Bar (Mobile Exclusive UI) */
.floating-message-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(13, 33, 24, 0.95);
    /* Deep glass */
    backdrop-filter: blur(15px) saturate(1.8);
    -webkit-backdrop-filter: blur(15px) saturate(1.8);
    border-top: 1px solid var(--lime-accent);
    padding: 18px 20px 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;

    transform: translateY(100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1),
        opacity 500ms ease;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
}

@media (min-width: 769px) {
    .floating-message-bar {
        display: none !important;
    }
}

.floating-message-bar.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.floating-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 500px;
    gap: 16px;
}

.floating-bar-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
    letter-spacing: 0.05em;
}

.floating-bar-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--lime-accent);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 10px 20px;
    border: 1px solid var(--lime-accent);
    border-radius: 50px;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.floating-bar-button:active {
    background: rgba(127, 216, 88, 0.1);
    transform: scale(0.95);
}

/* Update History Section */
.update-history-section {
    margin-top: 20px;
    margin-bottom: 40px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    border: 1px solid rgba(127, 216, 88, 0.1);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.update-history-title {
    font-size: 1rem;
    color: var(--lime-accent);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.update-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.update-item {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.update-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.update-date {
    color: var(--text-muted);
    font-family: monospace;
    white-space: nowrap;
    opacity: 0.8;
}

.update-content {
    color: var(--text-primary);
}

/* ===== CubiK Level Bar (Dashboard) ===== */
.ck-level-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 20px;
    padding: 14px 24px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.ck-level-bar:hover {
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

.ck-level-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: .1em;
    color: rgba(165, 180, 252, 0.8);
    text-transform: uppercase;
    white-space: nowrap;
}

.ck-level-num {
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: -.02em;
    line-height: 1;
    color: #c4b5fd;
    text-shadow:
        0 0 8px rgba(139, 92, 246, 0.9),
        0 0 20px rgba(139, 92, 246, 0.6),
        0 0 40px rgba(139, 92, 246, 0.3);
    animation: ck-glow-pulse 3s ease-in-out infinite;
}

@keyframes ck-glow-pulse {

    0%,
    100% {
        text-shadow: 0 0 8px rgba(139, 92, 246, 0.9), 0 0 20px rgba(139, 92, 246, 0.6), 0 0 40px rgba(139, 92, 246, 0.3);
    }

    50% {
        text-shadow: 0 0 14px rgba(167, 139, 250, 1), 0 0 32px rgba(139, 92, 246, 0.9), 0 0 60px rgba(139, 92, 246, 0.5);
    }
}

.ck-gauge-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.ck-gauge-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 500;
}

.ck-gauge-track {
    height: 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.ck-gauge-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #6366f1, #a78bfa);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
    transition: width .6s cubic-bezier(.16, 1, .3, 1);
}

.ck-mypage-hint {
    font-size: 0.7rem;
    color: rgba(165, 180, 252, 0.6);
    white-space: nowrap;
}

/* Streak and Today EXP Display */
.ck-streak-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 10px;
}

.ck-streak-stars {
    font-size: 1.4rem;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.5));
}

.ck-streak-flames {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    line-height: 1;
}

.ck-flame-mini {
    font-size: 11px;
    filter: drop-shadow(0 0 2px rgba(255, 69, 0, 0.4));
}

.ck-today-exp-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 80px;
}

.ck-today-exp-icon {
    font-size: 1.5rem;
    line-height: 1;
    transition: transform 0.3s ease;
}

.ck-today-exp-icon:hover {
    transform: scale(1.2);
}

.ck-today-exp-val {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

@media (max-width: 600px) {
    .ck-level-bar {
        padding: 16px 14px;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .ck-level-num {
        font-size: 1.8rem;
    }

    .ck-gauge-wrap {
        order: 3;
        width: 100%;
        margin-top: 4px;
    }

    .ck-today-exp-wrap {
        order: 2;
        padding-left: 8px;
        min-width: 60px;
        border-left: 1px solid rgba(255, 255, 255, 0.1);
    }

    .ck-mypage-hint {
        display: none;
    }
}

/* News Ticker Styles (Relocated to Last Updated) */
.last-updated {
    flex: 1;
    min-width: 0; /* Allow shrinking */
}

.news-ticker-wrapper {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    padding: 2px 0;
}

.news-ticker-track {
    display: inline-block;
    white-space: nowrap;
    padding-left: 100%;
    animation: ticker-flow 25s linear infinite;
}

.news-ticker-track:hover {
    animation-play-state: paused;
}

.news-ticker-text {
    position: relative;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0 40px;
    display: inline-block;
}

/* Lime-green Marker Effect (Refined) */
.news-ticker-text::before {
    content: '';
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 4px;
    height: 35%; /* Narrow marker */
    background: rgba(127, 216, 88, 0.4);
    z-index: -1;
}

@keyframes ticker-flow {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

@media (max-width: 768px) {
    .news-ticker-container {
        margin-top: 0;
        margin-bottom: 20px;
    }
    .news-ticker-text {
        font-size: 0.85rem;
        padding: 0 20px;
    }
}