/* ==========================================================================
   모두매쓰 (Modoo-Math) 스타일 프리미엄 학습지 인터페이스 & 아이패드 필기 CSS
   ========================================================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --accent: #0ea5e9;

    /* 난이도 테마 */
    --basic-color: #059669;
    --basic-bg: #ecfdf5;
    --basic-border: #a7f3d0;

    --applied-color: #2563eb;
    --applied-bg: #eff6ff;
    --applied-border: #bfdbfe;

    --advanced-color: #7c3aed;
    --advanced-bg: #f5f3ff;
    --advanced-border: #ddd6fe;

    --neutral-dark: #0f172a;
    --neutral-body: #334155;
    --neutral-muted: #64748b;
    --bg-viewport: #e2e8f0; /* 용지가 돋보이는 시험지 데스크 배경 */
    --paper-bg: #ffffff;
    --border-subtle: #cbd5e1;

    --shadow-paper: 0 10px 30px -5px rgba(0, 0, 0, 0.12), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-dock: 0 20px 25px -5px rgba(0, 0, 0, 0.18), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background-color: var(--bg-viewport);
    color: var(--neutral-body);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   1. 상단 글로벌 네비게이션 바 (모두매쓰 시그니처)
   ========================================================================== */
.modoo-navbar {
    background: #1e293b;
    color: white;
    padding: 0.65rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo-badge {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #38bdf8, #2563eb);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.brand-sub-badge {
    font-size: 0.65rem;
    background: #0ea5e9;
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 700;
}

.brand-desc {
    font-size: 0.7rem;
    color: #94a3b8;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-btn {
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-gemini-ai {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.35);
}

.btn-account {
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid #cbd5e1;
}
.btn-account:hover {
    background: #e2e8f0;
}
.btn-gemini-ai:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.5);
}

.btn-regen {
    background: #3b82f6;
    color: white;
}
.btn-regen:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-ipad {
    background: #8b5cf6;
    color: white;
}
.btn-ipad:hover {
    background: #7c3aed;
    transform: translateY(-1px);
}
.btn-ipad.active {
    background: #ec4899;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
}

.btn-print-main {
    background: #0f172a;
    color: white;
    border: 1px solid #475569;
}
.btn-print-main:hover {
    background: #334155;
    transform: translateY(-1px);
}

.btn-save {
    background: #10b981;
    color: white;
}
.btn-save:hover {
    background: #059669;
}

.btn-storage {
    background: #475569;
    color: white;
}
.btn-storage:hover {
    background: #64748b;
}

/* ==========================================================================
   2. 컨트롤 제어 툴바 (모두매쓰 서브 바)
   ========================================================================== */
.modoo-toolbar-bar {
    background: #ffffff;
    border-bottom: 1px solid #cbd5e1;
    padding: 0.65rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 54px;
    z-index: 90;
}

.toolbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.tool-group-grow {
    flex: 1;
    min-width: 220px;
}

.curriculum-coming-soon {
    margin: 4rem auto;
    max-width: 560px;
    padding: 2rem;
    text-align: center;
    border: 1px dashed #94a3b8;
    border-radius: 12px;
    color: #64748b;
    background: #f8fafc;
}

.curriculum-coming-soon strong {
    display: block;
    color: #334155;
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.tool-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
}

.modoo-select {
    padding: 0.45rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    background: #ffffff;
    outline: none;
    cursor: pointer;
}

.unit-select {
    width: 100%;
}

