/* 기본 레이아웃 */
        :root { --side-panel-width: 500px; }

        html,
        body {
            margin: 0;
            padding: 0;
            /*   body 배경색   */
            background-color: #FAF3E1;
        }

        body { font-family: 'Noto Sans KR', sans-serif; 
        
            min-height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; overflow-x: hidden; }
        .container { max-width: 1400px; width: 100%; background-color: #FAF3E1;
            margin: 0 auto; display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; transition: margin-right 0.3s; }



            
        .app-shell { flex: 1; min-height: calc(100vh - 64px); padding: 20px; box-sizing: border-box; display: flex; }

        .app-header {
            max-width: 1400px;
            width: 100%;   
            margin: 0 auto; 
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            /*     padding: 0 16px; */
            background: #495256;
            position: sticky;
            top: 0;
            z-index: 2500;
            box-shadow: 0 -1px 0 #495256;
        }

        .menu-toggle {
            position: absolute;
            left: 16px;
            width: 32px;
            height: 32px;
            border-radius: 0;
            background: transparent;
            border: none;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0;
        }

        .header-svg-icon {
            width: 26px;
            height: 26px;
            display: block;
        }

        .header-title-wrap {
            display: flex;
            align-items: center;
            gap: 8px;
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            
        }

        .header-icon {
            width: 30px;
            height: 30px;
        }

        .header-main-title {
            color: #f2ede8;
            
            font-weight: 700;
            line-height: 1.1;
        }

        .header-sub-title {
            color: #e5dad1;
            font-size: 9px;
            font-weight: 700;
        }

        .main-sidebar {
            position: fixed;
            top: 0;
            left: -80vw;
            width: 70vw;
            max-width: 350px;
            height: 100vh;
            background: #82907a;
            box-shadow: 3px 0 20px rgba(0, 0, 0, 0.2);
            z-index: 3100;
            transition: left 0.25s ease;
            padding: 18px 14px;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
        }

        .main-sidebar.open {
            left: 0;
        }

        .sidebar-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.35);
            z-index: 3050;
        }

        .sidebar-overlay.show {
            display: block;
        }

        .sidebar-brand {
            background: #fbf9f7;
            border-radius: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 12px;
        
            margin-left: -14px;
             margin-right: -14px;
            margin-top: -18px;
        }

        .sidebar-brand-icon {
            width: 28px;
            height: 28px;
        }

        .sidebar-main-title {
            font-size: 16px;
            color: #82907a;
            font-weight: 700;
            line-height: 1.1;
        }

        .header-auth-controls {
            position: absolute;
            right: clamp(52px, 12vw, 180px);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .header-user-nickname {
            color: #f2ede8;
            font-size: 13px;
            font-weight: 600;
            white-space: nowrap;
        }

        .top-auth-btn-link{
            display: inline-flex;
            align-items: center;
            justify-content: center;
            text-decoration: none;
        }


        .sidebar-auth-btn-link {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            text-decoration: none;
        }

        .top-auth-btn-img {
            height: 28px;
            width: auto;
            display: block;
        }

        .header-home-link {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #ffffff;
            text-decoration: none;
            width: 28px;
            height: 28px;
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
        }

        .sidebar-auth-wrap {
            margin-top: auto;
            padding-top: 10px;
            border-top: 1px solid rgba(250, 236, 185, 0.45);
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .sidebar-user-nickname {
            color: #fbf9f7;
            font-size: 13px;
            font-weight: 600;
            margin-bottom: 8px;
            text-align: center;
        }

        .sidebar-auth-btn-img {
            height: 40px;
            width: auto;
            display: block;
        }

        .admin-bottom-wrap {
            width: 100%;
            padding: 0 20px 16px;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
        }

        .admin-bottom-divider {
            width: min(980px, 100%);
            border: none;
            border-top: 1px solid rgba(0, 0, 0, 0.2);
            margin: 0;
        }

        .admin-bottom-link {
            text-decoration: none;
            color: #4e342e;
            border: 1px solid rgba(78, 52, 46, 0.6);
            padding: 6px 12px;
            font-size: 12px;
            font-weight: 600;
            text-transform: lowercase;
            background: #fff;
        }

        .home-page-wrap {
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            padding-top: 24px;
        }

        .home-card {
            width: min(720px, 100%);
            background: #fff;
            border-radius: 12px;
            padding: 24px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.05);
            color: #4e342e;
        }

        .sidebar-sub-title {
            font-size: 11px;
            color: #82907a;
            font-weight: 700;
        }

        .sidebar-nav {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0;
            background: #82907a;
            margin-left: -14px;
            margin-right: -14px;
            padding: 0 14px 10px 14px;
            border: none;
            border-radius: 0;
            
        }

        .sidebar-link {
            display: block;
            text-decoration: none;
            color: #fbf9f7;
            background: #82907a;
            padding: 10px 12px;
            width: 100%;
            text-align: center;
            border-radius: 0;
            font-weight: 600;
            border: none;
            box-shadow: none;
            border-bottom: 1px solid rgba(250, 236, 185, 0.45);
        }

        .sidebar-link:hover,
        .sidebar-link.active {
            background: #82907a;
            color: #fbf9f7;
        }

        /* 타이틀 */
        h1 { display: flex; align-items: center; justify-content: center; margin-bottom: 15px; font-size: 24px; gap: 8px; flex-shrink: 0; margin-top: 0; }
        .title-main { color: #4e342e; font-weight: 700; }
        .title-sub { color: #a1887f; font-weight: 700; font-size: 0.75em; margin-top: 4px; }
        #btn-home-abs { position: absolute; top: 5px; left: 0; width: 30px; height: 30px; cursor: pointer; z-index: 100; transition: transform 0.3s; opacity: 0.7; }
        #btn-home-abs:hover { transform: scale(1.1); opacity: 1; }

        /* 입력 영역 */
        .input-area { background: white; padding: 15px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 10px; display: flex; gap: 10px; flex-shrink: 0; flex-direction: column; }
        .input-header { display: flex; justify-content: space-between; align-items: center; }
        .input-label { font-weight: bold; color: #8D6E63; font-size: 13px; margin-left: 5px; }
        .char-count { font-size: 12px; color: #888; }
        textarea { width: 100%; height: 70px; padding: 10px; border: 1px solid #ddd; border-radius: 8px; resize: none; font-family: 'Roboto', sans-serif; font-size: 15px; box-sizing: border-box; }
        textarea.is-analyzing {
            color: #9e9e9e;
            background-color: #f2f2f2 !important;
            opacity: 0.9;
        }

        /* 버튼들 */
        .btn-row { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
        .btn-actions { display: flex; gap: 8px; }
        .chunk-limit-hint { font-size: 12px; color: #8D6E63; font-weight: 500; margin-left: 4px; }
        button { padding: 0 15px; height: 34px; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; transition: background 0.2s; font-size: 13px; }
        
       
        
        
        .btn-load { background-color: #5D4037; color: white; }
        .btn-analyze { background-color: #8D6E63; color: white; }
        .btn-clear { background-color: #e0e0e0; color: #555; }

        /* 구문 분석 버튼 */
        .btn-syntax {
            background-color: #A1887F; color: white; font-size: 11px; padding: 4px 10px; height: auto;
            border-radius: 20px;
            opacity: 0.5; pointer-events: none;
        }
        .btn-syntax.ready { opacity: 1; pointer-events: auto; cursor: pointer; background-color: #5D4037; }
        .panel-action-buttons {
            margin-left: auto;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .syntax-level-select {
            height: 28px;
            border: 1px solid #d7ccc8;
            border-radius: 14px;
            padding: 0 10px;
            font-size: 12px;
            color: #5d4037;
            background: #fff;
            font-weight: 600;
        }

        /* 페이지네이션 */
        .pagination-bar { display: flex; gap: 10px; justify-content: center; align-items: center; margin-bottom: 15px; padding: 5px 15px; background: #fff; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); min-height: 32px; }
        .pagination-info { font-size: 12px; color: #888; font-weight: 500; margin-right: 5px; }
        .pagination-buttons { display: flex; gap: 5px; flex-wrap: nowrap; justify-content: center; align-items: center; }
        .page-nav-btn {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            border: 1px solid #ddd;
            background: #fff;
            color: #666;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            padding: 0;
        }
        .page-nav-btn:disabled {
            opacity: 0.4;
            cursor: default;
        }
        .page-btn { width: 26px; height: 26px; border-radius: 50%; border: 1px solid #ddd; background: white; color: #aaa; cursor: pointer; font-weight: bold; font-size: 12px; display: flex; align-items: center; justify-content: center; }
        .page-btn.active { border-color: #333; color: #000; background-color: #fff; border-width: 1.5px; transform: scale(1.05); }
        .page-btn.analyzed { background-color: #E3F2FD; color: #1976D2; border-color: #1976D2; }
        .page-btn.active.analyzed { background-color: #2196F3; color: white; border-color: #2196F3; }

        /* 결과 화면 */
        .study-view { display: flex; flex: 1; min-height: 520px; gap: 20px; overflow: hidden; position: relative; }
        .panel { flex: 1; background: white; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); padding: 25px; display: flex; flex-direction: column; overflow: hidden; font-size: 17px; }
        .panel-title { font-weight: bold; color: #a1887f; margin-bottom: 15px; border-bottom: 2px solid #eee; padding-bottom: 8px; flex-shrink: 0; display: flex; align-items: center; }
        .content-box { overflow-y: auto; flex: 1; line-height: 1.7; padding-right: 5px; }

        .sent { display: inline; padding: 2px 4px; border-radius: 4px; cursor: pointer; transition: background-color 0.2s; }
        .en-sent:hover { background-color: #efebe9; }
        .ko-sent { color: #555; display: block; margin-bottom: 10px; }
        .sent.active { background-color: #fff9c4 !important; color: #3e2723; font-weight: 500; }

        /* [복구] 단어 호버 효과 */
        .word { cursor: pointer; border-bottom: 1px dotted transparent; }
        .sent.active .word:hover { border-bottom: 1px dotted #8D6E63; background-color: rgba(141, 110, 99, 0.2); font-weight: bold; }

        /* [복구] 플레이스홀더 디자인 (#aaa로 연하게) */
        .placeholder { text-align: center; color: #aaa; margin-top: 10%; font-weight: normal; }

        /*
         * ===================== 구문분석 패널 색상 수정 가이드 =====================
         * 이 아래 블록에서 구문분석(side panel) 관련 색을 한 번에 조정할 수 있어요.
         *
         * 1) 구문분석 페이지 배경색(사이드 패널 전체 배경)
         *    - 선택자: #side-panel
         *    - 속성: background-color
         *
         * 2) '구문 분석' 타이틀(패널 상단 큰 제목) 색상
         *    - 선택자: .side-title
         *    - 속성: color
         *
         * 3) [원문] 라벨 색상
         *    - 선택자: .syntax-origin-label
         *    - 속성: color
         *    - 참고: static/js/readstudy.js의 requestSyntax()에서
         *      `<p class="syntax-origin-label">[원문]</p>`로 렌더링됩니다.
         *
         * 4) 1) 직역, 2) 문장 뼈대 같은 각 소제목 색상
         *    - 선택자: .syntax-title
         *    - 속성: color
         *
         * 5) 알파벳(영어) 강조 색상
         *    - 선택자: .syntax-en
         *    - 속성: color
         *
         * 6) 한글 설명 본문 색상
         *    - 선택자: .syntax-body
         *    - 속성: color
         *
         * 참고)
         * - 섹션 경계선 색: .syntax-item 의 border-bottom
         * - 패널 기본 본문 텍스트 색: .side-content 의 color(필요시 추가)
         * ========================================================================
         */
        /* === [수정] 사이드 패널 (PC 너비 550px 적용) === */
        #side-panel {
            position: fixed; top: 0;
            right: calc(-1 * var(--side-panel-width));
            width: var(--side-panel-width);
            height: 100%;
            background-color: rgba(62, 39, 35, 0.95);
            color: #ECEFF1;
            box-shadow: -5px 0 20px rgba(0,0,0,0.2);
            transition: right 0.3s ease-in-out;
            z-index: 3000; padding: 30px; box-sizing: border-box;
            overflow-y: auto; display: flex; flex-direction: column;
            backdrop-filter: blur(5px);
        }
        #side-panel.open { right: 0; }
        .side-title { font-size: 20px; font-weight: bold; margin-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.3); padding-bottom: 10px; display: flex; justify-content: space-between; }
        .side-content { font-size: 15px; line-height: 1.6; white-space: pre-line; }
        .syntax-origin-label { color: #FFCCBC; margin-bottom: 10px; }
        .syntax-item { padding: 10px 0 14px 0; border-bottom: 1px solid rgba(255,255,255,0.25); }
        .syntax-item:last-child { border-bottom: none; }
        .syntax-title { color: #FFCCBC; font-weight: 700; margin-bottom: 6px; }
        .syntax-body { color: #ECEFF1; }
        .syntax-en { color: #f2d692; }
        .close-btn { cursor: pointer; font-size: 24px; line-height: 20px; }

        /* 로딩바 디자인 */
        #loading-layer { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(255, 255, 255, 0.8); z-index: 10; border-radius: 12px; text-align: center; padding-top: 150px; }
        .loading-text {
            font-size: 20px; font-weight: bold; color: #fff; background: #8D6E63;
            padding: 15px 40px; border-radius: 50px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.2); border: 2px solid #fff;
            display: inline-block;
        }

        #definition-popup { display: none; position: absolute; background: #4e342e; color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 14px; max-width: 260px; z-index: 2000; box-shadow: 0 4px 15px rgba(0,0,0,0.3); }

        .idiom-modal {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.35);
            z-index: 3200;
            align-items: center;
            justify-content: center;
            padding: 16px;
            box-sizing: border-box;
        }
        .idiom-modal.open {
            display: flex;
        }
        .idiom-modal-card {
            width: min(520px, 100%);
            max-height: 80vh;
            overflow-y: auto;
            border-radius: 12px;
            background: #fffaf4;
            border: 1px solid #e6d8c5;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            color: #4e342e;
        }
        .idiom-modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-weight: 700;
            padding: 12px 14px;
            border-bottom: 1px solid #e6d8c5;
            color: #6d4c41;
        }
        .idiom-close-btn {
            border: none;
            background: transparent;
            font-size: 22px;
            line-height: 1;
            color: #8d6e63;
            cursor: pointer;
            height: auto;
            padding: 0 4px;
        }
        .idiom-modal-body {
            padding: 14px;
            font-size: 14px;
            line-height: 1.6;
        }
        .idiom-loading,
        .idiom-empty {
            color: #6d4c41;
        }
        .idiom-selected-sentence {
            font-style: italic;
            color: #6d4c41;
            margin-bottom: 10px;
            padding: 8px 10px;
            border-radius: 8px;
            background: #f6ede3;
            border: 1px solid #eadcc9;
        }
        .idiom-list {
            margin: 0;
            padding-left: 18px;
        }
        .idiom-item {
            margin-bottom: 10px;
        }
        .idiom-expression {
            font-weight: 700;
            color: #4e342e;
        }
        .idiom-meaning {
            color: #5d4037;
            margin-top: 2px;
        }

        @media (min-width: 769px) {
            .study-view {
                align-items: flex-start;
            }
            .panel {
                height: auto;
            }
            .content-box {
                flex: none;
                height: calc(1.7em * 18);
                max-height: calc(1.7em * 18);
                overflow-y: auto;
            }
        }

        @media (max-width: 768px) {
            :root { --side-panel-width: 85vw; }
            h1 { font-size: 18px; }
            .study-view { flex-direction: column; }
            .app-shell { padding: 12px; min-height: calc(100vh - 64px); }
            .header-main-title { font-size: 16px; }
            .header-title-wrap { width: calc(100% - 110px); justify-content: center; }
            .header-auth-controls {
                right: 60px;
            }
            .header-user-nickname { display: none; }
            .btn-row { flex-direction: column; align-items: stretch; gap: 10px; }
            .btn-actions { justify-content: flex-end; }
            .chunk-limit-hint { margin-left: 0; }
            .study-view { min-height: 0; }
        }
