/* ═══════════════════════════════════════════════════════════════
   Audio Intelligence — Liquid Glass Design System
   visionOS 스타일 글래스모피즘: 깊이감 있는 반투명 레이어,
   정교한 1px 하이라이트 테두리, 은은한 빛 반사, 유동적 마이크로 인터랙션
   ═══════════════════════════════════════════════════════════════ */

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

:root {
    /* 배경 (깊은 공간감) */
    --bg: #07070d;
    --bg-deep: #04040a;

    /* 글라스 표면 — 반투명 화이트 오버레이 */
    --surface:  rgba(255, 255, 255, 0.055);
    --surface2: rgba(255, 255, 255, 0.09);
    --surface3: rgba(255, 255, 255, 0.13);

    /* 정교한 글라스 테두리 */
    --border:  rgba(255, 255, 255, 0.10);
    --border2: rgba(255, 255, 255, 0.16);
    --edge-hi: rgba(255, 255, 255, 0.22);   /* 상단 빛 반사 엣지 */

    --text:  #f4f4fa;
    --text2: #9c9cba;
    --text3: #5c5c7d;

    --primary: #4a9eff;
    --primary-soft: #7ab8ff;
    --primary-dim: rgba(74, 158, 255, 0.16);
    --primary-glow: rgba(74, 158, 255, 0.35);
    --mark: #ffd54a;
    --mark-dim: rgba(255, 213, 74, 0.13);
    --danger: #ff5a6e;
    --danger-dim: rgba(255, 90, 110, 0.14);
    --success: #34d99a;
    --warn: #ffab40;

    --radius: 20px;
    --radius-sm: 13px;
    --radius-xs: 9px;

    /* 글라스 그림자: 외곽 깊이 + 내부 상단 하이라이트 + 내부 바닥 음영 */
    --glass-shadow:
        0 8px 32px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 var(--edge-hi),
        inset 0 -1px 0 rgba(255, 255, 255, 0.04);
    --glass-shadow-lg:
        0 24px 64px rgba(0, 0, 0, 0.5),
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 var(--edge-hi),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05);

    --blur: blur(28px) saturate(180%);
    --blur-heavy: blur(44px) saturate(200%);

    --ease-fluid: cubic-bezier(0.32, 0.72, 0, 1);
    --ease-spring: cubic-bezier(0.34, 1.36, 0.44, 1);
}

html { background: var(--bg); }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Pretendard', 'Segoe UI', sans-serif;
    font-size: 14px;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    letter-spacing: -0.1px;
}

/* ── 앰비언트 배경: 글라스 뒤로 비치는 유동적 광원 ─────────── */
.ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(ellipse 80% 60% at 70% -10%, rgba(74, 110, 255, 0.14), transparent 55%),
        radial-gradient(ellipse 70% 55% at 10% 105%, rgba(150, 74, 255, 0.10), transparent 60%),
        var(--bg);
}
/* orb는 정적 라이트 레이어 — filter/애니메이션 없음.
   (움직이는 blur 광원은 위의 모든 backdrop-filter 패널을 매 프레임
   재계산시켜 재생창 깜빡임과 스크롤 렉의 원인이 됐음) */
.ambient .orb {
    position: absolute;
    border-radius: 50%;
    opacity: 0.5;
}
.ambient .orb:nth-child(1) {
    width: 46vmax; height: 46vmax;
    left: -12vmax; top: -14vmax;
    background: radial-gradient(circle, rgba(56, 120, 255, 0.28) 0%, rgba(56,120,255,0.10) 40%, transparent 68%);
}
.ambient .orb:nth-child(2) {
    width: 38vmax; height: 38vmax;
    right: -14vmax; top: 24%;
    background: radial-gradient(circle, rgba(148, 88, 255, 0.20) 0%, rgba(148,88,255,0.08) 40%, transparent 68%);
}
.ambient .orb:nth-child(3) {
    width: 34vmax; height: 34vmax;
    left: 18%; bottom: -18vmax;
    background: radial-gradient(circle, rgba(46, 190, 255, 0.14) 0%, rgba(46,190,255,0.05) 40%, transparent 68%);
}

#app { padding-top: env(safe-area-inset-top); }

@supports (padding-top: env(safe-area-inset-top)) {
    .tab-content { top: env(safe-area-inset-top) !important; }
    #login-screen { padding-top: env(safe-area-inset-top); }
}

