:root {
    --bg-gradient: radial-gradient(circle at top left, #1e293b 0%, #0f172a 100%);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-gold: #f59e0b;
    --accent-gold-hover: #d97706;
    --glass-bg: rgba(30, 41, 59, 0.45);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --font-outfit: 'Outfit', sans-serif;
    --font-noto: 'Noto Sans JP', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.portal-body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    font-family: var(--font-noto);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 100px 1rem 3rem;
    overflow-x: hidden;
}

.portal-container {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ヘッダー */
.portal-header {
    text-align: center;
}

.brand-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 0.15em;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    font-family: var(--font-outfit);
}

.portal-title {
    font-family: var(--font-outfit);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.portal-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* イントロカード */
.portal-intro-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--glass-glow);
    text-align: center;
}

.portal-intro-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    background: linear-gradient(90deg, #ffffff, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intro-text {
    font-size: 1.15rem;
    line-height: 1.75;
    color: #e2e8f0;
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.intro-description {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* モードグリッド */
.modes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
    width: 100%;
}

@media (max-width: 768px) {
    .modes-grid {
        grid-template-columns: 1fr;
    }
}

/* スマホ単体モードカードの表示制御 */
#mode-standalone {
    display: none;
    /* デフォルトは非表示（PC等の非タッチデバイス用） */
}

@media (pointer: coarse) {
    #mode-standalone {
        display: flex;
        /* タッチパネル対応デバイスの場合のみ表示する */
    }
}

.mode-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--glass-glow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    transition: background 0.3s;
}

.mode-card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.mode-card.featured {
    border-color: rgba(245, 158, 11, 0.25);
    background: rgba(30, 41, 59, 0.6);
}

.mode-card.featured::before {
    background: linear-gradient(90deg, var(--accent-gold), #fbbf24);
}

.badge-featured {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: var(--accent-gold);
    color: #0f172a;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.mode-icon {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    color: var(--accent-gold);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease;
}

.mode-card:hover .mode-icon {
    transform: scale(1.1) rotate(5deg);
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
}

.mode-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.mode-desc {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    flex-grow: 1;
}

.mode-btn {
    width: 100%;
    padding: 0.85rem 1.5rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.mode-btn.btn-highlight {
    background: var(--accent-gold);
    color: #0f172a;
    border: none;
}

.mode-btn.btn-highlight:hover {
    background: var(--accent-gold-hover);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}

.mode-btn.link-btn {
    text-decoration: none;
}

.mode-status {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* モーダルダイアログ */
.portal-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    animation: modalBgFade 0.3s ease;
}

@keyframes modalBgFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.portal-modal-content {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    width: 100%;
    max-width: 640px;
    padding: 2.5rem;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalContentEntry 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalContentEntry {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.portal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.portal-close:hover {
    color: var(--text-primary);
}

.portal-modal-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* 接続用レイアウト */
.connect-flow-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    align-items: center;
}

.connect-qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    background: #ffffff;
    padding: 1.25rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

#qrcode {
    width: 200px;
    height: 200px;
}

.qr-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.connect-instructions {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.connect-instructions ol {
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.5;
}

.connect-instructions li::marker {
    color: var(--accent-gold);
    font-weight: 700;
}

/* 直接起動リンクボックスの表示制御 */
.direct-link-box {
    margin-top: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: none;
    /* デフォルトは非表示（PC等の非タッチデバイス用） */
}

@media (pointer: coarse) {
    .direct-link-box {
        display: block;
        /* タッチパネル対応デバイスの場合のみ表示する */
    }
}

.small-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.portal-text-link {
    color: var(--accent-gold);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: underline;
    transition: color 0.2s;
    display: inline-block;
}

.portal-text-link:hover {
    color: var(--accent-gold-hover);
}

/* お知らせモーダル & チュートリアルカード */
body.modal-open,
html.modal-open {
    touch-action: auto !important;
    overflow: auto !important;
}

#tutorial-card,
.modal-content,
.quiz-card {
    height: auto;
    max-height: none !important;
    overflow: visible !important;
}

#tutorial-card img,
.modal-content img,
.quiz-card img {
    pointer-events: auto;
}

.msg-card {
    max-width: 420px;
    text-align: center;
}

.msg-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--accent-gold);
}

.msg-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.mini-btn {
    max-width: 140px;
    margin: 0 auto;
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
}

/* フッター */
.portal-footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
    margin-top: 1.5rem;
    font-family: var(--font-outfit);
}

/* モバイル表示の微調整 */
@media (max-width: 600px) {
    .portal-title {
        font-size: 2.2rem;
    }

    .portal-intro-card {
        padding: 1.5rem;
    }

    .portal-intro-card h2 {
        font-size: 1.3rem;
    }

    .intro-text {
        font-size: 1rem;
    }

    .connect-flow-layout {
        flex-direction: column;
    }
}

/* --- 練習ページ 3カラムレイアウト ＆ 進捗メニュー --- */

/* 3カラムグリッドレイアウト */
.practice-layout-3col {
    display: grid;
    grid-template-columns: 280px 1fr 340px;
    gap: 1.5rem;
    align-items: start;
    margin-top: 1rem;
}

