:root {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --fill: #F5F5F7;
  --fill-strong: #E8E8ED;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lift: 0 12px 32px rgba(0, 0, 0, 0.1);
  --text: #1D1D1F;
  --text-2: #424245;
  --text-3: #6E6E73;
  --blue: #0071E3;
  --blue-hover: #0077ED;
  --link: #0066CC;
  --blue-tint: rgba(0, 113, 227, 0.1);
  --blue-select: rgba(0, 113, 227, 0.06);
  --focus-ring: rgba(0, 113, 227, 0.6);
  --red: #E30000;
  --orange: #FF9500;
  --green: #34C759;
  --radius-lg: 22px;
  --radius: 18px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Apple SD Gothic Neo", "Pretendard", "Helvetica Neue", "Noto Sans KR", sans-serif;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6E73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --magnifier: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6E73' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--link); }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(251, 251, 253, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px;
  height: 52px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.brand { font-size: 17px; font-weight: 600; letter-spacing: -0.022em; white-space: nowrap; }
.topbar-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }

/* ---------- Segmented control ---------- */
.segmented {
  display: inline-flex;
  gap: 2px;
  min-inline-size: 0;
  margin: 0;
  padding: 2px;
  border: 0;
  border-radius: 10px;
  background: rgba(118, 118, 128, 0.12);
}
.segmented-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  min-height: 32px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.segmented-item input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.segmented-item.active,
.segmented-item:has(input:checked) {
  background: var(--surface);
  font-weight: 600;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04);
}
.segmented-item:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }

/* ---------- Recent bar ---------- */
.recent-bar { border-bottom: 1px solid var(--line); background: var(--bg); }
.recent-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.recent-label { flex: none; font-size: 13px; color: var(--text-3); font-weight: 600; }
.recent-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
.recent-list::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  max-width: 240px;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.chip:hover { color: var(--text); border-color: rgba(0, 0, 0, 0.26); }
.chip.active { background: var(--text); border-color: var(--text); color: #fff; }
.chip-time { margin-left: 6px; color: var(--text-3); font-weight: 400; }
.chip.active .chip-time { color: rgba(255, 255, 255, 0.6); }

/* ---------- Layout ---------- */
.container { max-width: 860px; margin: 0 auto; padding: 48px 24px 120px; }
.workspace { display: flex; flex-direction: column; gap: 24px; }
.empty-state { padding: 80px 0; text-align: center; color: var(--text-3); }

.page-head { margin-bottom: 8px; }
.page-title { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.18; }
.page-sub { margin-top: 8px; color: var(--text-3); font-size: 17px; line-height: 1.5; }
.muted { color: var(--text-3); font-size: 13px; }

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.022em;
}
.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--blue-tint);
  color: var(--link);
  font-size: 13px;
  font-weight: 600;
}
.text-link {
  border: 0;
  background: none;
  padding: 4px 0;
  color: var(--link);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
}
.text-link:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 980px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, .segmented-item:focus-visible,
.segmented-item:has(input:focus-visible), .bench-card:focus-visible, .text-link:focus-visible,
.inline-tab:focus-visible, .modal-tab:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 32px; padding: 0 14px; font-size: 13px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); }
.btn-soft { background: var(--fill-strong); color: var(--text); }
.btn-soft:hover:not(:disabled) { background: #DCDCE1; }
.btn-tint { background: var(--blue-tint); color: var(--link); }
.btn-tint:hover:not(:disabled) { background: rgba(0, 113, 227, 0.16); }
.btn-cta { width: 100%; min-height: 52px; font-size: 17px; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: rgba(118, 118, 128, 0.12); color: var(--text); }
.icon-btn .icon { width: 20px; height: 20px; }

.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

/* ---------- Form ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background-color: var(--fill);
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
textarea { resize: vertical; line-height: 1.6; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
}
input[type="search"] {
  padding-left: 40px;
  background-image: var(--magnifier);
  background-repeat: no-repeat;
  background-position: 14px center;
  background-size: 16px;
}
input[type="radio"], input[type="checkbox"] { accent-color: var(--blue); }
input::placeholder, textarea::placeholder { color: #86868B; }
input:focus, select:focus, textarea:focus {
  background-color: var(--surface);
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }

/* ---------- Bench cards ---------- */
.bench-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.bench-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 112px;
  padding: 18px;
  text-align: left;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.bench-card:hover { box-shadow: var(--shadow-lift); }
.bench-card.active { border-color: var(--blue); background: var(--blue-select); box-shadow: 0 0 0 1px var(--blue); }
.bench-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bench-q {
  font-size: 13px;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preset-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.preset-chip {
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--fill-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.preset-chip:hover { background: var(--blue-tint); color: var(--link); }

/* ---------- Viewpoint ---------- */
.viewpoint-question { display: block; margin-bottom: 12px; font-size: 15px; font-weight: 600; color: var(--text); }
.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--fill-strong);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.pill.required { background: rgba(255, 149, 0, 0.16); color: #A34B00; }
.pill.done { background: rgba(52, 199, 89, 0.15); color: #1F7A35; }
.pill.info { background: var(--blue-tint); color: var(--link); }
.field-error { margin-top: 8px; color: var(--red); font-size: 13px; font-weight: 500; }
textarea.has-error { border-color: var(--red); box-shadow: 0 0 0 4px rgba(227, 0, 0, 0.12); }

/* ---------- Disclosure ---------- */
.disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::after {
  content: "";
  width: 14px;
  height: 14px;
  flex: none;
  background: var(--chevron) center / contain no-repeat;
  transition: transform 0.2s;
}
.disclosure[open] summary::after { transform: rotate(180deg); }
.disclosure[open] summary { margin-bottom: 18px; }
.disclosure.boxed { padding: 16px 18px; border-radius: var(--radius); background: var(--fill); }
.disclosure.boxed input, .disclosure.boxed select, .disclosure.boxed textarea { background-color: var(--surface); }
.card.disclosure { padding: 22px 32px; }

.byok-line {
  grid-column: span 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--fill);
  font-size: 14px;
  color: var(--text-2);
}

/* ---------- Result ---------- */
.result-head { display: flex; flex-direction: column; gap: 6px; }
.result-title { font-size: 28px; font-weight: 700; letter-spacing: -0.028em; line-height: 1.3; }
.result-meta { font-size: 14px; color: var(--text-3); }
.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.16);
}
.mvp-video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; }

