/* ════════════════════════════════════════════
   콜드브루 Cold Vrew — Design System
   Typography: Pretendard GOV / Icons: Material Symbols
   Palette: 파스텔 블루·그린·핑크·옐로우 (KRDS 참고)
   ════════════════════════════════════════════ */

:root {
  /* surfaces */
  --bg: #F4F8FC;
  --panel: #FFFFFF;
  --line: #E2EAF3;
  --line-strong: #CDD9E8;

  /* ink */
  --ink: #243247;
  --ink-soft: #55677E;
  --ink-faint: #91A2B7;

  /* pastel palette */
  --blue: #4C7CF0;
  --blue-deep: #2F5BC7;
  --blue-soft: #E8F0FE;
  --blue-pastel: #BFD5FA;

  --green: #2E9E6B;
  --green-soft: #E2F5EB;
  --green-pastel: #B9E7CE;

  --pink: #D6608A;
  --pink-soft: #FBE9F0;
  --pink-pastel: #F5C4D6;

  --yellow: #B8860B;
  --yellow-soft: #FFF5D9;
  --yellow-pastel: #F7E3A6;

  --danger: #E25C5C;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 6px 24px rgba(36, 50, 71, 0.09);
  --shadow-sm: 0 2px 8px rgba(36, 50, 71, 0.07);

  --font: "Pretendard GOV Variable", "Pretendard GOV", Pretendard,
          -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI",
          "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  /* 모바일 동적 툴바(주소창 접힘)에 맞춰 정확히 화면을 채움 */
  height: 100vh;
  height: 100dvh;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.flex-spacer { flex: 1; }

/* Material Symbols */
.ms {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  display: inline-block;
  vertical-align: -4px;
  letter-spacing: normal;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}

kbd {
  font-family: var(--font);
  font-size: 11px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 5px;
  color: var(--ink-soft);
}

/* ════════════ 헤더 ════════════ */
.topbar {
  height: 60px;
  flex: none;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 20px;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 9px; flex: none; }
.brand-icon { font-size: 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.brand-text strong { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; white-space: nowrap; }
.brand-text span { font-size: 10.5px; color: var(--ink-faint); font-weight: 600; letter-spacing: 0.5px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  /* 버튼이 화면보다 많으면 가로로 스크롤(문서 전체가 넘치지 않도록) */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }
.tool-group { display: flex; gap: 2px; flex: none; }
.tool-sep { width: 1px; height: 30px; background: var(--line); margin: 0 6px; flex: none; }

/* 내보내기 그룹은 항상 오른쪽에 고정 — 스크롤해도 보임 */
#exportGroup {
  position: sticky;
  right: 0;
  background: linear-gradient(90deg, transparent, var(--panel) 16%, var(--panel));
  padding-left: 14px;
}

.tool-btn {
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 56px;
  padding: 5px 8px 4px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tool-btn .ms { font-size: 21px; }
.tool-label { font-size: 11px; font-weight: 600; }
.tool-btn:hover:not(:disabled) { background: var(--blue-soft); color: var(--blue-deep); }
.tool-btn:disabled { opacity: 0.35; cursor: default; }
.tool-btn.accent-yellow:hover:not(:disabled) { background: var(--yellow-soft); color: var(--yellow); }

.btn-primary {
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { background: var(--blue-deep); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.btn-primary.big { padding: 13px 28px; font-size: 16px; border-radius: var(--radius); }
.btn-primary .ms { font-size: 19px; }

.btn-ghost {
  font-family: var(--font);
  padding: 9px 16px;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-ghost:hover { background: var(--bg); }

/* ════════════ 워크스페이스 ════════════ */
.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ── 좌: 미리보기 ── */
.preview-pane {
  width: 44%;
  min-width: 380px;
  max-width: 640px;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 10px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #EDF3FB 0%, var(--bg) 100%);
  overflow-y: auto;
}

.video-shell {
  position: relative;
  background: #17202E;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 9;
  flex: none;
}
.video-shell video { width: 100%; height: 100%; display: block; object-fit: contain; }

.subtitle-overlay {
  position: absolute;
  left: 5%; right: 5%; bottom: 6%;
  text-align: center;
  font-size: calc(clamp(13px, 2.2vw, 19px) * var(--sub-scale, 1));
  font-weight: 700;
  color: var(--sub-color, #fff);
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
  pointer-events: none;
  line-height: 1.4;
  font-family: var(--sub-font, inherit);
}
.subtitle-overlay.pos-top { bottom: auto; top: 6%; }
.subtitle-overlay.pos-middle { bottom: 50%; transform: translateY(50%); }
.subtitle-overlay .sub-box {
  display: inline-block;
  background: var(--sub-bg, rgba(23, 32, 46, 0.62));
  border-radius: 8px;
  padding: 4px 12px;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  box-shadow: var(--shadow-sm);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue-deep);
  cursor: pointer;
  transition: background .15s;
}
.icon-btn:hover { background: var(--blue-pastel); }
.icon-btn .ms { font-size: 24px; font-variation-settings: 'FILL' 1, 'wght' 500; }

.time-display {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.switch-label input { display: none; }
.switch {
  width: 32px; height: 18px;
  border-radius: 10px;
  background: var(--line-strong);
  position: relative;
  transition: background .15s;
  flex: none;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: left .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch-label input:checked + .switch { background: var(--green); }
.switch-label input:checked + .switch::after { left: 16px; }

.rate-select, select {
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 5px 8px;
  cursor: pointer;
}

.timeline {
  width: 100%;
  height: 76px;
  flex: none;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: crosshair;
  box-shadow: var(--shadow-sm);
}

.timeline-legend {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--ink-faint);
  font-weight: 600;
  padding: 0 4px;
}
.timeline-legend .lg {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
}
.lg-wave { background: var(--blue-pastel); }
.lg-cut  { background: var(--pink-pastel); }
.lg-head { background: var(--blue); }

/* ── 우: 에디터 ── */
.editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--panel);
  position: relative;
}

.editor-head {
  flex: none;
  padding: 14px 24px 12px;
  border-bottom: 1px solid var(--line);
}
.editor-head h2 { font-size: 15px; font-weight: 800; }
.editor-head h2 .ms { color: var(--blue); margin-right: 4px; }
.editor-head p { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }

.editor-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 60px;
  user-select: none;
}

.editor-empty {
  color: var(--ink-faint);
  text-align: center;
  padding: 60px 20px;
  font-size: 13px;
}

/* 큐(문단) 블록 */
.cue {
  display: flex;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 4px;
  transition: background .15s;
}
.cue:hover { background: var(--bg); }
.cue.playing { background: var(--blue-soft); }

.cue-meta {
  flex: none;
  width: 74px;
  padding-top: 3px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cue-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--blue);
}
.cue-time {
  font-size: 11px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.cue-time:hover { color: var(--blue); text-decoration: underline; }

.cue-body {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 3px;
  align-content: flex-start;
  min-width: 0;
}

/* 토큰 (어절/무음) */
.tok {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 7px;
  font-size: 14.5px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background .12s, border-color .12s, opacity .12s;
  line-height: 1.5;
  max-width: 100%;
  word-break: break-all;
  touch-action: pan-y; /* 세로 드래그=스크롤, 가로 드래그=범위 선택 */
}
.tok.word { color: var(--ink); }
.tok.word:hover { background: var(--blue-soft); }

.tok.gap {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-faint);
  background: var(--bg);
  border: 1.5px dashed var(--line-strong);
  gap: 3px;
}
.tok.gap .ms { font-size: 14px; }
.tok.gap:hover { border-color: var(--yellow-pastel); background: var(--yellow-soft); color: var(--yellow); }

.tok.selected {
  background: var(--blue-pastel) !important;
  border-color: var(--blue) !important;
  color: var(--blue-deep) !important;
}

.tok.deleted {
  text-decoration: line-through;
  opacity: 0.45;
  background: var(--pink-soft);
  color: var(--pink);
}
.tok.deleted.gap { border-style: solid; border-color: var(--pink-pastel); }

.tok.current {
  box-shadow: 0 0 0 2px var(--green-pastel);
  background: var(--green-soft);
}

.tok.editing {
  background: #fff;
  border-color: var(--blue);
  padding: 0;
}
input.tok-edit {
  font-family: var(--font);
  font-size: 14.5px;
  border: none;
  outline: none;
  background: transparent;
  padding: 2px 7px;
  color: var(--ink);
  min-width: 48px;
}

/* 자막 경계선 (클립 사이 구분) */
.cue + .cue { position: relative; }
.cue + .cue::before {
  content: '';
  position: absolute;
  left: 12px; right: 12px; top: -2px;
  border-top: 1px dashed var(--line);
}

/* ── 선택 액션바 (플로팅) ── */
.sel-bar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 6px 8px 6px 16px;
  box-shadow: 0 8px 28px rgba(36, 50, 71, 0.28);
  z-index: 15;
  animation: selbar-in .18s ease;
  max-width: calc(100% - 24px);
}
@keyframes selbar-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.sel-count { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.sel-actions { display: flex; gap: 3px; }
.sel-actions button, .sel-close {
  font-family: var(--font);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  border: none;
  background: rgba(255,255,255,.1);
  color: #fff;
  border-radius: 10px;
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s;
  min-width: 46px;
}
.sel-actions button .ms { font-size: 19px; }
.sel-actions button:hover { background: rgba(255,255,255,.22); }
.sel-actions #selMerge.hot { background: var(--blue); }
.sel-actions #selMerge.hot:hover { background: var(--blue-deep); }
.sel-close {
  min-width: 34px;
  padding: 8px;
  background: transparent;
  align-self: stretch;
}
.sel-close .ms { font-size: 19px; }
.sel-close:hover { background: rgba(255,255,255,.14); }

/* ════════════ 빈 화면 ════════════ */
.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 30px 20px;
  background:
    radial-gradient(ellipse 60% 50% at 20% 10%, #E4EEFC 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 20%, #E7F6EE 0%, transparent 60%),
    radial-gradient(ellipse 50% 45% at 75% 90%, #FCEDF3 0%, transparent 60%),
    radial-gradient(ellipse 45% 40% at 15% 85%, #FFF7DE 0%, transparent 60%),
    var(--bg);
}

.dropzone {
  max-width: 760px;
  width: 100%;
  text-align: center;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(8px);
  border: 2px dashed var(--line-strong);
  border-radius: 24px;
  padding: 48px 40px 40px;
  transition: border-color .2s, background .2s;
}
.dropzone.dragover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.dz-icon { font-size: 44px; margin-bottom: 8px; }
.dropzone h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.dropzone h1 em { font-style: normal; font-size: 16px; font-weight: 700; color: var(--ink-faint); margin-left: 6px; }
.dz-lead { color: var(--ink-soft); margin: 10px 0 22px; font-size: 15px; }
.dz-hint { color: var(--ink-faint); font-size: 12.5px; margin-top: 12px; }

.dz-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 30px;
  text-align: left;
}
.feat {
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.feat .ms { font-size: 22px; }
.feat b { font-size: 13px; }
.feat small { font-size: 11.5px; color: var(--ink-soft); line-height: 1.45; }
.feat-blue   { background: var(--blue-soft);   } .feat-blue .ms   { color: var(--blue); }
.feat-green  { background: var(--green-soft);  } .feat-green .ms  { color: var(--green); }
.feat-yellow { background: var(--yellow-soft); } .feat-yellow .ms { color: var(--yellow); }
.feat-pink   { background: var(--pink-soft);   } .feat-pink .ms   { color: var(--pink); }

/* ════════════ 상태바 ════════════ */
.statusbar {
  flex: none;
  height: 30px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  font-size: 11.5px;
  color: var(--ink-soft);
  font-weight: 600;
  overflow: hidden;       /* 긴 힌트가 문서를 넘치지 않도록 */
  white-space: nowrap;
}
.st-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; min-width: 0; }
.st-item.st-hint { overflow: hidden; text-overflow: ellipsis; }
.st-item .ms { font-size: 15px; }
.st-green { color: var(--green); }
.st-pink { color: var(--pink); }
.st-yellow { color: var(--yellow); }
.st-hint { color: var(--ink-faint); font-weight: 500; }

/* ════════════ 모달 ════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(36, 50, 71, 0.4);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--panel);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 26px 28px 22px;
  width: 100%;
  max-width: 440px;
}
.modal h3 { font-size: 17px; font-weight: 800; margin-bottom: 14px; }
.modal h3 .ms { color: var(--blue); margin-right: 6px; font-size: 22px; }

.modal-file {
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  margin-bottom: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-row { margin-bottom: 14px; }
.form-row label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.form-row output { color: var(--blue); font-weight: 700; }
.form-row select { width: 100%; padding: 9px 10px; font-size: 13.5px; }
.form-row input[type="range"] { width: 100%; accent-color: var(--blue); }

.modal-note {
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--blue-soft);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin: 6px 0 16px;
  line-height: 1.5;
}
.modal-note .ms { font-size: 15px; margin-right: 3px; }
.modal-note.st-yellow { background: var(--yellow-soft); color: var(--yellow); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

/* 진행 단계 */
.steps { list-style: none; margin-bottom: 16px; }
.steps li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 4px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-faint);
}
.steps li .step-ico { font-size: 19px; }
.steps li.active { color: var(--blue-deep); }
.steps li.active .step-ico { color: var(--blue); animation: pulse 1.2s ease-in-out infinite; }
.steps li.done { color: var(--green); }
.steps li.skipped { text-decoration: line-through; }
.step-state { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; }
.steps li.done .step-state::after { content: '✓'; font-weight: 800; }

@keyframes pulse { 50% { opacity: 0.4; } }

.progress-track {
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--blue) 0%, #7BA5F5 100%);
  transition: width .25s ease;
}
.progress-text {
  font-size: 12px;
  color: var(--ink-soft);
  min-height: 18px;
  font-variant-numeric: tabular-nums;
}

