/* ============================================================
   앱 셸 + 공통 대시보드 컴포넌트 (app.css)
   어드민도 이 파일을 함께 로드해 셸/카드/테이블을 공유한다.
   ============================================================ */

/* hidden 속성은 클래스의 display 규칙보다 우선한다 (항상 숨김) */
[hidden] { display: none !important; }

/* 브랜드 (app/admin 에서도 사용) */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.03em; }
.brand__mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: #fff;
    background: linear-gradient(135deg, var(--blue-500), var(--blue-700)); box-shadow: var(--shadow-primary); }
.brand__mark svg { width: 19px; height: 19px; }
.brand__name { font-size: 17px; }
.brand--light .brand__name { color: var(--color-text); }

/* ============================================================
   셸 레이아웃
   ============================================================ */
.app { min-height: 100vh; min-height: 100dvh; }

.app-sidebar {
    position: fixed; top: 0; left: 0; z-index: 40;
    width: var(--sidebar-w); height: 100vh; height: 100dvh;
    display: flex; flex-direction: column;
    background: var(--color-surface); border-right: 1px solid var(--color-border);
    padding: 18px 14px;
}
.app-sidebar__brand { padding: 8px 10px 18px; }

.app-nav { display: grid; gap: 4px; }
.app-nav__item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; border-radius: var(--radius-md);
    color: var(--color-text-soft); font-weight: 600; font-size: 15px;
    transition: background .15s, color .15s;
}
.app-nav__item:hover { background: var(--color-surface-2); color: var(--color-text); }
.app-nav__item.is-active { background: var(--color-primary-soft); color: var(--color-primary); }
.app-nav__ic { width: 22px; height: 22px; flex-shrink: 0; }

.app-sidebar__foot { margin-top: auto; display: grid; gap: 10px; padding-top: 12px; }

.app-profile {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: var(--radius-md); border: 1px solid var(--color-border);
    transition: background .15s, border-color .15s;
}
.app-profile:hover { background: var(--color-surface-2); }
.app-profile.is-active { border-color: var(--color-primary); }
.app-profile__av { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--blue-300), var(--blue-600)); }
.app-profile__meta { min-width: 0; flex: 1; line-height: 1.3; }
.app-profile__meta strong { display: block; font-size: 14px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-profile__meta i { display: block; font-style: normal; font-size: 12px; color: var(--color-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-profile__chev { width: 18px; height: 18px; color: var(--color-muted); flex-shrink: 0; }

/* 상단바 (모바일 전용) */
.app-topbar {
    display: none; position: sticky; top: 0; z-index: 30;
    align-items: center; gap: 12px; height: var(--header-h);
    padding: 0 16px; background: var(--color-surface); border-bottom: 1px solid var(--color-border);
}
.app-burger { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; }
.app-burger:hover { background: var(--color-surface-2); }
.app-burger svg { width: 24px; height: 24px; }
.app-topbar__brand { margin-right: auto; }
.app-topbar__avatar span { display: block; width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-300), var(--blue-600)); }
.app-topbar__avatar.is-active span { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.app-scrim { position: fixed; inset: 0; z-index: 35; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); }

.app-bottom-nav { display: none; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; background: var(--color-bg-subtle); }
.app-page { max-width: 1100px; margin-inline: auto; padding: 64px 36px; }

body.nav-locked { overflow: hidden; }

/* ============================================================
   페이지 헤더
   ============================================================ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head__title h1 { font-size: 26px; }
.page-head__title p { margin-top: 6px; color: var(--color-text-soft); }
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   통계 카드
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    padding: 20px; box-shadow: var(--shadow-sm); container-type: inline-size; }
.stat-card__top { display: flex; align-items: center; justify-content: space-between; }
.stat-card__ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
    background: var(--color-primary-soft); color: var(--color-primary); }
.stat-card__ic svg { width: 21px; height: 21px; }
.stat-card__delta { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.stat-card__delta.up { color: var(--color-success); }
.stat-card__delta.down { color: var(--color-danger); }
.stat-card__value { margin-top: 14px; display: flex; align-items: baseline; flex-wrap: nowrap; white-space: nowrap;
    font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-card__unit { margin-left: 4px; font-size: 16px; font-weight: 700; letter-spacing: 0; color: var(--color-text-soft); }
.stat-card__unit--min { margin-left: 5px; }
.stat-card__label { margin-top: 2px; font-size: 14px; color: var(--color-text-soft); }
/* 상단 카드 ↔ 유형별 통계 구분선 */
.stat-divider { border: 0; border-top: 1px solid var(--color-border); margin: 0 0 20px; }
/* 유형 선택 드롭다운 줄 */
.stat-typebar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-typebar__label { font-size: 14px; font-weight: 600; color: var(--color-text-soft); }
.stat-typebar__select { min-width: 200px; cursor: pointer; }
/* 선택한 유형의 정답률·훈련 수 카드 — 상단 공통 카드와 열 너비를 동일하게 맞추고,
   카드 2개는 왼쪽 두 열을 채운다(반응형 열 수는 .stat-grid 미디어쿼리를 그대로 따름). */
.stat-grid--type { grid-template-columns: repeat(4, 1fr); }
/* 누적 훈련 시간: 카드 폭이 좁으면 분 단위는 숨기고 시간 단위만 노출 */
@container (max-width: 168px) {
    .stat-card__unit--min { display: none; }
}

/* ============================================================
   패널
   ============================================================ */
.panel { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--color-border); }
.panel__head h2 { font-size: 17px; }
.panel__head p { font-size: 13px; color: var(--color-muted); margin-top: 2px; }
.panel__body { padding: 22px; }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
/* 그리드 칸은 기본 min-width:auto 라 칸 안의 줄바꿈 불가 콘텐츠가 칸(=좁은 화면 폭)을
   넘기면 페이지가 가로로 늘어난다. min-width:0 으로 칸이 화면 폭을 넘지 않도록 막는다. */