/* ── 글라스 패널 공통 프리미티브 ──────────────────────────────
   backdrop-filter는 고정 오버레이(탭바·재생창·헤더·로그인)에만 사용.
   반복 카드(레코드 블록 등 수십 개)에 걸면 스크롤마다 전부 재계산되어
   심각한 병목 + 컴포지팅 깜빡임이 생기므로 그라디언트로만 표현 */
.glass, .login-box, .record-block, .mark-card, .lecture-card,
.form-modal, .monitor-card, .file-card, .engine-card {
    background: linear-gradient(160deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.045) 45%, rgba(255,255,255,0.06) 100%);
    border: 1px solid var(--border);
    box-shadow: var(--glass-shadow);
    position: relative;
}
.login-box {
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
}
/* 상단-좌측 스페큘러 시광(빛 반사) */
.login-box::before, .form-modal::before, .monitor-card::before, .engine-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(120% 60% at 18% -8%, rgba(255,255,255,0.10), transparent 55%);
}

/* ── 로그인 ─────────────────────────────── */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}
.login-box {
    padding: 44px 34px;
    border-radius: 30px;
    width: 348px;
    box-shadow: var(--glass-shadow-lg);
    text-align: center;
    animation: rise 0.7s var(--ease-fluid) both;
}
@keyframes rise {
    from { opacity: 0; transform: translateY(22px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}
.login-box h1 {
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -0.6px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 30%, rgba(255,255,255,0.55));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-box .login-sub {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 30px;
}
.login-box input {
    width: 100%;
    padding: 15px 18px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: 15px;
    color: var(--text);
    font-size: 15px;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.login-box input:focus {
    border-color: rgba(74, 158, 255, 0.55);
    background: rgba(255,255,255,0.085);
    box-shadow: 0 0 0 4px rgba(74, 158, 255, 0.14), inset 0 1px 0 var(--edge-hi);
}
.login-box button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(160deg, rgba(96,168,255,0.85), rgba(58,126,236,0.85));
    border: 1px solid rgba(140,196,255,0.45);
    border-radius: 15px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(58,126,236,0.35), inset 0 1px 0 rgba(255,255,255,0.35);
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s, filter 0.2s;
}
.login-box button:hover { filter: brightness(1.08); }
.login-box button:active { transform: scale(0.965); box-shadow: 0 4px 14px rgba(58,126,236,0.3), inset 0 1px 0 rgba(255,255,255,0.25); }
.error { color: var(--danger); font-size: 12px; margin-top: 10px; }

/* ── 화면 전환 ───────────────────────────── */
.screen { width: 100%; height: 100%; }
.hidden { display: none !important; }

/* ── 하단 탭바: 플로팅 글라스 캡슐 ─────────── */
.bottom-nav {
    position: fixed;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 12px; right: 12px;
    display: flex;
    background: linear-gradient(160deg, rgba(255,255,255,0.10), rgba(255,255,255,0.05));
    border: 1px solid var(--border);
    border-radius: 26px;
    z-index: 100;
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    box-shadow: var(--glass-shadow-lg);
    padding: 4px;
    overflow: hidden;
}
.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 9px 2px 7px;
    background: none;
    border: none;
    border-radius: 20px;
    color: var(--text3);
    font-size: 19px;
    cursor: pointer;
    gap: 3px;
    transition: color 0.3s, background 0.35s var(--ease-fluid), transform 0.25s var(--ease-spring);
    position: relative;
}
.nav-btn span {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: -0.1px;
}
.nav-btn:active { transform: scale(0.9); }
.nav-btn.active { color: var(--primary-soft); }

/* 리퀴드 글라스 인디케이터: 활성 탭 위치로 유체처럼 슬라이드 (JS가 left/width 지정) */
.nav-pill {
    position: absolute;
    top: 4px; bottom: 4px;
    left: 0; width: 0;
    border-radius: 20px;
    background: linear-gradient(160deg, rgba(74,158,255,0.22), rgba(74,158,255,0.08));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 0 2px 12px rgba(74,158,255,0.14);
    transition: left 0.5s var(--ease-spring), width 0.5s var(--ease-spring);
    pointer-events: none;
    opacity: 0;
}
.nav-pill.ready { opacity: 1; }
.nav-btn { position: relative; z-index: 1; }

/* ── 탭 콘텐츠 ───────────────────────────── */
.tab-content {
    position: fixed;
    top: 0; left: 0; right: 0;
    bottom: calc(72px + env(safe-area-inset-bottom));
    overflow-y: auto;
    padding: 0 16px 16px;
    scroll-behavior: smooth;
}
.tab-content::-webkit-scrollbar { width: 0; }
/* 탭 전환: hidden 해제(display 변경) 시마다 페이드 재생.
   transform은 데스크톱 중앙정렬(translateX)과 충돌하므로 opacity만 사용 */
.tab-content { animation: tab-in 0.35s var(--ease-fluid); }
@keyframes tab-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── 탭 헤더 ─────────────────────────────── */
.tab-header {
    position: sticky;
    top: 0;
    background: linear-gradient(rgba(7,7,13,0.72), rgba(7,7,13,0.45));
    padding: 20px 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.tab-header h2 {
    font-size: 20px;
    font-weight: 700;
    flex: 1;
    letter-spacing: -0.5px;
}
.tab-header button, .tab-header label {
    padding: 8px 15px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.10);
    transition: all 0.25s var(--ease-fluid);
}
.tab-header button:hover, .tab-header label:hover {
    background: var(--surface2);
    border-color: var(--border2);
    color: var(--text);
}
.tab-header button:active, .tab-header label:active { transform: scale(0.95); }

.tab-header #current-date {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: -0.3px;
}