/* 左サイドバー */
.left-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* コース進捗リスト */
.course-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.course-nav-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 0.9rem 1.1rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.course-nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

/* アクティブ（現在学習中） */
.course-nav-item.active {
    background: rgba(245, 158, 11, 0.08);
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.1);
}

.course-nav-item.active .course-title-text {
    color: var(--accent-gold);
    font-weight: 700;
}

/* クリア済み状態 */
.course-nav-item.completed .status-icon-area {
    color: #10b981;
    /* 緑色チェック */
    font-weight: bold;
}

/* ロック状態（未解放） */
.course-nav-item.locked {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.2);
}

.course-nav-item.locked .status-icon-area {
    color: #64748b;
}

.course-info-area {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.course-num-tag {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.course-title-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.status-icon-area {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

/* レスポンシブ */
@media (max-width: 1024px) {
    .practice-layout-3col {
        grid-template-columns: 240px 1fr;
    }

    .practice-layout-3col>.side-panel {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .practice-layout-3col {
        grid-template-columns: 1fr;
    }

    .practice-layout-3col>.side-panel,
    .practice-layout-3col>.left-sidebar {
        grid-column: span 1;
    }
}

/* SNSセクション */
.portal-sns-section {
    margin-top: 3rem;
    margin-bottom: 2rem;
}

.sns-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem 2.5rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--glass-glow);
    text-align: center;
}

.sns-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sns-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.sns-links-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.85rem;
}

.sns-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.4rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.sns-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* SNS個別のブランドホバーカラー */
.sns-x:hover {
    background: #000000;
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
}

.sns-threads:hover {
    background: #000000;
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
}

.sns-line:hover {
    background: #06c755;
    border-color: transparent;
    color: #ffffff;
}

.sns-facebook:hover {
    background: #1877f2;
    border-color: transparent;
    color: #ffffff;
}

/* PC等大画面時（769px以上）はモバイル専用バッジを隠す */
@media (min-width: 769px) {
    #mode-standalone .mobile-badge {
        display: none !important;
    }
}

/* スマホ閲覧時（768px以下）のモードカード自動最適化 */
@media (max-width: 768px) {
    /* PC連携バーチャル三線カードを非表示 */
    #mode-connect {
        display: none !important;
    }

    /* スマホ単体カードに「おすすめ」装飾を付与 */
    #mode-standalone {
        border-color: rgba(245, 158, 11, 0.35);
        background: rgba(30, 41, 59, 0.65);
        position: relative;
    }

    #mode-standalone::before {
        background: linear-gradient(90deg, var(--accent-gold), #fbbf24);
    }

    #mode-standalone .mobile-badge {
        display: inline-block !important;
    }

    #mode-standalone .standalone-btn {
        background: linear-gradient(135deg, var(--accent-gold) 0%, #d97706 100%) !important;
        color: #0f172a !important;
        box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3) !important;
        border: none !important;
    }
}

/* 初心者向け折りたたみ事前準備ガイド (アコーディオン) */
.accordion-group {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.accordion-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.accordion-item[open] {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.accordion-header {
    padding: 0.9rem 1.1rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: color 0.2s, background 0.2s;
    position: relative;
    z-index: 2;
}

.accordion-header::-webkit-details-marker {
    display: none;
}

.accordion-header:hover {
    color: var(--accent-gold);
}

.accordion-header::after {
    content: '▼';
    font-size: 0.75rem;
    color: var(--accent-gold);
    transition: transform 0.3s ease;
}

.accordion-item[open] .accordion-header::after {
    transform: rotate(180deg);
}

.accordion-body {
    padding: 0 1.25rem 1.25rem 1.25rem;
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 0.25rem;
    padding-top: 1rem;
}

.accordion-body p {
    margin-bottom: 0.75rem;
}

.accordion-body ul, .accordion-body ol {
    padding-left: 1.2rem;
    margin-bottom: 0.75rem;
}

.accordion-body li {
    margin-bottom: 0.4rem;
}

.prep-tip-box {
    background: rgba(245, 158, 11, 0.1);
    border: 1px dashed rgba(245, 158, 11, 0.35);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: #fbbf24;
    font-size: 0.83rem;
    margin-top: 0.75rem;
}

/* ちんだみ（調弦）ステップ表示 */
.chindami-step-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
    width: 100%;
    margin: 1.25rem 0;
}

.chindami-step-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 0.65rem 0.5rem;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.chindami-step-card.active {
    background: rgba(245, 158, 11, 0.12);
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.25);
    transform: translateY(-2px);
}

.chindami-step-card.ok {
    background: rgba(16, 185, 129, 0.12);
    border-color: #10b981;
    color: #34d399;
}

.string-tag {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.chindami-step-card.active .string-tag {
    background: var(--accent-gold);
    color: #0f172a;
}

.chindami-step-card.ok .string-tag {
    background: #10b981;
    color: #ffffff;
}

.target-pitch-text {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.pitch-status-icon {
    font-size: 1.1rem;
    font-weight: 700;
}