/* ========================================================
   스토리팝콘 개편 화면 (기획 요청 16·20번)
   휴대폰: 화면 전체가 위로 넘기는 피드. 큰 화면: 왼쪽 소개 + 가운데 9:16 화면
   디자인 원칙 (2026-10-13):
   - 누르는 순간 반응합니다 (scale 0.97). 서버 응답을 기다리지 않습니다.
   - 움직임은 transform·opacity만, 강한 ease-out 곡선, 300ms 안팎. 들어온 길로 나갑니다.
   - 떠 있는 요소(메뉴·버튼·위쪽 줄)는 반투명 재질로, 뒤의 내용이 비칩니다.
   - 자주 쓰는 동작(탭 바꾸기·키보드)은 움직이지 않습니다.
   ======================================================== */
:root {
  --pink: #ff2a85;
  --yellow: #ffea00;
  --cyan: #00e5ff;
  --ink: #ffffff;
  --muted: #a6abc0;
  --line: rgba(255, 255, 255, 0.12);
  --hairline: rgba(255, 255, 255, 0.08);
  --card: #15161e;
  --card2: #1f2130;
  --field: #0e0f15;
  --sheet-bg: #0d0d13;
  --top-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* 움직임 곡선: 들어오고 나가는 것은 ease-out, 화면 안에서 움직이는 것은 ease-in-out, 시트는 iOS 서랍 곡선 */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  /* 반투명 재질 */
  --glass: rgba(18, 19, 26, 0.62);
  --glass-light: rgba(255, 255, 255, 0.14);
  --glass-edge: inset 0 0.5px 0 rgba(255, 255, 255, 0.22);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  background: #000;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Hiragino Sans", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; -webkit-user-select: none; user-select: none; }
a { color: inherit; }
button, a, [data-open] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.9); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* ---------- 틀 ---------- */
.app { height: 100vh; height: 100dvh; display: flex; justify-content: center; }
.side { display: none; }
.phone { position: relative; width: 100%; height: 100%; overflow: hidden; background: #000; isolation: isolate; }
main { position: absolute; inset: 0; }
.pane { position: absolute; inset: 0; }

@media (min-width: 900px) {
  .app {
    align-items: center;
    gap: 64px;
    padding: 24px;
    background: radial-gradient(1200px 700px at 15% 20%, rgba(255, 42, 133, 0.16), transparent 60%),
                radial-gradient(900px 600px at 85% 90%, rgba(255, 234, 0, 0.08), transparent 60%), #07070b;
  }
  .side { display: flex; flex-direction: column; gap: 24px; width: 360px; }
  .phone {
    flex: none;
    height: min(calc(100dvh - 48px), 920px);
    width: calc(min(calc(100dvh - 48px), 920px) * 9 / 16);
    border-radius: 34px;
    /* 바깥 테두리 한 줄 + 위에서 비치는 빛 + 깊은 그림자 */
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.06),
                0 40px 100px -20px rgba(0, 0, 0, 0.75), 0 12px 30px rgba(0, 0, 0, 0.35);
  }
}

