:root {
    --bg-color: #f8f9fa;
    --panel-bg: #ffffff;
    --text-main: #212529;
    --text-muted: #6c757d;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --danger-color: #ef4444;
    --danger-hover: #dc2828;
    --border-color: #dee2e6;
    --omr-bg: #ffffff;
    --omr-text: #1e293b;
    --calc-bg: #f1f5f9;
    --calc-btn-bg: #ffffff;
    --calc-btn-hover: #e2e8f0;
    --calc-op-bg: #e0f2fe;
    --ui-radius: 4px;
    /* Layout Ratios */
    --timer-ratio: 0.2;
    --utils-ratio: 1;
    --calc-ratio: 2;
    --tools-bottom-padding: 0px;
    --tools-right-rail-button-size: 44px;
    --tools-right-rail-reserve: 58px;
    --notepad-font-size: 14px;
    --calc-surface: #f2f2f2;
    --calc-display-bg: #ece8ea;
    --calc-display-border: #cfc7cb;
    --calc-key-shadow: rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Pretendard', sans-serif;
}

/* 화면엔 안 보이지만 검색엔진 봇과 스크린 리더는 읽는 클래스 (SEO 핵심) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    width: 100vw;
    overflow: hidden; /* Prevent scrolling, strict app feel */
}

.hidden {
    display: none !important;
}

/* App Container */
.app-container {
    display: flex;
    height: 100%;
    width: 100%;
}

/* --- OMR Sidebar --- */
.omr-sidebar {
    background-color: var(--omr-bg);
    color: var(--omr-text);
    display: flex;
    transition: width 0.3s ease;
    border-right: 1px solid var(--border-color);
    z-index: 10;
}

.omr-sidebar.collapsed {
    width: 30px;
    cursor: pointer;
}

.omr-sidebar:not(.collapsed) {
    width: var(--omr-width, 320px);
    position: relative;
}

.omr-resizer {
    width: 6px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.2s;
    position: relative;
}
.omr-resizer:hover, .omr-resizer:active {
    background: var(--primary-color);
}

/* Resizer 안내 애니메이션 */
.omr-resizer.hint-active {
    width: 10px;
    background: var(--primary-color);
    animation: resizer-blink 0.6s ease-in-out 5;
    z-index: 20;
}
@keyframes resizer-blink {
    0%, 100% { background: var(--primary-color); box-shadow: none; }
    50% { background: #60a5fa; box-shadow: 0 0 14px rgba(59,130,246,0.8), 0 0 28px rgba(59,130,246,0.4); }
}

/* 리사이저 힌트 배지 */
.resizer-hint-badge {
    position: fixed;
    z-index: 100;
    background: rgba(30, 41, 59, 0.92);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid rgba(96, 165, 250, 0.6);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    animation: badge-appear 3s ease-in-out forwards;
}
.resizer-hint-badge .arrows {
    display: inline-block;
    animation: badge-arrows 0.8s ease-in-out infinite alternate;
    font-size: 14px;
}
@keyframes badge-appear {
    0% { opacity: 0; transform: translateX(10px); }
    10% { opacity: 1; transform: translateX(0); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}
@keyframes badge-arrows {
    0% { transform: translateX(-3px); }
    100% { transform: translateX(3px); }
}

.omr-toggle {
    width: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 4px;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    user-select: none;
    padding: 10px 0;
    border-radius: 4px;
}

.stats-toggle {
    width: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    background-color: #ef4444;
    color: white;
    cursor: pointer;
    user-select: none;
    padding: 10px 0;
    border-radius: 4px;
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.4);
    transition: background-color 0.2s;
}
.stats-toggle:hover { background-color: #dc2626; }

.help-toggle {
    width: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 13px;
    letter-spacing: 4px;
    background-color: #a855f7;
    color: white;
    cursor: pointer;
    user-select: none;
    padding: 10px 0;
    border-radius: 4px;
}
.help-toggle:hover { background-color: #9333ea; }

.compact-sidebar-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    gap: 6px;
    padding: 8px 0 10px;
}

.sidebar-shortcut {
    width: 34px;
    min-height: 42px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    user-select: none;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
}

.sidebar-shortcut-icon {
    font-size: 14px;
    line-height: 1;
}

.sidebar-shortcut-label {
    font-size: 8px;
    letter-spacing: 0;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
}

.sidebar-shortcut-label.compact {
    line-height: 1.15;
}

.sidebar-divider {
    width: 22px;
    border-top: 1px solid rgba(255,255,255,0.18);
    margin: 1px 0;
}

.donate-toggle {
    font-size: 16px;
    background-color: #f59e0b; /* yellow-amber for coffee */
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
}
.donate-toggle:hover {
    background-color: #d97706;
    transform: scale(1.1);
}

.settings-toggle {
    font-size: 13px;
    background-color: #475569;
    color: white;
    cursor: pointer;
    gap: 2px;
    transition: transform 0.2s;
}
.settings-toggle:hover {
    background-color: #334155;
    transform: scale(1.1);
}

.advanced-only {
    display: none !important;
}

body.advanced-mode .advanced-only {
    display: flex !important;
}

.normal-only {
    display: flex !important;
}

body.advanced-mode .normal-only {
    display: none !important;
}

.advanced-panel-only,
.advanced-action-only,
.advanced-layout-only {
    display: none !important;
}

body.advanced-mode .advanced-panel-only {
    display: block !important;
}

body.advanced-mode .advanced-action-only,
body.advanced-mode .advanced-layout-only {
    display: flex !important;
}

.advanced-calc-slot {
    visibility: hidden;
    pointer-events: none;
}

body.advanced-mode .advanced-calc-slot {
    visibility: visible;
    pointer-events: auto;
}

.advanced-toggle {
    font-size: 13px;
    background-color: #111827;
    color: white;
    cursor: pointer;
    gap: 2px;
    transition: transform 0.2s;
    box-shadow: 0 0 6px rgba(15, 23, 42, 0.35);
}

.advanced-toggle:hover {
    background-color: #1f2937;
    transform: scale(1.1);
}

.advanced-guide-toggle {
    font-size: 13px;
    background-color: #1d4ed8;
    color: white;
    cursor: pointer;
    gap: 2px;
    transition: transform 0.2s;
}

.advanced-guide-toggle:hover {
    background-color: #1e40af;
    transform: scale(1.1);
}

.popup-toggle {
    font-size: 13px;
    background-color: #0f766e;
    color: white;
    cursor: pointer;
    gap: 2px;
    transition: transform 0.2s;
}
.popup-toggle:hover {
    background-color: #115e59;
    transform: scale(1.1);
}

.extension-toggle {
    width: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    background-color: #10b981;
    color: white;
    cursor: pointer;
    user-select: none;
    padding: 8px 0;
    border-radius: 4px;
    gap: 2px;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}
.extension-toggle:hover {
    background-color: #059669;
    transform: scale(1.1);
}

.omr-toggle:hover { background-color: var(--primary-hover); }

.omr-sidebar:not(.collapsed) .sidebar-controls {
    display: none !important; /* Hide toggle bars when open */
}

.omr-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 5px;
    height: 100%;
    overflow: hidden;
    position: relative; /* For break overlay */
}

.omr-break-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.85);
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
    text-align: center;
}
.omr-break-overlay.hidden {
    display: none !important;
}

