/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #2d2d2d;
    --accent: #c8a96e;
    --accent-light: #e8d5b0;
    --bg: #f7f5f2;
    --card-bg: #ffffff;
    --text: #333333;
    --text-light: #777777;
    --border: #e8e4df;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
}

body {
    font-family: "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ===== Login Page ===== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #2d2d2d 0%, #4a4a4a 100%);
}

.login-container {
    background: var(--card-bg);
    padding: 48px 40px;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo h1 {
    font-size: 28px;
    color: var(--primary);
    letter-spacing: 4px;
    margin-bottom: 4px;
}

.login-logo p {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 32px;
}

.form-group {
    text-align: left;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--accent);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-login:hover {
    background: #b8994e;
}

.error-message {
    background: #fff0f0;
    color: #d32f2f;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
}

/* ===== Header ===== */
.header {
    background: var(--primary);
    color: #fff;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.header h1 {
    font-size: 20px;
    letter-spacing: 3px;
    font-weight: 600;
}

.header h1 span {
    font-size: 12px;
    color: var(--accent-light);
    letter-spacing: 1px;
    margin-left: 12px;
    font-weight: 400;
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1);
}

/* ===== Main Content ===== */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.notice {
    background: var(--card-bg);
    border-left: 4px solid var(--accent);
    padding: 14px 20px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 32px;
    font-size: 14px;
    color: var(--text-light);
    box-shadow: var(--shadow);
}

/* ===== Section ===== */
.section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title .icon {
    font-size: 22px;
}

/* ===== Columns Layout ===== */
.columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

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

/* ===== Subsection ===== */
.subsection {
    margin-bottom: 24px;
}

.subsection-title {
    font-size: 15px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: opacity 0.2s;
}

.subsection-title:hover { opacity: 0.8; }

.subsection-title .arrow {
    font-size: 12px;
    transition: transform 0.3s;
}

.subsection-title.open .arrow {
    transform: rotate(90deg);
}

.subsection-title.blue   { background: #e8f0fe; color: #1a56db; }
.subsection-title.green  { background: #e6f5ec; color: #1a7d42; }
.subsection-title.yellow { background: #fef6e0; color: #9a6d1f; }
.subsection-title.gray   { background: #f0eded; color: #555; }

/* ===== Cards Grid ===== */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.card-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: #eee;
    display: block;
}

.card-thumb-link {
    display: block;
    position: relative;
    overflow: hidden;
}

.card-thumb-link:hover .play-overlay {
    background: rgba(0,0,0,0.5);
}

.play-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.25);
    font-size: 40px;
    color: #fff;
    transition: background 0.2s;
    pointer-events: none;
}

.zoom-badge {
    display: inline-block;
    background: #2d8cff;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.card-body {
    padding: 16px;
}

.card-body h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary);
}