.cuts-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cut-item { display: flex; flex-direction: column; gap: 6px; }
.cut-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  background: var(--fill);
}
.cut-label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.block-title { margin-bottom: 14px; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }

.inline-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.inline-tab {
  position: relative;
  padding: 0 0 12px;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 15px;
  font-weight: 600;
}
.inline-tab.active { color: var(--text); }
.inline-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}
.tab-panel { display: flex; flex-direction: column; gap: 18px; }
.text-block { font-size: 15px; color: var(--text-2); line-height: 1.75; white-space: pre-wrap; }
.act-title { margin-bottom: 4px; font-size: 13px; font-weight: 700; color: var(--link); }
.kv-list { display: grid; grid-template-columns: 112px 1fr; gap: 10px 16px; font-size: 14px; }
.kv-list dt { color: var(--text-3); }
.kv-list dd { margin: 0; color: var(--text); }
.sub-title { font-size: 13px; font-weight: 600; color: var(--text-3); margin-bottom: 8px; }
.plain-list { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Progress ---------- */
.progress-card { display: flex; flex-direction: column; gap: 14px; }
.progress-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.progress-value { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; color: var(--text); line-height: 1; }
.progress-track { height: 6px; border-radius: 999px; background: var(--fill-strong); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--blue); transition: width 0.6s ease; }
.progress-step { font-size: 15px; color: var(--text-2); }
.error-text { color: var(--red); font-size: 14px; }

/* ---------- Shorts ---------- */
.segmented.small .segmented-item { min-width: 0; flex: 1; padding: 8px 16px; }
.segmented.small { display: flex; }
.short-list { display: flex; flex-direction: column; margin-top: 8px; }
.short-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.short-title { font-size: 15px; font-weight: 600; }