.omr-content.hidden {
    display: none;
}

.omr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

/* 상단 바 (탭접기 + 모드 표시) */
.omr-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    margin-bottom: 4px;
}

.omr-mode-label {
    font-size: 11px;
    color: #93c5fd;
    font-weight: bold;
}

.omr-mode-hint {
    margin-bottom: 4px;
    padding: 5px 7px;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(147, 197, 253, 0.25);
    color: #cbd5e1;
    font-size: 10px;
    line-height: 1.45;
}

.omr-collapse-btn {
    font-size: 11px;
    font-weight: bold;
    padding: 4px 10px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: linear-gradient(135deg, #475569, #334155);
    color: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.omr-collapse-btn:hover {
    background: linear-gradient(135deg, #64748b, #475569);
    border-color: rgba(255,255,255,0.5);
}

.omr-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 3px;
    font-size: 12px;
    max-height: 40vh;
}

/* Custom scrollbar for OMR */
.omr-body::-webkit-scrollbar { width: 6px; }
.omr-body::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }

/* 하단 세로 액션 버튼 영역 */
.omr-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.15);
    overflow-y: auto;
    flex-shrink: 0;
}

.omr-action-btn {
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: var(--ui-radius);
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    color: white;
    text-align: center;
    transition: all 0.15s;
}
.omr-action-btn:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}

