/* ==========================================================================
   THREE D PLUS 講座LMS 共通スタイル
   - 色：ネイビーを軸に、面は白、影は使わず細い線で区切る。「次はこの回」だけ橙
   - 書体：本文・見出し Noto Sans JP／数字 Montserrat
   - 形：ボタンは丸い錠剤型、カードは角丸16px
   ========================================================================== */
:root {
    --brand: #16325c;        /* 上の帯・進み具合の線 */
    --brand-ink: #1d4f91;    /* 線・飾り */
    --brand-pale: #e8eef7;   /* 薄い面 */
    --accent: #f5a524;       /* 「次はこの回」 */
    /* LMS用に足した濃淡 */
    --brand-deep: #1b3f7a;   /* 白い文字が読める濃さ（ボタン・リンク・ページ名） */
    --brand-deeper: #142f5c;
    --brand-mist: #f4f7fb;
    --brand-hair: #cfdaea;
    --accent-pale: #fff4dc;
    --sumi: #1c2b33;         /* 文字 */
    --sumi-2: #44525a;
    --sumi-3: #66737b;       /* 補足 */
    --sumi-4: #98a2a8;
    --paper: #ffffff;
    --ground: #f5f6f5;       /* ページの地 */
    --hair: #e1e5e3;         /* 区切りの細い線 */
    --hair-strong: #cbd3d0;  /* 入力欄の線 */
    --neutral-pale: #eef1f0;
    --stop: #c8372d;
    --stop-ink: #8f241c;
    --stop-pale: #fdf1ef;
    --stop-hair: #f3c9c4;
    --caution-ink: #8a5200;
    --caution-pale: #fff3d6;
    /* 以前の名前（古い指定が参照するので残す） */
    --bg: var(--ground);
    --panel: var(--paper);
    --text: var(--sumi);
    --muted: var(--sumi-3);
    --line: var(--hair);
    --primary: var(--brand-deep);
    --primary-soft: var(--brand-pale);
    --success: var(--brand-deep);
    --warning: #b26a00;
    --danger: var(--stop);
    --info: var(--brand-deep);
    --shadow: none;
    --radius: 16px;
    --font-jp: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
    --font-maru: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif; /* ページ名・見出し */
    --pill: 26px;            /* ボタンの角丸。1行なら錠剤型、文が長くて折り返したら角丸の四角になる */
    --chip: 14px;            /* 札の角丸（同上） */
    --font-num: "Montserrat", "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
    --ease: cubic-bezier(.23, 1, .32, 1);
    --check-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font-jp);
    font-size: 16px;
    line-height: 1.7;
    color: var(--sumi);
    background: var(--ground);
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word; /* 長い単語（インドネシア語など）でも枠からはみ出さない */
}
body.role-admin { font-size: 15px; line-height: 1.65; }
a { color: var(--brand-deep); text-decoration: none; }
a:hover { color: var(--brand-deeper); }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .next-chip { word-break: auto-phrase; } /* 見出しは文節で折り返す（対応ブラウザのみ） */
h1 { font-size: 26px; line-height: 1.4; }
h2 { font-size: 19px; line-height: 1.5; }
h3 { font-size: 16.5px; line-height: 1.55; }
.muted, .header-subtitle { color: var(--sumi-3); }
.text-link { font-weight: 700; }
.align-left { text-align: left; display: inline-block; }
.top-gap { margin-top: 14px; }