/* ── 검색바 ──────────────────────────────── */
.search-bar { margin-bottom: 14px; }
.search-bar input {
    width: 100%;
    padding: 12px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.search-bar input:focus {
    border-color: rgba(74,158,255,0.5);
    background: var(--surface2);
    box-shadow: 0 0 0 4px rgba(74,158,255,0.12), inset 0 1px 0 var(--edge-hi);
}
.search-bar input::placeholder { color: var(--text3); }

/* ── 레코드 블록 ─────────────────────────── */
.record-block {
    border-radius: 14px;
    padding: 9px 13px;
    margin-bottom: 5px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.25s, transform 0.25s var(--ease-spring), border-color 0.25s, box-shadow 0.3s;
}
.record-block:active { transform: scale(0.985); }
.record-block.playing {
    border-color: rgba(74,158,255,0.45);
    border-left-color: var(--primary);
    background: linear-gradient(160deg, rgba(74,158,255,0.16), rgba(74,158,255,0.06));
    box-shadow: 0 8px 28px rgba(74,158,255,0.14), inset 0 1px 0 var(--edge-hi);
}
.record-block.marked {
    border-left-color: var(--mark);
    background: linear-gradient(160deg, rgba(255,213,74,0.13), rgba(255,213,74,0.04));
}
.record-block.lecture-block { border-left-width: 3px; }
.record-block .timestamp {
    font-size: 10px;
    color: var(--text2);
    margin-bottom: 4px;
    font-weight: 500;
    letter-spacing: 0.1px;
}
.record-block .text {
    line-height: 1.5;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
}
.record-block .text mark {
    background: rgba(255,213,74,0.28);
    border-radius: 4px;
    padding: 0 3px;
    color: var(--mark);
}
.record-block .actions {
    display: flex;
    gap: 2px;
    margin-top: 5px;
    justify-content: flex-end;
}
.record-block .actions button {
    background: none;
    border: none;
    color: var(--text3);
    cursor: pointer;
    font-size: 13px;
    padding: 3px 6px;
    border-radius: var(--radius-xs);
    transition: color 0.2s, background 0.25s, transform 0.2s var(--ease-spring);
}
.record-block .actions button:hover {
    color: var(--text);
    background: var(--surface2);
}
.record-block .actions button:active { transform: scale(0.85); }
.selected-block {
    background: linear-gradient(160deg, rgba(74,158,255,0.20), rgba(74,158,255,0.08)) !important;
    border-color: rgba(74,158,255,0.5) !important;
    border-left-color: var(--primary) !important;
}

/* ── 필터 칩 ─────────────────────────────── */
.filter-chips {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.chip {
    padding: 7px 17px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
    transition: all 0.3s var(--ease-fluid);
}
.chip:active { transform: scale(0.93); }
.chip.active {
    background: linear-gradient(160deg, rgba(96,168,255,0.85), rgba(58,126,236,0.85));
    border-color: rgba(140,196,255,0.5);
    color: white;
    box-shadow: 0 4px 16px rgba(58,126,236,0.35), inset 0 1px 0 rgba(255,255,255,0.35);
}

/* ── 마킹 카드 ───────────────────────────── */
.mark-card {
    border-radius: var(--radius);
    padding: 17px;
    margin-bottom: 10px;
    cursor: pointer;
    border-left: 3px solid var(--mark);
    transition: background 0.25s, transform 0.25s var(--ease-spring);
}
.mark-card:active { transform: scale(0.985); }
.mark-card .mark-time { font-size: 11px; color: var(--text2); font-weight: 500; }
.mark-card .mark-text {
    margin-top: 7px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text);
}
.mark-card .mark-meta {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text2);
}