/* ---------- 왼쪽 소개 (큰 화면) ---------- */
.side-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 800; font-size: 22px; letter-spacing: -0.01em; }
.side-brand img { width: 64px; height: 64px; }
.side-aka { margin-top: -16px; font-size: 13px; color: var(--muted); }
.side-title { font-size: 40px; line-height: 1.16; font-weight: 800; white-space: pre-line; letter-spacing: -0.03em; }
.steps { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; line-height: 1.5; color: #e4e6f0; }
.steps b { flex: none; width: 36px; height: 36px; border-radius: 11px; background: rgba(255, 255, 255, 0.07); box-shadow: var(--glass-edge); display: grid; place-items: center; font-size: 18px; }
.side-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.side-links { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.side-links a { color: var(--muted); text-decoration: none; transition: color 160ms ease; }

/* ---------- 버튼 · 칩 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 18px; border-radius: 12px; font-weight: 700; background: rgba(255, 255, 255, 0.12); box-shadow: var(--glass-edge); text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--pink); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 18px rgba(255, 42, 133, 0.28); }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn.google { background: #fff; color: #111; }
.btn:disabled { opacity: 0.5; cursor: default; }
.chip { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.10); font-weight: 700; font-size: 13px; }
.chip.active { background: #fff; color: #000; }
.chip.ghost { background: transparent; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 800; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.seg-btn { padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--muted); }
.seg-btn.active { background: #fff; color: #000; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); }

/* 누르는 순간의 반응: 모든 누를 수 있는 것은 살짝 줄어듭니다 (서버를 기다리지 않음) */
.btn, .chip, .seg-btn, .icon-btn, .me-btn, .plaza-btn, .tab, .mini, .menu-item, .thread-card, .rail-btn .ico {
  transition: transform 160ms var(--ease-out), background-color 160ms ease, color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.btn:active, .chip:active, .seg-btn:active, .icon-btn:active, .me-btn:active, .plaza-btn:active, .mini:active, .menu-item:active, .tab:active { transform: scale(0.97); }
.thread-card:active { transform: scale(0.985); }
.rail-btn:active .ico { transform: scale(0.94); }
.btn:disabled:active { transform: none; }

/* 마우스를 올렸을 때만 (터치에서는 눌린 채로 남지 않게) */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background-color: rgba(255, 255, 255, 0.18); }
  .btn.primary:hover { background-color: #ff4a98; }
  .btn.google:hover { background-color: #f1f1f4; }
  .icon-btn:hover { background-color: rgba(255, 255, 255, 0.08); }
  .menu-item:hover { background-color: rgba(255, 255, 255, 0.07); }
  .thread-card:hover { border-color: rgba(255, 255, 255, 0.24); }
  .side-links a:hover { color: #fff; }
  .tab:hover { color: rgba(255, 255, 255, 0.85); }
}

/* ---------- 위쪽 줄: 로고 · 탭 · 계정 ---------- */
.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--top-h) + var(--safe-top));
  padding: var(--safe-top) 10px 0;
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.top-logo img { display: block; width: 34px; height: 34px; }
.tabs { position: relative; flex: 1; min-width: 0; display: flex; justify-content: safe center; gap: clamp(10px, 3.4vw, 18px); }
/* 굵기는 같게 두고 색만 바꿔 글자 폭이 흔들리지 않게 합니다 */
.tab { padding: 10px 2px; white-space: nowrap; font-weight: 800; font-size: clamp(14px, 4vw, 17px); letter-spacing: -0.01em; color: rgba(255, 255, 255, 0.58); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.tab.active { color: #fff; }
/* 탭 밑줄 하나가 고른 탭으로 미끄러집니다 (처음 자리 잡을 때는 움직이지 않음) */
.tab-ink { position: absolute; left: 0; bottom: 3px; width: 20px; height: 3px; border-radius: 2px; background: #fff; opacity: 0; pointer-events: none; }
.tab-ink.ready { opacity: 1; transition: transform 240ms var(--ease-out); }
.me-btn { flex: none; max-width: 112px; padding: 6px 11px; border-radius: 999px; background: var(--glass-light); -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%); box-shadow: var(--glass-edge); font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 계정 버튼: [언어 코드] + (로그아웃이면 '로그인' 글자, 로그인했거나 좁은 화면이면 사람 아이콘) */
.me-ico { display: none; }
.me-btn[data-in] .me-ico { display: inline; }
.me-btn[data-in] .me-text { display: none; }
@media (max-width: 420px) { .me-ico { display: inline; } .me-text { display: none; } }
.me-lang { display: inline-block; margin-right: 5px; padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.2); font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; vertical-align: 1px; }
.plaza-btn {
  flex: none; position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 18px;
  background: var(--glass-light); -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%); box-shadow: var(--glass-edge);
}
.plaza-btn .live-n {
  position: absolute; top: -3px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--pink); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}
/* 쓰기 탭: 글 목록이 위쪽 줄 밑으로 비쳐 지나갑니다 */
.app[data-tab="write"] .top {
  background: rgba(11, 11, 16, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 1px 0 var(--hairline);
}

.lang-hint {
  position: absolute; z-index: 30; top: calc(var(--top-h) + var(--safe-top) + 14px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 999px;
  background: rgba(24, 25, 34, 0.78); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--glass-edge), 0 10px 30px rgba(0, 0, 0, 0.35); font-size: 13px; font-weight: 600; white-space: nowrap;
}

/* ---------- 넘기는 피드 (웹툰 · 영상) ---------- */
.feed { overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior-y: contain; scrollbar-width: none; }
.feed::-webkit-scrollbar { display: none; }
.cut { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: #000; }
.cut-media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.cut-media img { width: 100%; height: 100%; object-fit: contain; }
.cut-shade { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: linear-gradient(transparent, rgba(0, 0, 0, 0.35) 40%, rgba(0, 0, 0, 0.8)); pointer-events: none; }

/* 이미지가 아직 없는 컷: 장르 색 배경에 글 */
.text-card {
  position: relative; width: 100%; height: 100%;
  padding: calc(var(--top-h) + var(--safe-top) + 44px) 28px calc(190px + var(--safe-bottom)) 26px;
  display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(160deg, #232526, #414345);
}
.text-card::before { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.2); }
.text-card > * { position: relative; }
.text-card .q { font-size: 72px; line-height: 0.6; font-weight: 800; opacity: 0.35; }
.text-card p { margin-top: 14px; font-size: clamp(19px, 5.2vw, 25px); line-height: 1.58; font-weight: 700; letter-spacing: -0.015em; word-break: keep-all; overflow-wrap: anywhere; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); }
.text-card .who { margin-top: 18px; font-size: 14px; font-weight: 700; color: rgba(255, 255, 255, 0.8); }
.g-A { background: linear-gradient(160deg, #3a1c71 0%, #b24592 55%, #f15f79 100%); }
.g-B { background: linear-gradient(160deg, #0b1d26 0%, #1c3b4a 55%, #2c5364 100%); }
.g-C { background: linear-gradient(160deg, #c2185b 0%, #ff5f6d 55%, #ffb36b 100%); }
@media (min-width: 900px) { .text-card p { font-size: 21px; } }

.cut-bar { position: absolute; z-index: 4; top: calc(var(--top-h) + var(--safe-top) + 2px); left: 12px; right: 12px; display: flex; gap: 3px; }
.cut-bar i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.26); }
.cut-bar i.on { background: #fff; }
.cut-count { position: absolute; z-index: 4; top: calc(var(--top-h) + var(--safe-top) + 12px); right: 12px; padding: 2px 9px; border-radius: 999px; background: rgba(0, 0, 0, 0.38); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

.cut-info { position: absolute; z-index: 2; left: 14px; right: 86px; bottom: calc(18px + var(--safe-bottom)); }
.ep-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.genre-tag { padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-size: 11px; font-weight: 800; letter-spacing: 0.01em; }
.caption { margin-top: 6px; font-size: 15px; line-height: 1.5; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); }
.credits { margin-top: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; font-weight: 600; color: rgba(255, 255, 255, 0.86); }
.badge { padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.01em; background: var(--yellow); color: #000; }
.badge.ai { background: var(--cyan); }

.rail { position: absolute; z-index: 3; right: 6px; bottom: calc(22px + var(--safe-bottom)); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rail-btn { width: 66px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); text-decoration: none; }
.rail-btn .n { font-variant-numeric: tabular-nums; }
.rail-btn .ico {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 22px;
  background: rgba(16, 16, 22, 0.36); -webkit-backdrop-filter: blur(12px) saturate(160%); backdrop-filter: blur(12px) saturate(160%);
  box-shadow: var(--glass-edge), 0 4px 14px rgba(0, 0, 0, 0.22);
}
.rail-btn.liked .ico { color: var(--pink); background-color: rgba(255, 42, 133, 0.2); }
/* 좋아요를 켤 때만 한 번 톡 (자주 끄고 켜도 짧게 끝남) */
.rail-btn.pop .ico { animation: pop 420ms var(--ease-out); }
@keyframes pop { 0% { transform: scale(0.94); } 35% { transform: scale(1.16); } 100% { transform: scale(1); } }

/* 첫 방문 소개 카드 · 회차 끝 카드 · 빈 화면 */
.card-center { height: 100%; padding: calc(var(--top-h) + var(--safe-top) + 24px) 26px calc(40px + var(--safe-bottom)); display: flex; flex-direction: column; justify-content: center; gap: 18px; text-align: center; align-items: center; }
.intro { background: radial-gradient(600px 400px at 50% 0%, rgba(255, 42, 133, 0.32), transparent 70%), #0b0b10; }
.intro img { width: 96px; height: 96px; }
.intro h2, .end h2 { font-size: 30px; line-height: 1.22; font-weight: 800; white-space: pre-line; letter-spacing: -0.025em; }
.intro .steps { text-align: left; max-width: 340px; }
.intro .steps li { font-size: 15px; }
/* 처음 한 번만 보는 카드라 차례로 떠오르게 합니다 */
.intro .card-center > * { animation: rise 560ms var(--ease-out) both; }
.intro .card-center > :nth-child(2) { animation-delay: 60ms; }
.intro .card-center > :nth-child(3) { animation-delay: 120ms; }
.intro .card-center > :nth-child(4) { animation-delay: 180ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.swipe { margin-top: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 700; color: #fff; }
.swipe::before { content: '↑'; font-size: 26px; animation: nudge 1.6s var(--ease-in-out) 1s 4; }
@keyframes nudge { 50% { transform: translateY(-8px); } }
.end { background: radial-gradient(500px 360px at 50% 100%, rgba(255, 234, 0, 0.14), transparent 70%), #0b0b10; }
.end p { color: #d6d9e6; line-height: 1.55; max-width: 320px; }
.end .ep-name { font-size: 14px; font-weight: 700; color: var(--muted); }
.end .btn { font-size: 17px; padding: 14px 28px; border-radius: 14px; }
.end .next { margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.empty { color: #d6d9e6; white-space: pre-line; line-height: 1.6; }
.loading-cut .card-center { color: var(--muted); }

/* 영상 */
.vcard video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.sound-hint { position: absolute; z-index: 3; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 10px 16px; border-radius: 999px; background: rgba(16, 16, 22, 0.5); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--glass-edge); font-weight: 700; font-size: 14px; pointer-events: none; }

/* ---------- 쓰기 탭: 글타래 목록 ---------- */
.write { overflow-y: auto; padding: calc(var(--top-h) + var(--safe-top) + 12px) 12px calc(28px + var(--safe-bottom)); background: #0b0b10; }
.write-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.write-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.badge.vid { background: var(--pink); color: #fff; }
/* 큰 화면에서만: 휴대폰 화면 오른쪽의 이전·다음 컷 버튼 */
.feed-nav { display: none; }
@media (min-width: 900px) {
  .feed-nav { display: flex; flex-direction: column; gap: 10px; margin-left: -40px; }
  .feed-nav .icon-btn { width: 44px; height: 44px; color: #fff; background: rgba(255, 255, 255, 0.1); box-shadow: var(--glass-edge); }
  .app[data-tab="write"] .feed-nav { visibility: hidden; }
}
@media (hover: hover) and (pointer: fine) {
  .feed-nav .icon-btn:hover { background-color: rgba(255, 255, 255, 0.18); }
  #pane-webtoon .cut { cursor: pointer; }
}
.write-hint { margin: 10px 2px 12px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.thread-card { display: block; width: 100%; text-align: left; margin-bottom: 10px; padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--hairline); }
.tc-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; }
.tc-title { margin-top: 6px; font-size: 17px; font-weight: 800; line-height: 1.32; letter-spacing: -0.015em; }
.tc-text, .tc-latest { margin-top: 6px; font-size: 14px; line-height: 1.5; color: #d6d9e6; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.tc-latest { -webkit-line-clamp: 1; color: var(--muted); }
.tc-meta { margin-top: 8px; display: flex; gap: 12px; font-size: 12.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.g-dot-A { background: #b24592; color: #fff; }
.g-dot-B { background: #2c5364; color: #fff; }
.g-dot-C { background: #ff5f6d; color: #fff; }

/* ---------- 시트 (글타래 · 새 이야기) ----------
   아래에서 올라오고 같은 길로 내려갑니다. 뒤의 화면은 어둡게 눌러 둡니다.
   위쪽 손잡이를 아래로 끌거나 빠르게 튕기면 닫힙니다 (app.js의 enableSheetDrag). */
.scrim { position: absolute; inset: 0; z-index: 39; background: rgba(0, 0, 0, 0.55); opacity: 0; transition: opacity 280ms ease; --exit-ms: 280; }
.scrim[data-open] { opacity: 1; transition-duration: 400ms; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; top: calc(var(--safe-top) + 10px); z-index: 40;
  display: flex; flex-direction: column; background: var(--sheet-bg);
  border-radius: 16px 16px 0 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 -16px 50px rgba(0, 0, 0, 0.45);
  transform: translateY(100%); transition: transform 280ms var(--ease-drawer); will-change: transform; --exit-ms: 280;
}
.sheet[data-open] { transform: none; transition-duration: 440ms; }
.sheet-head { position: relative; display: flex; align-items: center; gap: 6px; padding: 16px 8px 8px; border-bottom: 1px solid var(--hairline); touch-action: none; }
.sheet-head::before { content: ''; position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: rgba(255, 255, 255, 0.22); }
.sheet-head h2 { flex: 1; text-align: center; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-head > span { width: 40px; }
.sheet-body { position: relative; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 20px; }

.pnode { position: relative; margin-left: 8px; padding: 2px 0 16px 18px; border-left: 2px solid rgba(255, 255, 255, 0.14); }
.pnode::before { content: ''; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #5b6075; }
.pnode.current { border-left-color: transparent; }
.pnode.current::before { background: var(--pink); box-shadow: 0 0 0 4px rgba(255, 42, 133, 0.22); }
.pnode.link { cursor: pointer; }
.pmeta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pmeta b { color: #fff; font-weight: 700; }
.ptext { margin-top: 4px; font-size: 15.5px; line-height: 1.6; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.pnode.current .ptext { font-size: 16.5px; font-weight: 600; }
.ptitle { font-size: 20px; font-weight: 800; line-height: 1.28; letter-spacing: -0.02em; margin-bottom: 6px; }
.pact { margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.mini { padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 12.5px; font-weight: 700; color: #d6d9e6; font-variant-numeric: tabular-nums; }
.mini.liked { color: var(--pink); background: rgba(255, 42, 133, 0.14); }
.mini.ghost { background: transparent; color: var(--muted); }
.hidden-text { color: var(--muted); font-style: italic; }
.branches h3 { margin: 6px 0 8px; font-size: 14px; font-weight: 800; color: #fff; }
.branch { margin-bottom: 8px; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--hairline); }
.branch .ptext { font-size: 15px; }
.branch .open { margin-left: auto; color: var(--yellow); background: transparent; }
.no-branch { padding: 16px; border-radius: 14px; background: rgba(255, 234, 0, 0.08); color: #f3e88a; font-weight: 600; line-height: 1.5; }

.composer { padding: 10px 12px calc(10px + var(--safe-bottom)); border-top: 1px solid var(--hairline); background: #111219; }
.composer-login { display: flex; flex-direction: column; gap: 10px; align-items: stretch; text-align: center; }
.composer-login p { font-size: 13px; color: var(--muted); line-height: 1.5; }
textarea, .composer input, .new-form input {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); outline: none; resize: none; line-height: 1.5;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
textarea:focus, .composer input:focus, .new-form input:focus { border-color: rgba(255, 255, 255, 0.4); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.07); }
.composer-row { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.composer-row input { flex: 1; min-width: 0; }
.counter { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.warn { color: var(--pink); }
.new-form { display: flex; flex-direction: column; gap: 12px; }
.new-form #new-write { display: flex; flex-direction: column; gap: 12px; }
.field-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.genres { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 광장 (반쯤 올라오는 시트) ---------- */
.sheet.half { top: 38%; }
@media (min-width: 900px) { .sheet.half { top: 28%; } }
.online-chip { margin-left: 4px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.online-chip::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #34d27b; box-shadow: 0 0 0 3px rgba(52, 210, 123, 0.18); vertical-align: 1px; }
.plaza-sub { padding: 8px 16px 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.plaza-list { display: flex; flex-direction: column; gap: 12px; padding: 12px 14px 14px; }
.pmsg { display: flex; gap: 9px; align-items: flex-start; }
.pmsg.new { animation: msg-in 280ms var(--ease-out) both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } }
.pflag { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; background: rgba(255, 255, 255, 0.07); box-shadow: var(--glass-edge); }
.pmsg.mine .pflag { background: rgba(255, 42, 133, 0.22); }
.pbody { flex: 1; min-width: 0; }
.pline { font-size: 12px; font-weight: 600; color: var(--muted); }
.pline b { color: #fff; font-weight: 700; }
.ptxt { margin-top: 2px; font-size: 14.5px; line-height: 1.5; word-break: keep-all; overflow-wrap: anywhere; }
.ptr { margin-top: 5px; padding-left: 9px; border-left: 2px solid rgba(0, 229, 255, 0.55); font-size: 14px; line-height: 1.5; color: #d9f6ff; word-break: keep-all; overflow-wrap: anywhere; }
.ptr .badge, .pline .badge, .island .badge { margin-left: 6px; vertical-align: 1px; }
.pacts { flex: none; display: flex; gap: 4px; }
.quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
.quick::-webkit-scrollbar { display: none; }
.quick .chip { flex: none; padding: 4px 11px; font-size: 17px; transition: opacity 150ms ease, transform 160ms var(--ease-out); }
/* 보낸 직후 잠깐 쉬는 동안 (1초) */
.quick .chip:disabled, #plaza-form [type=submit]:disabled { opacity: 0.4; }

/* 광장 새 글 말풍선: 광장 버튼(오른쪽 위)에서 내려와 펼쳐집니다 */
.island {
  position: absolute; z-index: 45; top: calc(var(--top-h) + var(--safe-top) + 4px); right: 10px;
  max-width: min(320px, calc(100% - 20px)); padding: 9px 14px; border-radius: 18px; text-align: left;
  font-size: 13.5px; line-height: 1.4; color: #fff;
  background: rgba(24, 25, 34, 0.82); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.12), var(--glass-edge), 0 14px 40px rgba(0, 0, 0, 0.45);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  transform-origin: top right; opacity: 0; transform: scale(0.92) translateY(-6px);
  transition: opacity 160ms ease, transform 160ms var(--ease-out); --exit-ms: 160;
}
.island[data-open] { opacity: 1; transform: none; transition-duration: 280ms; }
.island b { font-weight: 700; }

/* ---------- 다른 나라 웹툰 (AI 번역) ---------- */
.world { background: radial-gradient(520px 380px at 50% 0%, rgba(0, 229, 255, 0.16), transparent 70%), #0b0b10; }
.world .globe { font-size: 56px; line-height: 1; }
.world p { color: #d6d9e6; line-height: 1.55; max-width: 320px; }
.world .next { margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.badge.orig { background: rgba(255, 255, 255, 0.2); color: #fff; }
/* 번역 ↔ 원문을 바꿀 때 글이 살짝 흐려졌다가 바뀝니다 (두 글이 겹쳐 보이지 않게) */
.text-card p, .caption, .ep-title .t { transition: opacity 160ms ease, filter 160ms ease; }
.cut.swapping .text-card p, .cut.swapping .caption, .cut.swapping .ep-title .t { opacity: 0; filter: blur(2px); }

/* ---------- 메뉴 · 알림 ---------- */
/* 계정 버튼(오른쪽 위)에서 펼쳐지고, 닫힐 때는 더 빨리 접힙니다 */
.menu {
  position: absolute; z-index: 50; top: calc(var(--top-h) + var(--safe-top)); right: 10px; width: 252px; padding: 8px; border-radius: 18px;
  background: rgba(30, 31, 41, 0.78); -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.12), var(--glass-edge), 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column;
  transform-origin: top right; opacity: 0; transform: scale(0.96) translateY(-4px);
  transition: opacity 140ms ease, transform 140ms var(--ease-out); --exit-ms: 140;
}
.menu[data-open] { opacity: 1; transform: none; transition-duration: 200ms; }
.menu-lang { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.menu-item { padding: 11px 10px; border-radius: 11px; text-align: left; text-decoration: none; font-weight: 600; font-size: 14px; }
.menu-item.danger { color: #ff8a8a; }
.toast {
  position: absolute; z-index: 60; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translate(-50%, 12px) scale(0.98);
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 999px; background: #fff; color: #000; font-weight: 700; font-size: 14px; text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  opacity: 0; pointer-events: none; transition: opacity 200ms ease, transform 360ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 접근성 ---------- */
/* 움직임 줄이기: 미끄러짐·튀어 오름은 빼고, 이해를 돕는 흐려짐(opacity)만 남깁니다 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .btn:active, .chip:active, .seg-btn:active, .icon-btn:active, .me-btn:active, .mini:active, .menu-item:active, .tab:active,
  .thread-card:active, .rail-btn:active .ico { transform: none; }
  .sheet { transform: none !important; opacity: 0; transition: opacity 200ms ease !important; }
  .sheet[data-open] { opacity: 1; }
  .menu, .island { transform: none !important; }
  .toast, .toast.show { transform: translate(-50%, 0); }
  .tab-ink.ready { transition: none; }
  .feed { scroll-behavior: auto; }
}
/* 투명도 줄이기: 반투명 재질을 불투명하게 */
@media (prefers-reduced-transparency: reduce) {
  .menu, .lang-hint, .island { background: #1e1f29; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .app[data-tab="write"] .top { background: #0b0b10; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .me-btn, .plaza-btn, .rail-btn .ico, .cut-count, .genre-tag, .sound-hint { -webkit-backdrop-filter: none; backdrop-filter: none; background-color: rgba(20, 20, 28, 0.85); }
}
/* 대비 높이기: 경계선을 또렷하게 */
@media (prefers-contrast: more) {
  :root { --line: rgba(255, 255, 255, 0.4); --hairline: rgba(255, 255, 255, 0.3); --muted: #c9cde0; }
}