.grid-2 > * { min-width: 0; }
.stack-16 { display: grid; gap: 16px; }

/* ============================================================
   막대 차트 (의존성 없음)
   ============================================================ */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 10px; }
.bar-chart__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-chart__bar { width: 100%; max-width: 34px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: linear-gradient(var(--blue-400), var(--blue-600)); position: relative; transition: filter .15s; }
.bar-chart__bar:hover { filter: brightness(1.08); }
.bar-chart__bar span { position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    font-size: 11px; font-weight: 700; color: var(--color-text-soft); }
.bar-chart__x { font-size: 11px; color: var(--color-muted); }

/* 주파수 대역별 정답률 */
.freq-list { display: grid; gap: 12px; }
.freq-row { display: grid; grid-template-columns: 64px 1fr 44px; align-items: center; gap: 12px; }
.freq-row__hz { font-size: 13px; font-weight: 700; color: var(--color-text-soft); font-variant-numeric: tabular-nums; }
.freq-row__track { height: 10px; border-radius: var(--radius-full); background: var(--color-surface-2); overflow: hidden; }
.freq-row__fill { height: 100%; border-radius: var(--radius-full); background: linear-gradient(90deg, var(--blue-400), var(--blue-600)); }
.freq-row__fill.warn { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.freq-row__fill.bad { background: linear-gradient(90deg, #f87171, #ef4444); }
.freq-row__pct { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* ============================================================
   테이블
   ============================================================ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 13px 16px; text-align: left; white-space: nowrap; }
.data-table thead th { font-size: 12px; font-weight: 700; color: var(--color-muted); text-transform: uppercase; letter-spacing: .03em;
    border-bottom: 1px solid var(--color-border); }
.data-table tbody tr { border-bottom: 1px solid var(--color-border); }
.data-table tbody tr:last-child { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--color-surface-2); }
.data-table tbody tr.is-clickable { cursor: pointer; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user__av { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--blue-300), var(--blue-600)); }
.cell-user__name { font-weight: 600; }
.cell-user__mail { font-size: 12px; color: var(--color-muted); }

/* ============================================================
   훈련 유형 카드
   ============================================================ */
.train-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.train-card { display: flex; flex-direction: column; background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s, border-color .15s; }
a.train-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--color-primary); }
.train-card__ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px;
    background: var(--color-primary-soft); color: var(--color-primary); margin-bottom: 18px; }