/* ── 마킹 상세 ───────────────────────────── */
.mark-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.mark-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.mark-nav button {
    padding: 10px 19px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.25s var(--ease-fluid);
}
.mark-nav button:active { transform: scale(0.95); }
.core-block {
    background: linear-gradient(160deg, rgba(255,213,74,0.14), rgba(255,213,74,0.05));
    border: 1px solid rgba(255,213,74,0.4);
    border-radius: var(--radius);
    box-shadow: 0 8px 28px rgba(255,213,74,0.08), inset 0 1px 0 var(--edge-hi);
}

/* ── 강의 카드 ───────────────────────────── */
.lecture-card {
    border-radius: var(--radius);
    padding: 17px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary);
    transition: transform 0.25s var(--ease-spring);
}
.lecture-card:active { transform: scale(0.99); }
.lecture-card .lecture-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.lecture-card .lecture-info { font-size: 12px; color: var(--text2); margin-top: 5px; }
.lecture-card .lecture-actions { display: flex; gap: 8px; margin-top: 12px; }
.lecture-card .lecture-actions button {
    padding: 7px 15px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.25s var(--ease-fluid);
}
.lecture-card .lecture-actions button:active { transform: scale(0.94); }

/* ── 폼 모달 ─────────────────────────────── */
.form-modal {
    border-radius: 24px;
    padding: 22px;
    margin-bottom: 16px;
}
.form-modal h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.3px;
}
.form-modal input, .form-modal select, .form-modal textarea {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    margin-bottom: 10px;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.form-modal input:focus, .form-modal select:focus, .form-modal textarea:focus {
    border-color: rgba(74,158,255,0.5);
    background: rgba(255,255,255,0.09);
    box-shadow: 0 0 0 4px rgba(74,158,255,0.12);
}
.form-btns { display: flex; gap: 8px; margin-top: 12px; }
.form-btns button {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text2);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s var(--ease-fluid);
}
.form-btns button:active { transform: scale(0.96); }
.btn-primary {
    background: linear-gradient(160deg, rgba(96,168,255,0.85), rgba(58,126,236,0.85)) !important;
    border: 1px solid rgba(140,196,255,0.45) !important;
    color: white !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 16px rgba(58,126,236,0.3), inset 0 1px 0 rgba(255,255,255,0.35) !important;
}
.btn-danger {
    background: linear-gradient(160deg, rgba(255,106,124,0.85), rgba(226,64,88,0.85)) !important;
    border: 1px solid rgba(255,150,162,0.4) !important;
    color: white !important;
    box-shadow: 0 4px 16px rgba(226,64,88,0.28), inset 0 1px 0 rgba(255,255,255,0.3) !important;
}

/* ── 요일 선택 ───────────────────────────── */
.day-selector label { font-size: 12px; color: var(--text2); margin-bottom: 6px; display: block; }
.days { display: flex; gap: 6px; margin: 6px 0 12px; }
.day-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s var(--ease-spring);
}
.day-btn:active { transform: scale(0.88); }
.day-btn.selected {
    background: linear-gradient(160deg, rgba(96,168,255,0.85), rgba(58,126,236,0.85));
    border-color: rgba(140,196,255,0.5);
    color: white;
    box-shadow: 0 4px 12px rgba(58,126,236,0.35), inset 0 1px 0 rgba(255,255,255,0.35);
}
.time-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.time-row span { color: var(--text2); }
.time-row input { margin-bottom: 0; flex: 1 1 0; width: auto; min-width: 0; }
/* date/time 입력이 박스 밖으로 튀어나오는 문제:
   iOS/모바일에서 네이티브 위젯의 고유 폭이 width를 무시하므로
   appearance를 제거하고 폭을 컨테이너에 강제 고정 */