.level-btn-group,
.col-toggle-group {
    display: flex;
    background: #f1f5f9;
    padding: 0.2rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.level-chip,
.col-chip {
    border: none;
    background: transparent;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}

.level-chip.active,
.col-chip.active {
    background: #ffffff;
    color: var(--primary);
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tool-toggles {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-left: auto;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
}

.checkbox-inline input {
    accent-color: var(--primary);
    width: 15px;
    height: 15px;
}

/* ==========================================================================
   3. 아이패드 / 태블릿 필기 툴바 (플로팅 독)
   ========================================================================== */
.ipad-drawing-dock {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    box-shadow: var(--shadow-dock);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: white;
    user-select: none;
    animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
    from { transform: translate(-50%, 30px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.dock-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #38bdf8;
    white-space: nowrap;
}

.dock-separator {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
}

.tool-btn {
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.35rem 0.65rem;
    border-radius: 16px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.tool-btn.active {
    background: #38bdf8;
    color: #0f172a;
    font-weight: 700;
}

.color-palette {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s;
}

.color-dot.active {
    border-color: white;
    transform: scale(1.2);
}

.dock-select {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    outline: none;
}

.dock-select option {
    background: #0f172a;
    color: white;
}

.dock-action-btn {
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    padding: 0.35rem 0.6rem;
    border-radius: 14px;
    font-size: 0.75rem;
    cursor: pointer;
}
.dock-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   4. 메인 뷰포트 & 실제 A4 시험지 용지
   ========================================================================== */
.page-viewport {
    flex: 1;
    padding: 1.5rem 1rem 4rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.print-sub-bar {
    width: 100%;
    max-width: 880px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.5rem;
}

.print-guide-text {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

.print-sub-right {
    display: flex;
    gap: 0.5rem;
}

.btn-sub-action {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-sub-action:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.btn-score-check {
    background: #059669;
    color: white;
    border-color: #059669;
}
.btn-score-check:hover {
    background: #047857;
}

/* 실제 A4 용지 규격 (210mm x 297mm 비율) */
.a4-sheet-wrapper {
    background: var(--paper-bg);
    width: 100%;
    max-width: 880px;
    min-height: 1180px;
    padding: 3rem 3rem 4rem 3rem;
    border-radius: 4px;
    box-shadow: var(--shadow-paper);
    position: relative;
    border: 1px solid #d1d5db;
}

.solution-sheet-wrapper {
    background: #fafaf9;
}

/* 시험지 상단 타이틀 영역 */
.worksheet-header {
    border-bottom: 2px solid #0f172a;
    padding-bottom: 1.25rem;
    margin-bottom: 2rem;
}

.worksheet-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.worksheet-brand h2 {
    font-size: 1.65rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.badge-accent {
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-solution {
    background: #fef3c7;
    color: #92400e;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

.student-info-box {
    display: flex;
    gap: 1.25rem;
    border: 1px solid #94a3b8;
    border-radius: 6px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}

.info-field {
    color: #1e293b;
    font-weight: 600;
}

.score-field {
    color: #dc2626;
    font-weight: 700;
}

.worksheet-meta-sub {
    margin-top: 0.65rem;
    display: flex;
    gap: 1.25rem;
    font-size: 0.78rem;
    color: #64748b;
}

/* ==========================================================================
   문제 리스트 및 1단/2단 그리드
   ========================================================================== */
.questions-grid.grid-col-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem 3rem;
}

.questions-grid.grid-col-1 {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.question-card {
    border-bottom: 1px dashed #cbd5e1;
    padding-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 220px;
    position: relative;
}

.q-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.q-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #0f172a;
    color: white;
    border-radius: 50%;
    font-size: 0.88rem;
    font-weight: 800;
}

.q-level-tag {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.badge-basic {
    background: var(--basic-bg);
    color: var(--basic-color);
    border: 1px solid var(--basic-border);
}

.badge-applied {
    background: var(--applied-bg);
    color: var(--applied-color);
    border: 1px solid var(--applied-border);
}

.badge-advanced {
    background: var(--advanced-bg);
    color: var(--advanced-color);
    border: 1px solid var(--advanced-border);
}

.badge-mix {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.q-unit-tag {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-left: auto;
}

.q-body {
    font-size: 1.05rem;
    color: #0f172a;
    line-height: 1.7;
    margin-bottom: 0.85rem;
}

.visual-objects {
    display: inline-block;
    font-size: 1.65rem;
    line-height: 1.8;
    letter-spacing: 0.12rem;
    word-break: break-word;
}

@media print {
    .visual-objects {
        font-size: 16pt;
        color: #000 !important;
    }
}

/* ==========================================================================
   아이패드 터치 캔버스 영역 (풀이 공간)
   ========================================================================== */
.scratchpad-box {
    margin-top: auto;
    position: relative;
    border: 1px dotted #cbd5e1;
    border-radius: 8px;
    min-height: 120px;
    background: #fafafa;
    overflow: hidden;
    touch-action: none;
}

.scratchpad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background: rgba(241, 245, 249, 0.8);
    border-bottom: 1px solid #e2e8f0;
}

.scratchpad-label {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 600;
}

.scratchpad-tools {
    display: flex;
    gap: 0.25rem;
}

.btn-scratch-tool {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}
.btn-scratch-tool:hover {
    background: #e2e8f0;
}

.scratchpad-canvas {
    display: block;
    position: absolute;
    top: 24px;
    left: 0;
    width: 100%;
    height: calc(100% - 24px);
    cursor: crosshair;
    touch-action: none;
}

body:not(.handwriting-mode-active) .scratchpad-canvas {
    pointer-events: none !important;
}

/* 화면 풀기 모드 스타일 */
.choices-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin: 0.65rem 0;
}

.choice-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.choice-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e2e8f0;
    font-size: 0.7rem;
    font-weight: 700;
}

.input-answer-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.65rem 0;
}

.ans-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
}

.input-answer {
    padding: 0.4rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 150px;
}

.q-result-feedback {
    margin-top: 0.45rem;
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
}
.q-result-feedback.correct {
    background: #ecfdf5;
    color: #065f46;
}
.q-result-feedback.incorrect {
    background: #fef2f2;
    color: #991b1b;
}

/* ==========================================================================
   해설집 스타일
   ========================================================================== */
.answer-quick-table {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.85rem;
    margin-top: 1rem;
}

.quick-table-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.quick-table-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem;
}

.quick-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 0.35rem 0.5rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.quick-item .num {
    font-weight: 700;
    color: #64748b;
}

.quick-item .ans {
    font-weight: 800;
    color: #0f172a;
}

.solutions-list {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.solution-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    background: white;
}

.sol-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.5rem;
    margin-bottom: 0.65rem;
}

.sol-number {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
}

.sol-ans-badge {
    margin-left: auto;
    background: #fee2e2;
    color: #991b1b;
    padding: 0.2rem 0.6rem;
    border-radius: 14px;
    font-size: 0.8rem;
}

.solution-steps {
    padding-left: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #334155;
}

.concept-tip-box {
    background: #fefce8;
    border: 1px solid #fef08a;
    border-radius: 6px;
    padding: 0.5rem 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: #854d0e;
    margin-top: 0.5rem;
}

/* ==========================================================================
   5. 보관함 및 재미나이 모달 창
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-card {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 580px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.modal-card-large {
    max-width: 720px;
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.modal-intro {
    font-size: 0.82rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.saved-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.saved-empty {
    text-align: center;
    color: #64748b;
    padding: 2rem;
}

.saved-error {
    color: #b91c1c;
}

.auth-modal-card {
    max-width: 760px;
}

.auth-forms {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.auth-panel {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 10px;
    padding: 1rem;
}

.auth-panel h4 {
    margin-bottom: 0.75rem;
    color: #0f172a;
}

.auth-panel label {
    display: block;
    margin-bottom: 0.65rem;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 700;
}

.auth-panel input {
    width: 100%;
    margin-top: 0.25rem;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    padding: 0.65rem 0.7rem;
    background: white;
    color: #0f172a;
    font: inherit;
}

.auth-submit,
.auth-logout {
    width: 100%;
    border: 0;
    border-radius: 7px;
    padding: 0.7rem;
    background: #2563eb;
    color: white;
    font-weight: 800;
    cursor: pointer;
}

.auth-register { background: #059669; }
.auth-logout { background: #dc2626; max-width: 200px; margin-top: 0.75rem; }
.auth-admin { border: 0; border-radius: 7px; padding: 0.7rem; background: #4f46e5; color: white; font-weight: 800; cursor: pointer; margin: 0.75rem 0.5rem 0 0; }
.account-request-panel p, .setup-admin-panel p { color: #64748b; font-size: 0.82rem; line-height: 1.6; }
.setup-admin-panel { margin-top: 1rem; border-color: #c4b5fd; background: #faf5ff; }
.admin-create-form { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.5rem; align-items: end; margin-bottom: 1rem; }
.admin-create-form h4 { grid-column: 1 / -1; }
.admin-create-form input, .admin-create-form select { min-width: 0; border: 1px solid #cbd5e1; border-radius: 7px; padding: 0.6rem; }
.admin-user-list { display: flex; flex-direction: column; gap: 0.5rem; }
.admin-user-item { display: grid; grid-template-columns: 1fr auto; gap: 0.75rem; align-items: center; border: 1px solid #e2e8f0; border-radius: 8px; padding: 0.75rem; }
.admin-user-meta strong { color: #0f172a; }
.admin-user-meta small { display: block; color: #64748b; margin-top: 0.2rem; }
.admin-user-actions { display: flex; gap: 0.4rem; }
.admin-user-actions button { border: 0; border-radius: 6px; padding: 0.4rem 0.6rem; cursor: pointer; font-size: 0.75rem; }
.btn-admin-password { background: #dbeafe; color: #1d4ed8; }
.btn-admin-delete { background: #fee2e2; color: #b91c1c; }

.auth-error {
    margin-bottom: 0.8rem;
    border: 1px solid #fecaca;
    border-radius: 7px;
    padding: 0.65rem;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.82rem;
}

.signed-in-panel {
    border: 1px solid #bbf7d0;
    border-radius: 9px;
    padding: 1rem;
    background: #f0fdf4;
}

.auth-security-note {
    margin-top: 1rem;
    color: #64748b;
    font-size: 0.72rem;
}

@media (max-width: 700px) {
    .auth-forms { grid-template-columns: 1fr; }
    .admin-create-form { grid-template-columns: 1fr; }
    .admin-user-item { grid-template-columns: 1fr; }
}

.saved-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.saved-item-info .title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1e293b;
}

.saved-item-info .date {
    font-size: 0.72rem;
    color: #94a3b8;
}

.saved-item-actions {
    display: flex;
    gap: 0.4rem;
}

.btn-open-saved {
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-del-saved {
    background: #fee2e2;
    color: #991b1b;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    cursor: pointer;
}

/* 재미나이 모달 세부 스타일 */
.gemini-step-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.gemini-step-box h4 {
    font-size: 0.92rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.gemini-meta-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge-gemini-info {
    background: #e0e7ff;
    color: #4338ca;
    padding: 0.25rem 0.65rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge-gemini-note {
    background: #fef3c7;
    color: #92400e;
    padding: 0.25rem 0.65rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.gemini-textarea {
    width: 100%;
    height: 110px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.6rem;
    font-size: 0.8rem;
    font-family: monospace;
    background: #ffffff;
    color: #334155;
    resize: vertical;
    margin-bottom: 0.65rem;
}

.gemini-btn-row {
    display: flex;
    gap: 0.65rem;
}

.btn-copy-prompt {
    flex: 1;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.55rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}
.btn-copy-prompt:hover {
    background: #4338ca;
}

.btn-launch-gemini {
    flex: 1;
    background: #0284c7;
    color: white;
    border-radius: 6px;
    padding: 0.55rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-launch-gemini:hover {
    background: #0369a1;
}

.gemini-subtext {
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 0.4rem;
}

.gemini-textarea-input {
    width: 100%;
    height: 120px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.6rem;
    font-size: 0.85rem;
    font-family: inherit;
    background: #ffffff;
    color: #0f172a;
    resize: vertical;
    margin-bottom: 0.65rem;
}

.btn-import-gemini {
    width: 100%;
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.btn-import-gemini:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45);
}

/* ==========================================================================
   A4 프린터 인쇄 스타일 (@media print)
   ========================================================================== */
@media print {
    @page {
        size: A4 portrait;
        margin: 12mm 15mm;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 11pt;
    }

    .no-print,
    .modoo-navbar,
    .modoo-toolbar-bar,
    .print-sub-bar,
    .ipad-drawing-dock,
    .modal-overlay,
    .scratchpad-header {
        display: none !important;
    }

    .page-viewport {
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }

    .a4-sheet-wrapper {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        min-height: auto !important;
    }

    .question-card {
        page-break-inside: avoid;
        border-bottom: 1px dashed #64748b !important;
    }

    .print-page-break {
        page-break-before: always !important;
    }

    body.print-only-questions #solutionSheetContainer {
        display: none !important;
    }

    body.print-only-solutions #questionSheetContainer {
        display: none !important;
    }

    .scratchpad-box {
        border: 1px dotted #94a3b8 !important;
        background: transparent !important;
    }

    .scratchpad-canvas {
        display: block !important;
    }
}
