﻿/* 되받쓰 규칙 사전 — 함정 돌파 비법 카드 디자인 v3.2 (컴팩트 전체화면 닫기 아이콘 적용) */
@import url('../vendor/fonts.css');

/* ══════════════════════════════════════
   RESET & BASE
══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --forest:    #142814;
    --forest-mid:#1E3D1E;
    --leaf:      #4CAA48;
    --leaf-deep: #2D7A29;
    --lemon:     #FFE135;
    --amber:     #F5C800;
    --trap-red:  #E53935;
    --safe-teal: #00897B;
    --card-bg:   #FFFFFF;
    --page-bg:   #F2F1EE;
    --ink:       #1A1A1A;
    --slate:     #6F6E69;
    --hairline:  #E8E7E4;
    --r: 16px;
}

html { scroll-behavior: smooth; }

body {
    font-family: "Pretendard Variable", Pretendard, -apple-system, sans-serif;
    letter-spacing: -0.01em;
    background: var(--page-bg);
    color: var(--ink);
    line-height: 1.7;
    padding-top: 60px;
    min-height: 100vh;
    min-height: 100dvh;   /* C6: 모바일 주소창 보정 (vh 는 폴백으로 남긴다) */
    overflow-x: hidden;
}

/* ══════════════════════════════════════
   NAV HEADER (Mobile & Normal PC)
══════════════════════════════════════ */
.header-fixed {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: var(--forest);
    height: 60px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.nav-container { display: flex; align-items: center; gap: 8px; }
.nav-link {
    display: flex; align-items: center; justify-content: center;
    padding: 7px 13px; border-radius: 8px;
    font-weight: 500; font-size: 0.9rem;
    color: rgba(255,255,255,0.80); text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-link.active { color: var(--lemon); font-weight: 700; }

/* ══════════════════════════════════════
   PAGE WRAPPER (Mobile First)
══════════════════════════════════════ */
.rule-page-wrap {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 12px 20px;
}

/* ══════════════════════════════════════
   PAGE HERO — Rule Title Block
══════════════════════════════════════ */
.rule-hero {
    background: linear-gradient(135deg, var(--forest) 0%, var(--forest-mid) 100%);
    border-radius: var(--r);
    padding: 20px 24px 16px;
    margin: 10px 0 0;
    position: relative;
    overflow: hidden;
}
.rule-hero::before {
    content: '';
    position: absolute; top: -30px; right: -20px;
    width: 140px; height: 140px;
    background: radial-gradient(circle, rgba(255,225,53,0.18) 0%, transparent 70%);
    pointer-events: none;
}
.rule-hero-meta {
    display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap;
    padding-right: 130px;
}
.rule-chip {
    display: inline-flex; align-items: center;
    background: var(--amber); color: var(--ink);
    font-size: 0.72rem; font-weight: 800;
    padding: 3px 10px; border-radius: 99px;
    letter-spacing: 0.04em;
}
.stage-chip {
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.85);
    font-size: 0.72rem; font-weight: 600;
    padding: 3px 10px; border-radius: 99px;
    letter-spacing: 0.02em;
}
.rule-hero h1 {
    font-size: clamp(1.3rem, 4vw, 1.7rem);
    font-weight: 800; color: #fff;
    line-height: 1.2; margin-bottom: 2px;
}
.rule-hero .rule-sub {
    font-size: 0.82rem; color: rgba(255,255,255,0.7); font-weight: 500;
}
.trap-icon {
    font-size: 2.5rem;
    position: absolute; bottom: 10px; right: 16px;
    opacity: 0.4;
}

/* Fullscreen Toggle Button */
.fullscreen-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.18); color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 12px; border-radius: 20px;
    font-size: 0.78rem; font-weight: 700; cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    position: absolute; top: 16px; right: 16px; z-index: 10;
}
.fullscreen-btn:hover { background: rgba(255,255,255,0.3); }
.fullscreen-btn svg { width: 14px; height: 14px; }

/* Back link */
.back-link {
    display: inline-flex; align-items: center; gap: 4px;
    color: var(--slate); font-size: 0.82rem; font-weight: 600;
    text-decoration: none; padding: 8px 2px 2px;
    transition: color 0.2s;
}
.back-link:hover { color: var(--forest); }

/* ══════════════════════════════════════
   SLIDER SYSTEM
══════════════════════════════════════ */
.slider-root {
    margin-top: 10px;
    position: relative;
    width: 100%;
}