input[type="date"], input[type="time"], input[type="datetime-local"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 42px;   /* appearance 제거 시 iOS에서 높이 붕괴 방지 */
}
input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value { text-align: left; }
.form-modal { overflow-x: clip; }
.color-picker { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.color-picker label { font-size: 13px; color: var(--text2); }
.color-picker input[type=color] {
    width: 40px; height: 32px;
    border: none; background: none; cursor: pointer; padding: 0;
    border-radius: 8px;
}

/* ── 파일 그리드 ─────────────────────────── */
.files-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.file-card {
    border-radius: var(--radius);
    padding: 18px 12px;
    cursor: pointer;
    transition: background 0.25s, transform 0.25s var(--ease-spring), border-color 0.25s;
}
.file-card:hover { background: var(--surface2); }
.file-card:active { transform: scale(0.96); }
.file-card.file-selected {
    border-color: rgba(74,158,255,0.55);
    background: linear-gradient(160deg, rgba(74,158,255,0.18), rgba(74,158,255,0.07));
    box-shadow: 0 6px 20px rgba(74,158,255,0.12), inset 0 1px 0 var(--edge-hi);
}
.file-card .file-icon { font-size: 28px; text-align: center; margin-bottom: 10px; }
.file-card .file-name {
    font-size: 12px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-card .file-memo { font-size: 11px; color: var(--text2); margin-top: 4px; }

/* ── 오디오 플레이어: 플로팅 글라스 패널 ────── */
.audio-player {
    position: fixed;
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: 12px; right: 12px;
    background: linear-gradient(160deg, rgba(255,255,255,0.11), rgba(255,255,255,0.055));
    border: 1px solid var(--border2);
    border-radius: 20px;
    padding: 9px 16px 10px;
    z-index: 90;
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    box-shadow: var(--glass-shadow-lg);
    /* 진입 애니메이션 없음: hidden 토글마다 opacity가 다시 0→1로 재생되어
       재생창이 깜빡이는 원인이었음. 레이어를 GPU에 고정해 안정화 */
    transform: translateZ(0);
}
.player-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text2);
    margin-bottom: 6px;
}
#player-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 6px;
}
.player-controls button {
    background: none;
    border: none;
    color: var(--text2);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    transition: color 0.2s, transform 0.25s var(--ease-spring);
}
.player-controls button:hover { color: var(--text); }
.player-controls button:active { transform: scale(0.85); }
#play-btn {
    background: linear-gradient(160deg, rgba(96,168,255,0.9), rgba(58,126,236,0.9)) !important;
    border-radius: 50% !important;
    color: white !important;
    width: 36px; height: 36px;
    font-size: 14px !important;
    display: flex; align-items: center; justify-content: center;
    padding: 0 !important;
    box-shadow: 0 6px 20px rgba(58,126,236,0.4), inset 0 1px 0 rgba(255,255,255,0.4);
}
.player-bar { margin-bottom: 6px; }
.player-bar input[type=range] {
    width: 100%;
    height: 4px;
    accent-color: var(--primary);
    cursor: pointer;
}
.speed-controls { display: flex; justify-content: center; gap: 6px; }
.speed-controls button {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text2);
    padding: 3px 11px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease-fluid);
}
.speed-controls button:active { transform: scale(0.92); }
.speed-controls button.active {
    background: linear-gradient(160deg, rgba(96,168,255,0.85), rgba(58,126,236,0.85));
    border-color: rgba(140,196,255,0.5);
    color: white;
    box-shadow: 0 3px 12px rgba(58,126,236,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}

/* ── 모니터링 ─────────────────────────────── */
.monitor-card {
    border-radius: var(--radius);
    padding: 19px;
    margin-bottom: 12px;
}
.monitor-card h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 14px;
}
.progress-bar {
    height: 7px;
    background: rgba(255,255,255,0.07);
    border-radius: 4px;
    overflow: hidden;
    margin: 6px 0;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}
