:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --card: #ffffff;
  --ink: #191919;
  --muted: #6b6b6b;
  --faint: #9a978f;
  --line: #e6e3db;
  --accent: #1f2a44;
  --accent-ink: #ffffff;
  --soft: #f0eee8;
  --danger: #b42318;
  --loading: #fff4c2;
  --now: #ffe066;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.site, main, .top-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

/* ---- 제목: SayText 가로 로고 + 한 줄 소개 ---- */
.site { padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: 14px; }
.site h1 { margin: 0; font-size: 26px; line-height: 1.3; letter-spacing: -0.03em; display: flex; align-items: center; gap: 10px; }
.site h1.brand { margin: 6px 0 0; line-height: 0; }
.brand-wordmark { display: block; width: auto; height: 46px; }
.brand-logo { width: 1.45em; height: 1.45em; flex: none; border-radius: 0.34em; box-shadow: 0 3px 10px rgba(31, 42, 68, 0.22); }
.site p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.site p.tagline { margin-top: 10px; font-size: 14.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* 남색 바탕 + 흰 굵은 글씨 (＋ 새 글) */
.chip.accent { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip.accent:active { background: var(--accent); opacity: 0.85; }
.open-edge { display: inline-block; margin-left: 6px; font-weight: 700; color: #7a4b00; text-decoration: underline; }

/* ---- Edge가 아닌 브라우저: 화면 맨 위에 늘 붙어 있는 안내 바 (닫을 수 없음) ---- */
.edge-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 25;
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 12px;
  width: 100%; margin: 0; border: 0; border-radius: 0;
  padding: calc(env(safe-area-inset-top) + 11px) max(16px, env(safe-area-inset-right)) 11px max(16px, env(safe-area-inset-left));
  background: linear-gradient(90deg, #0b4fb3 0%, #1380d3 55%, #17a389 100%);
  color: #fff; font-size: 17px; font-weight: 750; line-height: 1.35; letter-spacing: -0.01em; text-align: center;
  box-shadow: 0 3px 14px rgba(11, 79, 179, 0.3);
}
.edge-bar img { flex: none; width: 30px; height: 30px; padding: 3px; border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.eb-text { min-width: 0; }
.eb-cta { flex: none; background: #fff; color: #0b4fb3; font-size: 14px; font-weight: 800; padding: 5px 13px; border-radius: 999px; }
.edge-bar:hover .eb-cta { background: #eaf3ff; }
body.edge-bar-on { padding-top: var(--ebh, 54px); }
body.edge-bar-on .compact { top: var(--ebh, 54px); padding-top: 0; }

/* ---- Edge 받기 안내 창 ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(15, 18, 28, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  overflow-y: auto;
}
.modal { grid-template-columns: minmax(0, 1fr); }
.modal-box {
  position: relative;
  justify-self: center;
  min-width: 0;
  width: min(440px, 100%);
  background: linear-gradient(180deg, #f1f8fe 0%, #ffffff 38%);
  border-radius: 22px;
  padding: 28px 22px 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  text-align: center;
}
.modal-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted);
  font-size: 15px;
}
.edge-logo { display: block; margin: 0 auto 12px; }
.modal-box h2 { margin: 0; font-size: 21px; letter-spacing: -0.02em; }
.modal-box .lead { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.modal-box .lead b { color: var(--ink); }
.why { margin-top: 16px; text-align: left; background: var(--bg); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.why p { margin: 4px 0 0; color: var(--muted); line-height: 1.6; }
.why p b { color: var(--ink); }
.steps { margin: 14px 0 0; padding-left: 22px; text-align: left; font-size: 14px; color: var(--muted); line-height: 1.8; }
.steps b { color: var(--ink); }
.primary.edge-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  text-align: center;
  text-decoration: none;
  background: #0c59a4;
  padding: 14px 16px;
  font-size: 16px;
  border-radius: 12px;
}
.edge-open { display: block; margin-top: 12px; color: #0c59a4; font-size: 14px; font-weight: 600; text-decoration: none; }
.edge-hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.edge-later { margin-top: 10px; border: 0; background: none; color: var(--faint); font-size: 13px; padding: 6px; text-decoration: underline; }
body.modal-open { overflow: hidden; }

/* ---- MP3 저장 창 (내려받기 앱처럼: 원형 진행률 + 상태) ---- */
.sheet { text-align: left; padding-top: 24px; }
.sheet h2 { padding-right: 40px; }
.sheet .lead { margin-top: 4px; }
.file-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  transition: background-color 0.25s, border-color 0.25s;
}
.file-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.file-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info { font-size: 13px; color: var(--muted); }
.file-status { font-size: 13px; color: var(--muted); min-height: 1.4em; overflow-wrap: anywhere; }
.ring { position: relative; width: 64px; height: 64px; flex: none; }
.ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring-track { stroke: #e3e0d8; }
.ring-fill {
  stroke: #0c59a4;
  stroke-linecap: round;
  stroke-dasharray: 175.93;
  stroke-dashoffset: 175.93;
  transition: stroke-dashoffset 0.3s ease, stroke 0.25s;
}
.ring-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.file-card.idle .ring-text { font-size: 12px; color: var(--muted); }
/* 준비 중: 고리가 빙글빙글 */
.file-card.preparing .ring svg { animation: spin 0.9s linear infinite; }
.file-card.preparing .ring-fill { stroke-dashoffset: 132; }
@keyframes spin { to { transform: rotate(270deg); } }
.file-card.working { background: #f3f8fd; border-color: #cfe2f4; }
.file-card.working .file-status { color: #0c59a4; font-weight: 600; }
.file-card.done { background: #eef8f1; border-color: #bfe3cb; }
.file-card.done .ring-fill { stroke: #1f7a3a; }
.file-card.done .ring-text { color: #1f7a3a; font-size: 24px; }
.file-card.done .file-status { color: #1f7a3a; font-weight: 600; }
.file-card.error { background: #fdf0ef; border-color: #f2c9c4; }
.file-card.error .ring-fill { stroke: var(--danger); }
.file-card.error .ring-text { color: var(--danger); font-size: 22px; }
.file-card.error .file-status { color: var(--danger); font-weight: 600; }
.sheet-fields { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.sheet-fields .field.grow { flex: 1 1 160px; }
.sheet-fields select:disabled { opacity: 0.55; }
.primary.edge-btn.save-file { background: #1f7a3a; }
.primary.edge-btn.save-file.saved { background: #e6f4ea; color: #1f7a3a; }
#saveGo.cancel { background: var(--soft); color: var(--ink); }

main { padding-bottom: max(14px, env(safe-area-inset-bottom)); }

/* ---- 카드 ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.03);
}
.row { display: flex; align-items: center; gap: 10px; }
.row + .row { margin-top: 12px; }
.row.wrap { flex-wrap: wrap; row-gap: 10px; }
.row.between { justify-content: space-between; }

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  min-width: 0;
}
.field.grow { flex: 1 1 150px; }
.field.full { width: 100%; }
.field.full select, .field.grow select { flex: 1; min-width: 0; }

select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b6b6b' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center;
  border-radius: 10px;
  height: 38px;
  padding: 0 28px 0 11px;
  font-size: 15px;
  color: var(--ink);
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.rate-sel { width: 84px; flex: none; }

.primary, .ghost, .chip, .link {
  border: 0;
  border-radius: 10px;
  white-space: nowrap;
}
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 650; padding: 9px 16px; }
.primary:active { opacity: 0.85; }
.ghost { background: var(--soft); padding: 9px 12px; font-size: 14px; }
.ghost:active { background: #e5e2da; }
.play-btn { min-width: 92px; }
.progress { margin-left: auto; font-weight: 700; color: var(--muted); font-size: 14px; white-space: nowrap; text-align: right; }
.player .row:first-child { flex-wrap: wrap; row-gap: 8px; }

/* 처음부터 · 이전 문장 · 다음 문장 (한 덩어리) */
.seg { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 2px; gap: 2px; flex: none; }
.seg button {
  border: 0;
  background: none;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 14px;
  white-space: nowrap;
  color: var(--ink);
}
.seg button:hover { background: rgba(255, 255, 255, 0.7); }
.seg button:active { background: #fff; transform: scale(0.97); }

.link { background: none; color: var(--muted); padding: 4px 2px; font-size: 14px; }
.link:hover { color: var(--ink); }
.nav { min-height: 30px; }
.nav .link[hidden] { display: inline-block !important; visibility: hidden; }

.meta { margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--line); flex-wrap: wrap; row-gap: 8px; }
.count { color: var(--muted); font-size: 13px; }
.count b { color: var(--ink); }
.tools { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--soft); padding: 5px 11px; font-size: 13px; border-radius: 999px; }
.chip:active { background: #e5e2da; }
.chip.danger { color: var(--danger); }

/* ---- 본문 ---- */
.doc {
  padding: 18px 18px 6px;
  font-size: 18px;
  line-height: 1.85;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.doc p { margin: 0 0 1.15em; }
.s {
  color: var(--ink);
  border-radius: 5px;
  padding: 2px 1px;
  margin: 0 -1px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  cursor: pointer;
}
.s.hover, .s.pending { background: var(--loading); color: #000; }
.s.now { background: var(--now); color: #000; font-weight: 700; }

/* ---- 글 넣기 ---- */
.editor h2 { margin: 0; font-size: 17px; }
.editor textarea {
  display: block;
  width: 100%;
  min-height: 50vh;
  margin-top: 12px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fdfdfb;
  padding: 14px;
  line-height: 1.7;
  font-size: 16px;
  outline: none;
}
.editor textarea:focus { border-color: #c9c4b8; background: #fff; }
.editor .actions { margin-top: 12px; }

.credit { text-align: center; color: var(--faint); font-size: 12px; padding: 6px 2px 0; }
/* 맨 아래: 왼쪽 약관 · 가운데 Made by · 오른쪽 개발자 블로그 (모두 같은 높이) */
.site-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 14px 2px 6px; font-size: 12.5px; line-height: 1.5; text-align: left; }
.site-foot .foot-left { justify-self: start; display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; }
.site-foot .foot-mid { justify-self: center; white-space: nowrap; }
.site-foot .foot-right { justify-self: end; white-space: nowrap; }
.credit.site-foot a { color: var(--muted); font-weight: 400; border-bottom: 0; text-decoration: none; }
.credit.site-foot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.site-foot .fs { display: none; }
@media (max-width: 560px) {
  /* 좁은 화면: 짧은 이름으로 바꿔 한 줄에 세 덩어리를 그대로 둡니다 */
  .site-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; }
  .site-foot .foot-left { flex-wrap: nowrap; white-space: nowrap; column-gap: 4px; }
  .site-foot .fl { display: none; }
  .site-foot .fs { display: inline; }
}
.credit a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); }
.credit a:hover { color: var(--ink); border-color: var(--muted); }

/* 최상단: 왼쪽 언어 고르기, 오른쪽 앱으로 설치 · 로그인 (셋 다 높이 34px, 위에 붙는 메뉴에는 없음) */
.site-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; min-height: 34px; }
.lang-btn, .login-btn, .install-btn { height: 34px; display: inline-flex; align-items: center; justify-content: center; padding-top: 0 !important; padding-bottom: 0 !important; line-height: 1; }
.top-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* 앱으로 설치: 흰 바탕 버튼 (로그인 버튼 오른쪽) */
.install-btn {
  border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--accent);
  font-weight: 650; font-size: 13px; padding: 5px 13px; white-space: nowrap; box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04);
}
.install-btn:hover { border-color: #d6d2c7; }
.install-btn:active { background: var(--soft); }
.blog-link { font-size: 13px; color: var(--muted); text-decoration: none; padding: 4px 0; white-space: nowrap; }
.blog-link:hover { color: var(--ink); text-decoration: underline; }

/* ---- 위에 붙는 간단 메뉴 ---- */
.compact {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: rgba(247, 246, 242, 0.94);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
  transform: translateY(-110%);
  transition: transform 0.18s ease;
}
.compact.show { transform: none; }
.compact-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.compact-row { display: flex; align-items: center; gap: 8px; }
.compact .play-btn { min-width: 84px; padding: 8px 12px; }
.compact .seg button { padding: 7px 12px; font-size: 15px; }
.compact .voice-sel { flex: 1 1 auto; }
.compact .progress { margin-left: auto; }
@media (min-width: 640px) {
  /* 넓은 화면: 한 줄로 [재생][⏮ ‹ ›][속도][목소리 ……][N / M 문장] */
  .compact-inner { flex-direction: row; align-items: center; }
  .compact-row { display: contents; }
  .compact .voice-sel { flex: 0 1 320px; }
  .compact .progress { order: 99; margin-left: auto; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  transform: translateX(-50%);
  z-index: 30;
  max-width: calc(100% - 32px);
  display: flex;
  align-items: center;
  gap: 12px;
  background: #2b2b2b;
  color: #fff;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.toast button { background: none; border: 0; color: #ffd84d; font-weight: 700; padding: 0; }

@media (max-width: 420px) {
  .site h1 { font-size: 23px; }
  .doc { font-size: 17px; padding: 16px 15px 4px; }
  .player .seg .tx { display: none; }
  .player .seg .tx-short { display: inline; }
}
@media (min-width: 760px) {
  .site h1 { font-size: 30px; }
  .doc { padding: 26px 30px 10px; font-size: 19px; }
}

.tx-short { display: none; }

/* ---- 언어 고르기 ---- */
.lang-menu { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 5px 10px 5px 8px; font-size: 13px; color: var(--ink);
}
.lang-btn:hover { border-color: #d6d2c7; }
.lang-btn .caret { color: var(--muted); }
.flag { width: 20px; height: 15px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08); flex: none; }
.lang-list {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 190px;
  margin: 0; padding: 6px; list-style: none; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 36px rgba(20, 20, 20, 0.14);
}
.lang-list a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--ink); text-decoration: none; font-size: 14px; outline: none;
}
.lang-list a:hover, .lang-list a:focus-visible { background: var(--soft); }
.lang-list [aria-selected="true"] a { font-weight: 700; }
.lang-list [aria-selected="true"] a::after { content: "✓"; margin-left: auto; color: var(--accent); }

/* ---- 로그인 버튼 · 내 계정 ---- */
.login-btn {
  border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-weight: 650; font-size: 13px; padding: 6px 14px; white-space: nowrap;
}
.login-btn:active { opacity: 0.85; }
.account { position: relative; }
.avatar-btn { border: 0; background: none; padding: 0; border-radius: 999px; display: block; }
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; overflow: hidden;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--line);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.pop {
  position: absolute; z-index: 40; top: calc(100% + 8px); right: 0; width: min(280px, calc(100vw - 32px));
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px;
  box-shadow: 0 12px 36px rgba(20, 20, 20, 0.14);
}
.pop-head { padding: 10px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; }
.account-email { font-size: 14px; overflow-wrap: anywhere; }
.account-ways { font-size: 12px; color: var(--muted); }
.pop-item {
  display: block; width: 100%; text-align: left; border: 0; background: none; border-radius: 9px;
  padding: 9px 10px; font-size: 14px; color: var(--ink);
}
.pop-item:hover { background: var(--soft); }
.pop-item.danger { color: var(--danger); }

/* ---- 아이콘 ---- */
.ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; flex: none; }

/* ---- 로그인해야 쓰는 버튼 (로그인 전에는 회색) ---- */
.locked-able.locked { background: #ecebe7 !important; color: #a3a097 !important; font-weight: 500; }
.locked-able.locked::after {
  content: ""; display: inline-block; width: 10px; height: 11px; margin-left: 5px; vertical-align: -1px; opacity: 0.75;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 11'%3E%3Cpath d='M2 5V3.5a3 3 0 0 1 6 0V5h.5a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-5a.5.5 0 0 1 .5-.5zm1.2 0h3.6V3.5a1.8 1.8 0 0 0-3.6 0z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 11'%3E%3Cpath d='M2 5V3.5a3 3 0 0 1 6 0V5h.5a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-5a.5.5 0 0 1 .5-.5zm1.2 0h3.6V3.5a1.8 1.8 0 0 0-3.6 0z'/%3E%3C/svg%3E") no-repeat center / contain;
}
.locked-able.locked:disabled { opacity: 1; }

/* ---- 반복 ---- */
.repeat-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 13px; }
.repeat-btn.on { background: var(--accent); color: #fff; font-weight: 650; }
.repeat-panel { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.seg-choice { display: flex; flex-wrap: wrap; gap: 2px; background: var(--soft); border-radius: 12px; padding: 3px; }
.seg-choice button {
  flex: 1 1 auto; border: 0; background: none; border-radius: 9px; padding: 8px 10px; font-size: 13px; white-space: nowrap; color: var(--ink);
}
.seg-choice button.on { background: var(--card); font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.seg-choice button:disabled { color: var(--faint); cursor: default; }
.range-box { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.range-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 14px; color: var(--muted); }
.range-row input {
  width: 72px; height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; font: inherit;
  color: var(--ink); background: var(--card); font-variant-numeric: tabular-nums;
}
.hint { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.repeat-badge { font-size: 12px; font-weight: 700; color: var(--accent); background: #e8ebf2; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }

/* 구간 반복: 문장 번호와 구간 표시 */
.doc.numbered .s::before {
  content: attr(data-n); display: inline-block; min-width: 1.5em; margin-right: 3px; padding: 0 4px; border-radius: 5px;
  font-size: 11px; font-weight: 700; line-height: 1.6; text-align: center; vertical-align: 2px;
  color: var(--muted); background: var(--soft); font-variant-numeric: tabular-nums;
}
.s.in-range { box-shadow: inset 0 -2px 0 rgba(31, 42, 68, 0.38); }
.doc.numbered .s.range-a::before, .doc.numbered .s.range-b::before { background: var(--accent); color: #fff; }

/* ---- 재생목록 ---- */
.playlist .pl-title { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.pl-list { counter-reset: pl; list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; }
.pl-item { display: flex; align-items: center; gap: 6px; border-radius: 10px; padding: 2px 4px 2px 2px; counter-increment: pl; }
.pl-item::before { content: counter(pl); min-width: 22px; text-align: center; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.pl-item.now { background: var(--loading); }
.pl-item.now::before { content: "▶"; color: var(--accent); }
.pl-name { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 7px 4px; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-item.now .pl-name { font-weight: 700; }
.pl-tools { display: inline-flex; gap: 2px; flex: none; }
.pl-tools button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 13px; }
.pl-tools button:hover:not(:disabled) { background: var(--soft); color: var(--ink); }
.pl-tools button:disabled { opacity: 0.3; cursor: default; }

/* ---- 글 고르기 줄 ---- */
.text-pick { gap: 8px; }
.list-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; flex: none; }

/* ---- 로그인 전: 이 브라우저에만 저장 안내 ---- */
.guest-note {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  background: #f4f6fb; border-color: #dfe4ef; padding: 14px 44px 14px 14px;
}
.gn-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; background: #e3e8f3; display: grid; place-items: center; }
.gn-icon svg { width: 20px; height: 20px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; }
.gn-body b { font-size: 14px; }
.gn-body p { margin: 3px 0 6px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.link-strong { border: 0; background: none; padding: 0; font-size: 13.5px; font-weight: 700; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.guest-note .modal-x { top: 8px; right: 8px; width: 30px; height: 30px; font-size: 12px; background: transparent; }

/* ---- 글 목록 ---- */
.lib h2 { margin: 0; font-size: 18px; }
.lib h2 .count { font-weight: 500; margin-left: 4px; }
.lib-tools { margin-top: 12px; }
.search {
  flex: 1 1 200px; min-width: 0; height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px;
  font: inherit; font-size: 15px; background: var(--card); color: var(--ink); outline: none;
}
.search:focus { border-color: #c9c4b8; }
.lib-bar { margin-top: 12px; padding: 8px 0 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; row-gap: 8px; }
.check-all { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; cursor: pointer; }
.chip:disabled { opacity: 0.45; cursor: default; }
.chip.ghosty { background: none; }
.lib-list { list-style: none; margin: 0; padding: 0; }
.lib-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); border-radius: 10px; }
.lib-item:last-child { border-bottom: 0; }
.lib-item.selected { background: #f6f5f0; }
.lib-item.current { box-shadow: inset 3px 0 0 var(--now); }
.lib-check { margin-top: 3px !important; }
.lib-main { flex: 1; min-width: 0; }
.lib-title-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.lib-title {
  min-width: 0; border: 0; background: none; padding: 0; text-align: left; font-size: 15.5px; font-weight: 650; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lib-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.lib-rename { flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--faint); display: grid; place-items: center; }
.lib-rename:hover { background: var(--soft); color: var(--ink); }
.lib-rename svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.lib-title-input { flex: 1; min-width: 0; height: 34px; border: 1px solid #c9c4b8; border-radius: 9px; padding: 0 10px; font: inherit; font-size: 15px; font-weight: 600; outline: none; }
.lib-sub { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--muted); }
.lib-when { font-variant-numeric: tabular-nums; }
.lib-file { color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.badge { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.badge.fmt { background: var(--soft); color: #57544c; }
.badge.fmt-typed { background: #eef0f5; color: #3d4766; }
.badge.fmt-sample { background: #fff4c2; color: #7a5b00; }
.badge.fmt-pdf { background: #fdecea; color: #a8281c; }
.badge.fmt-docx, .badge.fmt-doc { background: #e7effb; color: #1d4f9c; }
.badge.fmt-rtf { background: #efe9fa; color: #5b3d99; }
.badge.fmt-txt, .badge.fmt-md { background: #e9f5ee; color: #1f6b3a; }
.now-badge { flex: none; background: var(--now); color: #000; }
.lib-empty { text-align: center; color: var(--muted); padding: 28px 0 16px; margin: 0; }
.lib-add { margin-top: 12px; gap: 6px; }

/* ---- 글 넣기: 끌어다 놓기 · 길이 제한 ---- */
.drop-zone { position: relative; }
.drop-hint {
  position: absolute; inset: 12px 0 0; display: none; place-items: center; border-radius: 12px;
  border: 2px dashed var(--accent); background: rgba(247, 246, 242, 0.92); color: var(--accent); font-weight: 700; pointer-events: none;
}
body.dragging .drop-hint { display: grid; }
.limit-note { margin-top: 10px; }
.limit-bar { height: 5px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.limit-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.15s; }
.limit-note p { margin: 7px 0 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.limit-note.over .limit-bar span { background: var(--danger); }
.limit-note.over p { color: var(--danger); }
.formats { margin: 10px 0 0; font-size: 12px; color: var(--faint); }

/* ---- 아래쪽 약관 링크 ---- */
.legal-links { margin-bottom: 4px; }
.legal-links a { border-bottom: 0 !important; }
.legal-links a b { font-weight: 700; }

/* ---- 로그인 창 ---- */
.auth-box { background: linear-gradient(180deg, #f6f4ee 0%, #ffffff 34%); padding: 30px 24px 18px; }
.modal-back {
  position: absolute; top: 10px; left: 10px; width: 36px; height: 36px; border: 0; border-radius: 999px;
  background: rgba(0, 0, 0, 0.05); color: var(--muted); font-size: 22px; line-height: 1;
}
.auth-logo { display: block; margin: 0 auto 12px; border-radius: 15px; box-shadow: 0 6px 18px rgba(31, 42, 68, 0.25); }
.auth-reason {
  margin: 12px 0 0; padding: 9px 12px; border-radius: 12px; background: var(--loading); color: #4a3b00;
  font-size: 14px; font-weight: 600;
}
/* 로그인 혜택 6가지: 버튼 모양 타일 2칸 × 3줄 */
.perks { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; text-align: left; }
.perks li {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 11px 12px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04), inset 0 -2px 0 rgba(31, 42, 68, 0.05);
}
.perk-ico { flex: none; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, #2a3b63, #18213b); color: #ffe066; display: grid; place-items: center; }
.perk-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.perk-tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.perk-tx b { font-size: 13.5px; color: var(--ink); letter-spacing: -0.01em; }
.perk-tx small { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.auth-step { margin-top: 16px; }
.google-box { display: flex; justify-content: center; min-height: 44px; }
.google-btn-slot { display: flex; justify-content: center; width: 100%; }
.google-btn-slot > div { margin: 0 auto; }
.google-fallback {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 44px;
  border: 1px solid #dadce0; border-radius: 999px; background: #fff; color: #3c4043; font-weight: 600; font-size: 15px;
}
.google-fallback:hover { background: #f8f9fa; }
.or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--faint); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form input:not(.hidden-email) {
  height: 46px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; font: inherit; font-size: 16px;
  background: #fff; color: var(--ink); outline: none;
}
.auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 42, 68, 0.12); }
.hidden-email { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.auth-submit { height: 46px; border-radius: 12px; font-size: 15px; }
.auth-submit:disabled { opacity: 0.6; cursor: progress; }
.auth-who { margin: 0 0 10px; }
.who-email { display: inline-block; background: var(--soft); border-radius: 999px; padding: 4px 12px; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.auth-lead { margin: 0 0 12px; font-size: 14px; color: var(--muted); line-height: 1.6; }
.auth-lead b { color: var(--ink); }
.field-hint { margin: 0; text-align: left; font-size: 12px; color: var(--faint); }
.code-input { text-align: center; font-size: 26px !important; letter-spacing: 0.45em; font-weight: 800; font-variant-numeric: tabular-nums; height: 56px !important; background: #fffdf3 !important; }
.small-link { display: inline-block; margin-top: 10px; font-size: 13px; }
.small-link:disabled { color: var(--faint); cursor: default; }
.auth-msg { margin: 12px 0 0; font-size: 13.5px; line-height: 1.55; border-radius: 10px; padding: 8px 10px; }
.auth-msg.error { background: #fdf0ef; color: var(--danger); }
.auth-msg.info { background: #eef3fb; color: #1d4f9c; }
.auth-legal { margin: 16px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--faint); }
.auth-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

/* ---- 확인 창 ---- */
.confirm-box { background: var(--card); padding: 26px 22px 18px; }
.confirm-box .lead { margin-top: 8px; }
.confirm-actions { display: flex; gap: 8px; margin-top: 18px; }
.confirm-actions button { flex: 1; height: 44px; border-radius: 12px; font-size: 15px; }
.primary.danger-btn { background: var(--danger); }

@media (max-width: 480px) {
  /* 좁은 화면: 앱으로 설치는 아이콘만 */
  .install-btn .ib-tx { display: none; }
  .install-btn { padding: 5px 10px; font-size: 14px; }
  .top-right { gap: 6px; }
}
@media (max-width: 420px) {
  .blog-link { font-size: 12px; }
  .repeat-btn { flex: 1 1 100%; justify-content: center; }
}

/* ---- 휴대폰 다듬기 ---- */
.edge-bar .fs { display: none; }
.lib > .row.between:first-child { flex-wrap: wrap; row-gap: 8px; }
.lib h2 { white-space: nowrap; }
@media (max-width: 560px) {
  /* Edge 안내 바: 한 줄(길면 두 줄)로, 짧은 문구 */
  .edge-bar { flex-wrap: nowrap; gap: 10px; font-size: 15.5px; padding-top: calc(env(safe-area-inset-top) + 9px); padding-bottom: 9px; }
  .edge-bar .fl { display: none; }
  .edge-bar .fs { display: inline; }
  .edge-bar img { width: 28px; height: 28px; }
  .eb-cta { font-size: 13px; padding: 5px 10px; }
}
@media (max-width: 600px) {
  /* 아이폰은 16px보다 작은 입력칸을 누르면 화면을 확대하므로 16px로 */
  select, .search, .range-row input, .lib-title-input { font-size: 16px; }
}
@media (max-width: 480px) {
  /* 손가락으로 누르기 쉬운 크기 (높이 36px 이상) */
  .chip { min-height: 36px; padding: 7px 13px; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
  /* 글 카드 아래 버튼: 줄마다 폭을 꽉 채워 가지런히 */
  .meta .tools, .lib-add, .lib-bar .tools { display: flex; flex-wrap: wrap; width: 100%; gap: 6px; }
  .meta .tools .chip, .lib-add .chip { flex: 1 1 auto; }
  .text-pick .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