.slide-progress-bar {
    height: 4px;
    background: var(--hairline);
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}
.slide-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--leaf), var(--amber));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.slide-counter {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
}
.slide-counter-text {
    font-size: 0.8rem; font-weight: 700;
    color: var(--slate); letter-spacing: 0.05em;
}
.slide-dots {
    display: flex; gap: 6px; align-items: center;
}
.slide-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--hairline); border: none; cursor: pointer;
    padding: 0; transition: all 0.2s;
}
.slide-dot.active {
    background: var(--leaf); transform: scale(1.25);
}

.slides-viewport {
    width: 100%;
    overflow: hidden;
    border-radius: var(--r);
    position: relative;
    touch-action: pan-y;
}

.slides-track {
    display: flex;
    width: 100%;
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

.slide {
    width: 100%; min-width: 100%; max-width: 100%;
    flex-shrink: 0; box-sizing: border-box;
    display: flex; flex-direction: column;
}

/* ══════════════════════════════════════
   CARD STYLES (Mobile Defaults)
══════════════════════════════════════ */
.card {
    background: var(--card-bg);
    border-radius: var(--r);
    padding: 20px 18px;
    border: 1px solid var(--hairline);
    box-shadow: 0 4px 16px rgba(15,15,15,0.05);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
    flex: 1;
}

.card--intro    { border-top: 5px solid #3B82F6; }
.card--rule     { border-top: 5px solid var(--amber); }
.card--examples { border-top: 5px solid var(--leaf); }
.card--trap     { border-top: 5px solid var(--trap-red); }
.card--practice1{ border-top: 5px solid #8B5CF6; }
.card--practice2{ border-top: 5px solid #safe-teal; }
.card--summary  { background: linear-gradient(135deg, var(--forest), var(--forest-mid)); border: none; color: #fff; }

.card-header {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-icon { font-size: 1.8rem; flex-shrink: 0; line-height: 1; }
.card-title { font-size: 1.1rem; font-weight: 800; line-height: 1.3; flex: 1; }
.card--intro    .card-title { color: #1D4ED8; }
.card--rule     .card-title { color: #92400E; }
.card--examples .card-title { color: var(--leaf-deep); }
.card--trap     .card-title { color: var(--trap-red); }
.card--practice1 .card-title { color: #5B21B6; }
.card--practice2 .card-title { color: var(--safe-teal); }
.card--summary  .card-title { color: var(--lemon); font-size: 1.2rem; }

.card-body { flex: 1; font-size: 0.93rem; color: var(--ink); line-height: 1.7; display: flex; flex-direction: column; justify-content: center; }
.card-body p { margin-bottom: 8px; }
.card-body p:last-child { margin-bottom: 0; }
.card--summary .card-body { color: rgba(255,255,255,0.9); }

.kw-sound  { color: #E53935; font-weight: 700; }
.kw-write  { color: #2D7A29; font-weight: 700; }
.kw-rule   { background: linear-gradient(to top, #FEF08A 50%, transparent 50%); font-weight: 700; padding: 0 2px; }
.kw-trap   { color: #E53935; font-weight: 700; }

.key-point {
    background: #FFFBEB; border: 1.5px solid #FDE68A; border-radius: 12px;
    padding: 12px 14px; font-size: 0.88rem; line-height: 1.6;
}
.key-point strong { color: #92400E; display: block; margin-bottom: 3px; font-size: 0.82rem; }
.card--summary .key-point { background: rgba(255,255,255,0.12); border-color: rgba(255,225,53,0.4); color: #fff; }
.card--summary .key-point strong { color: var(--lemon); }

.example-list { display: flex; flex-direction: column; gap: 8px; }
.example-item {
    display: flex; align-items: center; gap: 8px;
    background: #F0FDF4; border: 1px solid #BBF7D0;
    border-radius: 10px; padding: 8px 12px; font-size: 0.92rem;
}
.example-item .ex-from { color: var(--slate); flex: 1; }
.example-item .ex-arrow { color: var(--leaf); font-weight: 700; }
.example-item .ex-to { font-weight: 800; color: var(--trap-red); }
.example-item .ex-tip { font-size: 0.78rem; color: var(--slate); }

.practice-desc {
    font-size: 0.85rem; color: var(--slate); margin-bottom: 8px;
    padding: 8px 12px; background: #F5F3FF; border-radius: 10px; border: 1px solid #DDD6FE;
}
.practice-list { display: flex; flex-direction: column; gap: 8px; list-style: none; padding: 0; }
.practice-item {
    display: flex; align-items: center; background: #FAF9FF; border: 1px solid #E9D5FF;
    border-radius: 10px; padding: 8px 12px; font-size: 0.92rem; font-weight: 600; gap: 8px;
}
.practice-num {
    width: 22px; height: 22px; background: #8B5CF6; color: #fff;
    border-radius: 50%; font-size: 0.72rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.card--practice2 .practice-num { background: var(--safe-teal); }
.practice-item .pi-text { flex: 1; }

.answer-box {
    display: inline-flex; align-items: center; justify-content: center;
    background: #F1F0EE; border: 1.5px dashed #D3D1CB; border-radius: 8px;
    padding: 2px 12px; color: transparent; text-shadow: 0 0 8px rgba(0,0,0,0.25);
    font-weight: 800; cursor: pointer; min-width: 65px; transition: all 0.2s; user-select: none; margin: 0 2px;
}
.answer-box:hover { background: #FEF3C7; border-color: var(--amber); }
.answer-box.revealed { background: #FEF3C7; border-color: var(--amber); color: #D97706; text-shadow: none; }

.trap-box {
    background: #FEF2F2; border: 2px dashed #FECACA; border-radius: 12px;
    padding: 12px 14px; font-size: 0.88rem; line-height: 1.6; color: #7F1D1D;
}
.trap-box strong { display: block; margin-bottom: 4px; font-size: 0.82rem; color: var(--trap-red); }
.trap-example {
    margin-top: 6px; background: #fff; border: 1px solid #FECACA;
    border-radius: 8px; padding: 6px 10px; text-align: center; font-weight: 800; color: #991B1B;
}

.slide-nav {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-top: 10px;
}
.slide-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border-radius: 50px; font-size: 0.88rem; font-weight: 700;
    cursor: pointer; border: none; transition: all 0.2s; flex: 1; max-width: 150px;
}
.slide-btn--prev { background: var(--card-bg); border: 1.5px solid var(--hairline); color: var(--slate); }
.slide-btn--prev:hover { background: #F1F0EE; color: var(--ink); }
.slide-btn--next { background: var(--forest); color: #fff; box-shadow: 0 2px 8px rgba(20,40,20,0.22); }
.slide-btn--next:hover { background: var(--forest-mid); transform: translateY(-1px); }
.slide-btn--next.finish { background: linear-gradient(135deg, var(--leaf), var(--leaf-deep)); }
.slide-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none !important; box-shadow: none !important; }


/* ══════════════════════════════════════
   💻 PC & PPT MODE
══════════════════════════════════════ */
@media (min-width: 800px) {
    body { padding-top: 65px; height: 100vh; overflow-y: hidden; }
    body { height: 100dvh; }   /* C6 */
    .rule-page-wrap {
        max-width: 1250px; width: 94vw; margin: 0 auto; padding: 0 10px 10px;
        height: calc(100vh - 70px); display: flex; flex-direction: column; justify-content: space-between;
        height: calc(100dvh - 70px);   /* C6 */
    }
    
    .rule-hero { padding: 18px 32px; border-radius: 16px; margin-top: 4px; flex-shrink: 0; }
    .rule-hero h1 { font-size: 2.2rem; margin-bottom: 2px; }
    .rule-hero .rule-sub { font-size: 1.05rem; }
    .rule-chip { font-size: 0.82rem; padding: 3px 12px; }
    .stage-chip { font-size: 0.82rem; padding: 3px 12px; }
    .trap-icon { font-size: 3.5rem; right: 28px; bottom: 10px; opacity: 0.35; }
    .fullscreen-btn { top: 18px; right: 24px; padding: 8px 16px; font-size: 0.88rem; }
    
    .slider-root { flex: 1; display: flex; flex-direction: column; justify-content: space-between; margin-top: 6px; }
    .slide-progress-bar { height: 5px; margin-bottom: 6px; flex-shrink: 0; }
    .slide-counter { margin-bottom: 4px; flex-shrink: 0; }
    .slide-counter-text { font-size: 0.95rem; }
    .slide-dot { width: 10px; height: 10px; }
    
    .slides-viewport { flex: 1; display: flex; }
    .slides-track { flex: 1; height: 100%; }
    .slide { height: 100%; }
    
    .card {
        padding: 28px 44px;
        min-height: 0;
        height: 100%;
        border-radius: 20px;
        gap: 16px;
        box-shadow: 0 8px 30px rgba(0,0,0,0.06);
        justify-content: space-between;
    }
    .card-title { font-size: 1.8rem; }
    .card-icon { font-size: 2.8rem; }
    .card-body { font-size: 1.35rem; line-height: 1.75; flex: 1; justify-content: center; }
    .card-body p { margin-bottom: 12px; }
    
    .key-point { padding: 18px 24px; font-size: 1.2rem; border-radius: 16px; border-width: 2px; }
    .key-point strong { font-size: 1.05rem; margin-bottom: 6px; }
    
    .example-list { gap: 10px; }
    .example-item { padding: 12px 24px; font-size: 1.3rem; border-radius: 14px; border-width: 2px; }
    .example-item .ex-tip { font-size: 1.05rem; }
    
    .practice-desc { font-size: 1.15rem; padding: 12px 20px; border-radius: 14px; margin-bottom: 12px; border-width: 2px; }
    .practice-list { gap: 10px; }
    .practice-item { padding: 12px 24px; font-size: 1.25rem; border-radius: 14px; gap: 14px; border-width: 2px; }
    .practice-num { width: 34px; height: 34px; font-size: 1.05rem; }
    .answer-box { font-size: 1.25rem; padding: 3px 20px; min-width: 95px; border-width: 2px; }
    
    .trap-box { padding: 18px 24px; font-size: 1.2rem; border-radius: 16px; border-width: 2px; }
    .trap-box strong { font-size: 1.1rem; margin-bottom: 6px; }
    .trap-example { font-size: 1.35rem; padding: 10px; margin-top: 8px; }
    .trap-example small { font-size: 1rem; }
    
    .slide-nav { margin-top: 8px; flex-shrink: 0; }
    .slide-btn { padding: 12px 36px; font-size: 1.05rem; max-width: 200px; }
}

/* ══════════════════════════════════════
   🖥️ FULLSCREEN PPT MODE (컴팩트한 종료 원형 버튼)
══════════════════════════════════════ */
body.is-fullscreen {
    padding-top: 0 !important;
    background: #0A140A !important;
    display: flex; align-items: center; justify-content: center;
    height: 100vh !important; overflow: hidden !important;
    height: 100dvh !important;   /* C6 */
}
body.is-fullscreen .header-fixed,
body.is-fullscreen .back-link {
    display: none !important;
}
body.is-fullscreen .rule-page-wrap {
    max-width: 1500px; width: 96vw; height: 96vh; margin: 0; padding: 0;
}
body.is-fullscreen .rule-hero {
    margin-top: 0; padding: 18px 36px; border-radius: 20px;
}
body.is-fullscreen .rule-hero h1 { font-size: 2.6rem; }
body.is-fullscreen .rule-hero .rule-sub { font-size: 1.2rem; }

body.is-fullscreen .card {
    height: 100%;
    padding: 36px 54px;
    background: #ffffff;
    border-radius: 24px;
}
body.is-fullscreen .card--summary {
    background: linear-gradient(135deg, #142814, #1E3D1E);
}
body.is-fullscreen .card-title { font-size: 2.2rem; }
body.is-fullscreen .card-icon { font-size: 3.2rem; }
body.is-fullscreen .card-body { font-size: 1.5rem; line-height: 1.8; }

body.is-fullscreen .key-point { font-size: 1.35rem; padding: 22px 28px; }
body.is-fullscreen .key-point strong { font-size: 1.2rem; }
body.is-fullscreen .example-item { font-size: 1.45rem; padding: 16px 28px; }
body.is-fullscreen .practice-item { font-size: 1.45rem; padding: 16px 28px; }
body.is-fullscreen .practice-num { width: 40px; height: 40px; font-size: 1.2rem; }
body.is-fullscreen .answer-box { font-size: 1.4rem; padding: 4px 24px; min-width: 110px; }
body.is-fullscreen .trap-box { font-size: 1.35rem; padding: 22px 28px; }
body.is-fullscreen .trap-example { font-size: 1.55rem; padding: 12px; }

/* Compact Floating Circle Exit Button */
body.is-fullscreen .fullscreen-btn {
    position: fixed; top: 20px; right: 24px; z-index: 9999;
    background: rgba(229, 57, 53, 0.92); border: none;
    width: 44px; height: 44px; padding: 0;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    transition: transform 0.2s, background 0.2s;
}
body.is-fullscreen .fullscreen-btn:hover {
    background: #c62828; transform: scale(1.1);
}
body.is-fullscreen .fullscreen-btn svg {
    width: 22px; height: 22px; stroke-width: 2.8; color: #ffffff;
}

/* ══════════════════════════════════════
   📱 모바일 하단 내비게이션
   이 파일의 데스크톱 분기점(min-width:800px)에 맞춰 799px 이하를 모바일로 본다.
   helper.js 가 주입하는 .header-fixed 를 모바일에서만 아래로 내린다.
   ══════════════════════════════════════ */
@media screen and (max-width: 799px) {
    .header-fixed {
        top: auto;
        bottom: 0;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.25);
    }

    body {
        padding-top: 0;
        padding-bottom: 68px;
    }
}