/* ---------- 上の帯（ネイビー＋白ロゴ） ---------- */
.app-header { margin: 0; }
.brand-bar { background: var(--brand); }
.brand-in {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 60px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 16px;
    padding-top: 8px;
    padding-bottom: 8px;
}
.role-admin .brand-in { max-width: 1320px; }
.brand { display: flex; align-items: center; gap: 12px; min-height: 44px; color: #fff; }
.brand:hover { color: #fff; }
.brand img { width: 150px; height: auto; }
.brand-name {
    font-family: var(--font-maru);
    font-weight: 900;
    font-size: 15px;
    line-height: 1.2;
    letter-spacing: .04em;
    padding-left: 12px;
    border-left: 1.5px solid rgba(255, 255, 255, .6);
}
.header-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; margin-left: auto; }
/* 言語の切り替え（日本語／Tiếng Việt／Bahasa Indonesia）を置く場所：帯の右上（.header-nav の先頭）と、ログインの欄の下。
   今は置いていない。置くときはこの形を使う。スマホでは帯が2段に折り返す */
.lang-switch { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 12px; border-radius: var(--pill); background: rgba(255, 255, 255, .2); color: #fff; font-size: 13.5px; font-weight: 700; }
.lang-switch select { width: auto; min-height: 32px; padding: 2px 8px; border: 0; border-radius: 8px; background: #fff; color: var(--sumi); font-size: 14px; font-weight: 700; }
.auth-card .lang-switch { margin-top: 20px; background: var(--neutral-pale); color: var(--sumi-2); }
/* 講座が対応している言語の札（講座のカード・講座ページの先頭に置く想定。国旗の絵は使わず、言語の名前を字で出す） */
.lang-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.lang-tag { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--chip); background: #fff; box-shadow: inset 0 0 0 1.5px var(--brand-ink); color: var(--brand-deep); font-size: 12px; font-weight: 700; line-height: 1.5; }
.nav-icon { display: none; } /* 絵文字のアイコンは出さない */
.nav-btn { min-height: 40px; padding: 6px 16px; font-size: 14px; }
.admin-nav .nav-btn { white-space: nowrap; } /* 管理メニューは横に流す */
.brand-bar .nav-btn { min-height: 40px; padding: 6px 16px; font-size: 14px; background: #fff; border-color: #fff; color: var(--brand-deep); }
.brand-bar .nav-btn:hover { background: var(--brand-pale); border-color: var(--brand-pale); }
.brand-bar .nav-btn.active { background: #fff; border-color: #fff; color: var(--brand-deep); pointer-events: none; }
.brand-bar .nav-logout { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.brand-bar .nav-logout:hover { background: var(--brand-deeper); border-color: var(--brand-deeper); color: #fff; }

/* 管理画面のメニュー（帯の下の白い段） */
.admin-nav { display: block; background: #fff; border-bottom: 1px solid var(--hair); }
.admin-nav-in {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 12px;
    display: flex;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.admin-nav .nav-btn {
    flex: 0 0 auto;
    min-height: 48px;
    padding: 0 12px;
    border: 0;
    border-radius: 0;
    border-bottom: 3px solid transparent;
    background: none;
    color: var(--sumi-2);
    font-size: 14px;
}
.admin-nav .nav-btn:hover { color: var(--brand-deep); background: var(--brand-mist); }
.admin-nav .nav-btn.active { color: var(--brand-deep); border-bottom-color: var(--brand); background: none; pointer-events: none; }

/* ---------- ページの枠 ---------- */
.app-shell { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }
.role-admin .app-shell { max-width: 1320px; }
.page-head { margin: 4px 0 20px; }
.page-head h1 {
    margin: 0;
    font-family: var(--font-maru);
    font-weight: 900;
    font-size: 28px;
    line-height: 1.35;
    letter-spacing: .01em;
    color: var(--brand-deep);
    text-wrap: balance;
}
.page-head .header-subtitle { margin: 6px 0 0; font-size: 14.5px; color: var(--sumi-2); }
.page-body { display: grid; gap: 20px; }
.page-body > * { min-width: 0; }
.eyebrow { margin: 0 0 8px; color: var(--brand-deep); font-size: 13px; font-weight: 700; letter-spacing: .06em; }

/* ---------- 面（カード） ---------- */
.hero-panel, .panel { background: var(--paper); border: 1px solid var(--hair); border-radius: 16px; }
.panel { padding: 24px; }
.hero-panel { padding: 24px; display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.dashboard-hero { align-items: stretch; background: var(--brand-pale); border-color: var(--brand-pale); }
.hero-copy { flex: 1 1 auto; min-width: 0; }
.hero-panel h2 { font-size: 21px; margin-bottom: 6px; }
.hero-panel p { margin-bottom: 8px; }
.dashboard-hero .muted { color: var(--sumi-2); }
.hero-side-block { width: min(340px, 100%); display: grid; gap: 14px; align-content: start; }
.hero-course-thumb { border-radius: 12px; overflow: hidden; min-height: 180px; background: #fff; }
.hero-course-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero-badges { margin-top: 12px; }
.elevated-panel { box-shadow: none; }
.company-summary-card, .visual-guide { background: var(--paper); }
.danger-zone { border-color: var(--stop-hair); background: var(--stop-pale); }
.mini-card { border: 1px solid var(--hair); border-radius: 12px; padding: 14px 16px; background: var(--brand-mist); }
.mini-card p { margin: 6px 0 0; }
.mini-card .inline-between { flex-direction: column-reverse; gap: 2px; }
.mini-card .inline-between .muted { font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* 受講者ダッシュボードの先頭 */
.hero-illust {
    flex: none;
    width: 148px;
    height: 148px;
    align-self: center;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
}
.hero-illust img { width: 80%; height: auto; }

/* ---------- 進み具合（数字・線・輪） ---------- */
.metric-card {
    min-width: 260px;
    background: var(--paper);
    border: 1px solid var(--brand-hair);
    border-radius: 12px;
    padding: 18px 20px;
}
.metric-card p { margin-bottom: 2px; font-size: 14px; }
.metric-label { color: var(--sumi-3); font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.metric-value {
    font-family: var(--font-num);
    font-weight: 800;
    font-size: 48px;
    line-height: 1;
    letter-spacing: -.01em;
    font-variant-numeric: tabular-nums;
    margin-bottom: 12px;
    color: var(--sumi);
}
.metric-value.small { font-size: 28px; margin-bottom: 0; }
.metric-mini { position: relative; padding: 16px 18px; }
.progress { width: 100%; height: 10px; background: #dbe3ee; border-radius: 999px; overflow: hidden; margin: 12px 0 10px; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.progress.compact { height: 8px; max-width: 160px; margin: 8px 0 0; }
.progress-text { margin-bottom: 6px; font-size: 14px; }
.metric-circle {
    --p: 0;
    flex: none;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: var(--font-num);
    font-weight: 800;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    color: var(--sumi);
    background:
        radial-gradient(closest-side, #fff 76%, transparent 78%),
        conic-gradient(var(--brand) calc(var(--p) * 1%), #dbe3ee 0);
}

/* ---------- 並べ方 ---------- */
.card-grid { display: grid; gap: 16px; }
.courses-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.metrics-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.metrics-grid-5 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.split-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.admin-top-grid { align-items: start; }
.two-col-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-metrics-extended { display: grid; gap: 12px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.dashboard-metrics-extended .metric-card { min-width: 0; border-color: var(--hair); padding: 14px 16px; }
.stack-list { display: grid; gap: 16px; }
.compact-list { gap: 12px; }
.course-card__top, .inline-between { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.section-title-row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 12px; }
.section-title-row h2 { margin-bottom: 0; }

/* 受講者ダッシュボードの数字の帯（5つを1本にまとめ、講座の一覧の下へ） */
.stat-strip {
    order: 10;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    background: var(--paper);
    border: 1px solid var(--hair);
    border-radius: 16px;
    overflow: hidden;
}
.stat-strip .metric-mini { border: 0; border-left: 1px solid var(--hair); border-radius: 0; background: none; padding: 14px 16px; }
.stat-strip .metric-mini:first-child { border-left: 0; }
.stat-strip .metric-value.small { font-size: 24px; }

/* ---------- 札（状態の表示） ---------- */
.pill, .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: var(--chip);
    padding: 4px 12px;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.5;
    max-width: 100%;
}
.pill { background: none; color: var(--brand-deep); padding: 0; margin: 0 0 2px; font-size: 12px; }
.status-badge.done { background: var(--brand-pale); color: var(--brand-deeper); }
.status-badge.todo { background: var(--caution-pale); color: var(--caution-ink); }
.status-badge.danger { background: var(--stop-pale); color: var(--stop-ink); }
.status-badge.info { background: var(--neutral-pale); color: var(--sumi-2); }
.dashboard-hero .status-badge.info, .dashboard-hero .status-badge.done { background: #fff; }
.completion-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: fit-content;
    max-width: 100%;
    padding: 4px 12px;
    border-radius: var(--chip);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 12px;
}
.completion-badge.gold { background: var(--brand-deep); color: #fff; }
.completion-badge.gold::before { content: ""; flex: none; width: 12px; height: 12px; background: var(--check-white) center / contain no-repeat; }
.completion-badge.silver { background: var(--brand-pale); color: var(--brand-deeper); }
.completion-badge.bronze { background: #fff; color: var(--sumi-2); box-shadow: inset 0 0 0 1.5px var(--hair-strong); }
.completion-badge.neutral { background: var(--neutral-pale); color: var(--sumi-3); }
.hero-badges .completion-badge { margin-bottom: 0; }

/* ---------- ボタン（丸い錠剤型） ---------- */
.watch-button, button, .ghost-button {
    appearance: none;
    border: 1.5px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 48px;
    padding: 10px 22px;
    border-radius: var(--pill);
    max-width: 100%;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    transition: background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease), transform .12s var(--ease);
}
.watch-button, button { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.watch-button:hover, button:hover { background: var(--brand-deeper); border-color: var(--brand-deeper); color: #fff; }
.watch-button:active, button:active, .ghost-button:active { transform: scale(.97); }
.ghost-button { background: #fff; color: var(--sumi); border-color: var(--hair-strong); }
.ghost-button:hover { border-color: var(--brand-deep); color: var(--brand-deep); }
.small-btn { min-height: 38px; padding: 6px 14px; font-size: 13px; }
.delete-button { background: var(--stop); border-color: var(--stop); color: #fff; }
.delete-button:hover { background: var(--stop-ink); border-color: var(--stop-ink); }
.nav-logout { color: var(--stop-ink); }
button:disabled { opacity: .55; cursor: default; transform: none; }
.csv-download-btn { width: 100%; margin-top: 4px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 3px solid rgba(28, 190, 161, .5);
    outline-offset: 2px;
}

/* ---------- 入力 ---------- */
label { font-size: 14px; font-weight: 700; color: var(--sumi); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="url"], textarea, select {
    width: 100%;
    min-height: 50px;
    padding: 11px 14px;
    border: 1.5px solid var(--hair-strong);
    border-radius: 10px;
    background: #fff;
    color: var(--sumi);
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
}
.role-admin input[type="text"], .role-admin input[type="email"], .role-admin input[type="password"], .role-admin input[type="number"], .role-admin input[type="date"], .role-admin input[type="url"], .role-admin textarea, .role-admin select { min-height: 44px; padding: 8px 12px; font-size: 15px; }
input::placeholder, textarea::placeholder { color: var(--sumi-4); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { min-height: 120px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand-deep); }
.filters .filter-grid, .stack-form { display: grid; gap: 12px; }
.stack-form label { margin-top: 4px; }
.stack-form > button { margin-top: 8px; }
.filter-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: end; }
.filter-grid-wide { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.filter-actions { display: flex; align-items: end; gap: 10px; }
.multi-action, .wrap-actions, .compact-wrap { flex-wrap: wrap; }
.duration-inputs { display: grid; grid-template-columns: repeat(2, minmax(120px, 180px)); gap: 12px; align-items: center; }
.duration-inputs > div { display: flex; gap: 8px; align-items: center; }
.duration-inputs input { min-width: 0; }
.duration-inputs span { color: var(--sumi-3); font-weight: 700; }
.video-actions, .inline-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.compact-actions { margin-top: 0; justify-content: flex-end; }
.inline-form { display: inline-block; margin: 2px 4px 2px 0; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-card, .checkbox-row { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--hair); border-radius: 12px; padding: 12px 14px; background: #fff; font-weight: 500; }
.compact-user-card { align-items: center; }
.company-check-grid, .user-check-grid { max-height: 240px; overflow: auto; padding: 4px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 14.5px; line-height: 1.7; }
.check-row input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.status-form-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status-form-inline select { min-width: 128px; min-height: 38px; padding: 6px 10px; }
.status-form-inline .small-btn { min-height: 38px; white-space: nowrap; }
.compact-status-form, .compact-form { margin-top: 8px; }
.compact-status-form select, .compact-status-form button, .compact-form select, .compact-form button { min-height: 38px; }

/* ---------- お知らせ・注意の帯 ---------- */
.alert { border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; background: var(--brand-pale); color: var(--brand-deeper); border: 1px solid var(--brand-hair); font-weight: 500; }
.alert.error { background: var(--stop-pale); color: var(--stop-ink); border-color: var(--stop-hair); }
.alert.success { background: var(--brand-pale); color: var(--brand-deeper); border-color: var(--brand-hair); }
.page-body > .alert { margin-bottom: 0; }

/* ---------- 講座のカード（ダッシュボード） ---------- */
.enhanced-course-card { padding: 20px; display: flex; flex-direction: column; transition: border-color .16s var(--ease); }
.enhanced-course-card:hover { border-color: var(--brand); }
.enhanced-course-card h3 { font-size: 17px; margin: 0; }
.enhanced-course-card .course-card__top { margin-bottom: 10px; }
.enhanced-course-card > p.muted { font-size: 14px; line-height: 1.7; margin-bottom: 10px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.enhanced-course-card .progress { margin: 0 0 16px; }
.enhanced-course-card .watch-button { margin-top: auto; width: 100%; }
.enhanced-course-card .watch-button::after { content: ""; flex: none; width: 7px; height: 7px; margin-left: 4px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg); }
/* 修了した講座は、見直し用の控えめなボタンにする */
.enhanced-course-card:has(.completion-badge.gold) .watch-button { background: #fff; color: var(--brand-deep); }
.enhanced-course-card:has(.completion-badge.gold) .watch-button:hover { background: var(--brand-pale); }
.course-meta-row { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--sumi-3); font-size: 13px; margin: auto 0 8px; font-variant-numeric: tabular-nums; }
.course-thumb { aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--brand-pale); margin-bottom: 16px; }
.course-thumb img { width: 100%; height: 100%; object-fit: cover; }
.compact-course-card .course-thumb { aspect-ratio: 16 / 7; }
.course-thumb-admin { max-width: 420px; }
.course-thumb-empty { background: var(--brand-pale); }
.thumb-fallback { width: 100%; height: 100%; min-height: 180px; display: grid; place-items: center; }
.thumb-fallback span { width: 84px; height: 84px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--brand-deep); font-size: 34px; font-weight: 800; }
.table-course-cell { display: flex; gap: 12px; align-items: center; }
.table-course-thumb { width: 72px; min-width: 72px; height: 48px; border-radius: 8px; overflow: hidden; background: var(--brand-pale); display: grid; place-items: center; font-size: 10px; color: var(--sumi-3); border: 1px solid var(--brand-hair); }
.table-course-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 回の一覧（講座ページ）：番号を線でつなぐ工程表 ---------- */
.lesson-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.lesson-meta { display: flex; gap: 14px; align-items: flex-start; min-width: 0; flex: 1 1 auto; }
.lesson-meta h3 { margin: 0 0 2px; }
.lesson-meta p { margin: 0; font-size: 13.5px; line-height: 1.65; }
.lesson-number {
    position: relative;
    z-index: 1;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #fff;
    border: 2px solid var(--hair-strong);
    color: var(--sumi-3);
    font-family: var(--font-num);
    font-weight: 800;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}
.lesson-actions { display: flex; gap: 8px; align-items: center; flex: 0 1 auto; max-width: 52%; flex-wrap: wrap; justify-content: flex-end; }
.lesson-actions .watch-button { order: 2; } /* 札を先に、ボタンを右（下）にまとめる */
.lesson-actions .ghost-button { order: 3; }
.lesson-list-enhanced { gap: 0; background: var(--paper); border: 1px solid var(--hair); border-radius: 16px; overflow: hidden; }
.lesson-row-card { position: relative; border: 0; border-top: 1px solid var(--hair); border-radius: 0; background: none; padding: 18px 20px; align-items: flex-start; }
.lesson-row-card:first-child { border-top: 0; }
.lesson-row-card .lesson-actions { align-self: center; }
.lesson-row-card::before { content: ""; position: absolute; left: 39px; top: 0; bottom: 0; width: 2px; background: var(--hair); }
.lesson-row-card:first-child::before { top: 38px; }
.lesson-row-card:last-child::before { bottom: auto; height: 38px; }
.lesson-row-card:only-child::before { display: none; }
.lesson-row-card.is-done::before { background: var(--brand); }
.lesson-row-card .status-badge.todo { background: var(--neutral-pale); color: var(--sumi-3); }
.lesson-row-card .watch-button, .lesson-row-card .ghost-button { min-height: 44px; padding: 8px 18px; font-size: 14.5px; }
.lesson-row-card .watch-button { background: #fff; color: var(--brand-deep); border-color: var(--brand-deep); }
.lesson-row-card .watch-button:hover { background: var(--brand-pale); }
/* 済んだ回 */
.lesson-row-card.is-done .lesson-number { background: var(--brand) var(--check-white) center / 20px no-repeat; border-color: var(--brand); font-size: 0; }
/* 次に進む回（橙） */
.lesson-row-card.is-next { background: var(--accent-pale); }
.lesson-row-card.is-next .lesson-number { background: var(--accent); border-color: var(--accent); color: var(--sumi); }
.lesson-row-card.is-next .watch-button,
.lesson-row-card.is-next.is-watched .ghost-button { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.lesson-row-card.is-next .watch-button:hover,
.lesson-row-card.is-next.is-watched .ghost-button:hover { background: var(--brand-deeper); border-color: var(--brand-deeper); }
.lesson-row-card.is-next.is-watched .watch-button { background: #fff; color: var(--brand-deep); border-color: var(--brand-deep); }
.lesson-row-card.is-next .status-badge.todo { background: #fff; }
.next-chip { display: inline-block; background: var(--accent); color: var(--sumi); font-size: 12px; font-weight: 700; line-height: 1.5; padding: 2px 10px; border-radius: var(--chip); margin: 0 0 6px; }

/* ---------- 修了までの流れ（講座ページ・回の一覧の上）：絵に字は入れない ---------- */
.finish-rule p { margin: 0; font-size: 14px; }
.finish-flow { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.finish-flow li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 14px; font-weight: 700; line-height: 1.4; }
.finish-flow li + li::before { content: ""; position: absolute; left: -6px; top: 28px; width: 8px; height: 8px; border-top: 2px solid var(--brand-ink); border-right: 2px solid var(--brand-ink); transform: translate(-50%, -50%) rotate(45deg); }
.finish-ico { width: 56px; height: 56px; border-radius: 50%; background: var(--brand-pale) center / 28px no-repeat; }
.finish-ico.ico-play { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d4f91' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='12' rx='1.5'/%3E%3Cpath d='m10.5 8.5 4 2.5-4 2.5z'/%3E%3Cpath d='M8.5 20h7'/%3E%3C/svg%3E"); }
.finish-ico.ico-test { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d4f91' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 3.5h6v3H9z'/%3E%3Cpath d='M7 5H6a1 1 0 0 0-1 1v13.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-1'/%3E%3Cpath d='m9 13.5 2 2 4-4'/%3E%3C/svg%3E"); }
.finish-ico.ico-cert { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d4f91' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='11' rx='1.5'/%3E%3Cpath d='M8 8h8M8 11h5'/%3E%3Cpath d='m9.5 15-1 5.5 3.5-2 3.5 2-1-5.5'/%3E%3C/svg%3E"); }
@media (min-width: 861px) {
    .finish-rule { display: flex; align-items: center; gap: 32px; }
    .finish-flow { flex: 0 0 360px; margin: 0; }
}

/* ---------- 課題 ---------- */
.assignment-card { padding: 20px; border: 1px solid var(--hair); border-radius: 12px; background: #fff; }
.assignment-card__head { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.assignment-stack { display: grid; gap: 16px; }
.admin-comment-box { padding: 14px 16px; background: var(--brand-mist); border: 1px solid var(--brand-hair); border-radius: 12px; }
.admin-comment-box p { margin: 8px 0 0; }

/* ---------- 表（管理画面） ---------- */
.table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; max-height: 640px; border: 1px solid var(--hair); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; min-width: 900px; }
.compact-table { min-width: 680px; }
.admin-user-table { min-width: 1180px; }
.table th, .table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.table th { position: sticky; top: 0; z-index: 2; color: var(--sumi-2); font-size: 13px; font-weight: 700; background: var(--brand-mist); box-shadow: 0 1px 0 var(--hair); }
.table tbody tr:nth-child(even) td { background: #fafbfa; }
.table tbody tr:hover td { background: var(--brand-mist); }
.table tbody tr:last-child td { border-bottom: 0; }

/* ---------- ログインの画面 ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ground); }
.auth-wrap {
    width: 100%;
    max-width: 920px;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    background: var(--paper);
    border: 1px solid var(--hair);
    border-radius: 20px;
    overflow: hidden;
}
.auth-wrap-wide { max-width: 1000px; }
.auth-brand { background: var(--brand); padding: 32px; display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.auth-logo { width: 200px; height: auto; }
.auth-brand-copy { margin: auto 0; color: #fff; font-size: 24px; font-weight: 700; line-height: 1.6; letter-spacing: .04em; }
.auth-illust { margin: auto; width: min(100%, 280px); aspect-ratio: 1; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.auth-illust img { width: 80%; height: auto; }
.auth-card { width: 100%; max-width: 480px; background: var(--paper); border: 1px solid var(--hair); border-radius: 20px; padding: 32px; }
.auth-card-wide { max-width: 560px; }
.auth-wrap .auth-card { max-width: none; border: 0; border-radius: 0; padding: 40px 36px; align-self: center; }
.auth-card h1 { font-family: var(--font-maru); font-weight: 900; font-size: 26px; color: var(--sumi); margin-bottom: 8px; }
.auth-card .header-subtitle { color: var(--sumi-2); font-size: 14.5px; margin-bottom: 20px; }
.auth-card .stack-form > button { min-height: 54px; font-size: 16px; }
.auth-note { font-size: 13.5px; margin: 20px 0 0; line-height: 1.8; }

/* ---------- 視聴の画面 ---------- */
.watch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.watch-main { display: grid; gap: 20px; min-width: 0; }
.video-player-wrap { padding: 12px; }
.video-player { display: block; width: 100%; max-width: 100%; max-height: 68vh; aspect-ratio: 16 / 9; border-radius: 10px; background: #000; }
.player-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 4px 4px; }
.speed-controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.speed-label { font-size: 12.5px; margin-right: 2px; }
.speed-btn { min-height: 36px; padding: 4px 14px; font-size: 13px; background: #fff; color: var(--sumi); border-color: var(--hair-strong); }
.speed-btn:hover { background: var(--brand-pale); color: var(--brand-deep); border-color: var(--brand-deep); }
.speed-btn.active { background: var(--brand-deep); color: #fff; border-color: var(--brand-deep); }
.lock-note { font-size: 13.5px; }
.lock-note.warn { color: var(--caution-ink); font-weight: 700; }
.watch-title { margin-top: 8px; font-size: 20px; }
.watch-hint { font-size: 13.5px; }
.watch-actions { margin-top: 18px; }
.watch-actions .watch-button, .watch-actions .ghost-button { min-width: 140px; }
.quiz-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--accent-pale); border: 1.5px solid var(--accent); color: var(--sumi); font-weight: 700; margin-top: 16px; }
.quiz-cta[hidden] { display: none; }
.course-done { margin-top: 14px; font-weight: 700; }
.course-done[hidden] { display: none; }
.watch-sidebar { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 20px; }
.lecture-nav { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 4px; }
.lecture-nav__item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--sumi); border: 1px solid transparent; min-height: 52px; }
.lecture-nav__item:hover { background: var(--brand-mist); color: var(--sumi); }
.lecture-nav__item.current { background: var(--brand-pale); font-weight: 700; box-shadow: inset 3px 0 0 var(--brand); }
.lecture-nav__check { flex: 0 0 auto; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #fff; border: 1.5px solid var(--hair-strong); color: var(--sumi-3); font-family: var(--font-num); font-size: 12px; font-weight: 800; }
.lecture-nav__check.done { background: var(--brand); border-color: var(--brand); color: #fff; }
.lecture-nav__title { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 1.5; }
.lecture-nav__time { flex: 0 0 auto; font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- 確認テスト ---------- */
.quiz-panel { width: 100%; max-width: 760px; margin: 0 auto; }
.quiz-title { margin: 8px 0 12px; font-size: 20px; }
.quiz-list { list-style: none; padding: 0; margin: 20px 0; counter-reset: quiz; }
.quiz-q { margin: 0 0 28px; counter-increment: quiz; }
.quiz-q fieldset { border: none; padding: 0; margin: 0; min-width: 0; }
.quiz-qtext { display: block; width: 100%; padding: 0; font-weight: 700; font-size: 17px; line-height: 1.65; margin: 0 0 12px; color: var(--sumi); }
.quiz-qtext::before { content: "Q" counter(quiz); font-family: var(--font-num); font-weight: 800; font-size: 18px; color: var(--brand-ink); margin-right: 10px; }
.quiz-opt { display: flex; gap: 12px; align-items: flex-start; min-height: 56px; padding: 14px 16px; margin: 0 0 10px; border: 1.5px solid var(--hair-strong); border-radius: 12px; background: #fff; font-size: 16px; font-weight: 500; line-height: 1.6; color: var(--sumi); cursor: pointer; }
.quiz-opt:hover { border-color: var(--brand); }
.quiz-opt input { margin: 2px 0 0; width: 22px; height: 22px; flex: 0 0 auto; }
.quiz-opt:has(input:checked) { border-color: var(--brand-deep); background: var(--brand-pale); font-weight: 700; }
.quiz-form > button { min-height: 56px; font-size: 16px; }
.quiz-result { border-radius: 12px; padding: 16px 20px; margin: 12px 0 18px; }
.quiz-result p:last-child { margin-bottom: 0; }
.quiz-result.is-pass { background: var(--brand-pale); border: 1px solid var(--brand-hair); }
.quiz-result.is-fail { background: var(--stop-pale); border: 1px solid var(--stop-hair); }
.quiz-score { font-family: var(--font-num); font-size: 28px; font-weight: 800; line-height: 1.3; margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.quiz-mark { display: inline-block; width: 1.5em; font-weight: 700; }
.quiz-q.ok .quiz-mark { color: var(--brand-deep); }
.quiz-q.ng .quiz-mark { color: var(--stop); }
.quiz-choices { list-style: none; padding: 0; margin: 0 0 8px; }
.quiz-choices li { padding: 8px 12px; margin: 0 0 4px; border-radius: 8px; font-size: 15px; }
.quiz-choices li.is-answer { background: var(--brand-pale); font-weight: 700; }
.quiz-choices li.is-mine { background: var(--stop-pale); }
.quiz-explain { font-size: 15px; line-height: 1.75; background: var(--neutral-pale); border-radius: 8px; padding: 10px 14px; margin: 0; }

/* ---------- 受講履歴一覧（admin_export_history.php） ---------- */
.history-groups { gap: 14px; }
.history-group { padding: 0; overflow: hidden; }
.history-group summary::-webkit-details-marker { display: none; }
.history-summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(200px, 1.1fr) minmax(220px, 1.4fr) minmax(200px, 1fr) auto; gap: 18px; align-items: center; padding: 18px 24px; transition: background-color .15s var(--ease); }
.history-summary:hover { background: var(--brand-mist); }
.history-group[open] .history-summary { border-bottom: 1px solid var(--hair); background: var(--brand-mist); }
.history-summary__who { display: flex; gap: 12px; align-items: center; min-width: 0; }
.history-name { display: block; font-size: 15px; }
.history-sub { display: block; font-size: 12px; margin-top: 2px; }
.history-summary__course { min-width: 0; }
.history-summary__course strong { display: block; font-size: 14px; }
.history-summary__progress { min-width: 180px; }
.history-summary__progress .completion-badge { margin-bottom: 6px; padding: 3px 10px; }
.history-summary__progress .progress-text { font-size: 12px; margin-bottom: 4px; }
.history-toggle-hint { font-size: 11px; white-space: nowrap; }
.history-group[open] .history-toggle-hint::after { content: 'を閉じる'; }
.history-group .table-wrap { margin: 16px 24px 20px; padding: 0; }
.history-table { min-width: 760px; }
.history-table th, .history-table td { padding: 10px; font-size: 13px; }
.history-row-todo td { color: var(--sumi-3); background: #fbfcfb; }

/* ---------- 申し込み対応フロー（会社管理・会社詳細） ---------- */
.flow-steps { margin: 10px 0 0; padding-left: 0; list-style: none; counter-reset: flow; display: grid; gap: 8px; }
.flow-steps li { position: relative; padding-left: 30px; font-size: 13px; line-height: 1.5; counter-increment: flow; }
.flow-steps li::before { content: counter(flow); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--neutral-pale); color: var(--sumi-2); font-family: var(--font-num); font-size: 11px; font-weight: 800; }
.flow-steps li.done::before { content: '✓'; background: var(--brand); color: #fff; }
.flow-steps-large li { padding: 12px 14px 12px 44px; border: 1px solid var(--hair); border-radius: 12px; background: var(--brand-mist); font-size: 14px; }
.flow-steps-large li::before { left: 12px; top: 14px; }
.flow-steps-large li strong { display: block; }
.flow-steps-large li .muted { display: block; font-size: 12px; margin-top: 2px; }
.flow-guide { min-width: 260px; }
.detail-toggle { cursor: pointer; list-style: none; }
.detail-toggle::-webkit-details-marker { display: none; }
.detail-toggle::after { content: ' ▼'; font-size: 11px; color: var(--sumi-3); }
details[open] .detail-toggle::after { content: ' ▲'; }
.mail-draft { border: 1px solid var(--hair); border-radius: 12px; padding: 10px 14px; margin-top: 10px; background: #fff; }
.mail-draft summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.mail-draft pre { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 13.5px; line-height: 1.85; margin: 12px 0 4px; }

/* ---------- 修了証管理（admin_certificates.php） ---------- */
.cert-table { min-width: 1080px; }
.cert-issue-form { display: flex; gap: 8px; align-items: center; }
.cert-issue-form input[type="text"] { min-height: 38px; padding: 6px 10px; width: 160px; font-size: 13px; }
.cert-issue-form .small-btn { white-space: nowrap; }
.cert-actions { gap: 8px; }
.order-textarea { font-family: "MS Gothic", "Osaka-Mono", monospace; font-size: 13px; line-height: 1.7; }

/* ---------- 修了証書（certificate.php / A4横 印刷用）※証書そのものの見た目は変えていない ---------- */
.cert-page { background: #e8edf5; min-height: 100vh; padding: 24px; }
.cert-toolbar { max-width: 1100px; margin: 0 auto 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cert-sheet { max-width: 1100px; aspect-ratio: 297 / 210; margin: 0 auto; background: #fffdf7; box-shadow: 0 18px 44px rgba(24, 33, 47, 0.18); padding: 34px; line-height: 1.65; font-size: 15px; }
.cert-border { height: 100%; border: 3px double #b08d2f; outline: 1px solid #d9c37a; outline-offset: -10px; padding: 36px 56px; display: flex; flex-direction: column; align-items: center; text-align: center; color: #2a2a24; }
.cert-number { align-self: flex-end; font-size: 13px; color: #6b6350; margin: 0; }
.cert-title { font-size: 44px; letter-spacing: .35em; margin: 18px 0 22px; font-weight: 800; color: #1f1c12; line-height: 1.65; }
.cert-company { font-size: 15px; color: #5a523c; margin: 0 0 4px; }
.cert-name { font-size: 32px; font-weight: 700; margin: 0 0 24px; border-bottom: 2px solid #b08d2f; padding: 0 28px 6px; }
.cert-name-suffix { font-size: 18px; font-weight: 500; }
.cert-body p { font-size: 16px; margin: 4px 0; line-height: 1.9; }
.cert-course { font-size: 22px; font-weight: 700; margin: 8px 0 !important; }
.cert-meta { margin-top: 18px; font-size: 14px; color: #4d4636; }
.cert-meta p { margin: 2px 0; }
.cert-footer { margin-top: auto; width: 100%; display: flex; justify-content: space-between; align-items: flex-end; }
.cert-issued { font-size: 14px; margin: 0; }
.cert-issuer { font-size: 18px; font-weight: 700; margin: 0; }
.cert-birth { text-align: center; margin: 2px 0 0; font-size: 15px; color: #444; }
.cert-scope { max-width: 78%; margin: 14px auto 0; font-size: 12.5px; line-height: 1.7; color: #444; text-align: left; border-top: 1px solid #cfc7b5; padding-top: 10px; }

/* ---------- 画面の幅ごとの調整 ---------- */
@media (max-width: 1200px) {
    .dashboard-metrics-extended { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media screen and (max-width: 1140px) {
    .cert-page { padding: 12px; overflow-x: hidden; }
    .cert-sheet { width: 1100px; max-width: none; margin: 0; }
    .cert-toolbar { flex-wrap: wrap; }
}
@media (max-width: 1024px) {
    .watch-layout { grid-template-columns: 1fr; }
    .watch-sidebar { position: static; max-height: none; }
    .history-summary { grid-template-columns: 1fr 1fr; }
    .history-toggle-hint { display: none; }
}
@media (max-width: 860px) {
    .hero-panel, .lesson-row { flex-direction: column; align-items: stretch; }
    .metric-card { min-width: 0; }
    .hero-side-block { width: 100%; }
    .two-col-grid { grid-template-columns: 1fr; }
    .table-course-cell { align-items: flex-start; }
    .status-form-inline { flex-direction: column; align-items: stretch; }
    .status-form-inline .small-btn, .status-form-inline select { width: 100%; }
    .assignment-card__head, .check-grid { grid-template-columns: 1fr; display: grid; }
    .dashboard-metrics-extended { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* ダッシュボードの先頭：文を上に、進み具合は下に */
    .learner-hero { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "copy" "metric"; gap: 14px 12px; align-items: start; }
    .learner-hero .hero-copy { grid-area: copy; }
    .learner-hero .metric-card { grid-area: metric; }
    /* 回の一覧：ボタンは文の下、左をそろえる */
    .lesson-row-card { gap: 12px; }
    .lesson-row-card .lesson-actions { align-self: stretch; max-width: none; justify-content: flex-start; padding-left: 54px; }
}
@media (max-width: 640px) {
    .app-shell { padding: 16px 16px 48px; }
    .brand-in { padding: 6px 16px; min-height: 56px; gap: 6px 10px; }
    .brand img { width: 88px; }
    .brand-name { font-size: 13px; padding-left: 10px; }
    .role-user .brand-name { display: none; }
    .brand-bar .nav-btn { min-height: 40px; padding: 6px 14px; font-size: 13.5px; }
    .page-head { margin: 0 0 16px; }
    .page-head h1 { font-size: 22px; }
    .page-head .header-subtitle { font-size: 14px; }
    .page-body { gap: 16px; }
    h1 { font-size: 22px; }
    h2 { font-size: 18px; }
    .hero-panel, .panel { padding: 18px 16px; }
    .hero-panel h2 { font-size: 19px; }
    .metric-value { font-size: 42px; }
    .courses-grid { grid-template-columns: 1fr; }
    .dashboard-metrics-extended, .check-grid { grid-template-columns: 1fr; }
    .stat-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .stat-strip .metric-mini { grid-column: span 2; padding: 12px; }
    .stat-strip .metric-mini:nth-child(n+4) { grid-column: span 3; border-top: 1px solid var(--hair); }
    .stat-strip .metric-mini:nth-child(4) { border-left: 0; }
    .stat-strip .metric-label { font-size: 12px; }
    .history-summary { grid-template-columns: 1fr; gap: 12px; }
    .table-wrap { max-height: 480px; }
    /* 回の一覧 */
    .lesson-row-card { padding: 16px; }
    .lesson-row-card::before { left: 35px; }
    .lesson-row-card:first-child::before { top: 36px; }
    .lesson-row-card:last-child::before { height: 36px; }
    .lesson-meta { gap: 12px; }
    .lesson-meta h3 { font-size: 16px; }
    .lesson-row-card .lesson-actions { padding-left: 52px; }
    .lesson-row-card.is-next:not(.is-watched) .watch-button, .lesson-row-card.is-next.is-watched .ghost-button { flex: 1 1 100%; min-height: 50px; font-size: 16px; order: 5; }
    /* 視聴の画面：主なボタンは押しやすく全幅に */
    .video-player-wrap { padding: 8px; }
    .video-player { max-height: 46vh; border-radius: 8px; }
    .watch-sidebar { padding: 18px 12px; }
    .watch-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .watch-actions .ghost-button, .watch-actions .watch-button, .watch-actions button { width: 100%; min-width: 0; }
    .watch-actions > :only-child { grid-column: 1 / -1; }
    .quiz-cta .watch-button { width: 100%; min-height: 48px; font-size: 15px; }
    .quiz-form > button { width: 100%; }
    .quiz-panel .inline-actions > a { flex: 1 1 100%; }
    /* ログインの画面 */
    .auth-page { padding: 0; place-items: stretch; background: var(--paper); }
    .auth-wrap { grid-template-columns: 1fr; align-content: start; border: 0; border-radius: 0; min-height: 100vh; }
    .auth-brand { flex-direction: row; align-items: center; justify-content: space-between; padding: 14px 20px; gap: 12px; }
    .auth-logo { width: 150px; }
    .auth-brand-copy { margin: 0; font-size: 13px; line-height: 1.5; text-align: right; }
    .auth-illust { margin: 0; width: 76px; flex: none; }
    .auth-wrap .auth-card { padding: 24px 20px 40px; align-self: start; }
    .auth-card h1 { font-size: 23px; }
    .auth-page > .auth-card { border: 0; border-radius: 0; padding: 24px 20px 40px; max-width: none; align-self: start; }
}
@media (prefers-reduced-motion: reduce) {
    .watch-button, button, .ghost-button { transition: none; }
    .watch-button:active, button:active, .ghost-button:active { transform: none; }
}

@media print {
    @page { size: A4 landscape; margin: 0; }
    .no-print { display: none !important; }
    .cert-page { background: #fff; padding: 0; }
    .cert-sheet { max-width: none; width: 100%; height: 100vh; aspect-ratio: auto; box-shadow: none; padding: 12mm; }
}
