    :root {
      --bg: #fafafa;
      --surface: #fafafa;
      --border: #dbdbdb;
      --text: #262626;
      --text-sub: #8e8e8e;
      --accent: #ed4956;
      --blue: #0095f6;
      --story-ring: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
      --nav-h: 82px;
      --header-h: 50px;
    }
    * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
    html, body { height: 100%; overflow: hidden; background: #fafafa; }
    body { overflow: visible; isolation: auto;/*hidden;*/ }
    body {
      background: var(--bg);
      font-family: 'Noto Sans KR', sans-serif;
      color: var(--text);
      max-width: 430px;
      width: 100%;
      margin: 0 auto;
      display: flex; flex-direction: column;
      height: 100dvh;
      position: relative;
      box-shadow: 0 0 40px rgba(0,0,0,0.15);
      isolation: isolate;
    }

    /* ═══ HEADER ═══════════════════════════════ */
    .app-header {
      height: var(--header-h);
      padding: env(safe-area-inset-top) 16px 0;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      display: flex; align-items: center; justify-content: space-between;
      flex-shrink: 0;
      /* 항상 최상단 고정 - 상태바 #fafafa 보장 */
      position: fixed;
      top: 0; left: 0; right: 0;
      max-width: 430px;
      margin: 0 auto;
      z-index: 99998;
      transition: height 0.2s ease, border-color 0.2s ease;
      overflow: hidden;
    }
    /* 오버레이 열릴 때: 상태바 높이만 남기고 내용 숨김 */
    .app-header.overlay-open {
      height: env(safe-area-inset-top, 44px);
      border-bottom-color: transparent;
    }
    /* 헤더 고정으로 인한 공간 확보 */
    .app-header-spacer {
      height: var(--header-h);
      flex-shrink: 0;
    }
    .header-logo {
      font-family: 'Dancing Script', cursive; font-size: 26px;
      background: var(--story-ring);
      -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    }
    .header-title { font-size: 16px; font-weight: 700; }
    .header-icons { display: flex; gap: 16px; align-items: center; }
    .header-icons svg { width: 24px; height: 24px; cursor: pointer; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
    .notif-dot { position: relative; display: flex; align-items: center; }
    .settings-sheet { transform: translateY(100%); }
    .settings-sheet.open { transform: translateY(0) !important; }
    .notif-dot.has-notif::after { content:''; position:absolute; top:-2px; right:-2px; width:8px; height:8px; background:var(--accent); border-radius:50%; border:1.5px solid white; }

    /* ═══ SCREENS ══════════════════════════════ */
    .app-body { flex: 1; padding-top:82px; overflow: hidden; position: relative; }
    .screen { position: absolute; inset: 0; overflow-y: auto; display: none; flex-direction: column; background: var(--bg); }
    .screen.active { display: flex; }

    /* ═══ BOTTOM NAV ════════════════════════════ */
    .bottom-nav {
      background: var(--surface); border-top: 1px solid var(--border);
      display: flex; justify-content: space-around;
      align-items: center;
      flex-shrink: 0;
      padding-bottom: 28px;
      height: 82px;
    }
    .nav-btn {
      flex: 1; background: none; border: none; cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      padding: 8px; transition: transform 0.15s;
    }
    .nav-btn:active { transform: scale(0.85); }
    .nav-btn svg { width: 26px; height: 26px; fill: none; stroke: var(--text-sub); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.15s; }
    .nav-btn.active svg { stroke: var(--text); stroke-width: 2.5; }

    .ptr-indicator { display:flex;align-items:center;justify-content:center;gap:8px;height:0;overflow:hidden;transition:height 0.2s;font-size:13px;color:var(--text-sub);flex-shrink:0; }
    .ptr-indicator.visible { height:48px; }
    .ptr-spinner { width:18px;height:18px;border:2px solid var(--border);border-top-color:var(--text-sub);border-radius:50%; }
    .ptr-spinner.spin { animation:spin 0.8s linear infinite; }
    /* ═══ FEED SCREEN ═══════════════════════════ */
    .stories-wrap {
      background: var(--surface); border-bottom: 1px solid var(--border);
      padding: 12px 0; overflow-x: auto; scrollbar-width: none; flex-shrink: 0;
    }
    .stories-wrap::-webkit-scrollbar { display: none; }
    .stories-list { display: flex; gap: 14px; padding: 0 16px; width: max-content; }
    .story-item { display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; }
    .story-ring { width: 64px; height: 64px; border-radius: 50%; padding: 2.5px; background: var(--story-ring); transition: transform 0.15s; }
    .story-ring:active { transform: scale(0.93); }
    .story-ring.seen { background: linear-gradient(45deg, #dbdbdb, #dbdbdb); }
    .story-avatar { width:100%; height:100%; border-radius:50%; object-fit:cover; border:2.5px solid white; background:#efefef; display:flex; align-items:center; justify-content:center; font-size:22px; overflow:hidden; }
    .story-avatar img { width:100%; height:100%; object-fit:cover; }
    .story-name { font-size:11px; color:var(--text); max-width:68px; text-align:center; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }

    /* POST */
    .post { background: var(--surface); border-bottom: 1px solid var(--border); animation: fadeUp 0.35s ease both; }
    @keyframes fadeUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
    .post-header { display:flex; align-items:center; justify-content:space-between; padding:10px 12px; position:relative; }
    /*.post-menu { position:absolute; right:8px; top:36px; background:var(--bg); border:1px solid var(--border); border-radius:8px; box-shadow:0 4px 12px rgba(0,0,0,0.15); z-index:100; min-width:120px; overflow:hidden; }*/
    .post-menu { position:absolute; right:8px; top:36px; background:var(--bg); border:1px solid var(--border); border-radius:8px; box-shadow:0 4px 12px rgba(0,0,0,0.15); z-index:9998 !important; min-width:120px; overflow:hidden; }
    .post-menu-item { padding:12px 16px; font-size:14px; cursor:pointer; color:var(--text); text-align:center; }
    .post-menu-item.danger { color:#ff3b30; }
    .post-menu-item:active { background:var(--bg-sub); }
    /* 캡션 편집 오버레이 */
    .caption-edit-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:9999; display:flex; align-items:center; justify-content:center; padding:20px; }
    .caption-edit-box { background:var(--bg); border-radius:16px; padding:20px; width:100%; max-width:400px; display:flex; flex-direction:column; gap:12px; }
    .caption-edit-title { font-size:16px; font-weight:600; text-align:center; }
    .caption-edit-textarea { width:100%; border:1px solid var(--border); border-radius:10px; padding:10px; font-size:14px; background:var(--bg-sub); color:var(--text); resize:none; font-family:inherit; box-sizing:border-box; }
    .caption-edit-actions { display:flex; gap:8px; }
    .caption-edit-cancel { flex:1; padding:10px; border-radius:10px; border:1px solid var(--border); background:var(--bg-sub); color:var(--text); font-size:14px; cursor:pointer; }
    .caption-edit-save { flex:1; padding:10px; border-radius:10px; border:none; background:#0095f6; color:#fff; font-size:14px; font-weight:600; cursor:pointer; }
    .post-user { display:flex; align-items:center; gap:10px; cursor:pointer; }
    .post-avatar { width:34px; height:34px; border-radius:50%; background:#efefef; display:flex; align-items:center; justify-content:center; font-size:16px; overflow:hidden; flex-shrink:0; }
    .post-avatar img { width:100%; height:100%; object-fit:cover; }
    .post-username { font-size:13.5px; font-weight:600; }
    .post-location { font-size:11px; color:var(--text-sub); }
    .post-more { padding:4px 8px; cursor:pointer; font-size:20px; line-height:1; }
    .post-images { position:relative; width:100%; aspect-ratio:1; overflow:hidden; background:#efefef; }
    .post-images-track { display:flex; height:100%; transition:transform 0.3s ease; }
.post-images-track img { width:100%; height:100%; object-fit:cover; object-position:top; flex-shrink:0; }
    .img-placeholder { width:100%; height:100%; flex-shrink:0; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#efefef,#e0e0e0); font-size:48px; }
    .slide-dots { position:absolute; bottom:10px; left:50%; transform:translateX(-50%); display:flex; gap:4px; }
    .slide-dot { width:6px; height:6px; border-radius:50%; background:rgba(255,255,255,0.5); transition:background 0.2s; }
    .slide-dot.active { background:white; }
    .slide-btn { position:absolute; top:50%; transform:translateY(-50%); background:rgba(255,255,255,0.85); border:none; border-radius:50%; width:28px; height:28px; display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:14px; box-shadow:0 1px 4px rgba(0,0,0,0.2); opacity:0; transition:opacity 0.2s; }
    .post-images:hover .slide-btn { opacity:1; }
    .slide-btn.prev { left:8px; } .slide-btn.next { right:8px; }
    .slide-count { position:absolute; top:10px; right:10px; background:rgba(0,0,0,0.55); color:white; font-size:12px; padding:3px 9px; border-radius:20px; }
    .post-actions { display:flex; align-items:center; justify-content:space-between; padding:8px 12px 4px; }
    .post-actions-left { display:flex; gap:2px; align-items:center; }
    .action-btn { background:none; border:none; cursor:pointer; padding:4px 6px; display:flex; align-items:center; gap:5px; transition:transform 0.1s; }
    .action-btn:active { transform:scale(0.85); }
    .action-btn svg { width:24px; height:24px; fill:none; stroke:var(--text); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; transition:all 0.15s; flex-shrink:0; }
    .action-btn .btn-count { font-size:13px; font-weight:600; color:var(--text); }
    .heart-btn.liked svg { fill:var(--accent); stroke:var(--accent); }
    .heart-btn.liked .btn-count { color:var(--accent); }
    .bookmark-btn.saved svg { fill:var(--text); }
    .heart-pop { animation:heartPop 0.3s ease; }
    @keyframes heartPop { 0%{transform:scale(1)} 50%{transform:scale(1.35)} 100%{transform:scale(1)} }
    .post-caption { padding:0 12px 6px; font-size:13.5px; line-height:1.5; }
    .post-caption .uname { font-weight:600; margin-right:5px; }
    .post-caption .caption-text { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; cursor:pointer; }
    .post-caption .caption-text.expanded { display:block; -webkit-line-clamp:unset; overflow:visible; }
    .post-caption .more-btn { color:var(--text-sub); cursor:pointer; font-size:13px; }
    .post-comments-preview { padding:0 12px 4px; font-size:13.5px; color:var(--text-sub); cursor:pointer; }
    .post-comments-list { padding:0 12px 4px; font-size:13.5px; }
    .post-comment-item { margin-bottom:2px; color:var(--text); line-height:1.5; }
    .post-comment-item .uname { font-weight:600; margin-right:5px; }
    .post-time { padding:0 12px 12px; font-size:10px; color:var(--text-sub); text-transform:uppercase; letter-spacing:0.3px; cursor:pointer; }

    /* ═══ 댓글 바텀시트 ════════════════════════════ */
    /*.bottom-sheet-backdrop { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:100; }*/
    .bottom-sheet-backdrop { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:400 !important; }
    .bottom-sheet-backdrop.open { display:block; }
    /*.comment-sheet { position:fixed; bottom:0; left:0; right:0; max-width:470px; margin:0 auto; transform:translateY(100%); background:var(--surface); border-radius:16px 16px 0 0; z-index:300; display:flex; flex-direction:column; max-height:85vh; transition:transform 0.3s cubic-bezier(0.32,0.72,0,1); }*/
    .comment-sheet { position:fixed; bottom:0; left:0; right:0; max-width:470px; margin:0 auto; transform:translateY(100%); background:var(--surface); border-radius:16px 16px 0 0; z-index:401 !important; display:flex; flex-direction:column; max-height:85vh; transition:transform 0.3s cubic-bezier(0.32,0.72,0,1); }
    .comment-sheet.open { transform:translateY(0); }
    .sheet-handle { width:36px; height:4px; background:#dbdbdb; border-radius:2px; margin:12px auto 0; flex-shrink:0; }
    .sheet-header { display:flex; align-items:center; justify-content:center; padding:14px 16px 10px; border-bottom:1px solid var(--border); flex-shrink:0; position:relative; }
    .sheet-title { font-size:14px; font-weight:700; }
    .sheet-close { position:absolute; right:16px; background:none; border:none; font-size:22px; cursor:pointer; color:var(--text-sub); line-height:1; padding:0; }
    .sheet-comments { flex:1; overflow-y:auto; padding:12px 16px; display:flex; flex-direction:column; gap:0; }
    /* ─ 댓글 아이템 ─ */
    .sheet-comment-item { display:flex; gap:10px; align-items:flex-start; padding:10px 0; }
    .sheet-comment-item + .sheet-comment-item { border-top: none; }
    /* 메인 댓글 아바타: 38px */
    .sheet-avatar { width:38px; height:38px; border-radius:50%; background:linear-gradient(135deg,#667eea,#764ba2); flex-shrink:0; display:flex; align-items:center; justify-content:center; color:white; font-size:14px; font-weight:700; overflow:hidden; }
    .sheet-avatar.char { background:linear-gradient(135deg,#f09433,#dc2743); }
    .sheet-avatar.npc-avatar { background:#e0e0e0; padding:0; }
    /* 대댓글 아바타: 28px 상단정렬 */
    .sheet-reply-avatar { width:28px; height:28px; border-radius:50%; background:linear-gradient(135deg,#667eea,#764ba2); flex-shrink:0; align-self:flex-start; display:flex; align-items:center; justify-content:center; color:white; font-size:11px; font-weight:700; overflow:hidden; }
    .sheet-reply-avatar.char { background:linear-gradient(135deg,#f09433,#dc2743); }
    .sheet-reply-avatar.npc-avatar { background:#e0e0e0; padding:0; }
    /* NPC 댓글 작성자 이름 */
    .sheet-comment-name.npc-name { color:var(--text-sub); font-weight:600; }
    /* 댓글 바디 */
    .sheet-comment-body { flex:1; min-width:0; }
    .sheet-comment-header { display:flex; align-items:baseline; gap:6px; margin-bottom:3px; }
    .sheet-comment-name { font-size:13px; font-weight:700; }
    .sheet-comment-time { font-size:11px; color:var(--text-sub); }
    .sheet-comment-text { font-size:13.5px; line-height:1.5; color:var(--text); word-break:break-word; }
    .sheet-comment-actions { display:flex; gap:14px; align-items:center; margin-top:6px; }
    .sheet-reply-btn { background:none; border:none; font-size:12px; color:var(--text-sub); cursor:pointer; padding:0; font-weight:500; }
    /* 대댓글 컨테이너 */
    .sheet-replies { margin-left:48px; display:flex; flex-direction:column; gap:0; }
    .sheet-reply-item { display:flex; gap:8px; align-items:flex-start; padding:8px 0; }
    .sheet-loading { text-align:center; padding:30px; color:var(--text-sub); font-size:13px; }
    /*.sheet-input-wrap { border-top:1px solid var(--border); padding:0 16px; padding-bottom:env(safe-area-inset-bottom); height:82px; display:flex; align-items:center; gap:10px; flex-shrink:0; background:var(--surface); }*/
    /* 👇 [수정됨] position: relative; 추가 */
    .sheet-input-wrap { border-top:1px solid var(--border); padding:0 16px; padding-bottom:env(safe-area-inset-bottom); height:82px; display:flex; align-items:center; gap:10px; flex-shrink:0; background:var(--surface); position: relative; }
    
    /* 👇 [추가된 코드] 아이폰 키보드 틈새 비침 방지용 하단 가림막 (댓글창용) */
    .sheet-input-wrap::after {
      content: '';
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      height: 500px;
      background: var(--surface); /* 댓글창 배경색과 동일하게 맞춤 */
      pointer-events: none;
    }
    /* 👆[추가된 코드 끝] */
    .sheet-input-avatar { width:30px; height:30px; border-radius:50%; background:linear-gradient(135deg,#667eea,#764ba2); flex-shrink:0; display:flex; align-items:center; justify-content:center; color:white; font-size:12px; font-weight:700; overflow:hidden; }
    .sheet-input { flex:1; min-width:0; border:1.5px solid var(--border); border-radius:20px; padding:8px 14px; font-size:14px; font-family:inherit; outline:none; background:var(--surface); color:var(--text); transition:border-color 0.2s; }
    .sheet-input:focus { border-color:var(--blue); }
    .sheet-post-btn { background:none; border:none; cursor:pointer; color:var(--blue); font-size:13.5px; font-weight:700; opacity:0.4; transition:opacity 0.2s, background 0.2s, color 0.2s; white-space:nowrap; padding:6px 10px; border-radius:14px; flex-shrink:0; }
    .sheet-post-btn.active { opacity:1; background:var(--blue); color:white; }

    /* ═══ 포스팅 상세 뷰 ════════════════════════════ */
    /*
     * [상태바 수정]
     * top:0 → 상단을 완전히 덮어서 safe-area 위에 검정이 안 보이게
     * background:#fafafa → html/body와 동일한 배경
     * 실제 이미지/영상은 img-wrap 안에서 background:#000 + padding-top:safe-area로 처리
     */

    .post-detail-screen {
    position: fixed; left: 0; right: 0; bottom: 0; top: 0;
    /* 배경: 반투명 검정 (뒤가 살짝 비침) */
    background: rgba(0, 0, 0, 0.15);
    z-index: 270; display: flex; flex-direction: column;
        
    /* 처음엔 화면 밖(오른쪽)에 있다가 */
    transform: translateX(100%);
    transition: transform 0.3s ease, opacity 0.3s ease; /* opacity 트랜지션 추가 */
    }
    .post-detail-screen.open {
        transform: translateX(0);
    }
        
    /* [추가] 스와이프로 닫힐 때 배경이 서서히 투명해지도록 하는 클래스 */
    .post-detail-screen.fading-out {
        background: rgba(0, 0, 0, 0) !important;
        transition: background 0.3s ease !important;
    }

    /* 슬라이더 컨테이너와 이미지 영역은 배경 투명으로 변경 (부모 배경 따라가게) */
    .detail-slider-container {
        background: transparent !important;
    }
    .post-detail-img-outer {
        background: transparent !important;
    }

    /* safe-area 위쪽을 fafafa로 채우는 역할 */
    .post-detail-safe-area {
      height: env(safe-area-inset-top);
      background: #fafafa;
      flex-shrink: 0;
    }

    /* 실제 이미지 영역: 나머지 전체
    .post-detail-img-outer {
      flex: 1;
      position: relative;
      overflow: hidden;
      background: #000;
    }*/

    .post-detail-header { position:absolute; top:0; left:0; right:0; z-index:30; display:flex; align-items:center; justify-content:space-between; padding:12px 16px; }
    .post-detail-back { background:none; border:none; color:white; font-size:24px; cursor:pointer; padding:4px; }
    .post-detail-img-wrap { position:absolute; inset:0; }
.post-detail-img-wrap img { width:100%; height:100%; object-fit:cover; object-position:top; }
    /* 우측 버튼 - 완전 독립 레이어 */
    .post-detail-side { position:absolute; right:16px; bottom:calc(82px + 80px); display:flex; flex-direction:column; align-items:center; gap:22px; z-index:20; pointer-events:all; width:28px; }
    .post-detail-side-btn { display:flex; flex-direction:column; align-items:center; gap:4px; cursor:pointer; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
    .post-detail-side-btn svg { width:28px; height:28px; fill:none; stroke:white; stroke-width:1.8; filter:drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
    .post-detail-side-btn span { display:block; min-height:16px; color:white; font-size:12px; font-weight:600; text-shadow:0 1px 2px rgba(0,0,0,0.5); }
    .post-detail-side-btn.liked svg { stroke:#ff3040; fill:#ff3040; }
    .post-detail-side-btn.saved svg { fill:white; stroke:white; }
    .detail-more-menu { position:fixed; bottom:162px; right:60px; background:white; border-radius:12px; overflow:hidden; box-shadow:0 4px 20px rgba(0,0,0,0.25); z-index:9999; min-width:110px; }
    .detail-more-menu-item { padding:14px 20px; font-size:15px; font-weight:500; cursor:pointer; color:#111; text-align:center; -webkit-tap-highlight-color:transparent; }
    .detail-more-menu-item:active { background:#f0f0f0; }
    .detail-more-menu-item.danger { color:#ed4956; }
    /* 그라데이션 전용 레이어 */
    .post-detail-gradient { position:absolute; bottom:82px; left:0; right:0; height:35%; background:linear-gradient(to top, rgba(0,0,0,0.80) 0%, rgba(0,0,0,0.4) 50%, transparent 100%); pointer-events:none; z-index:5; }

    /*
     * [캡션 확장 방향 수정]
     * flex-direction:column-reverse → 유저 영역이 화면 하단에 고정
     * 캡션이 늘어날 때 위쪽으로만 확장됨
     * DOM 순서: caption-scroll → user (화면 표시: user 아래, caption 위)
     */
    .post-detail-bottom {
      position:absolute; bottom:82px; left:0; right:36px;
      pointer-events:none; z-index:6; padding:12px 16px 8px;
      display:flex; flex-direction:column-reverse;
    }
    /* column-reverse라 margin-top이 화면상 user와 caption 사이 간격 */
    .post-detail-user { display:flex; align-items:center; gap:10px; margin-top:8px; pointer-events:all; flex-shrink:0; cursor:pointer; }
    /* 캡션 스크롤 영역 */
    .post-detail-caption-scroll { overflow:hidden; scrollbar-width:none; padding-bottom:0; pointer-events:all; touch-action:pan-y; }
    .post-detail-caption-scroll::-webkit-scrollbar { display:none; }
    .post-detail-caption-scroll.expanded { overflow-y:scroll; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; }

    .post-detail-avatar { width:36px; height:36px; border-radius:50%; background:linear-gradient(135deg,#f09433,#dc2743); display:flex; align-items:center; justify-content:center; font-size:18px; border:2px solid white; flex-shrink:0; overflow:hidden; cursor:pointer; pointer-events:all; position:relative; z-index:30; }
    .post-detail-username { color:white; font-weight:700; font-size:14px; text-shadow:0 1px 3px rgba(0,0,0,0.8); pointer-events:all; cursor:pointer; position:relative; z-index:30; }
    .post-detail-caption { color:white; font-size:13.5px; line-height:1.6; text-shadow:0 1px 2px rgba(0,0,0,0.7); display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; pointer-events:none; }
    .post-detail-caption.expanded { display:block; overflow:visible; pointer-events:none; }
    .post-detail-caption .hashtag { color:#8bb8ff; }
    .post-caption .hashtag { color:#8bb8ff; }
    .post-detail-more { color:rgba(255,255,255,0.6); font-size:13px; margin-top:2px; cursor:pointer; pointer-events:all; }
    .post-detail-meta { color:rgba(255,255,255,0.7); font-size:11px; margin-top:6px; text-shadow:0 1px 2px rgba(0,0,0,0.7); }

    /* 댓글 추가 바 - 화면 최하단 고정 */
    .post-detail-comment-bar { position:absolute; bottom:0; left:0; right:0; display:flex; align-items:center; gap:12px; padding:0 16px; padding-bottom:env(safe-area-inset-bottom); height:82px; background:var(--surface); border-top:1px solid var(--border); cursor:pointer; pointer-events:all; z-index:10; }
    .post-detail-comment-bar span {
        color: var(--text-sub); font-size: 14px; border: 1.5px solid var(--border); border-radius: 20px;
        padding: 8px 16px; flex: 1; }
    .post-detail-comment-avatar { width:28px; height:28px; border-radius:50%; background:linear-gradient(135deg,#667eea,#764ba2); display:flex; align-items:center; justify-content:center; color:white; font-size:11px; font-weight:700; flex-shrink:0; }
    .post-detail-slide-indicator { position:absolute; top:16px; right:16px; background:rgba(0,0,0,0.5); color:white; font-size:12px; padding:4px 8px; border-radius:12px; z-index:5; }
    /* ═══ 공유 시트 ════════════════════════════════ */
    /*.share-sheet { position:fixed; bottom:0; left:50%; transform:translateX(-50%) translateY(100%); width:min(430px,100vw); background:var(--surface); border-radius:16px 16px 0 0; z-index:300; display:flex; flex-direction:column; max-height:85vh; transition:transform 0.3s cubic-bezier(0.32,0.72,0,1); padding-bottom:env(safe-area-inset-bottom); }*/
.share-sheet { position:fixed; bottom:0; left:50%; transform:translateX(-50%) translateY(100%); width:min(430px,100vw); background:var(--surface); border-radius:16px 16px 0 0; z-index:401 !important; display:flex; flex-direction:column; max-height:85vh; transition:transform 0.3s cubic-bezier(0.32,0.72,0,1); padding-bottom:env(safe-area-inset-bottom); }
    .share-sheet.open { transform:translateX(-50%) translateY(0); }
    .share-chars { display:grid; grid-template-columns:repeat(3,1fr); gap:16px 8px; padding:16px 20px; overflow-y:auto; }
    .share-char-item { display:flex; flex-direction:column; align-items:center; gap:6px; cursor:pointer; }
    .share-char-item:active .share-char-avatar { transform:scale(0.9); }
    .share-char-avatar { width:64px; height:64px; border-radius:50%; background:linear-gradient(135deg,#f09433,#dc2743); display:flex; align-items:center; justify-content:center; font-size:28px; transition:transform 0.15s; border:3px solid transparent; overflow:hidden; }
    .share-char-avatar.selected { border-color:var(--blue); box-shadow:0 0 0 2px var(--blue); }
    .share-char-name { font-size:12px; color:var(--text); text-align:center; font-weight:500; }
    .share-send-btn { margin:8px 16px calc(16px + env(safe-area-inset-bottom)); background:var(--blue); color:white; border:none; border-radius:10px; padding:13px; font-size:15px; font-weight:700; font-family:inherit; cursor:pointer; opacity:0.4; transition:opacity 0.2s; }
    .share-send-btn.active { opacity:1; }
    /*.toast { position:fixed; bottom:80px; left:50%; transform:translateX(-50%) translateY(20px); background:rgba(0,0,0,0.8); color:white; padding:10px 20px; border-radius:24px; font-size:13px; opacity:0; transition:all 0.3s; z-index:200; pointer-events:none; white-space:nowrap; }*/
    .toast { position:fixed; bottom:80px; left:50%; transform:translateX(-50%) translateY(20px); background:rgba(0,0,0,0.8); color:white; padding:10px 20px; border-radius:24px; font-size:13px; opacity:0; transition:all 0.3s; z-index:100000 !important; pointer-events:none; white-space:nowrap; }
    .toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

    /* ═══ STORY MODAL ════════════════════════════ */
    /* ═══ STORY FEED SCREEN ═══════════════════════ */
    .story-feed-screen { display:flex; flex-direction:column; flex:1; overflow:hidden; background:var(--bg); }
    #storyScrollFeed { flex:1; overflow-y:auto; display:flex; align-items:center; justify-content:center; }
    .sv-loading { display:flex; align-items:center; justify-content:center; flex:1; }
    .sv-empty { display:flex; align-items:center; justify-content:center; flex-direction:column; gap:12px; flex:1; color:var(--text-sub); font-size:14px; }

    /* ═══ SETTINGS ═══════════════════════════════════════ */
    .settings-card {
      background:var(--surface); border-radius:14px;
      border:1px solid var(--border); padding:14px 16px;
    }
    .settings-card-title { font-size:13px; font-weight:700; color:var(--text); margin-bottom:10px; }
    .settings-nav-btn {
      width:100%; display:flex; align-items:center; justify-content:space-between;
      padding:14px 16px; background:var(--surface); border:1px solid var(--border);
      border-radius:14px; font-size:14px; font-weight:600; color:var(--text);
      cursor:pointer; font-family:inherit; -webkit-tap-highlight-color:transparent;
      transition:background 0.12s;
    }
    .settings-nav-btn:active { background:#f0f0f0; }
    .settings-reset-btn {
      padding:8px; background:#fff0f0; border:1px solid #fca5a5;
      border-radius:8px; font-size:12px; color:#dc2626; cursor:pointer;
    }
    /* ═══ ADD CHARACTER ══════════════════════════════════ */
    .addchar-label { font-size:10px; color:var(--text-sub); display:block; margin-bottom:3px; }
    .addchar-input {
      width:100%; box-sizing:border-box; padding:7px 9px;
      border:1px solid var(--border); border-radius:8px;
      font-size:12px; background:var(--bg); font-family:inherit;
    }
    .addchar-select {
      width:100%; padding:6px 8px; border:1px solid var(--border);
      border-radius:8px; font-size:12px; background:var(--bg);
      margin-top:3px; font-family:inherit;
    }

.story-feed-empty {
      text-align:center; padding:60px 20px;
      color:var(--text-sub); font-size:14px;
    }

    /* 기본: 피드에서 열릴 때 전체화면 */
    /*.story-modal { display:none; position:fixed; inset:0; max-width:430px; margin:0 auto; z-index:300; background:black; overflow:hidden; }*/
    /* ✨ 수정 후 (background 값을 #fafafa로 변경) */
    .story-modal { display:none; position:fixed; inset:0; max-width:430px; margin:0 auto; z-index:300; background:#fafafa; overflow:hidden; }
    .story-modal.open { display:block; }
    /* 스토리 탭에서 열릴 때: 헤더~탭바 사이 */
    .story-modal.open.tab-mode {
      top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
      bottom: 82px;
    }
    /* 이미지: 화면 전체 채움 */
    .story-content { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; }
    .story-img { width:100%; height:100%; object-fit:cover; padding-bottom:0; }
    /* 전체화면 모드에서 상태바 영역 커버 */
    .story-modal:not(.tab-mode) .story-img { padding-top:env(safe-area-inset-top,0px); }
    .story-img-placeholder { font-size:80px; }
    .story-tap-left, .story-tap-right { position:absolute; top:0; height:100%; width:40%; cursor:pointer; z-index:5; }
    .story-tap-left { left:0; } .story-tap-right { right:0; }
    /* UI 오버레이: 이미지 위 */
    .story-ui-top { position:absolute; top:0; left:0; right:0; z-index:10; background:linear-gradient(to bottom, rgba(0,0,0,0.45) 0%, transparent 100%); padding-top:8px; padding-bottom:20px; }
    .story-progress { display:flex; gap:3px; padding-top:env(safe-area-inset-top,44px); padding-left:10px; padding-right:10px; padding-bottom:0; }
    .story-progress-bar { flex:1; height:2.5px; background:rgba(255,255,255,0.35); border-radius:2px; overflow:hidden; }
    .story-progress-fill { height:100%; background:white; width:0%; transition:width linear; }
    .story-header { display:flex; align-items:center; justify-content:space-between; padding:8px 14px 0; }
    .story-user { display:flex; align-items:center; gap:10px; }
    .story-user-avatar { width:36px; height:36px; border-radius:50%; border:2px solid white; background:#333; overflow:hidden; display:flex; align-items:center; justify-content:center; font-size:18px; }
    .story-user-avatar img { width:100%; height:100%; object-fit:cover; }
    .story-user-name { color:white; font-size:14px; font-weight:600; }
    .story-user-time { color:rgba(255,255,255,0.7); font-size:12px; }
    .story-close { background:none; border:none; color:white; font-size:28px; cursor:pointer; line-height:1; }
    /* 스토리 우측 액션 바 */
    .story-action-bar { position:absolute; right:12px; bottom:96px; z-index:15; display:flex; flex-direction:column; align-items:center; gap:20px; }
    .story-action-btn { display:flex; flex-direction:column; align-items:center; gap:3px; cursor:pointer; -webkit-tap-highlight-color:transparent; }
    .story-action-btn svg { fill:none; stroke:white; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; filter:drop-shadow(0 1px 3px rgba(0,0,0,0.5)); }
    .story-action-btn span { font-size:11px; color:white; font-weight:600; text-shadow:0 1px 3px rgba(0,0,0,0.6); min-height:14px; }
    #storyActionLike.liked svg { fill:#ff3040; stroke:#ff3040; }
    #storyActionBookmark.saved svg { fill:white; }
    #storyActionComment.commented svg { fill:#0095f6; stroke:#0095f6; }
    /* 피드/스토리 댓글 아이콘 filled */
    .comment-btn.commented svg { fill:#0095f6; stroke:#0095f6; }
    /* 댓글 바 */
    /*.story-comment-bar { position:absolute; bottom:0; left:0; right:56px; z-index:10; display:flex; align-items:center; gap:10px; padding:0 16px; padding-bottom:env(safe-area-inset-bottom); height:82px; background:linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 100%); cursor:pointer; }*/
    .story-comment-bar { position:absolute; bottom:0; left:0; right:0; z-index:12; display:flex; align-items:center; gap:10px; padding:0 16px; padding-bottom:env(safe-area-inset-bottom,0px); height:82px; background:var(--surface); border-top:1px solid var(--border); cursor:pointer; }
    .story-comment-avatar { width:32px; height:32px; border-radius:50%; background:linear-gradient(135deg,#667eea,#764ba2); display:flex; align-items:center; justify-content:center; color:white; font-size:13px; font-weight:700; flex-shrink:0; overflow:hidden; }
    .story-comment-avatar img { width:100%; height:100%; object-fit:cover; }
    .story-comment-placeholder { color:var(--text-sub); font-size:14px; border:1.5px solid var(--border); border-radius:20px; padding:8px 16px; flex:1; }
    .story-modal.tab-mode .story-close { display: none !important; }
    /* tab-mode: 모달이 이미 헤더 아래에서 시작하므로 safe-area 추가 패딩 불필요 */
    .story-modal.tab-mode .story-progress { padding-top: 8px; }
 /*
    .sheet-input-wrap { border-top:1px solid var(--border); padding:0 16px; padding-bottom:env(safe-area-inset-bottom); height:82px; display:flex; align-items:center; gap:10px; flex-shrink:0; background:var(--surface); }
    .sheet-input-avatar { width:30px; height:30px; border-radius:50%; background:linear-gradient(135deg,#667eea,#764ba2); flex-shrink:0; display:flex; align-items:center; justify-content:center; color:white; font-size:12px; font-weight:700; }
    .sheet-input { flex:1; border:1.5px solid var(--border); border-radius:20px; padding:8px 14px; font-size:14px; font-family:inherit; outline:none; background:var(--surface); color:var(--text); transition:border-color 0.2s; }
    .sheet-input:focus { border-color:var(--blue); }
    .sheet-post-btn { background:none; border:none; cursor:pointer; color:var(--blue); font-size:13.5px; font-weight:700; opacity:0.4; transition:opacity 0.2s, background 0.2s, color 0.2s; white-space:nowrap; padding:6px 12px; border-radius:14px; }
    .sheet-post-btn.active { opacity:1; background:var(--blue); color:white; }
*/
    /* ═══ DM SCREEN ══════════════════════════════ */
    .char-list { flex:1; overflow-y:auto; }
    .char-item { display:flex; align-items:center; gap:14px; padding:12px 16px; cursor:pointer; transition:background 0.15s; border-bottom:1px solid #f5f5f5; }
    .char-item:active { background:#f9f9f9; }

    /* 스와이프 DM 삭제/숨기기 */
    .char-item-wrap { position:relative; overflow:hidden; border-bottom:1px solid #f5f5f5; }
    .char-item { position:relative; background:var(--surface); user-select:none; border-bottom:none; z-index:1; }
    .char-item-actions {
      position:absolute; right:0; top:0; bottom:0;
      display:flex; align-items:stretch; width:0; overflow:hidden;
      transition: width 0.22s cubic-bezier(0.4,0,0.2,1);
      z-index:2;
    }
    .char-item-actions.show-hide { width:72px; }
    .char-item-actions.show-both { width:144px; }
    .char-action-hide, .char-action-delete {
      border:none; font-size:13px; font-weight:600;
      width:72px; min-width:72px; cursor:pointer; color:white; flex-shrink:0;
    }
    .char-action-hide { background:#8e8e93; }
    .char-action-delete { background:#ff3b30; }
    .char-ring { width:58px; height:58px; border-radius:50%; padding:2px; background:var(--story-ring); flex-shrink:0; }
    .char-ring.low  { background:linear-gradient(45deg,#dbdbdb,#dbdbdb); }
    .char-ring.need { background:linear-gradient(45deg,#ff4b4b,#c0392b,#e74c3c); }
    .char-ring.free { background:linear-gradient(45deg,#2ecc71,#27ae60,#1abc9c); }
    .char-ring.busy { background:linear-gradient(45deg,#b0b0b0,#888888,#aaaaaa); }
    .char-ring-inner { width:100%; height:100%; border-radius:50%; background:#efefef; overflow:hidden; display:flex; align-items:center; justify-content:center; font-size:24px; border:2.5px solid white; }
    .char-ring-inner img { width:100%; height:100%; object-fit:cover; }
    .char-info { flex:1; min-width:0; }
    .char-name { font-size:14px; font-weight:600; margin-bottom:3px; }
    .char-preview { font-size:13px; color:var(--text-sub); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .char-meta { display:flex; flex-direction:column; align-items:flex-end; gap:4px; }
    .affinity-bar-wrap { margin-top:4px; width:48px; height:3px; background:#efefef; border-radius:2px; overflow:hidden; }
    .affinity-bar { height:100%; background:linear-gradient(90deg,#f09433,#dc2743); border-radius:2px; transition:width 0.6s ease; }

    /* 채팅 */
    .chat-wrapper { display:none; flex-direction:column; position:fixed; inset:0; background:var(--surface); z-index:50; }
    .chat-wrapper.open { display:flex; }
    .chat-sub-header { display:flex; align-items:center; gap:10px; padding:10px 14px; border-bottom:1px solid var(--border); flex-shrink:0; background:var(--surface); }
    .chat-back { background:none; border:none; font-size:22px; cursor:pointer; color:var(--text); padding:2px 6px 2px 0; }
    .chat-char-avatar { width:36px; height:36px; border-radius:50%; background:#efefef; overflow:hidden; display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; cursor:pointer; }
    .chat-char-avatar img { width:100%; height:100%; object-fit:cover; }
    .chat-char-name { font-size:15px; font-weight:700; }
    .chat-char-sub { font-size:11px; color:var(--text-sub); }
    .affinity-header { background:var(--surface); border-bottom:1px solid var(--border); padding:7px 16px; display:flex; align-items:center; gap:10px; flex-shrink:0; }
    .affinity-label { font-size:11px; color:var(--text-sub); white-space:nowrap; }
    .affinity-track { flex:1; height:5px; background:#efefef; border-radius:3px; overflow:hidden; }
    .affinity-fill { height:100%; background:linear-gradient(90deg,#f09433,#dc2743,#bc1888); border-radius:3px; transition:width 0.8s cubic-bezier(0.34,1.56,0.64,1); }
    .affinity-score { font-size:12px; font-weight:700; color:#dc2743; }
    .affinity-tier { font-size:11px; padding:2px 8px; border-radius:10px; font-weight:600; }
    .tier-cold { background:#e8f4fd; color:#0095f6; }
    .tier-warm { background:#fff0f3; color:#dc2743; }
    .tier-hot  { background:#ffd6dd; color:#bc1888; }
    .chat-messages { flex:1; overflow-y:auto; padding:16px 16px 16px; display:flex; flex-direction:column; gap:6px; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; }
    /* 메시지 버블 포함 전체 영역에서 스크롤 가능하도록 */
    .chat-messages * { touch-action:pan-y; }
    .date-divider { text-align:center; font-size:11px; color:var(--text-sub); margin:8px 0; position:relative; }
    .date-divider::before, .date-divider::after { content:''; position:absolute; top:50%; width:30%; height:1px; background:var(--border); }
    .date-divider::before { left:0; } .date-divider::after { right:0; }
    .msg-row { display:flex; align-items:flex-end; gap:8px; animation:msgIn 0.2s ease both; }
    @keyframes msgIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
    .msg-row.me { flex-direction:row-reverse; }
    .msg-avatar { width:28px; height:28px; border-radius:50%; background:#efefef; overflow:hidden; display:flex; align-items:center; justify-content:center; font-size:14px; flex-shrink:0; align-self:flex-end; }
    .msg-avatar img { width:100%; height:100%; object-fit:cover; }
    .msg-row.me .msg-avatar { display:none; }
    .msg-bubble-wrap { display:flex; flex-direction:column; gap:2px; max-width:72%; }
    .msg-row.me .msg-bubble-wrap { align-items:flex-end; }
    .msg-bubble {
          padding: 10px 14px;
          border-radius: 22px;
          font-size: 14px;
          line-height: 1.5;
          word-break: break-word;
          -webkit-user-select: none;
          user-select: none;
          -webkit-touch-callout: none;
          pointer-events: auto;
          touch-action: pan-y;
        }
    .msg-row.me .msg-bubble { background:#0095f6; color:white; border-bottom-right-radius:6px; }
    .msg-row:not(.me) .msg-bubble { background:#efefef; color:var(--text); border-bottom-left-radius:6px; }
    .msg-time { font-size:10px; color:var(--text-sub); padding:0 4px; }
    .typing-indicator { display:none; align-items:flex-end; gap:8px; padding:0 16px 4px; flex-shrink:0; }
    .typing-indicator.show { display:flex; }
    .typing-avatar { width:28px; height:28px; border-radius:50%; background:#efefef; display:flex; align-items:center; justify-content:center; font-size:14px; }
    .typing-bubble { background:#efefef; border-radius:22px; border-bottom-left-radius:6px; padding:12px 16px; display:flex; gap:4px; align-items:center; }
    .typing-dot { width:7px; height:7px; border-radius:50%; background:#aaa; animation:typingBounce 1.2s infinite ease-in-out; }
    .typing-dot:nth-child(2){animation-delay:.2s} .typing-dot:nth-child(3){animation-delay:.4s}
    @keyframes typingBounce { 0%,60%,100%{transform:translateY(0);opacity:.5} 30%{transform:translateY(-5px);opacity:1} }
    .img-send-btn { background:none; border:none; padding:6px; cursor:pointer; color:var(--text-sub); flex-shrink:0; display:flex; align-items:center; justify-content:center; border-radius:8px; transition:color 0.2s; }
    .img-send-btn:active { color:#0095f6; }
    .img-menu-backdrop { display:none; position:fixed; inset:0; z-index:200; }
    .img-menu-backdrop.open { display:block; }
    .img-menu-sheet { position:fixed; left:50%; bottom:0; width:min(430px,100%); margin-left:min(-215px,-50%); background:var(--surface); border-radius:16px 16px 0 0; z-index:201; transform:translateY(100%); transition:transform 0.28s cubic-bezier(0.32,0.72,0,1); padding-bottom:env(safe-area-inset-bottom); }
    .img-menu-sheet.open { transform:translateY(0); }
    .img-menu-item { display:flex; align-items:center; gap:14px; padding:16px 20px; font-size:15px; cursor:pointer; border-bottom:1px solid var(--border); color:var(--text); -webkit-tap-highlight-color:transparent; }
    .img-menu-item:last-child { border-bottom:none; color:var(--text-sub); }
    .img-menu-item:active { background:#f5f5f5; }
    .img-menu-item svg { width:22px; height:22px; flex-shrink:0; }
    .chat-input-wrap { border-top:1px solid var(--border); padding:0 12px; padding-bottom:env(safe-area-inset-bottom); height:82px; background:#fafafa; display:flex; align-items:center; gap:10px; flex-shrink:0; position:relative; z-index:52; isolation:isolate; }
/* 👇 [추가된 코드] 아이폰 키보드 틈새 비침 방지용 하단 가림막 */
    .chat-input-wrap::after {
      content: '';
      position: absolute;
      top: 100%; /* 입력창 영역 바로 밑에서부터 시작 */
      left: 0;
      right: 0;
      height: 500px; /* 키보드 최대 높이보다 넉넉하게 덮어줌 (화면 밖으로 나감) */
      background: #fafafa; /* 입력창 배경색과 동일하게 맞춰서 일체감 부여 */
      pointer-events: none; /* 화면 밖 영역 터치 방해 금지 */
    }
    /* 👆 [추가된 코드 끝] */
    .chat-input { flex:1; border:1.5px solid var(--border); border-radius:22px; padding:9px 16px; font-size:14px; font-family:inherit; outline:none; background:var(--surface); color:var(--text); transition:border-color 0.2s; resize:none; max-height:68px; overflow-y:auto; }
    .chat-input:focus { border-color:var(--blue); }
    .send-btn { width:36px; height:36px; border-radius:50%; background:var(--blue); border:none; cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0; opacity:0.4; transition:opacity 0.2s,transform 0.1s; }
    .send-btn.active { opacity:1; }
    .send-btn:active { transform:scale(0.9); }
    .send-btn svg { width:18px; height:18px; fill:white; }
    .empty-chat { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; color:var(--text-sub); font-size:14px; padding:40px; }

    /* ═══ CREATE SCREEN ══════════════════════════ */
    .create-screen { flex:1; overflow-y:auto; padding:16px; }
    .create-card { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px; margin-bottom:12px; }
    .create-card h3 { font-size:15px; font-weight:700; margin-bottom:10px; }
    .form-label { font-size:12px; color:var(--text-sub); display:block; margin-bottom:4px; font-weight:500; }
    .form-select, .form-input {
      width:100%; background:#fafafa; border:1px solid var(--border); border-radius:8px;
      padding:9px 12px; font-size:14px; font-family:inherit; color:var(--text);
      margin-bottom:10px; outline:none; transition:border-color 0.2s;
    }
    .form-select:focus, .form-input:focus { border-color:var(--blue); background:white; }
    .form-row { display:flex; gap:12px; }
    .form-row > div { flex:1; }
    .generate-btn {
      width:100%; background:linear-gradient(135deg,#f09433,#dc2743,#bc1888);
      border:none; border-radius:10px; color:white; font-size:15px; font-weight:700;
      padding:13px; cursor:pointer; font-family:inherit; transition:opacity 0.2s,transform 0.1s;
    }
    .generate-btn:active { transform:scale(0.98); }
    .generate-btn:disabled { opacity:0.5; cursor:not-allowed; }
    .result-card { background:var(--surface); border:1px solid var(--border); border-radius:12px; overflow:hidden; margin-bottom:16px; display:none; }
    .result-img { width:100%; aspect-ratio:1; object-fit:cover; background:#efefef; display:flex; align-items:center; justify-content:center; font-size:48px; }
    .result-img img { width:100%; height:100%; object-fit:cover; }
    .result-info { padding:14px; }
    .result-caption { font-size:14px; font-weight:600; margin-bottom:6px; }
    .result-tags { display:flex; flex-wrap:wrap; gap:6px; }
    .result-tag { background:#f0f0f0; border-radius:20px; padding:3px 10px; font-size:12px; color:var(--text-sub); }
    .result-tag.green { background:#e6f4ea; color:#1e7e34; }
    .result-tag.blue  { background:#e3f0fb; color:#0d6efd; }
    .result-tag.pink  { background:#fce4ec; color:#c2185b; }
    .poll-btn { width:100%; background:#f0f0f0; border:none; border-radius:8px; padding:10px; font-size:14px; cursor:pointer; font-family:inherit; margin-top:10px; transition:background 0.2s; }
    .poll-btn:hover { background:#e0e0e0; }
    .create-log { background:#f8f9fa; border:1px solid var(--border); border-radius:8px; padding:12px; font-size:12px; line-height:1.8; font-family:monospace; color:var(--text-sub); margin-top:10px; max-height:200px; overflow-y:auto; }

    /* ═══ PROFILE SCREEN ═════════════════════════ */
    .profile-screen { flex:1; overflow:hidden; display:flex; flex-direction:column; padding-bottom:0; }
    #savedGrid { flex:1; overflow-y:auto; padding-bottom:16px; }
    .profile-header-bg { height:100px; background:var(--story-ring); }
    .profile-info { padding:0 16px 16px; position:relative; }
    .profile-avatar-wrap { position:absolute; top:-36px; left:16px; }
    .profile-avatar { width:72px; height:72px; border-radius:50%; background:white; border:3px solid white; display:flex; align-items:center; justify-content:center; font-size:32px; overflow:hidden; }
    .profile-name-row { padding-top:44px; display:flex; align-items:center; justify-content:space-between; }
    .profile-name { font-size:20px; font-weight:700; }
    .profile-bio { font-size:13px; color:var(--text-sub); margin-top:4px; }
    .affinity-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; padding:0 16px 16px; }
    .affinity-card { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px; }
    .affinity-card-header { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
    .affinity-card-emoji { font-size:28px; }
    .affinity-card-name { font-size:14px; font-weight:700; }
    .affinity-card-job { font-size:11px; color:var(--text-sub); }
    .affinity-card-score { font-size:24px; font-weight:700; color:#dc2743; margin-bottom:4px; }
    .affinity-card-bar { height:4px; background:#efefef; border-radius:2px; overflow:hidden; }
    .affinity-card-fill { height:100%; background:linear-gradient(90deg,#f09433,#dc2743); border-radius:2px; }
    .affinity-card-tier { font-size:11px; color:var(--text-sub); margin-top:4px; }

    /* ═══ SETUP ══════════════════════════════════ */
    .setup-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:300; display:flex; align-items:center; justify-content:center; padding:20px; }
    .setup-box { background:white; border-radius:16px; padding:28px; width:100%; max-width:400px; }
    .setup-box h2 { font-family:'Dancing Script',cursive; font-size:28px; background:var(--story-ring); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; margin-bottom:8px; }
    .setup-box p { font-size:14px; color:var(--text-sub); margin-bottom:20px; }
    .setup-input { width:100%; border:1.5px solid var(--border); border-radius:10px; padding:12px 14px; font-size:14px; font-family:inherit; outline:none; margin-bottom:12px; }
    .setup-input:focus { border-color:var(--blue); }
    .setup-submit { width:100%; background:linear-gradient(135deg,#f09433,#dc2743,#bc1888); border:none; border-radius:10px; color:white; font-size:15px; font-weight:700; padding:13px; cursor:pointer; font-family:inherit; }

    /* ═══ LOADING / EMPTY ════════════════════════ */
    .loading { display:flex; align-items:center; justify-content:center; padding:40px; color:var(--text-sub); gap:10px; font-size:14px; flex-shrink:0; }
    .spinner { width:20px; height:20px; border:2px solid var(--border); border-top-color:var(--text-sub); border-radius:50%; animation:spin 0.8s linear infinite; }
    @keyframes spin { to{transform:rotate(360deg)} }
    .empty { text-align:center; padding:60px 20px; color:var(--text-sub); font-size:14px; }

    /* ═══ SPLASH ═════════════════════════════════ */
    #splashScreen {
      position:fixed; inset:0; z-index:99999;
      padding-top:env(safe-area-inset-top);
      background:var(--surface);
      display:flex; flex-direction:column;
      align-items:center; justify-content:center;
      gap:0;
      transition:opacity 0.5s ease;
    }
    #splashScreen.fade-out { opacity:0; pointer-events:none; }
    .splash-logo {
      font-family:'Dancing Script',cursive; font-size:48px;
      background:var(--story-ring);
      -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
      margin-bottom:12px;
    }
    .splash-status {
      font-size:13px; color:var(--text-sub); margin-top:16px; min-height:20px;
      transition:opacity 0.3s;
    }
    .splash-notif {
      margin-top:20px; display:flex; flex-direction:column; gap:8px; width:260px;
    }
    .splash-notif-item {
      background:#fafafa; border:1px solid var(--border); border-radius:10px;
      padding:10px 14px; font-size:13px; display:flex; align-items:center; gap:10px;
      animation:fadeUp 0.3s ease both;
    }
    .splash-notif-item .notif-emoji { font-size:20px; flex-shrink:0; }

    /* ═══ NOTIFICATIONS SCREEN ════════════════════ */
    /* Bug #8: 알림 헤더 고정 — screen이 flex column, 헤더 sticky */
    .notif-screen { display:flex; flex-direction:column; flex:1; overflow:hidden; }
    .notif-header-bar {
      padding:14px 16px; font-size:16px; font-weight:700;
      border-bottom:1px solid var(--border); background:var(--surface);
      display:flex; align-items:center; justify-content:space-between;
      flex-shrink:0;
    }
    #notifList { flex:1; overflow-y:auto; }
    .notif-read-all {
      font-size:13px; color:var(--blue); font-weight:400; cursor:pointer;
    }
    .notif-section-title {
      font-size:13px; font-weight:700; color:var(--text-sub);
      padding:14px 16px 6px;
    }
    .notif-item {
      display:flex; align-items:center; gap:12px;
      padding:12px 16px; background:var(--surface);
      border-bottom:1px solid var(--border);
      cursor:pointer; transition:background 0.15s;
    }
    .notif-item.unread { background:#fff8f8; }
    .notif-item:active { background:#f0f0f0; }
    .notif-avatar {
      width:46px; height:46px; border-radius:50%;
      background:linear-gradient(135deg,#f09433,#dc2743);
      display:flex; align-items:center; justify-content:center;
      font-size:22px; flex-shrink:0;
    }
    .notif-body { flex:1; }
    .notif-text { font-size:14px; line-height:1.4; color:var(--text); }
    .notif-text strong { font-weight:700; }
    .notif-time { font-size:11px; color:var(--text-sub); margin-top:2px; }
    .notif-action { display:flex; gap:8px; margin-top:8px; justify-content:flex-end; }
    .notif-btn {
      padding:6px 16px; border-radius:8px; font-size:13px; font-weight:600;
      border:none; cursor:pointer; font-family:inherit;
    }
    .notif-btn.accept { background:var(--blue); color:white; }
    .notif-btn.reject { background:#efefef; color:var(--text); }
    .notif-empty { text-align:center; padding:60px 20px; color:var(--text-sub); font-size:14px; }
    .notif-dot-badge {
      position:absolute; top:-2px; right:-2px;
      width:8px; height:8px; background:var(--accent);
      border-radius:50%; border:1.5px solid white;
    }

    /* ═══ CHARACTER PROFILE SCREEN ════════════════ */
    .char-profile-screen {
      position:fixed; inset:0; z-index:260;
      transform:translateX(100%);
      background:var(--bg); display:flex; flex-direction:column;
      transition:transform 0.3s ease;
    }
    .char-profile-screen.open { transform:translateX(0); }
    .char-profile-header {
      display:flex; align-items:center; justify-content:space-between;
      padding:12px 16px; background:var(--surface);
      border-bottom:1px solid var(--border); flex-shrink:0;
      position:relative;
    }
    .char-profile-back { background:none; border:none; font-size:26px; cursor:pointer; padding:2px 6px; color:var(--text); line-height:1; position:relative; z-index:1; }
    .char-profile-username { font-size:16px; font-weight:700; position:absolute; left:50%; transform:translateX(-50%); pointer-events:none; }
    /*.char-profile-body { flex:1; overflow-y:auto; }*/
    .char-profile-body { display:flex; flex-direction:column; flex:1; overflow:hidden !important; }
    /*.char-profile-top { padding:16px; }*/
    .char-profile-top { padding:16px; flex-shrink:0; }
    .char-profile-info-row {
      display:flex; align-items:center; gap:20px; margin-bottom:16px;
    }
    .char-profile-avatar-wrap { position:relative; width:80px; height:80px; flex-shrink:0; cursor:pointer; }
    .char-profile-avatar-big {
      width:80px; height:80px; border-radius:50%;
      background:linear-gradient(135deg,#f09433,#dc2743);
      display:flex; align-items:center; justify-content:center;
      font-size:36px; overflow:hidden;
    }
    .char-profile-avatar-big img { width:100%; height:100%; object-fit:cover; }
    .avatar-edit-badge { position:absolute; bottom:0; right:0; width:22px; height:22px; background:#0095f6; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:12px; border:2px solid white; pointer-events:none; }
    .char-profile-stats { display:flex; gap:16px; flex:1; justify-content:space-around; }
    .char-profile-stat { text-align:center; }
    .char-profile-stat-num { font-size:17px; font-weight:700; }
    .char-profile-stat-label { font-size:11px; color:var(--text-sub); }
    .char-profile-name-block { margin-bottom:10px; }
    .char-profile-name { font-size:15px; font-weight:700; }
    .char-profile-bio { font-size:13px; color:var(--text-sub); margin-top:2px; }
    .char-profile-btns { display:flex; gap:8px; margin-bottom:16px; }
    .char-profile-btn {
      flex:1; padding:9px; border-radius:8px; font-size:14px; font-weight:600;
      border:1.5px solid var(--border); background:var(--surface);
      cursor:pointer; font-family:inherit; text-align:center;
      transition:all 0.15s;
    }
    .char-profile-btn.primary { background:var(--blue); color:white; border-color:var(--blue); }
    .char-profile-btn.following { background:var(--surface); color:var(--text); }
    .char-profile-btn.pending { background:#efefef; color:var(--text-sub); border-color:#efefef; }
    .char-profile-affinity-locked {
      background:#fafafa; border:1px dashed var(--border);
      border-radius:10px; padding:14px; text-align:center;
      color:var(--text-sub); font-size:13px; margin-bottom:12px;
    }
    .char-profile-affinity-locked .lock-icon { font-size:22px; margin-bottom:4px; }
    .char-profile-affinity-open {
      background:var(--surface); border:1px solid var(--border);
      border-radius:10px; padding:14px; margin-bottom:12px;
    }
    .char-profile-affinity-label { font-size:12px; color:var(--text-sub); margin-bottom:6px; font-weight:600; }
    .char-profile-affinity-row { display:flex; align-items:center; gap:10px; }
    .char-profile-affinity-score { font-size:22px; font-weight:700; color:#dc2743; min-width:40px; }
    .char-profile-affinity-bar { flex:1; height:6px; background:#efefef; border-radius:3px; overflow:hidden; }
    .char-profile-affinity-fill { height:100%; background:linear-gradient(90deg,#f09433,#dc2743); border-radius:3px; }
    .char-profile-affinity-tier { font-size:12px; color:var(--text-sub); margin-top:4px; }
    /*.char-profile-posts { border-top:1px solid var(--border); }*/
    .char-profile-posts { display:flex; flex-direction:column; flex:1; overflow:hidden; border-top:1px solid var(--border); }
    /*.char-profile-posts-tabs { display:flex; border-bottom:1px solid var(--border); }*/
    .char-profile-posts-tabs { display:flex; border-bottom:1px solid var(--border); flex-shrink:0; }
    .char-profile-posts-tab { flex:1; padding:12px; text-align:center; cursor:pointer; border-bottom:2px solid transparent; display:flex; align-items:center; justify-content:center; }
    .char-profile-posts-tab svg { stroke:var(--text-sub); }
    .char-profile-posts-tab.active { border-bottom-color:var(--text); }
    .char-profile-posts-tab.active svg { stroke:var(--text); }
    .char-profile-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:2px; }
    .char-profile-grid-item { aspect-ratio:1; background:#efefef; overflow:hidden; cursor:pointer; }
    .char-profile-grid-item img { width:100%; height:100%; object-fit:cover; object-position: 20% center;}
    /* 🔓 호감도 해금 시스템 및 프로필 그리드 스타일 */
    .profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: #dbdbdb; border-top: 1px solid var(--border); }
    .profile-grid-item { aspect-ratio: 1; background: #efefef; overflow: hidden; position: relative; }
    .profile-grid-item img { width: 100%; height: 100%; object-fit: cover; object-position: 20% center;}

    .modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 400; justify-content: center; align-items: flex-end; }
    .modal-backdrop.open { display: flex; }
    .unlock-sheet { background: var(--surface); width: 100%; max-width: 430px; border-radius: 20px 20px 0 0; padding: 0 20px 28px; max-height: 90vh; overflow-y: auto; transform: translateY(100%); transition: transform 0.3s ease; }
    .unlock-sheet.open { transform: translateY(0); }
    .unlock-sheet-handle { width:36px;height:4px;background:#ddd;border-radius:2px;margin:12px auto 16px;cursor:pointer; }
    .follow-list-btn { border:1px solid var(--border); background:var(--surface); border-radius:8px; font-size:13px; font-weight:600; padding:5px 12px; cursor:pointer; color:var(--text); }
    .follow-list-btn.following { background:var(--text); color:white; border-color:var(--text); }
    .follow-list-btn.unfollow { background:white; color:#ff3b30; border-color:#ff3b30; }

    .follower-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
    .follower-item img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
    /* ═══ SECRET INFO PAGE ═══════════════════════ */
    #secretInfoContent { padding: 0 !important; background: var(--bg); }

    /* 히어로 헤더 영역 */
    .si-hero {
      position: relative;
      background: #111;
      overflow: hidden;
      min-height: 220px;
      display: flex; flex-direction: column; justify-content: flex-end;
    }
    .si-hero-bg {
      position: absolute; inset: 0;
      background-size: cover; background-position: 20% center;
      filter: blur(18px) brightness(0.4) saturate(1.2);
      transform: scale(1.1);
    }
    .si-hero-content {
      position: relative; z-index: 1;
      padding: 20px 20px 18px;
      display: flex; flex-direction: column; align-items: center;
    }
    .si-avatar {
      width: 84px; height: 84px; border-radius: 50%;
      border: 3px solid white;
      object-fit: cover;
      box-shadow: 0 4px 16px rgba(0,0,0,0.4);
      margin-bottom: 10px;
      background: linear-gradient(135deg, #f09433, #dc2743);
      display: flex; align-items: center; justify-content: center;
      font-size: 38px; overflow: hidden;
    }
    .si-avatar img { width:100%; height:100%; object-fit:cover; border-radius:50%; }
    .si-name {
      color: white; font-size: 18px; font-weight: 700;
      text-shadow: 0 1px 6px rgba(0,0,0,0.5);
      margin-bottom: 4px; letter-spacing: -0.3px;
    }
    .si-job {
      color: rgba(255,255,255,0.75); font-size: 12px;
      margin-bottom: 14px;
    }
    /* 호감도 게이지 */
    .si-gauge-wrap { width: 100%; }
    .si-gauge-meta {
      display: flex; justify-content: space-between;
      color: rgba(255,255,255,0.7); font-size: 11px; margin-bottom: 5px;
    }
    .si-gauge-meta strong { color: white; font-size: 13px; }
    .si-gauge-track {
      height: 6px; background: rgba(255,255,255,0.2);
      border-radius: 3px; overflow: hidden;
    }
    .si-gauge-fill {
      height: 100%;
      background: linear-gradient(90deg, #f09433, #e6683c, #dc2743, #cc2366);
      border-radius: 3px;
      transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .si-tier-badge {
      display: inline-flex; align-items: center; gap: 4px;
      background: rgba(255,255,255,0.15); backdrop-filter: blur(8px);
      border: 1px solid rgba(255,255,255,0.2);
      border-radius: 20px; padding: 3px 10px;
      color: white; font-size: 11px; font-weight: 600;
      margin-top: 10px;
    }

    /* 섹션 컨테이너 */
    .si-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

    .si-section {
      background: white;
      border-radius: 16px;
      border: 1px solid #f0f0f0;
      overflow: hidden;
    }
    .si-section-title {
      font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
      color: var(--text-sub); text-transform: uppercase;
      padding: 12px 16px 0;
    }
    .si-section.si-secret-section .si-section-title {
      background: linear-gradient(135deg, #fff0f5, #ffeef2);
      color: #e891b8;
      padding: 12px 16px 8px;
      margin: 0;
    }

    /* 정보 행 */
    .si-row {
      display: flex; align-items: center; justify-content: space-between;
      padding: 13px 16px;
      border-bottom: 1px solid #f8f8f8;
      gap: 10px;
    }
    .si-row:last-child { border-bottom: none; }
    .si-row-left {
      display: flex; align-items: center; gap: 9px;
      color: var(--text-sub); font-size: 13px; flex-shrink: 0;
    }
    .si-row-icon { font-size: 16px; width: 20px; text-align: center; }
    .si-row-val {
      font-size: 14px; font-weight: 600; color: var(--text);
      text-align: right; word-break: break-word; line-height: 1.4; flex: 1;
      max-width: 65%;
    }
    .si-row-val.locked {
      filter: blur(6px); user-select: none; color: #bbb;
    }
    .si-row-val.lock-label {
      filter: none; color: var(--text-sub); font-weight: 400;
      font-size: 12px;
    }
    .si-row-val.accent { color: #dc2743; }
    .si-row-val.warn { color: #ff8f00; }

    /* 은밀한 비밀 카드 */
    .si-secret-card {
      margin: 0; padding: 14px 16px;
      background: linear-gradient(135deg, #fff0f5, #ffeef2);
    }
    .si-secret-label {
      font-size: 11px; font-weight: 700; color: #cc2366;
      letter-spacing: 0.5px; margin-bottom: 6px;
      display: flex; align-items: center; gap: 4px;
    }
    .si-secret-text {
      font-size: 13px; line-height: 1.65; color: #333;
    }
    .si-secret-text.locked {
      filter: blur(7px); user-select: none; color: #999;
    }
    .si-lock-placeholder {
      display: flex; align-items: center; gap: 8px;
      padding: 12px 16px; color: var(--text-sub); font-size: 13px;
    }
    .si-lock-placeholder .lock-icon { font-size: 18px; }

    /* 상태 칩 그리드 */
    .si-status-grid {
      display: grid; grid-template-columns: 1fr 1fr;
      gap: 1px; background: #f0f0f0;
    }
    .si-status-cell {
      background: white; padding: 12px 14px;
      display: flex; flex-direction: column; gap: 3px;
    }
    .si-status-cell-label {
      font-size: 10px; color: var(--text-sub);
      text-transform: uppercase; letter-spacing: 0.3px;
    }
    .si-status-cell-val {
      font-size: 14px; font-weight: 600; color: var(--text);
    }

    /* 비밀사진 섹션 */
    .si-photo-grid {
      display: grid; grid-template-columns: 1fr 1fr;
      gap: 8px; padding: 12px 16px 16px;
    }
    .si-photo-slot {
      aspect-ratio: 9/16; border-radius: 12px;
      overflow: hidden; position: relative; cursor: pointer;
      background: #f0f0f0;
    }
    .si-photo-slot img { width:100%; height:100%; object-fit:cover; }
    .si-photo-badge {
      position: absolute; bottom: 7px; right: 7px;
      background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
      color: white; font-size: 10px; font-weight: 600;
      padding: 3px 8px; border-radius: 10px;
    }
    .si-photo-empty {
      aspect-ratio: 9/16; border-radius: 12px;
      border: 2px dashed #e0e0e0;
      display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      gap: 5px; color: #ccc;
    }
    .si-photo-empty span:first-child { font-size: 26px; }
    .si-photo-empty span { font-size: 11px; }

    /* 임신/산후 배너 */
    .si-pregnancy-banner {
      margin: 0 16px;
      border-radius: 12px; padding: 12px 14px;
      background: linear-gradient(135deg, #fff0f5, #ffe4ef);
      border: 1px solid #ffd6e7;
      display: flex; align-items: center; gap: 10px;
    }
    .si-pregnancy-banner .banner-icon { font-size: 22px; }
    .si-pregnancy-banner .banner-text { flex: 1; }
    .si-pregnancy-banner .banner-title {
      font-size: 12px; font-weight: 700; color: #cc2366;
    }
    .si-pregnancy-banner .banner-sub {
      font-size: 12px; color: #666; margin-top: 1px;
    }

    /* 레거시 호환 (다른 곳에서 쓸 수도 있어서 남겨둠) */
    .unlock-row { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid #f8f8f8; font-size: 14px; }
    .unlock-row.locked { color: #ccc; }
    .unlock-row.locked .val { filter: blur(5px); }
    .val { font-weight: 600; color: var(--text); max-width: 60%; text-align: right; word-break: break-word; white-space: normal; line-height: 1.4; }
    .heart-gauge { height: 8px; background: #eee; border-radius: 4px; margin: 10px 0 20px; overflow: hidden; }
    .heart-gauge-fill { height: 100%; background: linear-gradient(90deg, #ff7eb3, #ff758c); transition: width 1s ease; }
    .char-profile-locked-posts {
      text-align:center; padding:60px 20px; color:var(--text-sub);
    }
    .char-profile-locked-posts .lock-big { font-size:40px; margin-bottom:10px; }
    /* ═══ 개선된 슬라이드 애니메이션 (눈 아픔 방지) ═══ */
        
        /* 1. 애니메이션 시간 0.3s -> 0.45s로 늘림 (너무 빠르면 어지러움) */
        /* 2. cubic-bezier(0.19, 1, 0.22, 1) -> 아이폰 스크롤 같은 감속 효과 */
        .slide-anim-up-enter {
            animation: slideInUp 0.45s cubic-bezier(0.19, 1, 0.22, 1) forwards;
        }
        .slide-anim-down-enter {
            animation: slideInDown 0.45s cubic-bezier(0.19, 1, 0.22, 1) forwards;
        }
    .slide-anim-down-enter { animation: slideInDown 0.3s ease forwards; }
    .slide-anim-down-exit { animation: slideOutDown 0.3s ease forwards; }

    /* 올라올 때 투명도를 0.8부터 시작해서 눈부심 방지 */
    @keyframes slideInUp {
        from { transform: translateY(100%); opacity: 0.8; }
        to { transform: translateY(0); opacity: 1; }
    }
    
    /* 내려올 때도 동일 */
    @keyframes slideInDown {
        from { transform: translateY(-100%); opacity: 0.8; }
        to { transform: translateY(0); opacity: 1; }
    }
    @keyframes slideInDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }
    @keyframes slideOutDown { from { transform: translateY(0); } to { transform: translateY(100%); } }

    /* 애니메이션 컨테이너 최적화 */
    .post-detail-img-outer {
        will-change: transform, opacity;
        background: #000; /* 배경을 완전 검정으로 고정 */
    }
    
    /* 뒤쪽 배경이 절대 흰색으로 보이지 않게 처리 */
    .detail-slider-container {
        background: #000 !important;
    }id="postDetailScreen
      
      /* [수정] 제자리에서 빠르게 사라지는 효과 */
      .fade-out-quick {
          animation: fadeOutQuick 0.25s ease-out forwards !important;
      }

      @keyframes fadeOutQuick {
          from { opacity: 1; transform: scale(1); }
          to { opacity: 0; transform: scale(0.95); } /* 살짝 작아지면서 사라짐 */
      }

      /* 기존 post-detail-screen 배경은 다시 완전 검정 또는 #fafafa로 (취향껏) */
      .post-detail-screen {
          /* ... 기존 속성들 ... */
          background: #000; /* 깔끔하게 검정 유지 */
      }
      /* ═══ 스토리 뷰어 그룹/슬라이드 전환 애니메이션 ═══ */
      .story-content.sv-slide-up    { animation: svSlideUp   0.35s cubic-bezier(0.19,1,0.22,1) forwards; }
      .story-content.sv-slide-down  { animation: svSlideDown 0.35s cubic-bezier(0.19,1,0.22,1) forwards; }
      .story-content.sv-slide-left  { animation: svSlideLeft 0.28s cubic-bezier(0.19,1,0.22,1) forwards; }
      .story-content.sv-slide-right { animation: svSlideRight 0.28s cubic-bezier(0.19,1,0.22,1) forwards; }
      @keyframes svSlideUp    { from { transform:translateY(100%);  opacity:0.8; } to { transform:translateY(0); opacity:1; } }
      @keyframes svSlideDown  { from { transform:translateY(-100%); opacity:0.8; } to { transform:translateY(0); opacity:1; } }
      @keyframes svSlideLeft  { from { transform:translateX(40%);   opacity:0.5; } to { transform:translateX(0); opacity:1; } }
      @keyframes svSlideRight { from { transform:translateX(-40%);  opacity:0.5; } to { transform:translateX(0); opacity:1; } }

      /* ═══ 복사 메뉴 (Context Menu) ═══ */
          .copy-menu {
            position: fixed;
            z-index: 99999; /* 최상위 */
            background: rgba(30, 30, 30, 0.95);
            color: white;
            padding: 10px 18px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            display: none; /* 평소엔 숨김 */
            box-shadow: 0 4px 15px rgba(0,0,0,0.3);
            cursor: pointer;
            backdrop-filter: blur(4px);
          }
          .copy-menu:active { background: rgba(0,0,0,1); }
          /* 복사 메뉴 스타일 */
          .context-menu-overlay {
            display: none;
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.5);
            z-index: 9999;
            align-items: center;
            justify-content: center;
            pointer-events: auto; /* 터치 이벤트 받음 */
          }
          .context-menu-btn {
            background: white;
            color: black;
            padding: 16px 32px;
            border-radius: 12px;
            font-weight: 600;
            font-size: 16px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.2);
            cursor: pointer;
            transform: scale(1);
            transition: transform 0.1s;
            /* 👇 [추가] 텍스트 선택 및 시스템 메뉴 차단 👇 */
            -webkit-user-select: none;
            user-select: none;
            -webkit-touch-callout: none;
          }
          .context-menu-btn:active { transform: scale(0.95); }
          .context-menu-wrap {
            display: flex;
            flex-direction: column;
            gap: 48px;
          }
          .context-menu-btn--delete {
            color: #ed4956;
          }

/* ═══════════════════════════════════════════════════════════
   디버그 탭 스타일 (Phase 1.1)
   ═══════════════════════════════════════════════════════════ */
.debug-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0a0a0a;
  color: #e0e0e0;
  font-size: 13px;
}

.debug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  background: #111;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

.debug-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.debug-badge {
  background: #333;
  color: #aaa;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 400;
}

.debug-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.debug-toggle-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #888;
  cursor: pointer;
}

.debug-console {
  background: #0d0d0d;
  border-bottom: 1px solid #1e1e1e;
  padding: 6px 12px;
  font-size: 11px;
  font-family: monospace;
  height: 60px;
  overflow-y: auto;
  flex-shrink: 0;
  color: #ccc;
  line-height: 1.6;
}

.debug-tabs {
  display: flex;
  overflow-x: auto;
  background: #111;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
  scrollbar-width: none;
}
.debug-tabs::-webkit-scrollbar { display: none; }

.debug-tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: #666;
  padding: 8px 2px;
  font-size: 11px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-align: center;
}
.debug-tab-btn.active {
  color: #fff;
  border-bottom-color: #0af;
}

.debug-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.debug-section {
  padding: 12px;
  overflow-x: hidden;
  box-sizing: border-box;
  width: 100%;
}

/* 캐릭터 카드 */
.debug-char-card {
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.debug-char-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.debug-char-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-right: 4px;
}

.debug-chip {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 12px;
  font-weight: 600;
}

.debug-chip-event {
  background: #1a1a3a;
  color: #88aaff;
  border: 1px solid #334;
}

.debug-chip-pregnant {
  background: #2a1a1a;
  color: #ff8888;
  border: 1px solid #433;
}

.debug-char-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.debug-stat {
  background: #1a1a1a;
  border-radius: 6px;
  padding: 4px 8px;
  min-width: 60px;
}

.debug-stat-label {
  font-size: 10px;
  color: #666;
  margin-bottom: 1px;
}

.debug-stat-val {
  font-size: 12px;
  color: #ddd;
  font-weight: 600;
}

/* 욕구 바 */
.debug-needs {
  margin-top: 6px;
}

.debug-need-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.debug-need-label {
  width: 30px;
  font-size: 10px;
  color: #888;
  text-align: right;
  flex-shrink: 0;
}

.debug-need-bar-wrap {
  flex: 1;
  height: 5px;
  background: #1e1e1e;
  border-radius: 3px;
  overflow: hidden;
}

.debug-need-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.debug-need-val {
  width: 24px;
  font-size: 10px;
  font-weight: 700;
  text-align: right;
  flex-shrink: 0;
}

/* 일정 목록 */
.debug-sched-list {
  margin-top: 8px;
  border-top: 1px solid #222;
  padding-top: 6px;
}

.debug-sched-title {
  font-size: 11px;
  color: #666;
  margin-bottom: 4px;
}

.debug-sched-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 2px 0;
  color: #ccc;
}

.debug-sched-item.done {
  color: #555;
  text-decoration: line-through;
}

.debug-babies {
  margin-top: 6px;
  font-size: 11px;
  color: #f9a;
}

/* 트리거 그리드 */
.debug-group-title {
  font-size: 11px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.debug-trigger-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.debug-trigger-btn {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #ccc;
  padding: 8px 4px;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  line-height: 1.4;
  transition: background 0.15s;
}

.debug-trigger-btn:active {
  background: #252525;
}

.debug-trigger-btn small {
  font-size: 9px;
  color: #666;
}

.debug-trigger-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.debug-trigger-label {
  font-size: 11px;
  color: #888;
  width: 80px;
  min-width: 80px;
  flex-shrink: 0;
}

.debug-select {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #ddd;
  padding: 5px 6px;
  border-radius: 6px;
  font-size: 11px;
  flex: 1;
  min-width: 0;
  max-width: 120px;
  box-sizing: border-box;
}

.debug-input {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #ddd;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  box-sizing: border-box;
  min-width: 0;
}

.debug-input-num {
  width: 60px;
  flex-shrink: 0;
}

.debug-slider {
  flex: 1;
  accent-color: #0af;
}

.debug-needs-editor {
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 10px;
}

/* 버튼 스타일 */
.debug-btn-sm {
  background: #1e1e1e;
  border: 1px solid #333;
  color: #ccc;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
}

.debug-btn-primary {
  background: #0a3a5a;
  border: 1px solid #0af;
  color: #0af;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}

.debug-btn-primary:active {
  background: #0a4a6a;
}

.debug-btn-accent {
  background: #2a2a00;
  border: 1px solid #aa8800;
  color: #ffcc00;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}

.debug-btn-danger {
  background: #2a0000;
  border: 1px solid #880000;
  color: #ff4444;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}

/* 시뮬레이션 결과 */
.debug-sim-result {
  margin-top: 10px;
}

.debug-sim-box {
  background: #0a1a0a;
  border: 1px solid #0a4a0a;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.8;
  color: #aaa;
}

.debug-hint {
  font-size: 11px;
  color: #555;
  margin-bottom: 10px;
  line-height: 1.5;
}

/* 크론 로그 */
.debug-cron-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.debug-cron-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: #141414;
  border-radius: 6px;
  font-size: 11px;
}

.debug-cron-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.debug-cron-name {
  width: 140px;
  color: #ccc;
  font-family: monospace;
  font-size: 11px;
  flex-shrink: 0;
}

.debug-cron-time {
  width: 80px;
  color: #666;
  font-size: 10px;
  flex-shrink: 0;
}

.debug-cron-detail {
  flex: 1;
  color: #555;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 테이블 */
.debug-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.debug-table th {
  background: #1a1a1a;
  color: #888;
  padding: 5px 8px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid #2a2a2a;
  white-space: nowrap;
}

.debug-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #1a1a1a;
  color: #ccc;
  vertical-align: middle;
}

.debug-table tr:last-child td {
  border-bottom: none;
}

/* 생성 로그 */
.debug-gen-summary {
  display: flex;
  gap: 16px;
  padding: 10px;
  background: #141414;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}

.debug-gen-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* NSFW 모드 */
.nsfw-mode #chatMessages {
  background: linear-gradient(180deg, #fff0f5 0%, #fff8fb 100%);
}
.nsfw-mode .chat-sub-header {
  background: linear-gradient(90deg, #ff758c 0%, #ff7eb3 100%) !important;
}
.nsfw-mode .chat-char-name,
.nsfw-mode .chat-char-sub,
.nsfw-mode .chat-back {
  color: white !important;
}
.nsfw-mode .typing-indicator { background: #fff8fb; }
/* .chat-input-wrap 는 기존 #fafafa 유지 — NSFW 오버라이드 없음 */

/* 1. 스토리 탭 모드일 때 하단 댓글창 숨기기 */
.story-modal.tab-mode .story-comment-bar {
    display: none !important;
}

/* 2. 캐릭터 프로필 하단 사진 그리드 영역 전용 스크롤 설정 */
#charProfileGrid {
    flex: 1;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom);
}

/* 2. 팝업 창이 위아래로 화면 끝에서 끝까지 길게 늘어나는 버그 완벽 해결 */
.post-menu {
    height: max-content !important; /* 강제로 늘어나지 않고 딱 내용물(수정,삭제) 크기만큼만 유지 */
}

/* 3. 캡션 텍스트 입력 창도 혹시 늘어난다면 딱 맞게 고정 */
.caption-edit-box {
    height: max-content !important;
}

/* 1. 하트 버튼 자체의 아래 여백을 늘려서 전체 간격을 벌림 */
#storyActionLike {
    margin-bottom: -12px !important;
}

/*로고*/
.version-logo-style {
  font-family: 'Dancing Script', cursive;
  font-size: 26px; /* 스플래시보다 조금 작게 조정 */
  background: var(--story-ring);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 5px;
}

/* ═══ 출생신고서 ═══════════════════════════════════════════════ */
.birth-doc-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.78);
  z-index: 99999; display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: bdFadeIn 0.2s ease;
}
@keyframes bdFadeIn { from { opacity:0; } to { opacity:1; } }

.birth-doc-wrap {
  background: #f5f0e0;
  width: 100%; max-width: 400px; max-height: 88vh; overflow-y: auto;
  border-radius: 3px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(0,0,0,0.12);
  font-family: 'Noto Sans KR', 'Batang', serif;
  position: relative;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 24px, rgba(0,0,0,0.04) 24px, rgba(0,0,0,0.04) 25px),
    repeating-linear-gradient(90deg, transparent, transparent 24px, rgba(0,0,0,0.02) 24px, rgba(0,0,0,0.02) 25px);
}

/* 헤더 빨간 줄 */
.birth-doc-header {
  background: #b71c1c;
  padding: 12px 16px 10px;
  color: white; text-align: center; position: relative;
  border-bottom: 3px solid #7f0000;
}
.birth-doc-header-top {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-bottom: 4px;
}
.birth-doc-country {
  font-size: 12px; font-weight: 700; letter-spacing: 3px; opacity: 0.88;
}
.birth-doc-title {
  font-size: 21px; font-weight: 900; letter-spacing: 8px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  font-family: 'Noto Sans KR', serif;
}
.birth-doc-number {
  font-size: 9px; opacity: 0.75; letter-spacing: 0.5px; margin-top: 5px;
}
/* 엠블럼 테두리 */
.birth-doc-emblem {
  width: 26px; height: 26px;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900;
  color: rgba(255,255,255,0.9);
}

/* 탭 (쌍둥이) */
.birth-doc-tabs {
  display: flex; background: #ece6d0;
  border-bottom: 1.5px solid rgba(0,0,0,0.18);
}
.birth-doc-tab {
  flex: 1; padding: 8px 4px; text-align: center;
  font-size: 11px; font-weight: 500; color: #666;
  cursor: pointer; border: none; background: none;
  border-bottom: 2.5px solid transparent;
  transition: all 0.18s; font-family: inherit;
}
.birth-doc-tab.active {
  color: #b71c1c; border-bottom-color: #b71c1c;
  background: #f5f0e0; font-weight: 700;
}

/* 본문 */
.birth-doc-body { padding: 10px 14px 4px; }

.birth-doc-section-title {
  font-size: 10px; font-weight: 700; color: #7f0000;
  letter-spacing: 1.5px; margin: 10px 0 5px;
  display: flex; align-items: center; gap: 5px;
}
.birth-doc-section-title::before { content: '■'; font-size: 7px; }

/* 표 */
.birth-doc-table {
  width: 100%; border-collapse: collapse;
  border: 1.5px solid rgba(0,0,0,0.28);
  font-size: 12px; margin-bottom: 2px;
}
.birth-doc-table td {
  border: 1px solid rgba(0,0,0,0.2);
  padding: 7px 9px; vertical-align: middle;
}
.birth-doc-table td:first-child {
  background: rgba(183,28,28,0.06);
  font-weight: 700; width: 80px; text-align: center;
  letter-spacing: 2px; white-space: nowrap;
  color: #333; font-size: 10px; line-height: 1.6;
}
.birth-doc-table input {
  width: 100%; border: none; background: transparent;
  font-family: inherit; font-size: 13px; color: #111;
  padding: 0 0 2px; outline: none;
  border-bottom: 1.5px solid #b71c1c;
  -webkit-appearance: none;
}
.birth-doc-table input::placeholder { color: #bbb; font-size: 11px; }
.birth-doc-table .bd-val {
  font-size: 12px; color: #222; letter-spacing: 0.3px;
}

/* 도장 + 서명 푸터 */
.birth-doc-footer {
  padding: 8px 14px 10px;
  display: flex; justify-content: space-between; align-items: flex-end;
  border-top: 1px dashed rgba(0,0,0,0.15); margin-top: 8px;
}
.birth-doc-sign {
  font-size: 10px; color: #555; line-height: 1.8;
}
.birth-doc-sign strong { font-size: 11px; color: #333; }

.birth-doc-stamp-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.birth-doc-stamp {
  width: 62px; height: 62px;
  filter: drop-shadow(0 1px 3px rgba(183,28,28,0.3));
  opacity: 0.88;
  transform: rotate(-6deg);
}
.birth-doc-stamp-label {
  font-size: 8px; color: #aaa; letter-spacing: 1px;
  transform: rotate(-6deg); margin-top: -2px;
}

/* 버튼 */
.birth-doc-btns {
  display: flex; gap: 8px; padding: 0 14px 16px;
}
.birth-doc-btn-cancel {
  flex: 1; padding: 11px; border-radius: 3px;
  border: 1.5px solid rgba(0,0,0,0.22); background: transparent;
  font-size: 12px; color: #666; cursor: pointer;
  font-family: inherit; letter-spacing: 0.5px;
}
.birth-doc-btn-submit {
  flex: 2; padding: 11px; border-radius: 3px;
  border: none; background: #b71c1c;
  font-size: 13px; color: white; font-weight: 700;
  cursor: pointer; font-family: inherit; letter-spacing: 3px;
  transition: opacity 0.15s;
}
.birth-doc-btn-submit:active { opacity: 0.82; }
.birth-doc-btn-submit:disabled { background: #999; cursor: not-allowed; letter-spacing: 0; }

/* 워터마크 */
.birth-doc-watermark {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; opacity: 0.05; z-index: 0;
}
.birth-doc-watermark svg text {
  font-size: 52px; font-weight: 900; fill: #333;
  font-family: 'Noto Sans KR', serif;
}

/* ═══ 가로 모드 차단 오버레이 ════════════════════════════════════ */
#landscapeBlock {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #111;
  align-items: center;
  justify-content: center;
}
#landscapeBlockInner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
@media screen and (orientation: landscape) {
  #landscapeBlock {
    display: flex;
  }
}