.skip-btn { background: #ef4444; }
.skip-btn:hover { background: #dc2626; }

.timer-skip-btn {
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 6px;
    background: #6d28d9;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    height: 30px;
    min-width: 36px;
    padding: 0 6px;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.01em;
    box-shadow: inset 0 -1px 0 rgba(255,255,255,0.08);
}

.timer-skip-btn:hover {
    filter: brightness(1.08);
}

.advanced-timer-shell {
    margin-left: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(180deg, #0f172a 0%, #111c2f 100%);
    border: 1px solid #334155;
    padding: 5px 8px 5px 10px;
    border-radius: 9px;
    min-width: 0;
    max-width: calc(100% - 86px);
    width: auto;
    flex: 0 1 auto;
    justify-content: flex-start;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.28);
}

.timer-summary-block {
    display: flex;
    flex-direction: column;
}

.timer-total-block {
    align-items: flex-start;
    min-width: 82px;
}

.timer-phase-block {
    align-items: flex-start;
    min-width: 96px;
}

.timer-summary-label {
    font-size: 9px;
    color: #94a3b8;
    margin-bottom: 1px;
}

.timer-summary-value {
    color: #f8fafc;
    font-weight: 700;
    font-family: 'Consolas', monospace;
    line-height: 1;
}

.timer-summary-value.total {
    font-size: 15px;
}

.timer-summary-value.phase {
    font-size: 19px;
    color: #4ade80;
}

.timer-divider {
    width: 1px;
    height: 24px;
    background: #334155;
}

.timer-phase-name {
    color: #60a5fa;
    font-size: 10px;
    font-weight: 700;
    margin-bottom: 1px;
}

.timer-phase-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.timer-guide-row {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 700;
    margin-top: 4px;
}

.timer-guide-value {
    color: #38bdf8;
    font-family: 'Consolas', monospace;
}

.advanced-timer-controls {
    display: grid;
    grid-template-columns: repeat(4, 36px);
    gap: 4px;
    align-items: center;
    margin-left: 0;
}

.timer-play-btn {
    width: 36px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: inset 0 -1px 0 rgba(255,255,255,0.12);
}

.timer-play-btn:hover {
    background: #1d4ed8;
}

.timer-next-btn {
    background: #6d28d9;
}

.timer-next-btn:hover {
    background: #5b21b6;
}

.timer-reset-btn {
    background: #0f766e;
}

.timer-reset-btn:hover {
    background: #0f8b82;
}

.timer-full-reset-btn {
    background: #c2410c;
}

.timer-full-reset-btn:hover {
    background: #9a3412;
}

.timer-skip-btn:disabled {
    background: #334155;
    color: #e2e8f0;
    cursor: not-allowed;
    box-shadow: none;
    border-color: #475569;
    opacity: 0.95;
}

body.advanced-mode .top-bar {
    justify-content: flex-start;
    gap: 6px;
    padding: 0 6px 0 8px;
}

body.advanced-mode .popup-btn {
    padding: 5px 8px;
    font-size: 10px;
    border-radius: 6px;
}

@media (max-width: 1180px) {
    .advanced-timer-shell {
        max-width: calc(100% - 72px);
        gap: 6px;
        padding-right: 6px;
    }

    .advanced-timer-controls {
        grid-template-columns: repeat(4, 32px);
        gap: 4px;
    }

    .timer-skip-btn,
    .timer-play-btn {
        min-width: 32px;
        width: 32px;
        height: 28px;
        padding: 0;
        font-size: 8px;
    }

    .timer-total-block {
        min-width: 74px;
    }

    .timer-phase-block {
        min-width: 86px;
    }
}

.mode-btn { background: #f59e0b; }
.mode-btn:hover { background: #d97706; }
.mode-btn.active-score { background: #22c55e; }
.mode-btn.active-score:hover { background: #16a34a; }

.grade-btn { background: var(--primary-color); }
.grade-btn:hover { background: var(--primary-hover); }

.detail-btn { background: #a855f7; }
.detail-btn:hover { background: #9333ea; }

.reset-action-btn { background: #64748b; }
.reset-action-btn:hover { background: #475569; }

/* OMR specific styling */
.subject-group {
    background: rgba(0,0,0,0.03);
    padding: 2px;
    margin-bottom: 6px;
    border-radius: var(--ui-radius);
}
.subject-title {
    font-weight: bold;
    margin-bottom: 2px;
    color: #3b82f6;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 1px;
    font-size: 11px;
}
.q-row {
    display: flex;
    align-items: center;
    margin-bottom: 1px;
    padding: 1px 0;
    gap: 0;
    transition: background 0.2s;
}
.q-row.current-q {
    background: rgba(59, 130, 246, 0.2);
    border-radius: var(--ui-radius);
}
.q-row.past-q {
    opacity: 0.6;
}
/* 실전 모드: 시간 종료된 과목 */
.subject-group.subject-locked {
    opacity: 0.5;
    position: relative;
}
.subject-group.subject-locked .subject-title {
    color: #94a3b8;
}
.lock-badge {
    font-size: 10px;
    color: #ef4444;
    font-weight: 600;
    margin-left: 4px;
}
.q-row.locked-q {
    opacity: 0.4;
    pointer-events: none;
}
.q-num {
    width: 18px;
    flex: 0 0 18px;
    text-align: left;
    margin-right: 0;
    font-weight: 600;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}
.q-options {
    display: flex;
    align-items: center;
    gap: 1px;
    min-width: 0;
}
.q-opt {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    font-size: 9px;
    border-radius: 50%;
    border: 1px solid #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
    transition: all 0.1s;
    color: var(--omr-text);
}
.q-opt:hover:not(:disabled) { background: rgba(0,0,0,0.05); }
.q-opt.selected { background: var(--primary-color); border-color: var(--primary-color); color: white; }
.q-opt:disabled { cursor: not-allowed; opacity: 0.5; border-color: #cbd5e1; }
/* Score mode visualization */
.q-row.status-correct { background: rgba(34, 197, 94, 0.15); border-radius: var(--ui-radius); }
.q-row.status-wrong { background: rgba(239, 68, 68, 0.1); border-radius: var(--ui-radius); border-left: 3px solid #ef4444; }
.q-row.status-missed { background: rgba(148, 163, 184, 0.15); border-radius: var(--ui-radius); border-left: 3px solid #94a3b8; opacity: 0.8; }

.q-opt.correct { background: #16a34a !important; border-color: #16a34a !important; color: white !important; box-shadow: 0 0 6px rgba(22, 163, 74, 0.5); font-weight: bold; }
.q-opt.wrong { background: #dc2626 !important; border-color: #dc2626 !important; color: white !important; box-shadow: 0 0 6px rgba(220, 38, 38, 0.5); font-weight: bold; }

/* Skip Button */
.q-skip-btn {
    font-size: 9px;
    padding: 1px 4px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    margin-left: auto;
}
.q-skip-btn:hover {
    background: #e2e8f0;
    color: #334155;
    border-color: #94a3b8;
}

.score-result {
    padding: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--ui-radius);
    font-size: 12px;
    color: var(--omr-text);
}
.stat-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
.stat-line:last-child {
    margin-bottom: 0;
    padding-top: 4px;
    border-top: 1px dashed rgba(0, 0, 0, 0.2);
    color: #10b981;
    font-weight: bold;
}

.bulk-import-modal {
    max-width: 760px;
    max-height: 88vh;
}

.bulk-import-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bulk-import-note {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #dbeafe;
    background: #f8fbff;
    color: #334155;
    font-size: 12px;
    line-height: 1.65;
}

.bulk-import-textarea {
    width: 100%;
    min-height: 180px;
    resize: vertical;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    font-size: 12px;
    line-height: 1.6;
    font-family: Consolas, 'Courier New', monospace;
    color: #0f172a;
    background: #fff;
}

.bulk-import-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bulk-import-btn {
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.bulk-import-btn.primary {
    background: #2563eb;
    color: #fff;
}

.bulk-import-btn.success {
    background: #059669;
    color: #fff;
    margin-left: auto;
}

.bulk-import-btn:disabled {
    background: #94a3b8;
    color: rgba(255,255,255,0.85);
    cursor: not-allowed;
}

.bulk-import-summary {
    flex: 1;
    min-width: 180px;
    font-size: 12px;
    color: #475569;
}

.bulk-import-select-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.bulk-import-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: #334155;
    font-weight: 600;
}

.bulk-import-field select {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 12px;
    color: #0f172a;
    background: #fff;
}

.bulk-import-preview {
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #f8fbff;
    padding: 12px;
    font-size: 12px;
    color: #334155;
    line-height: 1.6;
    max-height: 250px;
    overflow: auto;
}

.bulk-import-preview table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-top: 8px;
}

.bulk-import-preview th,
.bulk-import-preview td {
    border: 1px solid #bfdbfe;
    padding: 6px 8px;
    text-align: center;
}

.bulk-import-preview th {
    background: #e0ecff;
    color: #1d4ed8;
}

.bulk-import-status {
    flex: 1;
    min-width: 180px;
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
}

/* Layout Settings in OMR */
.layout-settings {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0,0,0,0.2);
    font-size: 11px;
    color: var(--omr-text);
}
.settings-title {
    font-weight: bold;
    margin-bottom: 4px;
    color: #3b82f6;
    text-align: center;
}
.settings-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
    align-items: center;
}
.settings-row input {
    width: 40px;
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.2);
    color: var(--omr-text);
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 11px;
    text-align: center;
}
.settings-row input:focus { outline: 1px solid var(--primary-color); }

/* --- Main Layout --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 100px; /* 극단적 축소를 위해 최소폭 제한 하향 */
    overflow-x: hidden; /* 우측 잘림 방지용 숨김 처리 보조 */
}

/* Top Bar */
.top-bar {
    background-color: var(--panel-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    flex: var(--timer-ratio) 1 0;
    min-height: 0;
    overflow: hidden;
}

.layout-resizer {
    flex: 0 0 8px;
    background: transparent;
    transition: background 0.2s, box-shadow 0.2s;
}

.layout-resizer.horizontal {
    width: 100%;
    cursor: row-resize;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.7);
}

.layout-resizer.horizontal:hover,
.layout-resizer.horizontal:active,
body.popup-editor-mode .layout-resizer.horizontal.active {
    background: rgba(59, 130, 246, 0.18);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.timer-display {
    width: 60px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    background: transparent;
    color: var(--primary-color);
    outline: none;
    text-align: center;
}

.timer-display:not([readonly]) {
    border-bottom: 1px solid var(--primary-color);
}

.timer-controls button, .global-controls button {
    background: #e2e8f0;
    border: none;
    padding: 4px 8px;
    border-radius: var(--ui-radius);
    cursor: pointer;
    font-size: 12px;
}
.timer-controls button:hover { background: #cbd5e1; }

.popup-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: var(--ui-radius);
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}
.popup-btn:hover { background: #059669; }

.danger-btn { background: var(--danger-color) !important; color: white !important; }
.danger-btn:hover { background: var(--danger-hover) !important; }

/* Tools Layout (Notepad + Calc) */
.tools-layout {
    flex: calc(var(--utils-ratio) + var(--calc-ratio)) 1 0;
    display: flex;
    flex-direction: column;
    padding: 0 var(--tools-right-rail-reserve, 58px) var(--tools-bottom-padding, 0px) 0;
    min-height: 0;
}

/* Utility Section (Notepad/Canvas) */
.utility-section {
    flex: var(--utils-ratio) 1 0;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--panel-bg);
    min-height: 0;
    overflow: hidden;
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 7px;
    padding: 6px 10px 5px;
    background: linear-gradient(180deg, #dfe1e5 0%, #ececef 100%);
    border-bottom: 1px solid var(--border-color);
}

.tool-tabs {
    display: flex;
    gap: 12px;
    align-items: center;
}

.tab-btn {
    padding: 0 0 4px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    cursor: pointer;
    font-weight: 700;
    color: #656971;
    font-size: 12px;
    line-height: 1;
    letter-spacing: -0.01em;
}
.tab-btn.active {
    color: #2e3138;
    border-bottom-color: #2e3138;
}

.tool-delete-btn {
    padding: 5px 11px;
    border: 1px solid #cfd2d6;
    border-radius: 4px;
    background: linear-gradient(180deg, #ffffff 0%, #f3f4f6 100%);
    color: #4b5563;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
}

.tool-delete-btn:hover {
    background: linear-gradient(180deg, #ffffff 0%, #eceff3 100%);
}

.tool-body {
    flex: 1;
    position: relative;
    min-height: 0;
}

.tool-wrapper {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
.tool-wrapper.hidden {
    display: none;
}

#notepad {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    padding: 14px 16px;
    font-size: var(--notepad-font-size, 14px);
    line-height: 1.5;
    outline: none;
    background: var(--panel-bg);
    color: var(--text-main);
}

#canvasWrapper {
    background: var(--panel-bg);
    cursor: crosshair;
}
#drawingBoard {
    display: block;
}

/* Calculator Section */
.calculator-section {
    flex: var(--calc-ratio) 1 0;
    background-color: var(--calc-surface);
    display: flex;
    flex-direction: column;
    padding: 10px 10px 0;
    min-height: 0;
    overflow: hidden;
}

.section-panel-label {
    font-size: 14px;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.calc-display-shell {
    min-height: 0;
    flex: 0 0 auto;
    height: clamp(84px, 17vh, 104px);
    max-height: clamp(84px, 17vh, 104px);
    padding: 8px 10px;
    border: 1px solid var(--calc-display-border);
    border-radius: 10px;
    background: linear-gradient(180deg, #f7f3f5 0%, var(--calc-display-bg) 100%);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.75);
    margin-bottom: 6px;
    overflow: hidden;
}

.calc-history {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    gap: 2px;
    text-align: right;
    color: #2f2a2d;
    font-family: Consolas, monospace;
    overflow: hidden;
}

.calc-history::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.calc-line {
    width: 100%;
    line-height: 1;
    text-align: right;
}

.calc-line.history-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    font-size: clamp(8px, 2.2vw, 11px);
    color: #807279;
}

.calc-line.current-line {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-all;
    font-size: clamp(15px, 5vw, 26px);
    font-weight: 700;
    color: #1f1a1d;
}

.calc-line.history-line.calc-line-compact {
    font-size: clamp(7px, 2vw, 10px);
    letter-spacing: -0.02em;
}

.calc-line.current-line.calc-line-compact {
    font-size: clamp(13px, 4.3vw, 21px);
    letter-spacing: -0.02em;
}

.calc-line.history-line.calc-line-tight {
    font-size: clamp(6px, 1.8vw, 9px);
    letter-spacing: -0.04em;
}

.calc-line.current-line.calc-line-tight {
    font-size: clamp(11px, 3.7vw, 17px);
    letter-spacing: -0.04em;
}

.calc-keys {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, minmax(0, 1fr));
    gap: clamp(3px, 1vw, 6px);
    padding-bottom: clamp(2px, 1.2vw, 6px);
    min-height: 0;
}

.calc-btn {
    border: 1px solid #d3c9ce;
    border-radius: clamp(5px, 2vw, 9px);
    background: linear-gradient(180deg, #ffffff 0%, #f3eff1 100%);
    font-size: clamp(9px, 3.7vw, 17px);
    line-height: 1;
    padding: 0;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s, transform 0.12s;
    color: #2b2327;
    font-weight: 700;
    box-shadow: 0 2px 5px var(--calc-key-shadow);
}

.calc-btn:hover { background: linear-gradient(180deg, #fffefe 0%, #ece6e9 100%); }
.calc-btn:active { transform: translateY(1px); }

.op-btn { background: linear-gradient(180deg, #fef4f4 0%, #f8dde0 100%); color: #b4232c; }
.op-btn:hover { background: linear-gradient(180deg, #fce9eb 0%, #f5d3d8 100%); }

.fn-btn { background: linear-gradient(180deg, #f3f4f6 0%, #e4e7eb 100%); color: #475569; }
.fn-btn:hover { background: linear-gradient(180deg, #eceef2 0%, #d9dde3 100%); }

.sqrt-btn {
    background: linear-gradient(180deg, #fef4f4 0%, #f8dde0 100%);
    color: #b4232c;
}
.sqrt-btn:hover { background: linear-gradient(180deg, #fce9eb 0%, #f5d3d8 100%); }

.equal-btn { background: linear-gradient(180deg, #d74d56 0%, #bc3941 100%); color: white; border-color: #bc3941; }
.equal-btn:hover { background: linear-gradient(180deg, #df5b64 0%, #c74149 100%); }

.grid-row-span { grid-row: span 2; }

.skct-floating-btn {
    position: absolute;
    right: max(4px, calc((var(--tools-right-rail-reserve, 58px) - var(--tools-right-rail-button-size, 44px)) / 2));
    width: var(--tools-right-rail-button-size, 44px);
    height: var(--tools-right-rail-button-size, 44px);
    border: none;
    border-radius: clamp(8px, 2vw, 12px);
    background: #171717;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    cursor: pointer;
    z-index: 20;
}

.skct-floating-btn.chat-btn {
    top: 12px;
}

.skct-floating-btn.question-btn {
    bottom: calc(var(--tools-bottom-padding, 0px) + 14px);
    font-size: clamp(12px, calc(var(--tools-right-rail-button-size, 44px) * 0.55), 24px);
    font-weight: 700;
}

.settings-slider-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-slider-label {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.settings-slider-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid #d8dde6;
    border-radius: 8px;
    background: #ffffff;
}

.settings-slider-control input[type="range"] {
    flex: 1;
    accent-color: #d84f58;
}

.settings-slider-control strong {
    min-width: 24px;
    text-align: right;
    color: #1f2937;
    font-size: 12px;
}

.chat-bubble-icon {
    position: relative;
    width: clamp(10px, calc(var(--tools-right-rail-button-size, 44px) * 0.5), 22px);
    height: clamp(8px, calc(var(--tools-right-rail-button-size, 44px) * 0.36), 16px);
    border: 2px solid #ffffff;
    border-radius: 8px;
}

.chat-bubble-icon::before {
    content: "";
    position: absolute;
    left: 4px;
    bottom: -5px;
    width: 8px;
    height: 8px;
    border-left: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    transform: rotate(-25deg);
    background: transparent;
}

.chat-bubble-icon::after {
    content: "···";
    position: absolute;
    inset: -2px 0 0 0;
    text-align: center;
    font-size: clamp(7px, calc(var(--tools-right-rail-button-size, 44px) * 0.27), 12px);
    letter-spacing: 1px;
}

.popup-editor-panel {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1200;
    width: min(340px, calc(100vw - 28px));
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(12px);
}

.popup-editor-panel.collapsed {
    width: auto;
    max-width: calc(100vw - 28px);
    padding: 10px 12px;
}

.popup-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.popup-editor-title {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
}

.popup-editor-toggle-btn {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.popup-editor-toggle-btn:hover {
    background: #f8fafc;
}

.popup-editor-content {
    margin-top: 8px;
}

.popup-editor-panel.collapsed .popup-editor-content {
    display: none;
}

.popup-editor-desc {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.55;
    color: #475569;
}

.popup-editor-field {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #334155;
}

.popup-editor-field span {
    flex: 0 0 auto;
    font-weight: 700;
}

.popup-editor-field input[type="range"] {
    flex: 1;
    accent-color: #2563eb;
}

.popup-editor-field strong {
    min-width: 44px;
    text-align: right;
}

.popup-editor-metrics {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    line-height: 1.55;
    color: #334155;
}

.popup-editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.popup-editor-btn {
    flex: 1;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.popup-editor-btn.ghost {
    background: #ffffff;
    color: #334155;
}

.popup-editor-btn.primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.popup-editor-status {
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.5;
    color: #64748b;
}

.popup-editor-status.error {
    color: #b91c1c;
}

.popup-editor-status.success {
    color: #047857;
}

/* Responsive Adjustments for Extreme Scaling */
.top-bar { font-size: 12px; }
.timer-display { width: 50px; font-size: 16px; }

/* Modal Overlays */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-overlay.hidden { display: none; }
.modal-content {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    color: var(--text-main);
    box-sizing: border-box;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}
.modal-body {
    overflow-y: auto;
    flex: 1;
    padding-right: 2px;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    flex-shrink: 0;
}
.modal-header h3 { margin: 0; color: #1e293b; font-size: 16px; }
.btn-close {
    background: transparent;
    border: none;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    color: #64748b;
}

/* Help Modal - Sticky Header */
.help-modal-content {
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}
.help-modal-header {
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 10;
    padding: 16px 20px;
    margin-bottom: 0;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.help-modal-body {
    overflow-y: auto;
    padding: 20px;
    flex: 1;
}

/* ============================================================
   COMMUNITY SYSTEM STYLES
   ============================================================ */

/* Sidebar Toggle Button */
.comment-toggle {
    width: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    background-color: #6366f1;
    color: white;
    cursor: pointer;
    user-select: none;
    padding: 10px 0;
    border-radius: 4px;
    gap: 2px;
    transition: background-color 0.2s, transform 0.2s;
}
.comment-toggle:hover {
    background-color: #4f46e5;
    transform: scale(1.1);
}

/* Community Modal */
#cmModal .modal-content {
    max-width: 600px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

/* Notice inside community modal */
.cm-notice {
    padding: 10px 14px;
    border-radius: 6px;
    margin: 10px 14px 0;
    font-size: 13px;
}

.cm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px 10px;
    border-bottom: 1px solid #e2e8f0;
}
.cm-header h3 { margin: 0; font-size: 16px; color: #1e293b; cursor: default; }
.cm-header .btn-close { font-size: 22px; }

.cm-auth-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    flex-wrap: wrap;
}
.cm-auth-nick { font-weight: bold; color: #1e293b; }
.cm-auth-code { color: #6366f1; font-family: 'Consolas', monospace; font-size: 11px; background: #eef2ff; padding: 2px 6px; border-radius: 4px; cursor: pointer; }
.cm-admin-badge { background: #fef3c7; color: #92400e; padding: 2px 6px; border-radius: 4px; font-weight: bold; font-size: 10px; }
.cm-logout-btn, .cm-login-btn {
    padding: 3px 10px; border: 1px solid #cbd5e1; background: white; border-radius: 4px;
    cursor: pointer; font-size: 11px; font-weight: 600; color: #475569; transition: background 0.2s;
}
.cm-logout-btn:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.cm-login-btn:hover { background: #eef2ff; color: #4f46e5; border-color: #a5b4fc; }

/* Tabs */
.cm-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.cm-tab {
    padding: 6px 14px;
    border: 1px solid transparent;
    border-radius: 20px;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.cm-tab:hover { color: #1e293b; background: #f1f5f9; border-color: #e2e8f0; }
.cm-tab.active { color: white; background: linear-gradient(135deg, #6366f1, #8b5cf6); border-color: transparent; box-shadow: 0 2px 6px rgba(99,102,241,0.3); }

/* Write Form */
.cm-write {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    background: #fafbfc;
}
.cm-write textarea {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    resize: none;
    font-family: 'Pretendard', sans-serif;
    outline: none;
    min-height: 40px;
    max-height: 100px;
    transition: border-color 0.2s;
}
.cm-write textarea:focus { border-color: #6366f1; }
.cm-write button {
    padding: 8px 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.1s, box-shadow 0.2s;
}
.cm-write button:hover { transform: scale(1.03); box-shadow: 0 2px 8px rgba(99,102,241,0.3); }

/* Post List */
.cm-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
}
.cm-list::-webkit-scrollbar { width: 5px; }
.cm-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.cm-empty {
    text-align: center;
    padding: 40px 10px;
    color: #94a3b8;
}
.cm-empty span { font-size: 32px; display: block; margin-bottom: 10px; }

/* Post Card */
.cm-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    transition: box-shadow 0.2s;
}
.cm-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.cm-card.pinned { border-color: #a5b4fc; background: #fafbff; }

.cm-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.cm-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cm-nick { font-weight: 700; color: #1e293b; font-size: 13px; }
.cm-time { color: #94a3b8; font-size: 11px; }

.cm-badge {
    font-size: 10px; padding: 1px 6px; border-radius: 4px; font-weight: 600;
}
.cm-badge.pin { background: #eef2ff; color: #4f46e5; }
.cm-badge.cat { background: #f0fdf4; color: #16a34a; }
.cm-badge.edit { color: #94a3b8; font-weight: normal; }

.cm-body { font-size: 13px; line-height: 1.6; color: #334155; margin-bottom: 8px; word-break: break-word; }

.cm-foot { display: flex; justify-content: space-between; align-items: center; }
.cm-stats { display: flex; gap: 8px; }
.cm-stats button {
    background: none; border: 1px solid #e2e8f0; border-radius: 20px;
    padding: 3px 10px; font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 4px;
    transition: all 0.2s; color: #64748b;
}
.cm-stats button:hover { background: #f8fafc; border-color: #cbd5e1; }
.cm-like.liked { border-color: #fca5a5; background: #fff1f2; color: #e11d48; }

.cm-author-acts { display: flex; gap: 4px; }
.cm-act-btn {
    background: none; border: none; font-size: 11px; cursor: pointer; color: #94a3b8;
    padding: 2px 6px; border-radius: 4px; transition: all 0.15s;
}
.cm-act-btn:hover { background: #f1f5f9; color: #475569; }
.cm-act-btn.cm-del:hover { background: #fef2f2; color: #dc2626; }

.cm-admin-acts {
    display: flex; gap: 3px;
}
.cm-admin-acts button {
    background: #fef3c7; border: 1px solid #fcd34d; border-radius: 4px;
    font-size: 10px; padding: 2px 6px; cursor: pointer; font-weight: 600;
    transition: background 0.15s;
}
.cm-admin-acts button:hover { background: #fde68a; }

/* Replies */
.cm-replies { padding: 8px 0 0 12px; border-top: 1px dashed #e2e8f0; margin-top: 8px; }
.cm-replies.hidden { display: none; }

.cm-reply {
    background: #f8fafc; border-radius: 6px; padding: 8px 10px; margin-bottom: 6px;
    border-left: 3px solid #e2e8f0;
}
.cm-reply.admin { border-left-color: #f59e0b; background: #fffbeb; }
.cm-reply.pinned { border-left-color: #6366f1; }

.cm-reply-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
.cm-reply-body { font-size: 12px; color: #475569; line-height: 1.5; word-break: break-word; }
.cm-reply-acts { margin-top: 4px; }
.cm-reply-acts button {
    background: none; border: none; font-size: 10px; cursor: pointer; color: #94a3b8; padding: 1px 4px;
}
.cm-reply-acts button:hover { color: #475569; }

.cm-reply-form { display: flex; gap: 6px; margin-top: 8px; }
.cm-reply-form textarea {
    flex: 1; border: 1px solid #cbd5e1; border-radius: 6px; padding: 6px 8px;
    font-size: 12px; resize: none; font-family: 'Pretendard', sans-serif; outline: none;
}
.cm-reply-form textarea:focus { border-color: #6366f1; }
.cm-reply-submit {
    padding: 6px 12px; background: #6366f1; color: white; border: none; border-radius: 6px;
    font-size: 11px; font-weight: bold; cursor: pointer; white-space: nowrap;
}
.cm-reply-submit:hover { background: #4f46e5; }

/* Reply form top row (nickname + password) */
.cm-reply-form-top {
    display: flex; gap: 6px; margin-bottom: 6px;
}
.cm-reply-form-top input {
    flex: 1; padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 11px; outline: none;
}
.cm-reply-form-top input:focus { border-color: #6366f1; }
.cm-reply-form-bot { display: flex; gap: 6px; }


/* Edit */
.cm-edit-ta {
    width: 100%; min-height: 60px; border: 1px solid #6366f1; border-radius: 6px;
    padding: 8px; font-size: 13px; font-family: 'Pretendard', sans-serif; resize: vertical; outline: none;
}
.cm-edit-acts { display: flex; gap: 6px; margin-top: 6px; }
.cm-edit-acts button {
    padding: 4px 12px; border: none; border-radius: 4px; font-size: 12px; font-weight: bold; cursor: pointer;
}
.cm-edit-save { background: #6366f1; color: white; }
.cm-edit-cancel { background: #e2e8f0; color: #475569; }

.cm-loading { text-align: center; padding: 20px; color: #94a3b8; font-size: 13px; }

/* ============================================================
   AUTH MODAL STYLES
   ============================================================ */
#cmAuthModal .modal-content { max-width: 380px; }

.cm-auth-tabs { display: flex; border-bottom: 2px solid #e2e8f0; }
.cm-auth-tab {
    flex: 1; padding: 10px; border: none; background: transparent; cursor: pointer;
    font-size: 13px; font-weight: 600; color: #94a3b8;
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s;
}
.cm-auth-tab.active { color: #4f46e5; border-bottom-color: #4f46e5; }

.cm-auth-form { padding: 16px; }
.cm-auth-form label { display: block; font-size: 12px; color: #475569; font-weight: 600; margin-bottom: 4px; margin-top: 10px; }
.cm-auth-form input {
    width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 13px; outline: none; transition: border-color 0.2s;
}
.cm-auth-form input:focus { border-color: #6366f1; }
.cm-auth-submit {
    width: 100%; margin-top: 16px; padding: 10px; background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white; border: none; border-radius: 6px; font-weight: bold; font-size: 14px; cursor: pointer;
}
.cm-auth-submit:hover { box-shadow: 0 2px 10px rgba(99,102,241,0.3); }

.cm-auth-success { text-align: center; padding: 20px; }
.cm-auth-ok-title { font-size: 18px; font-weight: bold; color: #16a34a; margin-bottom: 12px; }
.cm-auth-ok-code {
    font-size: 28px; font-weight: 900; color: #4f46e5; font-family: 'Consolas', monospace;
    background: #eef2ff; padding: 12px 20px; border-radius: 8px; display: inline-block;
    margin-bottom: 12px; letter-spacing: 2px; border: 2px dashed #a5b4fc;
}
.cm-auth-success p { font-size: 13px; color: #64748b; line-height: 1.5; }
.cm-auth-ok-btn {
    margin-top: 16px; padding: 10px 30px; background: #6366f1; color: white;
    border: none; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 14px;
}

/* Pulse animation for stats dot (reused) */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