.train-card__ic svg { width: 28px; height: 28px; }
.train-card__title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; }
.train-card__desc { margin-top: 10px; color: var(--color-text-soft); font-size: 14px; flex: 1; }
.train-card__meta { margin-top: 18px; display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--color-muted); }
.train-card__meta span { display: inline-flex; align-items: center; gap: 5px; }
.train-card__meta svg { width: 16px; height: 16px; }
.train-card__cta { margin-top: 18px; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--color-primary); }
.train-card__cta svg { width: 18px; height: 18px; }
.train-card.is-soon { opacity: .72; }
.train-card.is-soon .train-card__ic { background: var(--color-surface-2); color: var(--color-muted); }

/* ============================================================
   빈/안내 박스
   ============================================================ */
.notice { display: flex; gap: 14px; padding: 18px 20px; border-radius: var(--radius-lg);
    background: var(--color-primary-soft); color: var(--color-text); }
.notice svg { width: 22px; height: 22px; color: var(--color-primary); flex-shrink: 0; }
.notice strong { display: block; }
.notice p { font-size: 14px; color: var(--color-text-soft); margin-top: 2px; }

.coming-inline { display: inline-flex; align-items: center; gap: 6px; padding: 14px 18px; border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-md); color: var(--color-muted); font-size: 14px; }

/* 빈 상태 */
.empty-state { text-align: center; padding: 36px 20px; color: var(--color-text-soft); }
.empty-state__ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 14px; background: var(--color-surface-2); color: var(--color-muted); }
.empty-state__ic svg { width: 26px; height: 26px; }
.empty-state p { font-size: 14px; line-height: 1.7; }

/* 개발 중(준비 중) 공용 화면 — includes/coming-soon.php */
.coming-soon { max-width: 520px; margin: 6vh auto; text-align: center; padding: 24px; }
.coming-soon__ic { display: grid; place-items: center; width: 84px; height: 84px; margin: 0 auto 20px; border-radius: 24px;
    background: var(--color-primary-soft); color: var(--color-primary); }
.coming-soon__ic svg { width: 42px; height: 42px; }
.coming-soon__badge { gap: 5px; }
.coming-soon__badge svg { width: 13px; height: 13px; }
.coming-soon__title { margin-top: 16px; font-size: clamp(22px, 3.5vw, 28px); }
.coming-soon__desc { margin-top: 12px; font-size: 15px; line-height: 1.7; color: var(--color-text-soft); }
.coming-soon__actions { margin-top: 28px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ============================================================
   설정 (좌 범주 / 우 상세)
   ============================================================ */
.settings-layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
/* 데스크톱에서는 래퍼가 레이아웃에 관여하지 않도록(설정 범주가 그리드 칸을 그대로 차지) */
.settings-nav-wrap { display: contents; }
.settings-nav { position: sticky; top: 24px; display: grid; gap: 4px; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 10px; box-shadow: var(--shadow-sm); }
.settings-nav__item { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: var(--radius-md);
    color: var(--color-text-soft); font-weight: 600; font-size: 14px; cursor: pointer; transition: .15s; }
.settings-nav__item:hover { background: var(--color-surface-2); color: var(--color-text); }
.settings-nav__item.is-active { background: var(--color-primary-soft); color: var(--color-primary); }
.settings-nav__item svg { width: 20px; height: 20px; }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--color-border); }
.setting-row:last-child { border-bottom: 0; }
.setting-row__info { flex: 1 1 auto; min-width: 0; }
.setting-row__info strong { font-size: 15px; }
.setting-row__info p { font-size: 13px; color: var(--color-text-soft); margin-top: 3px; }
.setting-row__control { flex-shrink: 0; }
/* 상위 항목(예: 효과음)이 꺼져 하위 항목(효과음 볼륨)이 비활성일 때 회색 처리 */
.setting-row.is-disabled { opacity: .45; }
.setting-row.is-disabled .vol-pop__trigger { pointer-events: none; cursor: not-allowed; }
.settings-num-input { width: 92px; text-align: center; }
.settings-num-input + .settings-field-msg { margin-top: 6px; text-align: right; }
.settings-actions { display: flex; justify-content: flex-end; width: 100%; margin-top: 4px; }
.settings-actions .btn { min-width: 88px; margin-left: auto; }