.card-body p {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.card-link:hover { color: #b8994e; }

/* ===== Detail Page - Video Embed ===== */
.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    margin-bottom: 20px;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

/* ===== Content Detail Page ===== */
.detail-header {
    margin-bottom: 24px;
}

.detail-header h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

.breadcrumb {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 24px;
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

.info-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.info-box h3 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-box a {
    color: var(--accent);
    word-break: break-all;
}

.passcode {
    display: inline-block;
    background: #f5f5f5;
    padding: 4px 12px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
    color: var(--primary);
    user-select: all;
}

/* ===== Zoom Player Box ===== */
.zoom-player-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.zoom-icon-area {
    flex-shrink: 0;
}

.zoom-info {
    flex: 1;
}

.zoom-label {
    font-size: 13px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.zoom-open-btn {
    display: inline-block;
    background: #2d8cff;
    color: #fff;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    margin-bottom: 16px;
}

.zoom-open-btn:hover { background: #1a7ae6; }

.zoom-passcode {
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.copy-btn {
    background: #f0f0f0;
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-btn:hover { background: #e0e0e0; }

@media (max-width: 600px) {
    .zoom-player-box { flex-direction: column; padding: 24px; }
}

/* ===== Toggle Content ===== */
.toggle-content {
    display: none;
}

.toggle-content.open {
    display: block;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 24px;
    font-size: 12px;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .header-inner { height: 56px; }
    .header h1 { font-size: 16px; }
    .header h1 span { display: block; margin-left: 0; margin-top: 2px; }
    .main { padding: 20px 16px 48px; }
    .cards { grid-template-columns: 1fr; }
    .login-container { margin: 16px; padding: 32px 24px; }
}

/* ===== 初学者ガイド：エントリーセクション ===== */
.beginner-entry {
    background: linear-gradient(135deg, #fdf6e3 0%, #f3e7c8 100%);
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: 36px;
    border: 1px solid var(--accent-light);
    box-shadow: var(--shadow);
}
.beginner-entry h2 {
    font-size: 22px;
    color: var(--primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.beginner-entry h2 .badge-new {
    font-size: 11px;
    background: #d32f2f;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
}
.beginner-entry p {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 16px;
}
.beginner-entry .btn-start {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    padding: 12px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: background 0.2s;
}
.beginner-entry .btn-start:hover { background: #555; }

/* ===== 初学者ガイド：章カード ===== */
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}
.chapter-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.chapter-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-color: var(--accent-light);
}
.chapter-card .ch-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
}
.chapter-card h3 {
    font-size: 17px;
    color: var(--primary);
    margin-top: 4px;
}
.chapter-card .ch-summary {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.6;
}
.chapter-card .ch-meta {
    margin-top: auto;
    padding-top: 12px;
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
    border-top: 1px solid var(--border);
}

/* ===== 章詳細ページ ===== */
.chapter-hero {
    background: var(--primary);
    color: #fff;
    padding: 32px;
    border-radius: var(--radius);
    margin-bottom: 32px;
}
.chapter-hero .ch-label {
    font-size: 12px;
    color: var(--accent-light);
    letter-spacing: 2px;
    margin-bottom: 8px;
}
.chapter-hero h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
}
.chapter-hero p {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.7;
}

.topic-block {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.topic-block h3 {
    font-size: 19px;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 10px;
}
.topic-block h3 .topic-num {
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 1px;
}
.topic-block h4 {
    font-size: 15px;
    color: var(--primary);
    margin-top: 20px;
    margin-bottom: 10px;
    padding-left: 10px;
    border-left: 3px solid var(--accent);
}
.topic-block p { font-size: 14px; margin-bottom: 12px; }
.topic-block ul, .topic-block ol {
    padding-left: 24px;
    margin-bottom: 12px;
    font-size: 14px;
}
.topic-block li { margin-bottom: 6px; }
.topic-block strong { color: #d32f2f; font-weight: 600; }
.topic-block .keyword { color: #1a7d42; font-weight: 600; }

/* チェックリスト */
.checklist {
    background: #f9f7f2;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 14px 0;
    list-style: none;
    padding-left: 20px;
}
.checklist li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 8px;
    font-size: 14px;
}
.checklist li::before {
    content: "☐";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-size: 16px;
    font-weight: 700;
}

/* ハイライトボックス */
.highlight-box {
    background: linear-gradient(135deg, #fef6e0 0%, #fef0d0 100%);
    border-left: 4px solid #f0a020;
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    margin: 16px 0;
    font-size: 14px;
}
.highlight-box.danger {
    background: #fff0f0;
    border-color: #d32f2f;
}
.highlight-box.success {
    background: #e6f5ec;
    border-color: #1a7d42;
}
.highlight-box.info {
    background: #e8f0fe;
    border-color: #1a56db;
}
.highlight-box strong { color: var(--primary); }

/* テーブル */
.simple-table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 14px;
}
.simple-table th, .simple-table td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
}
.simple-table th {
    background: #f0eded;
    font-weight: 600;
    color: var(--primary);
}
.simple-table tr:nth-child(even) td { background: #fafafa; }

/* タイムライン */
.timeline {
    position: relative;
    padding-left: 30px;
    margin: 16px 0;
}
.timeline::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--accent-light);
}
.timeline-item {
    position: relative;
    padding-bottom: 16px;
}
.timeline-item::before {
    content: "";
    position: absolute;
    left: -27px;
    top: 6px;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px var(--accent-light);
}
.timeline-item .t-time {
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
    margin-bottom: 4px;
}
.timeline-item .t-desc {
    font-size: 13px;
    color: var(--text-light);
}

/* 章ナビ */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.chapter-nav a {
    flex: 1;
    background: var(--card-bg);
    padding: 14px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    font-size: 14px;
    transition: background 0.2s;
}
.chapter-nav a:hover { background: #fafafa; }
.chapter-nav .nav-prev { text-align: left; }
.chapter-nav .nav-next { text-align: right; }
.chapter-nav .nav-label {
    display: block;
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 4px;
    letter-spacing: 1px;
}
.chapter-nav .nav-title {
    font-weight: 600;
    color: var(--primary);
}

@media (max-width: 600px) {
    .topic-block { padding: 20px; }
    .chapter-hero { padding: 24px; }
    .chapter-hero h2 { font-size: 22px; }
}

/* ===== 章末テスト ===== */
.quiz-block { border: 2px solid #c9a96e; }
.quiz-prev { font-size: 13px; color: #666; margin: 6px 0 10px; }
.qz { padding: 14px 16px; margin: 12px 0; border: 1px solid #e3e3e3; border-radius: 8px; background: #fff; }
.qz-q { font-weight: 600; margin-bottom: 8px; }
.qz-opt { display: block; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.qz-opt:hover { background: #f7f3ea; }
.qz-exp { margin-top: 8px; font-size: 14px; color: #333; }
.qz.ok { border-color: #2e7d32; background: #f3faf3; }
.qz.ng { border-color: #c0392b; background: #fdf5f4; }
.qz-btn { background: #c9a96e; color: #fff; border: 0; border-radius: 6px; padding: 12px 28px; font-size: 16px; cursor: pointer; margin-top: 8px; }
.qz-btn:hover { background: #b8955a; }
.qz-result { margin-top: 12px; }
.qz-score { padding: 14px; border-radius: 8px; font-weight: 700; font-size: 16px; }
.qz-score.pass { background: #e8f5e9; color: #2e7d32; }
.qz-score.fail { background: #fdecea; color: #c0392b; }
.qz-warn { padding: 10px; background: #fff8e1; color: #8a6d00; border-radius: 6px; }
.qz-badge { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.qz-badge.pass { background: #e8f5e9; color: #2e7d32; }
.qz-badge.fail { background: #fdecea; color: #c0392b; }
.qz-badge.none { background: #eee; color: #777; }
#qz-overall { margin: 12px 0 20px; font-size: 14px; }
.qz-barwrap { display: inline-block; width: 200px; height: 8px; background: #eee; border-radius: 4px; vertical-align: middle; margin-left: 8px; overflow: hidden; }
.qz-bar { display: block; height: 100%; background: #c9a96e; }
.step-label { display: inline-block; background: #c9a96e; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-bottom: 6px; }
.qz-retry { margin-top: 10px; background: #555; }
.qz-retry:hover { background: #333; }

/* ===== ユーザーバー ===== */
.header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.user-bar { display: flex; align-items: center; gap: 14px; font-size: 13px; color: #ddd; }
.user-bar .ub-name { font-weight: 600; color: #fff; }
.user-bar small { color: #bbb; font-weight: 400; }
.user-bar .ub-link { color: #c9a96e; text-decoration: none; }
.user-bar .ub-link:hover { text-decoration: underline; }