.progress-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-soft));
    box-shadow: 0 0 10px rgba(74,158,255,0.5);
    transition: width 0.5s var(--ease-fluid);
}
.progress-fill.warn { background: linear-gradient(90deg, #e08a20, var(--warn)); box-shadow: 0 0 10px rgba(255,171,64,0.45); }
.progress-fill.danger { background: linear-gradient(90deg, #e24058, var(--danger)); box-shadow: 0 0 10px rgba(255,90,110,0.45); }

/* ── 설정 ────────────────────────────────── */
.settings-list { padding: 4px 0; }
.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.setting-item label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}
.setting-item .setting-desc {
    font-size: 11px;
    color: var(--text2);
    margin-top: 2px;
}

/* iOS 스타일 토글 */
.toggle-switch {
    position: relative;
    width: 50px; height: 29px;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.08);
    border-radius: 29px;
    cursor: pointer;
    transition: background 0.35s var(--ease-fluid), border-color 0.35s, box-shadow 0.35s;
    border: 1px solid var(--border);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.25);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px; top: 50%;
    transform: translateY(-50%);
    width: 21px; height: 21px;
    background: linear-gradient(180deg, #ffffff, #d8d8e4);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    transition: left 0.35s var(--ease-spring), background 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(160deg, rgba(96,168,255,0.9), rgba(58,126,236,0.9));
    border-color: rgba(140,196,255,0.5);
    box-shadow: 0 0 14px rgba(58,126,236,0.35), inset 0 1px 0 rgba(255,255,255,0.3);
}
.toggle-switch input:checked + .toggle-slider::before { left: calc(100% - 24px); }

.setting-item input[type="checkbox"] {
    width: 44px;
    height: 24px;
    accent-color: var(--primary);
    cursor: pointer;
}
.setting-item select, .setting-item input[type="number"] {
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    padding: 8px 11px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
}
.setting-item select:focus, .setting-item input[type="number"]:focus {
    border-color: rgba(74,158,255,0.5);
    box-shadow: 0 0 0 3px rgba(74,158,255,0.12);
}
.setting-item select option { background: #14141f; color: var(--text); }

.setting-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.9px;
    padding: 22px 0 8px;
}

/* ── STT 엔진 선택 카드 ───────────────────── */
.engine-card {
    border-radius: var(--radius);
    padding: 15px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 13px;
    transition: border-color 0.3s, background 0.3s, transform 0.25s var(--ease-spring), box-shadow 0.3s;
}
.engine-card:active { transform: scale(0.985); }
.engine-card.selected {
    border-color: rgba(74,158,255,0.55);
    background: linear-gradient(160deg, rgba(74,158,255,0.17), rgba(74,158,255,0.06));
    box-shadow: 0 8px 28px rgba(74,158,255,0.14), inset 0 1px 0 var(--edge-hi);
}
.engine-card .engine-radio {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--border2);
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.3s, background 0.3s;
}
.engine-card.selected .engine-radio {
    border-color: var(--primary-soft);
    background: radial-gradient(circle at 50% 42%, var(--primary-soft) 0 6px, transparent 7px);
    box-shadow: 0 0 10px rgba(74,158,255,0.5);
}
.engine-card .engine-body { flex: 1; min-width: 0; }
.engine-card .engine-name {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}
.engine-card .engine-desc { font-size: 11.5px; color: var(--text2); margin-top: 3px; line-height: 1.5; }
.engine-badge {
    font-size: 9.5px;
    font-weight: 700;
    padding: 2.5px 8px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
}
.engine-badge.active-badge {
    color: var(--success);
    background: rgba(52,217,154,0.12);
    border-color: rgba(52,217,154,0.3);
}
.engine-badge.quant-badge {
    color: var(--primary-soft);
    background: var(--primary-dim);
    border-color: rgba(74,158,255,0.3);
}
.engine-badge.warn-badge {
    color: var(--warn);
    background: rgba(255,171,64,0.1);
    border-color: rgba(255,171,64,0.3);
}
.engine-download-btn {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border2);
    background: var(--surface2);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s var(--ease-fluid);
}
.engine-download-btn:active { transform: scale(0.94); }

/* ── 로그 ────────────────────────────────── */
.log-item {
    padding: 10px 13px;
    border-radius: var(--radius-sm);
    margin-bottom: 5px;
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    border: 1px solid transparent;
}
.log-item.INFO {
    background: rgba(74,158,255,0.07);
    border-color: rgba(74,158,255,0.14);
}
.log-item.WARN {
    background: rgba(255,171,64,0.07);
    border-color: rgba(255,171,64,0.16);
    color: var(--warn);
}
.log-item.ERROR {
    background: rgba(255,90,110,0.07);
    border-color: rgba(255,90,110,0.16);
    color: var(--danger);
}
.log-stack {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text2);
    display: none;
}

/* ── 힌트 / 빈 상태 ──────────────────────── */
.hint { font-size: 12px; color: var(--text2); margin-bottom: 12px; }
.empty-state {
    text-align: center;
    padding: 52px 20px;
    color: var(--text2);
}
.empty-state .empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.8; }
.empty-state p { font-size: 14px; }

/* ── 반응형 ──────────────────────────────── */
@media (min-width: 768px) {
    .tab-content { max-width: 720px; margin: 0 auto; left: 50%; transform: translateX(-50%); right: auto; width: 720px; }
    .files-grid { grid-template-columns: repeat(4, 1fr); }
    .bottom-nav { max-width: 696px; margin: 0 auto; left: 50%; transform: translateX(-50%); right: auto; width: 696px; }
    .audio-player { max-width: 696px; margin: 0 auto; left: 50%; transform: translateX(-50%); right: auto; width: 696px; }
}