/* ---------- Modal ---------- */
.modal {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.modal[open] { display: flex; flex-direction: column; }
.modal:focus { outline: none; }
.modal::backdrop { background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 24px 28px 8px; }
.modal-head h2 { font-size: 21px; font-weight: 700; letter-spacing: -0.022em; }
.modal-tabs { flex: none; display: flex; gap: 4px; padding: 8px 24px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.modal-tab {
  position: relative;
  padding: 10px 12px 12px;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.modal-tab.active { color: var(--text); }
.modal-tab.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}
.modal-body { flex: 1; min-height: 0; padding: 24px 28px 28px; overflow-y: auto; }
.settings-panel { display: flex; flex-direction: column; }
.panel-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.panel-intro h3, .panel-title { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.panel-title { margin-bottom: 14px; }
.panel-intro .muted, .settings-panel > .muted { margin-top: 2px; }
.balance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  margin-bottom: 28px;
  border-radius: var(--radius);
  background: var(--fill);
}
.balance-value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.balance-value strong { font-weight: 700; }
.code-label { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.code-block {
  margin: 0;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--fill);
  color: var(--text-2);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  overflow: auto;
}
.code-block.tall { max-height: 280px; }
.settings-panel .disclosure { margin-top: 16px; }
.manual-target { margin: 20px 0; }

/* ---------- Manual workflow ---------- */
.manual-block { padding: 20px 0; border-top: 1px solid var(--line); }
.manual-block:first-child { border-top: 0; padding-top: 0; }
.manual-block h4 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.manual-block .form-grid { margin-top: 14px; }
.stage-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.stage-chip { padding: 4px 10px; border-radius: 999px; background: var(--fill-strong); color: var(--text-3); font-size: 12px; font-weight: 600; }
.stage-chip.active { background: var(--blue-tint); color: var(--link); }
.mono-box {
  margin-top: 12px;
  padding: 14px;
  max-height: 220px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--fill);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-2);
  white-space: pre-wrap;
}
.feedback-ok { color: #1F7A35; font-size: 14px; font-weight: 600; }
.feedback-err { color: var(--red); font-size: 14px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 100;
  max-width: calc(100vw - 48px);
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .topbar-inner { grid-template-columns: auto 1fr auto; padding: 0 16px; gap: 10px; }
  .brand { font-size: 15px; }
  .segmented { justify-self: center; }
  .segmented-item { min-width: 0; padding: 0 12px; }
  .container { padding: 32px 16px 80px; }
  .recent-inner { padding: 10px 16px; }
  .card { padding: 24px 20px; border-radius: var(--radius); }
  .page-title { font-size: 28px; }
  .bench-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cuts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-body { padding: 20px; }
}
@media (max-width: 520px) {
  .brand { display: none; }
  .topbar-inner { grid-template-columns: 1fr auto; }
  .segmented { justify-self: start; }
  .bench-grid, .form-grid { grid-template-columns: 1fr; }
  .bench-card { min-height: 0; }
  .span-2, .byok-line { grid-column: auto; }
  .kv-list { grid-template-columns: 1fr; gap: 2px; }
  .kv-list dd { margin-bottom: 8px; }
  .short-item { flex-direction: column; align-items: stretch; }
  #studio .topbar-inner { grid-template-columns: auto 1fr auto; padding: 0 10px; gap: 4px; }
}

/* ---------- Topic home ---------- */
.topic-bar {
  max-width: 1120px;
  min-height: 52px;
  margin: 0 auto;
  padding: 6px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}
.topic-bar .brand { display: block; }
.topic-bar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.auth-bar { display: flex; align-items: center; gap: 8px; }
.auth-guest, .auth-user { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-oauth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.15s, background 0.15s;
}
.btn-google {
  background: #FFFFFF;
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn-google:hover { background: var(--fill); }
.btn-kakao {
  background: #FEE500;
  color: #191919;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.btn-kakao:hover { filter: brightness(0.97); }
.auth-name { font-size: 14px; font-weight: 600; color: var(--text); }
.auth-tier {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--fill-strong);
  color: var(--text-2);
}
.auth-tier[data-tier="paid"] { background: var(--blue-tint); color: var(--blue); }
.auth-tier[data-tier="admin"] { background: rgba(52, 199, 89, 0.16); color: #1d7a36; }
.auth-notice {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(227, 0, 0, 0.08);
  color: var(--red);
  font-size: 14px;
  font-weight: 500;
}
.session-mcp-box {
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--fill);
}
#topicHome .container { max-width: 1120px; padding-top: 64px; }
@media (min-width: 1280px) {
  #topicHome .container { max-width: 1320px; }
}
#topicHome .workspace { gap: 28px; }
#topicHome .page-head { margin-bottom: 12px; }
#topicHome .page-title { font-size: clamp(36px, 5vw, 56px); line-height: 1.08; letter-spacing: -0.035em; }
#topicHome .page-sub { max-width: 34em; margin-top: 14px; font-size: clamp(17px, 1.9vw, 21px); line-height: 1.45; }
.home-styles { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 28px; }
.period-switch .segmented-item { min-width: 76px; min-height: 36px; font-size: 15px; }
#previewStyles { display: inline-flex; align-items: center; gap: 4px; font-size: 17px; }
#previewStyles::after {
  content: "";
  width: 10px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230066CC' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}
#defaultStyleStatus { color: var(--text-3); font-size: 14px; }
#defaultStyleStatus:empty { display: none; }

#topicHome .card { padding: 36px 40px; }
#topicHome .card.disclosure { padding: 24px 40px; }
#topicHome .card h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.028em; line-height: 1.2; }
#weekPanel, #weeklyPanel, #discoveryPanel, #topicRequest { scroll-margin-top: 76px; }

.topic-form { display: grid; gap: 20px; }
.topic-form .btn { justify-self: start; }
#topicStatus { padding: 0 4px; color: var(--text-3); font-size: 14px; }
#topicStatus:empty, #guideStatus:empty, #copyStatus:empty { display: none; }
#guideStatus, #publicGuide, #handoffField { margin-top: 16px; }
#guideStatus, #copyStatus { color: var(--text-3); font-size: 14px; }
.mcp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#handoff textarea { min-height: 88px; }

/* Bench list */
#weekPanel .section-head { flex-wrap: wrap; align-items: baseline; margin-bottom: 10px; }
.head-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
#weekStatus { color: var(--text-2); font-size: 15px; }
#weekMatches { color: var(--text-3); font-size: 14px; }
#collectionStatus { margin-top: 4px; }
#retryWeek { margin-top: 16px; }
#weekFilters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 28px; }
#weekFilters .field { min-width: 0; }
.week-minimum {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--fill);
  color: var(--text-3);
  font-size: 15px;
  font-weight: 400;
  white-space: nowrap;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.week-minimum:focus-within {
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}
.week-minimum input,
.week-minimum input:focus {
  flex: 1;
  min-width: 0;
  padding: 11px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: right;
  -moz-appearance: textfield;
}
.week-minimum input::-webkit-inner-spin-button,
.week-minimum input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.week-minimum:has(input:placeholder-shown) [aria-hidden="true"] { display: none; }
.week-results-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; }
.week-results-bar:has(#weekMatches:not(:empty)) { margin: 22px 0 16px; }

[data-band="ten"], [data-ratio-band="ten"] { --band-color: #34C759; --band-text: #1F7A35; --band-tint: rgba(52, 199, 89, 0.15); --band-solid: #18803A; }
[data-band="five"], [data-ratio-band="five"] { --band-color: #FF9500; --band-text: #A34B00; --band-tint: rgba(255, 149, 0, 0.16); --band-solid: #C25400; }
[data-band="other"], [data-ratio-band="other"] { --band-color: #C7C7CC; --band-text: var(--text-3); --band-tint: var(--fill); --band-solid: rgba(29, 29, 31, 0.78); }
.band-count {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--band-tint, var(--fill));
  color: var(--band-text, var(--text-3));
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

#benchBands { margin-top: 12px; }
#benchBands > details { border-top: 1px solid var(--line); }
#benchBands > details > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 2px;
  list-style: none;
  cursor: pointer;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
#benchBands > details > summary::-webkit-details-marker { display: none; }
#benchBands > details > summary::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--band-color);
}
#benchBands > details > summary::after {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  margin-left: auto;
  background: var(--chevron) center / contain no-repeat;
  transition: transform 0.2s;
}
#benchBands > details[open] > summary::after { transform: rotate(180deg); }
#benchBands > details > .week-scroll:not(:empty) { padding-bottom: 32px; }

/* Video cards: 벤치 DB, 키워드 검색, 수동 검색 결과가 같은 카드를 쓴다 */
:is(#weekTable, .discovery-table) { display: block; width: 100%; }
:is(#weekTable, .discovery-table) thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
:is(#weekTable, .discovery-table) tbody {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 264px), 1fr));
  gap: 24px 20px;
}
:is(#weekTable, .discovery-table) tbody tr {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    "video video video"
    "channel channel channel"
    "views subscribers date"
    "footer footer footer";
  align-content: start;
  column-gap: 12px;
  padding: 0 16px 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
@media (hover: hover) {
  :is(#weekTable, .discovery-table) tbody tr:hover {
    border-color: transparent;
    box-shadow: 0 18px 36px -16px rgba(0, 0, 0, 0.3);
    transform: translateY(-3px);
  }
  :is(#weekTable, .discovery-table) tbody tr:hover .week-thumb img { transform: scale(1.04); }
}
:is(#weekTable, .discovery-table) tbody tr:has(.week-title a:focus-visible) { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
:where(#weekTable, .discovery-table) :where(th, td) { display: block; min-width: 0; padding: 0; text-align: left; font-weight: 400; }
:is(#weekTable, .discovery-table) tbody th { grid-area: video; margin: 0 -16px; }
.week-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--fill);
}
.week-thumb:empty::before { content: "썸네일 없음"; color: var(--text-3); font-size: 13px; }
.week-thumb img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.week-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 2.84em;
  margin: 14px 16px 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.week-title a { color: inherit; text-decoration: none; }
.week-title a::after { content: ""; position: absolute; inset: 0; }
.week-title a:focus-visible { outline: none; }
.week-channel {
  grid-area: channel;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.week-channel > span {
  min-width: 0;
  overflow: hidden;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.week-channel small { flex: none; padding: 2px 8px; border-radius: 6px; background: var(--fill); color: var(--text-3); font-size: 12px; font-weight: 500; }
.week-channel small:empty { display: none; }
.week-views { grid-area: views; }
.week-subscribers { grid-area: subscribers; }
.week-date { grid-area: date; }
:is(.week-stat, .week-date) {
  padding-top: 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
:is(.week-stat, .week-date)::before { content: attr(data-label); display: block; margin-bottom: 1px; color: var(--text-3); font-size: 12px; font-weight: 500; }
.week-ratio { position: absolute; top: 12px; left: 12px; z-index: 1; pointer-events: none; }
.week-ratio > span {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.78);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.week-ratio > .measured-ratio { background: var(--band-solid, rgba(29, 29, 31, 0.78)); }
.week-observed { grid-area: footer; align-self: center; padding: 14px 108px 0 0; color: var(--text-3); font-size: 12px; line-height: 1.4; }
.week-action { grid-area: footer; align-self: center; justify-self: end; position: relative; z-index: 1; padding-top: 14px; }
.week-reading-note { position: relative; z-index: 1; margin-top: 2px; color: #A34B00; }
.week-reading-note summary { cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  :is(#weekTable, .discovery-table) tbody tr, .week-thumb img { transition: none; }
  :is(#weekTable, .discovery-table) tbody tr:hover,
  :is(#weekTable, .discovery-table) tbody tr:hover .week-thumb img { transform: none; }
}
@media (max-width: 850px) {
  #weekFilters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  #weekFilters { grid-template-columns: minmax(0, 1fr); }
  #benchBands > details > summary { padding: 18px 2px; font-size: 17px; }
}

/* Keywords and YouTube results */
#weeklyPanel { min-width: 0; }
#weeklyPanel > h2 + #keywordStatus { margin-top: -12px; }
#weeklyKeywords {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
#weeklyKeywords li { display: grid; align-content: start; gap: 6px; padding: 20px 22px; border-radius: var(--radius); background: var(--fill); }
#weeklyKeywords strong { font-size: 21px; font-weight: 700; letter-spacing: -0.022em; line-height: 1.25; }
#weeklyKeywords span { color: var(--text-3); font-size: 13px; }
#weeklyKeywords, #weeklyResults, #weeklyStatus { min-width: 0; overflow-wrap: anywhere; }
#weeklyKeywords:empty, #weeklyStatus:empty, #weeklyResults:empty, #passStatus:empty { display: none; }
#searchIntro, #passStatus, #weeklyStatus { font-size: 14px; }
#passStatus, #weeklyStatus { color: var(--text-3); }
#passForm, #weeklyForm { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
#passForm .field, #weeklyForm .field { flex: 1 1 320px; }
#apiTitle { padding-top: 28px; border-top: 1px solid var(--line); font-size: 21px; font-weight: 700; letter-spacing: -0.022em; }
#weeklyResults { display: grid; }
#weeklyResults > section { min-width: 0; padding: 28px 0 8px; border-top: 1px solid var(--line); }
#weeklyResults h3 { font-size: 21px; font-weight: 700; letter-spacing: -0.022em; }
#weeklyResults h3 + .muted { margin-top: 4px; }
#weeklyResults h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 0 14px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}
#weeklyResults h4::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--band-color, #C7C7CC); }
.weekly-links { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 14px; }
.weekly-links a { text-decoration: none; }
.weekly-links a:hover { text-decoration: underline; }

/* Recommendation */
#recommendForm > .field:first-child { gap: 12px; color: var(--text); font-size: 17px; font-weight: 600; letter-spacing: -0.016em; }
#topicRequest { padding: 14px 16px; font-size: 17px; }
#localKeyOption summary { color: var(--text-2); font-size: 14px; font-weight: 500; }
.topic-table { width: 100%; border-collapse: collapse; }
.topic-table th, .topic-table td { padding: 16px 10px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.topic-table thead th { padding-top: 0; color: var(--text-3); font-size: 12px; font-weight: 600; }
.topic-table tbody tr { border-top: 1px solid var(--line); }
.topic-table tbody th { font-size: 16px; font-weight: 600; letter-spacing: -0.016em; }
.topic-table tbody td { color: var(--text-2); }
@media (min-width: 521px) {
  .topic-table :is(td, thead th):last-child { text-align: right; white-space: nowrap; }
}

/* Manual search */
#discoveryPanel > h2 + .muted { margin-top: -12px; font-size: 14px; }
.search-kinds { justify-self: start; }
#manualKeyOption > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  color: var(--link);
  font-size: 14px;
  cursor: pointer;
}
#manualKeyOption > summary::-webkit-details-marker { display: none; }
#manualKeyOption > summary::after {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--chevron) center / contain no-repeat;
  transition: transform 0.2s;
}
#manualKeyOption[open] > summary::after { transform: rotate(180deg); }
#manualKeyOption[open] > summary { margin-bottom: 12px; }
#discoveryResults { display: grid; gap: 8px; }
#discoveryHeading { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
#discoveryStatus { color: var(--text-3); font-size: 14px; }
#discoveryChannels { display: grid; margin: 8px 0 0; padding: 0; list-style: none; }
#discoveryChannels:empty { display: none; }
#discoveryChannels li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 12px 2px;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
#discoveryChannels :is(a, strong) { color: var(--text); font-weight: 600; text-decoration: none; }
#discoveryChannels a:hover { color: var(--link); text-decoration: underline; }
#discoveryChannels span { color: var(--text-3); font-size: 14px; }

/* Style picker */
.style-topic { color: var(--text-2); overflow-wrap: anywhere; }
.style-topic:empty { display: none; }
#styleChoices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.style-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  cursor: pointer;
  overflow-wrap: anywhere;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.style-choice:hover { border-color: rgba(0, 0, 0, 0.26); }
.style-choice:has(:checked) { border-color: var(--blue); background: var(--blue-select); box-shadow: 0 0 0 1px var(--blue); }
.style-choice:focus-within { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.style-choice input { width: 18px; height: 18px; padding: 0; margin: 0; }
.style-choice span, .style-choice img, .style-choice video { grid-column: 1 / -1; }
.style-choice span { color: var(--text-3); font-size: 14px; }
.style-choice img, .style-choice video { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 10px; background: var(--fill); }
#studioStyleBtn { margin-top: 12px; }
.stock-sources { overflow-wrap: anywhere; }
.stock-sources a { color: var(--link); text-decoration: underline; }

@media (max-width: 760px) {
  #topicHome .container { padding: 40px 16px 88px; }
  #topicHome .card { padding: 26px 20px; border-radius: var(--radius); }
  #topicHome .card.disclosure { padding: 20px; }
  #topicHome .card h2 { font-size: 24px; }
  .home-styles { margin-top: 20px; }
  #weeklyResults > section { padding: 22px 0 4px; }
}
@media (max-width: 520px) {
  .topic-bar { padding: 0 16px; }
  .period-switch { width: 100%; }
  .period-switch .segmented-item { flex: 1; min-width: 0; }
  #passForm .btn, #weeklyForm .btn { flex: 1 1 100%; }
  .topic-table thead { position: absolute; clip-path: inset(50%); }
  .topic-table tbody tr { display: grid; gap: 6px; padding: 14px 0; }
  .topic-table th, .topic-table td { padding: 0; }
  .topic-table td:last-child { padding-top: 6px; }
  #styleChoices { grid-template-columns: minmax(0, 1fr); }
  #confirmStyle { justify-self: stretch; }
}

.instagram-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); gap: 14px; border: 0; padding: 0; }
.instagram-choices label { display: grid; gap: 8px; cursor: pointer; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.instagram-choices label:has(:checked) { outline: 2px solid var(--focus-ring); }
.instagram-choices img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 6px; }

.shorts-examples { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr)); gap:20px; }
.shorts-examples video { display:block; width:100%; max-height:48vh; background:#171921; border-radius:12px; }
.ranking-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 9 / 16;
  max-height: 48vh;
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  background: #171921;
}
.ranking-frame {
  position: relative;
  container-type: inline-size;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 9 / 16;
  background: linear-gradient(155deg, #202b40, #303e54 58%, #1b2230);
  color: #f4f6fa;
}
.ranking-frame strong, .ranking-caption {
  position: absolute;
  inset-inline: 7%;
  text-align: center;
}
.ranking-frame strong {
  top: 6%;
  padding: 0.35em;
  border-block: 1px solid #708097;
  font-size: 8cqw;
}
.ranking-frame ol {
  position: absolute;
  top: 29%;
  left: 9%;
  margin: 0;
  padding-left: 1.3em;
  font-size: 5.5cqw;
  font-weight: 700;
  line-height: 2;
}
.ranking-frame li::after {
  content: "";
  display: inline-block;
  vertical-align: middle;
  width: 10cqw;
  height: 0.22em;
  border-radius: 1em;
  background: #8799ac;
}
.ranking-media {
  position: absolute;
  top: 49%;
  left: 47%;
  color: #c0ccd8;
  font-size: 6cqw;
}
.ranking-caption {
  bottom: 8%;
  justify-self: center;
  padding: 0.28em 0.8em;
  border-radius: 0.24em;
  background: #131b27;
  font-size: 5.5cqw;
}
.travel-season-preview { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; }
#travelSeasonImage {
  flex: 0 0 36%;
  aspect-ratio: 4 / 3;
  border-radius: 7px;
  background: url("/shorts-previews/seasons.jpg") 0 0 / 200% 200%;
}
#travelSeasonImage[data-season="summer"] { background-position: 100% 0; }
#travelSeasonImage[data-season="autumn"] { background-position: 0 100%; }
#travelSeasonImage[data-season="winter"] { background-position: 100% 100%; }
.travel-season-preview figcaption, .travel-season-credit { font-size: .82rem; line-height: 1.45; }
.travel-season-credit { margin: 0 0 12px; color: var(--text-3); }
.travel-season-credit summary { cursor: pointer; }
.shorts-examples p { margin:8px 0 14px; }