/* ── 자막 디자인 모달 ── */
.modal.modal-wide { max-width: 560px; }

.font-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 7px;
  max-height: 190px;
  overflow-y: auto;
  padding: 2px;
}
.font-grid button {
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 8px 6px 6px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color .12s, background .12s;
}
.font-grid button:hover { background: var(--bg); }
.font-grid button.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}
.font-grid .fg-sample { font-size: 17px; line-height: 1.3; color: var(--ink); }
.font-grid .fg-name { font-family: var(--font); font-size: 10.5px; color: var(--ink-faint); font-weight: 600; }

.style-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.seg-group { display: flex; gap: 0; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg-group button {
  flex: 1;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 4px;
  border: none;
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
}
.seg-group button + button { border-left: 1px solid var(--line); }
.seg-group button.active { background: var(--blue); color: #fff; }

input[type="color"] {
  width: 100%;
  height: 34px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 2px 3px;
  cursor: pointer;
}

.label-with-switch { display: flex; justify-content: space-between; align-items: center; }
.bg-controls { display: flex; align-items: center; gap: 8px; }
.bg-controls input[type="color"] { width: 52px; flex: none; }
.bg-controls input[type="range"] { flex: 1; accent-color: var(--blue); }
.bg-controls output { font-size: 11.5px; color: var(--ink-soft); font-weight: 600; min-width: 34px; }
.bg-controls.off { opacity: 0.35; pointer-events: none; }

.export-burn { margin-bottom: 14px; font-size: 13px; }

.export-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.export-summary .es-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.export-summary .es-card b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.export-summary .es-card span { font-size: 11.5px; color: var(--ink-faint); font-weight: 600; }
.es-card.es-green b { color: var(--green); }
.es-card.es-pink b { color: var(--pink); }

/* ════════════ 토스트 ════════════ */
.toast-wrap {
  position: fixed;
  left: 16px;
  bottom: 42px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in .25s ease;
  max-width: 420px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--danger); }
.toast .ms { font-size: 18px; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ════════════ 스크롤바 & 반응형 ════════════ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; border: 2px solid var(--panel); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

/* 툴바가 넘치기 시작하면 라벨을 숨기고 아이콘만 */
@media (max-width: 1420px) {
  .tool-label { display: none; }
  .tool-btn { min-width: 40px; }
  .brand-text span { display: none; }
}

/* 툴바가 넘치기 시작하면 라벨 숨김(아이콘만) — 넘쳐도 툴바가 가로 스크롤됨 */
@media (max-width: 1420px) {
  .tool-label { display: none; }
  .tool-btn { min-width: 40px; }
  .brand-text span { display: none; }
}

/* 태블릿: 미리보기/편집기 세로 스택 */
@media (max-width: 900px) {
  .tool-sep { margin: 0 3px; }
  .workspace { flex-direction: column; overflow-y: auto; }
  .preview-pane {
    width: 100%; max-width: none; min-width: 0;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .st-hint { display: none; }
  .style-cols { grid-template-columns: 1fr; gap: 0; }
}

/* 모바일: 간격 축소 + 내보내기 라벨 숨김 */
@media (max-width: 680px) {
  .topbar { height: 54px; padding: 0 6px; gap: 6px; }
  .brand { gap: 6px; }
  .brand-icon { font-size: 22px; }
  .brand-text strong { font-size: 14px; }

  #exportSep { display: none; }
  #btnExport { padding: 8px 12px; }
  #btnExport .btn-label { display: none; }

  /* 세로 스택 간격 축소 */
  .preview-pane { padding: 10px; gap: 8px; }
  .player-controls { flex-wrap: wrap; gap: 8px 10px; padding: 8px 10px; }
  .player-controls .time-display { font-size: 12px; }
  .editor-head { padding: 12px 16px 10px; }
  .editor-head p { font-size: 11px; }
  .editor-scroll { padding: 12px 14px 80px; }
  .cue { gap: 8px; padding: 8px 6px; }
  .cue-meta { width: 52px; }
  .tok { font-size: 15px; padding: 4px 8px; }  /* 터치 타깃 확대 */

  /* 빈 화면 */
  .empty-state { padding: 18px 12px; }
  .dropzone { padding: 32px 20px 26px; border-radius: 18px; }
  .dropzone h1 { font-size: 24px; }
  .dz-lead { font-size: 14px; }
  .dz-features { grid-template-columns: 1fr; }

  /* 모달: 하단 시트 스타일 (꽉 차게) */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal, .modal.modal-wide {
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 0 0;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    max-height: 88vh;
    overflow-y: auto;
  }
  .font-grid { max-height: 30vh; }

  /* 선택 액션바: 하단 고정 바 (좁은 화면에서도 버튼이 넘치지 않게) */
  .sel-bar {
    position: fixed;
    left: 8px; right: 8px; bottom: 40px;
    transform: none;
    max-width: none;
    border-radius: 14px;
    padding: 6px 8px;
    gap: 6px;
    justify-content: space-between;
    box-sizing: border-box;
  }
  @keyframes selbar-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
  }
  /* 선택 개수는 공간이 부족하면 줄임표로 */
  .sel-count { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
  .sel-actions { flex: 0 1 auto; justify-content: center; gap: 4px; }
  .sel-actions button { flex: none; min-width: 42px; max-width: none; padding: 6px 6px; }
  .sel-close { flex: none; min-width: 30px; padding: 6px; }
}