/* ── 버튼 기본 ───────────────────────────── */
button { color: var(--text); font-family: inherit; }
.mark-detail-header button { color: var(--text); }
.upload-btn { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }

/* 포커스 접근성 */
:focus-visible {
    outline: 2px solid rgba(74,158,255,0.6);
    outline-offset: 2px;
}

/* ── 화자 배지 ─────────────────────────────── */
.spk-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 5px;
    padding: 1px 7px;
    border-radius: 20px;
    font-size: 9.5px;
    font-weight: 700;
    color: var(--spk, var(--primary));
    background: color-mix(in srgb, var(--spk, var(--primary)) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--spk, var(--primary)) 30%, transparent);
    cursor: pointer;
    transition: transform 0.2s var(--ease-spring);
    white-space: nowrap;
}
.spk-badge:active { transform: scale(0.9); }

/* ── 엔트리 애니메이션 (transform/opacity만 — GPU 저비용) ──────
   monitor-card는 4~15초 폴링으로 재구성되므로 제외 (펄스 방지) */
@keyframes card-in {
    from { opacity: 0; transform: translateY(12px) scale(0.985); }
    to   { opacity: 1; transform: none; }
}
.record-block, .mark-card, .lecture-card, .file-card, .engine-card, .form-modal {
    animation: card-in 0.4s var(--ease-fluid) both;
}
/* 리스트 스태거: 앞쪽 8개까지 순차 등장 */
.record-list > *:nth-child(2), .files-grid > *:nth-child(2), #lectures-list > *:nth-child(2) { animation-delay: 0.035s; }
.record-list > *:nth-child(3), .files-grid > *:nth-child(3), #lectures-list > *:nth-child(3) { animation-delay: 0.07s; }
.record-list > *:nth-child(4), .files-grid > *:nth-child(4), #lectures-list > *:nth-child(4) { animation-delay: 0.105s; }
.record-list > *:nth-child(5), .files-grid > *:nth-child(5), #lectures-list > *:nth-child(5) { animation-delay: 0.14s; }
.record-list > *:nth-child(6), .files-grid > *:nth-child(6), #lectures-list > *:nth-child(6) { animation-delay: 0.175s; }
.record-list > *:nth-child(7), .files-grid > *:nth-child(7), #lectures-list > *:nth-child(7) { animation-delay: 0.21s; }
.record-list > *:nth-child(8), .files-grid > *:nth-child(8), #lectures-list > *:nth-child(8) { animation-delay: 0.245s; }