/* 토글 스위치 */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__slider { position: absolute; inset: 0; cursor: pointer; border-radius: var(--radius-full);
    background: var(--color-border-strong); transition: .2s; }
.switch__slider::before { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; transition: .2s; box-shadow: var(--shadow-sm); }
.switch input:checked + .switch__slider { background: var(--color-primary); }
.switch input:checked + .switch__slider::before { transform: translateX(20px); }

/* 세그먼트 / 테마 선택 — 트랙 위에 떠 있는 알약(pill) 형태 토글 */
.seg {
    display: inline-flex; padding: 4px; gap: 2px;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
}
.seg button, .seg .seg__opt, .seg .seg__btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: var(--radius-full);
    font-size: 14px; font-weight: 600; line-height: 1;
    color: var(--color-text-soft);
    transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}
.seg button:not(.is-active):hover,
.seg .seg__btn:not(.is-active):hover {
    color: var(--color-text);
    background: color-mix(in srgb, var(--color-text) 6%, transparent);
}
.seg .is-active {
    background: var(--color-surface);
    color: var(--color-primary);
    font-weight: 700;
    box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--color-primary) 16%, transparent);
}
.theme-opt { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.theme-opt svg { width: 18px; height: 18px; }
.theme-opt:disabled { cursor: wait; opacity: .65; }
.settings-save-status { min-height: 18px; margin-top: 6px; font-size: 12px; text-align: right; color: var(--color-text-soft); }
.settings-save-status.is-success { color: var(--color-success); }
.settings-save-status.is-error { color: var(--color-danger); }

.settings-alert {
    display: flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 11px 13px;
    border-radius: var(--radius-md); font-size: 14px;
}
.settings-alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.settings-alert.is-success { background: var(--color-success-soft); color: var(--color-success); }
.settings-alert.is-success strong { display: block; }
.settings-alert.is-success p { margin-top: 2px; font-size: 13px; }
.settings-alert.is-error { display: block; background: var(--color-danger-soft); color: var(--color-danger); }
.settings-alert.is-error p + p { margin-top: 4px; }
.settings-account-form { display: grid; gap: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--color-border); }
.settings-field-msg { min-height: 1em; font-size: 13px; color: var(--color-text-soft); }
.settings-field-msg:empty { display: none; }
.settings-field-msg.is-error { color: var(--color-danger); }
.settings-account-form .input[aria-invalid="true"] { border-color: var(--color-danger); }