/* ── 슬라이드 도킹 패널 (상단 고정, 전사 내용을 밀어냄) ───── */
#slide-panel {
    position: fixed;
    top: calc(6px + env(safe-area-inset-top));
    left: 10px; right: 10px;
    height: var(--sp-h, 34vh);   /* 드래그 핸들로 조절 (slides.js) */
    z-index: 150;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, rgba(28,28,44,0.92), rgba(18,18,30,0.92));
    border: 1px solid var(--border2);
    border-radius: 18px;
    box-shadow: var(--glass-shadow-lg);
    backdrop-filter: blur(24px) saturate(170%);
    -webkit-backdrop-filter: blur(24px) saturate(170%);
    overflow: hidden;
    animation: panel-in 0.35s var(--ease-spring);
}
@keyframes panel-in {
    from { opacity: 0; transform: translateY(-16px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}
/* 패널이 열리면 콘텐츠가 아래로 밀려나 전사 내용이 가려지지 않음 */
body.slides-open .tab-content {
    top: calc(6px + env(safe-area-inset-top) + var(--sp-h, 34vh) + 8px) !important;
}
/* 패널이 열린 동안 부가 UI를 숨겨 전사 블록 공간 최대화 */
body.slides-open .search-bar,
body.slides-open .select-row { display: none; }
body.slides-open .tab-header { padding-top: 8px; padding-bottom: 8px; }
body.slides-open .tab-header h2,
body.slides-open .tab-header #current-date { font-size: 15px; }
body.slides-open .record-block { padding: 7px 11px; margin-bottom: 4px; }

/* PPT 열람 중 재생창 축소: [✕][재생바][−10 ⏸ +10] 한 줄 배치.
   패널을 닫으면(body.slides-open 해제) 원래 재생창으로 복귀 */
body.slides-open .audio-player {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px 5px 8px;
    border-radius: 16px;
}
body.slides-open .player-info {
    margin: 0;
    flex-shrink: 0;
    gap: 0;
}
body.slides-open #player-time,
body.slides-open #player-title,
body.slides-open #slides-btn { display: none; }
body.slides-open .player-bar {
    flex: 1;
    margin: 0;
    min-width: 0;
}
body.slides-open .player-controls {
    margin: 0;
    gap: 2px;
    flex-shrink: 0;
}
body.slides-open .player-controls button[title="이전"],
body.slides-open .player-controls button[title="다음"],
body.slides-open #repeat-btn { display: none; }
body.slides-open #play-btn {
    width: 30px; height: 30px;
    font-size: 12px !important;
    box-shadow: 0 3px 10px rgba(58,126,236,0.35), inset 0 1px 0 rgba(255,255,255,0.35);
}
body.slides-open .player-controls button {
    padding: 4px 6px;
    font-size: 11px;
}
body.slides-open .speed-controls { display: none; }

/* 크기 조절 핸들 (패널 하단) */
.sp-resize {
    height: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ns-resize;
    touch-action: none;
}
.sp-resize::before {
    content: '';
    width: 44px; height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.22);
}
.sp-resize:active::before { background: var(--primary-soft); }
.sp-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sp-btn {
    background: none;
    border: none;
    color: var(--text2);
    font-size: 14px;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 9px;
    line-height: 1;
    transition: color 0.2s, background 0.25s, transform 0.2s var(--ease-spring);
}
.sp-btn:active { transform: scale(0.88); }
.sp-btn.active {
    color: var(--primary-soft);
    background: var(--primary-dim);
}
#sp-prev, #sp-next { font-size: 20px; padding: 2px 10px; }
.sp-page { font-size: 11.5px; font-weight: 600; color: var(--text); margin-left: 2px; }
.sp-status { font-size: 10.5px; color: var(--warn); margin-left: 6px; }
.sp-stage {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    background: rgba(0,0,0,0.25);
}
#sp-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
}
.sp-computing {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
    font-size: 13px;
    color: var(--text);
    background: rgba(10,10,18,0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.sp-computing small { color: var(--text2); font-size: 11px; }
.sp-tap {
    position: absolute;
    top: 0; bottom: 0;
    width: 25%;
    cursor: pointer;
}
.sp-tap-left { left: 0; }
.sp-tap-right { right: 0; }
@media (min-width: 768px) {
    #slide-panel { max-width: 720px; left: 50%; transform: translateX(-50%); right: auto; width: 720px; }
}

/* ── 아이패드 프로 가로 모드: 슬라이드│전사 분할 레이아웃 ─────────
   패널이 열리면 상단 도킹 대신 왼쪽 54% = 슬라이드(세로 꽉 참),
   오른쪽 46% = 전사 타임라인 + 재생창 + 탭바. 닫으면 원래 중앙 컬럼. */
@media (min-width: 1024px) and (orientation: landscape) {
    body.slides-open #slide-panel {
        top: calc(8px + env(safe-area-inset-top));
        bottom: calc(10px + env(safe-area-inset-bottom));
        left: 12px;
        right: calc(46% + 6px);
        width: auto;
        height: auto;           /* --sp-h(높이 조절) 대신 화면 전체 높이 */
        max-width: none;
        transform: none;
    }
    body.slides-open #slide-panel .sp-resize { display: none; }

    body.slides-open .tab-content {
        top: env(safe-area-inset-top) !important;
        bottom: calc(72px + env(safe-area-inset-bottom)) !important;
        left: auto !important;
        right: 6px !important;
        width: calc(46% - 12px) !important;
        max-width: none !important;
        margin: 0 !important;
        transform: none !important;
    }
    body.slides-open .bottom-nav {
        left: auto;
        right: 12px;
        width: calc(46% - 24px);
        max-width: none;
        margin: 0;
        transform: none;
    }
    body.slides-open .audio-player {
        left: auto;
        right: 12px;
        width: calc(46% - 24px);
        max-width: none;
        margin: 0;
        transform: none;
    }
    /* 가로 모드는 공간 여유가 있으므로 검색바·선택 버튼 다시 표시 */
    body.slides-open .search-bar,
    body.slides-open .select-row { display: flex; }
    body.slides-open .search-bar { display: block; }
}

/* 모션 최소화 설정 존중 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