.app-toast-stack {
    position: fixed; z-index: 1200; top: 20px; right: 20px;
    display: grid; gap: 8px; pointer-events: none;
}
.app-toast {
    display: flex; align-items: center; gap: 9px;
    padding: 12px 16px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    font-size: 14px; font-weight: 600;
    animation: app-toast-in .2s ease-out;
    transition: opacity .2s, transform .2s;
}
.app-toast.is-success { color: var(--color-success); }
.app-toast.is-error { color: var(--color-danger); }
.app-toast.is-info { color: var(--color-primary); }
.app-toast svg { width: 19px; height: 19px; flex-shrink: 0; }
.app-toast.is-hiding { opacity: 0; transform: translateY(-8px); }
@keyframes app-toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.settings-dialog:not([open]) { display: none; }
.settings-dialog {
    position: fixed; inset: 0; margin: auto;
    width: min(520px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0;
    color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.settings-dialog::backdrop { background: rgba(2, 6, 23, .58); backdrop-filter: blur(2px); }
.settings-dialog__card { display: grid; gap: 18px; padding: 24px; }
.settings-dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.settings-dialog__head h2 { font-size: 20px; }
.settings-dialog__head p { margin-top: 5px; font-size: 13px; color: var(--color-text-soft); }
.settings-dialog__close { width: 32px; height: 32px; border-radius: var(--radius-sm); font-size: 26px; line-height: 1; color: var(--color-text-soft); }
.settings-dialog__close:hover { background: var(--color-surface-2); color: var(--color-text); }
.settings-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.settings-dialog .field-msg { min-height: 1em; font-size: 13px; color: var(--color-text-soft); }
.settings-dialog .field-msg:empty { display: none; }
.settings-dialog .field-msg.is-error { color: var(--color-danger); }
.settings-dialog .input[aria-invalid="true"] { border-color: var(--color-danger); }

.select { padding: 9px 14px; border-radius: var(--radius-md); border: 1px solid var(--color-border-strong);
    background: var(--color-surface); font-size: 14px; font-weight: 600; }

.range { width: 200px; accent-color: var(--color-primary); }

/* 설정: 볼륨 — 현재 %만 표시하고, 클릭하면 위에 10%p 단위 페이더 팝업이 뜬다. */
.vol-pop { position: relative; display: inline-flex; }
.vol-pop__trigger {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 64px; min-height: 42px; padding: 10px 18px;
    border: 1px solid var(--color-border); border-radius: 8px; background: transparent;
    cursor: pointer; font-size: 14px; font-weight: 700; color: var(--color-primary);
    font-variant-numeric: tabular-nums; line-height: 1;
    transition: border-color .12s ease, background .12s ease;
}
.vol-pop__trigger:hover { border-color: var(--color-primary); }
.vol-pop__trigger[aria-expanded="true"] { border-color: var(--color-primary); background: var(--color-primary-soft); }
.vol-pop__panel {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 20;
    padding: 12px 14px; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.vol-pop__range { display: block; width: 168px; accent-color: var(--color-primary); cursor: pointer; }

/* ============================================================
   이용안내 (아코디언)
   ============================================================ */
.guide-section { margin-bottom: 28px; }
.guide-section h2 { font-size: 18px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.guide-section h2 svg { width: 22px; height: 22px; color: var(--color-primary); }

/* ============================================================
   프로필
   ============================================================ */
.profile-hero { display: flex; align-items: center; gap: 20px; }
.profile-hero__av { width: 76px; height: 76px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--blue-300), var(--blue-600)); }
.profile-hero__meta h1 { font-size: 24px; }
.profile-hero__meta p { color: var(--color-text-soft); margin-top: 4px; }
.profile-hero__badges { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

.info-list { display: grid; gap: 0; }
.info-list__row { display: flex; justify-content: space-between; gap: 16px; padding: 15px 0; border-bottom: 1px solid var(--color-border); }
.info-list__row:last-child { border-bottom: 0; }
.info-list__row dt { color: var(--color-text-soft); font-size: 14px; }
.info-list__row dd { font-weight: 600; font-size: 14px; }

/* ============================================================
   반응형
   ============================================================ */
@media (max-width: 1024px) {
    .app-topbar { display: flex; }
    .app-sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
    .app-sidebar.is-open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .train-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1025px) {
    .app-scrim { display: none; }
}
@media (max-width: 768px) {
    .app-burger { display: none; }
    .app-sidebar, .app-scrim { display: none; }
    .app-bottom-nav {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
        display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
        min-height: 62px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
        background: var(--color-surface); border-top: 1px solid var(--color-border);
        box-shadow: 0 -8px 24px rgba(15, 23, 42, .08);
    }
    .app-bottom-nav__item {
        min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        padding: 5px 2px; border-radius: var(--radius-md);
        color: var(--color-muted); font-size: 11px; font-weight: 600;
    }
    .app-bottom-nav__item.is-active { color: var(--color-primary); background: var(--color-primary-soft); }
    .app-bottom-nav__ic { width: 21px; height: 21px; }
    .app-main { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
    .app-page { padding: 40px 18px 32px; }
    .settings-layout { grid-template-columns: 1fr; }
    /* 박스(테두리·곡선·그림자)를 래퍼로 옮긴다. 스크롤은 안쪽 .settings-nav가 담당하고,
       래퍼 패딩만큼 안쪽으로 들어가 가로 스크롤바가 곡선 모서리에 닿지 않는다.
       overflow:hidden 으로 내부를 곡선 모양으로 클립.
       min-width:0 으로 긴 메뉴가 그리드 칸(=화면 너비)을 넘겨 페이지가 늘어나는 것도 막는다. */
    .settings-nav-wrap {
        display: block; position: relative; min-width: 0;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        padding: 8px;
        overflow: hidden;
    }
    .settings-nav {
        position: static; grid-auto-flow: column; grid-auto-columns: max-content;
        overflow-x: auto; -webkit-overflow-scrolling: touch;
        background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 0;
        /* 스크롤바를 강제 스타일링하지 않는다. OS 기본(오버레이) 스크롤바를 그대로 써서
           가만히 있으면 자동으로 부드럽게 사라지고, 스크롤할 때만 얇게 나타나도록 한다. */
    }
    .settings-nav__item { white-space: nowrap; }
    /* 스크롤 여지가 있을 때만 좌·우에 표면색 그라데이션으로 더 있음을 암시 (래퍼가 곡선으로 클립) */
    .settings-nav-wrap::before,
    .settings-nav-wrap::after {
        content: ""; position: absolute; top: 0; bottom: 0; width: 40px; z-index: 2;
        pointer-events: none; opacity: 0; transition: opacity .18s ease;
    }
    .settings-nav-wrap::before {
        left: 0; background: linear-gradient(to right, var(--color-surface) 45%, transparent);
    }
    .settings-nav-wrap::after {
        right: 0; background: linear-gradient(to left, var(--color-surface) 45%, transparent);
    }
    .settings-nav-wrap.can-scroll-left::before { opacity: 1; }
    .settings-nav-wrap.can-scroll-right::after { opacity: 1; }
    .train-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .stat-grid { grid-template-columns: 1fr; }
    /* 토글·버튼은 정보 우측에 그대로 두고, 정보 텍스트만 줄어들게 한다.
       (페이더 행만 위 @768 규칙으로 세로 배치됨) */
    .setting-row__info { min-width: 0; }
    .app-toast-stack { top: 14px; right: 14px; left: 14px; }
    .app-toast { justify-content: center; }
}

/* ============================================================
   홈 — 최근 훈련 단축 카드 / 뉴스
   ============================================================ */
.recent-trainings { display: flex; flex-direction: column; }
.recent-train {
    display: flex; align-items: center; gap: 16px; width: 100%;
    padding: 14px 4px; text-align: left; background: none; border: 0;
    border-top: 1px solid var(--color-border); color: inherit; cursor: pointer;
    transition: opacity .15s;
}
.recent-train:first-child { border-top: 0; padding-top: 4px; }
.recent-train:last-child { padding-bottom: 4px; }
.recent-train__ic { margin-bottom: 0; flex-shrink: 0; }
.recent-train__main { flex: 1; min-width: 0; }
.recent-train__main .train-card__desc {
    margin-top: 4px; flex: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recent-train .btn { flex-shrink: 0; }
.recent-train__title-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-train:hover .train-card__title { color: var(--color-primary); }
.recent-train--link { text-decoration: none; }

.news-list { list-style: none; display: flex; flex-direction: column; }
.news-item { padding: 14px 0; border-top: 1px solid var(--color-border); }
.news-item:first-child { border-top: 0; padding-top: 2px; }
.news-item:last-child { padding-bottom: 2px; }
.news-item__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.news-item__title { min-width: 0; font-size: 15px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.news-item__title .badge { vertical-align: middle; }
.news-item__date { flex-shrink: 0; font-size: 12px; color: var(--color-muted); }
.news-item__body { display: block; margin-top: 6px; font-size: 13px; line-height: 1.6; color: var(--color-text-soft); overflow-wrap: anywhere; }

/* 뉴스 항목 클릭 → 전체 보기 */
.news-item__open { display: flex; align-items: center; gap: 12px; width: 100%; padding: 0; text-align: left; background: none; border: 0; color: inherit; cursor: pointer; }
.news-item__main { flex: 1; min-width: 0; }
.news-item__chev { flex: none; display: grid; place-items: center; color: var(--color-muted); transition: color .15s, transform .15s; }
.news-item__chev svg { width: 18px; height: 18px; }
.news-item__open:hover .news-item__title { color: var(--color-primary); }
.news-item__open:hover .news-item__chev { color: var(--color-text-soft); transform: translateX(2px); }
.news-item__open:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }

/* 뉴스 전체 보기 다이얼로그 (settings-dialog 스타일 재사용) */
.news-dialog__meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--color-muted); }
.news-dialog__meta:empty { display: none; }
.news-dialog__title { margin-top: 8px; font-size: 20px; line-height: 1.35; }
.news-dialog__body { font-size: 14px; line-height: 1.7; color: var(--color-text-soft); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60vh; overflow: auto; }

/* ============================================================
   모바일 "더보기" 시트 (하단바 오버플로) + 더보기 버튼
   ============================================================ */
.app-bottom-nav__more { border: 0; background: none; cursor: pointer; font-family: inherit; }

.app-sheet { position: fixed; inset: 0; z-index: 60; display: block; }
.app-sheet[hidden] { display: none; }
.app-sheet__scrim {
    position: absolute; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px);
    opacity: 0; transition: opacity .22s ease;
}
.app-sheet.is-open .app-sheet__scrim { opacity: 1; }
.app-sheet__panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: var(--color-surface); border-top-left-radius: 20px; border-top-right-radius: 20px;
    border-top: 1px solid var(--color-border); box-shadow: 0 -12px 32px rgba(15, 23, 42, .18);
    padding: 10px 14px calc(18px + env(safe-area-inset-bottom));
    transform: translateY(100%); transition: transform .24s cubic-bezier(.32, .72, 0, 1);
}
.app-sheet.is-open .app-sheet__panel { transform: translateY(0); }
.app-sheet__handle { width: 40px; height: 4px; margin: 8px auto 14px; border-radius: var(--radius-full); background: var(--color-border-strong); }
.app-sheet__nav { display: grid; gap: 4px; }
.app-sheet__item {
    display: flex; align-items: center; gap: 14px; padding: 14px 12px; border-radius: var(--radius-md);
    color: var(--color-text-soft); font-size: 15px; font-weight: 600;
}
.app-sheet__item:hover { background: var(--color-surface-2); color: var(--color-text); }
.app-sheet__item.is-active { color: var(--color-primary); background: var(--color-primary-soft); }
.app-sheet__ic { flex: none; width: 22px; height: 22px; }

@media (prefers-reduced-motion: reduce) {
    .app-sheet__scrim, .app-sheet__panel { transition: none; }
}
html[data-reduce-motion="1"] .app-sheet__scrim,
html[data-reduce-motion="1"] .app-sheet__panel { transition: none; }

/* 데스크톱(하단바 미노출)에서는 시트도 숨긴다 */
@media (min-width: 769px) { .app-sheet { display: none !important; } }

/* ── 홈 하단 광고 ──
   home.js가 화면폭에 맞는 카카오 애드핏 배너를 주입한다(PC 728x90 / 모바일 320x50).
   광고가 차단·미노출돼도 회색 '광고' 자리표시(::after)를 남겨 빈 공간이 생기지 않게 한다. */
.home-ad {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    min-height: 90px;
    overflow: hidden;
    --ad-w: 728px;
    --ad-h: 90px;
}
.home-ad::after {
    content: "광고";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: var(--ad-w);
    height: var(--ad-h);
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    color: var(--color-muted);
    /* 광고 미로딩(차단·미노출)으로 '광고' 텍스트만 뜰 때 — R값 없는 딱딱한 흰색 계열 네모 */
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 0;
    pointer-events: none;
    z-index: 0;
}
/* 다크 테마에선 새하얀 블록이 튀므로 표면색으로만 낮춘다(딱딱한 네모·R 없음은 유지) */
[data-theme="dark"] .home-ad::after { background: var(--color-surface); }
.home-ad .kakao_ad_area { position: relative; z-index: 1; max-width: 100%; }
@media (max-width: 768px) {
    .home-ad { min-height: 50px; --ad-w: 320px; --ad-h: 50px; }
}
