/* ===================================================================
   ImgAi · Studio Layout (v4) — 풀폭 워크스페이스 + 반응형 고도화
   모노톤 뉴트럴 + 그린 액센트 (#10a37f)
   =================================================================== */

:root {
  --bg: #ffffff;
  --surface: #f7f7f8;
  --surface-2: #ececec;
  --surface-3: #fafafa;
  --composer: #ffffff;

  --text: #0d0d0d;
  --text-muted: #6e6e80;
  --text-light: #a0a0ae;

  --border: #e5e5e5;
  --border-strong: #d6d6d9;

  --primary: #10a37f;
  --primary-hover: #0e8e6d;
  --primary-soft: #e7f6f1;
  --primary-soft-hover: #d6efe6;
  --on-primary: #ffffff;

  --select: #0d0d0d;
  --on-select: #ffffff;

  --user-bubble: #f4f4f4;

  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --success: #10a37f;
  --warn: #92733a;
  --warn-soft: #fbf6ec;
  --warn-border: #ecdcc0;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.16);

  --radius: 16px;
  --radius-lg: 20px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --radius-pill: 999px;
  --radius-composer: 22px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t: 0.15s var(--ease);

  --shell: 1180px;
  --topbar-h: 60px;
  --font: "Söhne", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", Helvetica, Arial, sans-serif;

  color-scheme: light dark;
}

:root[data-theme="dark"] {
  --bg: #1a1a1a;
  --surface: #262626;
  --surface-2: #333333;
  --surface-3: #212121;
  --composer: #2f2f2f;

  --text: #ececec;
  --text-muted: #b4b4b4;
  --text-light: #8e8e8e;

  --border: #3a3a3c;
  --border-strong: #4d4d4f;

  --primary: #19c37d;
  --primary-hover: #1bd389;
  --primary-soft: #16271f;
  --primary-soft-hover: #1d3a2c;
  --on-primary: #0d0d0d;

  --select: #ececec;
  --on-select: #0d0d0d;

  --user-bubble: #323232;

  --danger: #f87171;
  --danger-soft: #2c1717;
  --success: #19c37d;
  --warn: #d6b778;
  --warn-soft: #2a2419;
  --warn-border: #463c24;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.6);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

* { box-sizing: border-box; }
::selection { background: var(--primary); color: var(--on-primary); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); background-clip: padding-box; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

html { scroll-behavior: smooth; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body { min-height: 100vh; }
button { font-family: inherit; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

.skip-link { position: absolute; top: -48px; left: 12px; z-index: 9999; padding: 9px 16px; background: var(--select); color: var(--on-select); border-radius: var(--radius-sm); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.skip-link:focus { top: 12px; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }

/* ===== Top bar ===== */
.topbar { position: sticky; top: 0; z-index: 500; background: var(--bg); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: var(--shell); margin: 0 auto; height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 clamp(16px, 3vw, 28px); }
.brand-link { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand-mark { font-size: 1.3rem; line-height: 1; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; }
.brand-badge { font-size: 0.64rem; font-weight: 600; padding: 3px 8px; border-radius: var(--radius-pill); background: var(--primary-soft); color: var(--primary); letter-spacing: 0.02em; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.pill-btn { width: auto !important; padding: 0 14px; gap: 6px; }
.pill-btn-label { font-size: 0.85rem; font-weight: 600; }

/* ===== Hero (index full-width band) ===== */
main > .hero {
  position: relative; text-align: center;
  padding: clamp(44px, 7vw, 92px) 24px clamp(30px, 4vw, 52px);
  border-bottom: 1px solid var(--border);
  background: radial-gradient(ellipse 70% 100% at 50% 0%, var(--primary-soft) 0%, transparent 65%);
}
.hero-inner { max-width: 760px; margin: 0 auto; }
.hero-eyebrow { display: inline-block; font-size: 0.76rem; font-weight: 600; color: var(--primary); background: var(--bg); border: 1px solid var(--border); padding: 6px 14px; border-radius: var(--radius-pill); margin-bottom: 22px; }
.hero-title { font-size: clamp(2rem, 5.5vw, 3.4rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.08; margin: 0 0 18px; color: var(--text); }
.hero-accent { color: var(--primary); }
.hero-sub { font-size: clamp(1rem, 2.2vw, 1.18rem); color: var(--text-muted); margin: 0 auto; max-width: 560px; line-height: 1.6; }
.hero-tags { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.hero-tag { display: inline-flex; align-items: center; padding: 8px 16px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); font-size: 0.86rem; font-weight: 600; color: var(--text); text-decoration: none; transition: border-color var(--t), background var(--t), transform var(--t); }
.hero-tag:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }

/* ===== Shell ===== */
.shell { max-width: var(--shell); margin: 0 auto; padding: clamp(28px, 4vw, 48px) clamp(16px, 3vw, 28px) 36px; }

/* ===== Workspace (2-pane) ===== */
.workspace { display: grid; grid-template-columns: 1fr; gap: 18px; margin-bottom: 8px; }
@media (min-width: 1000px) {
  .workspace { grid-template-columns: minmax(0, 416px) minmax(0, 1fr); gap: 24px; align-items: start; }
  .panel-output { position: sticky; top: calc(var(--topbar-h) + 22px); }
}
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.panel-input { padding: clamp(18px, 2.5vw, 24px); display: flex; flex-direction: column; gap: 26px; }
.panel-output { background: transparent; border: none; min-height: 360px; }

/* fields (guided steps) */
.field { display: flex; flex-direction: column; }
.field-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.field-num { width: 24px; height: 24px; border-radius: 50%; background: var(--select); color: var(--on-select); display: inline-flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 700; flex: 0 0 auto; }
.field-title { font-size: 0.98rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.field-opt { font-size: 0.72rem; font-weight: 500; color: var(--text-light); margin-left: 2px; }

/* ===== Mode toggle ===== */
.mode-toggle { display: flex; gap: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 4px; margin-bottom: 14px; }
.mode { flex: 1; padding: 10px 12px; background: transparent; border: none; border-radius: var(--radius-pill); cursor: pointer; color: var(--text-muted); font-weight: 600; font-size: 0.88rem; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background var(--t), color var(--t); }
.mode.active { background: var(--select); color: var(--on-select); }
.mode:not(.active):hover { color: var(--text); }

/* ===== Category search ===== */
.cat-search-wrap { margin-bottom: 12px; }
.cat-search { width: 100%; padding: 11px 16px; background: var(--composer); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-pill); font: inherit; font-size: 0.9rem; transition: border-color var(--t), box-shadow var(--t); }
.cat-search::placeholder { color: var(--text-light); }
.cat-search:focus { outline: none; border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.cat-empty { margin: 0 0 14px; padding: 12px 16px; text-align: center; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); font-size: 0.86rem; }

/* ===== Categories (wrap grid) ===== */
.categories { margin-bottom: 12px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
.cat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 11px 6px; background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 0.74rem; font-weight: 500; text-align: center; transition: border-color var(--t), color var(--t), background var(--t); }
.cat:hover { border-color: var(--border-strong); color: var(--text); }
.cat.active { background: var(--select); color: var(--on-select); border-color: var(--select); }
.cat.active .cat-name { color: var(--on-select); }
.cat-emoji { font-size: 1.3rem; line-height: 1; }
.cat-name { color: inherit; line-height: 1.2; }
.cat.search-hide { display: none !important; }
.cat.favorited::before { content: '★'; position: absolute; top: 3px; right: 5px; font-size: 0.56rem; color: var(--primary); line-height: 1; pointer-events: none; }
.cat.active.favorited::before { color: var(--on-select); }

/* cat hint + favorite */
.cat-hint-row { display: flex; align-items: stretch; gap: 8px; margin: 14px 0 0; }
.cat-hint { flex: 1; margin: 0; padding: 11px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); font-size: 0.84rem; line-height: 1.5; min-height: 1em; }
.cat-hint:empty { display: none; }
.cat-hint:empty + .fav-btn { align-self: flex-start; }
.fav-btn.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }

/* ===== Uploader ===== */
.dropzone { background: var(--bg); border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 32px 18px 24px; text-align: center; cursor: pointer; transition: border-color var(--t), background var(--t); }
.dropzone:hover, .dropzone.drag, .dropzone:focus-visible { border-color: var(--primary); background: var(--primary-soft); outline: none; }
.dz-icon { font-size: 1.9rem; margin-bottom: 10px; opacity: 0.8; }
.dz-text { margin: 0 0 12px; font-size: 0.92rem; font-weight: 500; color: var(--text-muted); }
.dz-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.dz-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; background: var(--composer); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); color: var(--text); font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: border-color var(--t), background var(--t); }
.dz-btn:hover { border-color: var(--primary); background: var(--surface); }
.dz-hint { margin: 14px 0 0; color: var(--text-light); font-size: 0.76rem; }

.preview { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.preview img { max-width: 100%; max-height: 340px; border-radius: var(--radius-sm); display: block; margin: 0 auto 12px; }
.preview-img-zoom { cursor: zoom-in; }
.preview-tools { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.preview-info { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 0.82rem; }
.clear-btn { font-size: 0.84rem; }

/* links */
.link { background: none; border: none; padding: 0; color: var(--primary); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link:hover { color: var(--primary-hover); }
.link.danger { color: var(--danger); }

/* ===== Prompt (composer) ===== */
.prompt-area textarea, .panel-input textarea { width: 100%; padding: 13px 16px; background: var(--composer); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-composer); font: inherit; font-size: 0.92rem; resize: vertical; box-shadow: var(--shadow-sm); transition: border-color var(--t), box-shadow var(--t); }
.panel-input textarea::placeholder { color: var(--text-light); }
.panel-input textarea:focus { outline: none; border-color: var(--text-light); box-shadow: var(--shadow); }
.prompt-controls { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.prompt-controls .prompt-chips { margin-top: 0; flex: 1 1 100%; min-width: 0; }
.prompt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.prompt-chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; padding: 6px 13px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-pill); color: var(--text-muted); font: inherit; font-size: 0.8rem; font-weight: 500; cursor: pointer; transition: color var(--t), border-color var(--t); }
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.voice-btn, .depth-btn { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 8px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-pill); color: var(--text-muted); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: color var(--t), border-color var(--t), background var(--t); }
.voice-btn:hover, .depth-btn:hover { color: var(--text); border-color: var(--border-strong); }
.depth-btn .depth-label { white-space: nowrap; color: var(--text); }
.voice-btn.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); animation: pulse 1.4s var(--ease) infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(16,163,127,0.35); } 50% { box-shadow: 0 0 0 8px rgba(16,163,127,0); } }

/* turnstile */
.turnstile-box { display: flex; justify-content: center; min-height: 65px; }

/* ===== Primary button ===== */
.primary { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; padding: 14px 22px; background: var(--primary); color: var(--on-primary); border: none; border-radius: var(--radius-pill); font-size: 1rem; font-weight: 600; cursor: pointer; transition: background var(--t), transform 0.06s ease, opacity var(--t); }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.primary:active:not(:disabled) { transform: translateY(1px); }
.primary:disabled { background: var(--surface-2); color: var(--text-light); cursor: not-allowed; }
.primary.small { width: auto; padding: 9px 18px; font-size: 0.86rem; }
.analyze-btn { padding: 16px 22px; font-size: 1.05rem; font-weight: 700; box-shadow: var(--shadow); }
.primary.canceling { background: var(--danger); }
.primary.canceling:hover { background: var(--danger); opacity: 0.9; }
.primary.canceling .btn-label::after { content: '' !important; }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,0.4); border-top-color: currentColor; border-radius: 50%; animation: spin 0.7s linear infinite; display: none; }
.primary.loading .spinner { display: inline-block; }
.primary.loading .btn-label::after { content: "…"; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Icon buttons ===== */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; background: var(--composer); border: 1px solid var(--border); border-radius: var(--radius-pill); cursor: pointer; font-size: 0.98rem; color: var(--text); transition: border-color var(--t), background var(--t), color var(--t); }
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface); }
.icon-btn.small { width: 34px; height: 34px; font-size: 0.92rem; }
.icon-btn.active, .icon-btn.rate-up.active, .icon-btn.bookmark-btn.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.icon-btn.rate-down.active { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.icon-btn.loading-spin { pointer-events: none; opacity: 0.7; }
.icon-btn.loading-spin span { display: inline-block; animation: spin 0.7s linear infinite; }

/* ===== Output: empty state ===== */
.output-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 420px; padding: 48px 30px; background: var(--surface); border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); }
#result:not(.hidden) ~ .output-empty { display: none; }
.output-empty-art { font-size: 3rem; margin-bottom: 18px; opacity: 0.45; }
.output-empty-title { font-weight: 700; font-size: 1.08rem; margin: 0 0 8px; color: var(--text); }
.output-empty-sub { color: var(--text-muted); font-size: 0.9rem; margin: 0; max-width: 320px; line-height: 1.6; }

/* ===== Result ===== */
.result { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(20px, 2.5vw, 28px); animation: rise 0.22s var(--ease); }
.panel-output .result { margin-top: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.result-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.result h2 { font-size: 1.08rem; margin: 0; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.result-cat-emoji { font-size: 1.2rem; }
.result-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.result-text { font-size: 0.97rem; line-height: 1.8; word-break: break-word; min-height: 1.7em; }
.result-text.streaming::after { content: "●"; display: inline-block; margin-left: 3px; color: var(--text); animation: blink 1s steps(2) infinite; font-size: 0.7em; vertical-align: middle; }
@keyframes blink { 50% { opacity: 0; } }

/* followup chat */
.followup-area { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.followup-row { display: flex; gap: 8px; align-items: center; }
.followup-row input { flex: 1; min-width: 0; padding: 12px 16px; background: var(--composer); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); font: inherit; font-size: 0.9rem; box-shadow: var(--shadow-sm); transition: border-color var(--t), box-shadow var(--t); }
.followup-row input::placeholder { color: var(--text-light); }
.followup-row input:focus { outline: none; border-color: var(--text-light); box-shadow: var(--shadow); }
.followup-row .primary.small { flex: 0 0 auto; padding: 11px 18px; }
.chat-user { margin: 20px 0 8px; padding: 11px 16px; background: var(--user-bubble); border-radius: 20px 20px 6px 20px; display: inline-flex; gap: 8px; align-items: flex-start; color: var(--text); font-size: 0.93rem; max-width: 88%; margin-left: auto; width: fit-content; }
.chat-user .chat-label { flex-shrink: 0; }
.chat-user .chat-text { flex: 1; word-break: break-word; }
.chat-ai { margin: 0 0 8px; padding: 8px 0; }

/* disclaimer */
.disclaimer { margin-top: 20px; padding: 11px 14px; background: var(--warn-soft); border: 1px solid var(--warn-border); border-radius: var(--radius-sm); color: var(--warn); font-size: 0.82rem; line-height: 1.5; }
.disclaimer:empty { display: none; }

/* skeleton */
.skeleton { display: flex; flex-direction: column; gap: 11px; padding: 4px 0; }
.skeleton-line { height: 13px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton-line:nth-child(1) { width: 60%; }
.skeleton-line:nth-child(2) { width: 92%; }
.skeleton-line:nth-child(3) { width: 78%; }
.skeleton-line:nth-child(4) { width: 86%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.error-retry { margin-top: 14px; }

/* markdown */
.markdown h2 { font-size: 1.1rem; margin: 22px 0 8px; font-weight: 600; letter-spacing: -0.01em; }
.markdown h3 { font-size: 1.0rem; margin: 18px 0 6px; font-weight: 600; }
.markdown h4 { font-size: 0.93rem; margin: 13px 0 4px; font-weight: 600; color: var(--text-muted); }
.markdown p { margin: 10px 0; }
.markdown ul, .markdown ol { margin: 10px 0; padding-left: 22px; }
.markdown li { margin: 6px 0; }
.markdown li::marker { color: var(--text-light); }
.markdown strong { font-weight: 600; }
.markdown em { font-style: italic; }
.markdown code { background: var(--surface-2); padding: 1.5px 6px; border-radius: 5px; font-size: 0.88em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.markdown pre { background: var(--surface-2); padding: 14px 16px; border-radius: var(--radius-sm); overflow-x: auto; margin: 12px 0; }
.markdown pre code { background: none; padding: 0; font-size: 0.86em; }
.markdown a { color: var(--primary); text-underline-offset: 2px; }
.markdown blockquote { margin: 12px 0; padding: 4px 0 4px 16px; border-left: 2px solid var(--border-strong); color: var(--text-muted); }

/* ===== Ad slot ===== */
.ad-slot { margin: 28px 0; min-height: 200px; padding: 24px 14px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.ad-slot::before { content: "ADVERTISEMENT"; position: absolute; top: 8px; left: 14px; font-size: 0.6rem; letter-spacing: 0.12em; color: var(--text-light); font-weight: 600; }
.ad-slot ins.adsbygoogle { display: block !important; width: 100%; min-height: 180px; }

/* ===== Sections ===== */
.why, .howto, .about, .faq { margin-top: 28px; padding: clamp(26px, 3.5vw, 40px) clamp(20px, 3vw, 36px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.why h2, .howto h2, .about h2, .faq h2 { margin: 0 0 22px; font-size: clamp(1.3rem, 3vw, 1.7rem); font-weight: 800; letter-spacing: -0.025em; color: var(--text); }
.about h2 { margin-bottom: 8px; }
.about-lead { margin: 0 0 26px; color: var(--text-muted); font-size: 0.96rem; }
.group-title { margin: 28px 0 14px; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); display: inline-flex; align-items: center; gap: 8px; }
.group-title small { font-size: 0.7rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text-light); }

.why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.why-card { padding: 22px 20px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color var(--t), transform var(--t); }
.why-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.why-icon { font-size: 1.7rem; margin-bottom: 12px; display: inline-block; }
.why-card h3 { margin: 0 0 6px; font-size: 1rem; font-weight: 700; }
.why-card p { margin: 0; font-size: 0.85rem; color: var(--text-muted); line-height: 1.55; }

.howto-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; gap: 18px; padding: 18px 4px; align-items: flex-start; border-bottom: 1px solid var(--border); }
.step:last-child { border-bottom: none; }
.step-num { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.92rem; }
.step-body h3 { margin: 0 0 5px; font-size: 1rem; font-weight: 600; }
.step-body p { margin: 0; font-size: 0.89rem; color: var(--text-muted); line-height: 1.6; }

.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 11px; }
.feature { padding: 18px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border); transition: border-color var(--t), transform var(--t); }
.feature:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.feature h4 { margin: 0 0 6px; font-size: 0.95rem; font-weight: 600; color: var(--text); }
.feature p { margin: 0; font-size: 0.85rem; line-height: 1.55; color: var(--text-muted); }
a.feature { text-decoration: none; }
a.feature:hover { border-color: var(--primary); }
.feature-indigo, .feature-pink, .feature-yellow, .feature-green, .feature-blue, .feature-purple, .feature-red, .feature-amber { background: var(--bg); border-color: var(--border); }

.faq details { border-bottom: 1px solid var(--border); padding: 4px 0; }
.faq details:last-child { border-bottom: none; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 0.94rem; padding: 14px 28px 14px 0; position: relative; list-style: none; user-select: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 4px; top: 50%; width: 9px; height: 9px; border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: translateY(-65%) rotate(45deg); transition: transform var(--t); }
.faq details[open] summary::after { transform: translateY(-35%) rotate(-135deg); }
.faq details p { margin: 0 0 14px; color: var(--text-muted); font-size: 0.91rem; line-height: 1.65; }

kbd { display: inline-block; padding: 3px 7px; background: var(--surface-2); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.78rem; color: var(--text); font-weight: 600; min-width: 22px; text-align: center; }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-content { position: relative; width: 100%; max-width: 540px; max-height: 86vh; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; animation: pop 0.2s var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 1.08rem; font-weight: 600; }
.modal-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 0.86rem; gap: 8px; }
.modal-toolbar.secondary { padding: 10px 20px; flex-wrap: wrap; }
.search-input, .filter-select { padding: 9px 14px; background: var(--composer); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-pill); font: inherit; font-size: 0.86rem; transition: border-color var(--t), box-shadow var(--t); }
.search-input { flex: 1; min-width: 0; }
.filter-select { flex: 0 0 auto; max-width: 160px; cursor: pointer; border-radius: var(--radius-sm); }
.search-input:focus, .filter-select:focus { outline: none; border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.history-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.stat { text-align: center; display: flex; flex-direction: column; }
.stat strong { font-size: 1.4rem; font-weight: 700; line-height: 1.1; color: var(--text); }
.stat span { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.history-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.history-list { flex: 1; overflow-y: auto; padding: 4px 0; min-height: 100px; }
.history-item { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--t); }
.history-item:hover { background: var(--surface); }
.history-item:last-child { border-bottom: none; }
.history-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 10px; background: var(--surface-2); flex: 0 0 auto; }
.history-thumb-placeholder { display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.history-body { flex: 1; min-width: 0; }
.history-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.history-cat { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.history-time { font-size: 0.74rem; color: var(--text-muted); }
.history-preview { font-size: 0.83rem; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history-delete { align-self: center; background: none; border: none; color: var(--text-light); cursor: pointer; padding: 4px 8px; font-size: 1.1rem; border-radius: 6px; }
.history-delete:hover { color: var(--danger); background: var(--danger-soft); }
.empty-state { text-align: center; padding: 44px 20px; color: var(--text-muted); }
.shortcuts-list { padding: 8px 20px 16px; overflow-y: auto; }
.kbd-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.kbd-row:last-child { border-bottom: none; }
.kbd-row > span { font-size: 0.9rem; flex: 1; color: var(--text); }
.kbd-group { display: inline-flex; align-items: center; gap: 4px; }
.kbd-group > span { font-size: 0.78rem; color: var(--text-muted); }
.image-modal { cursor: zoom-out; }
.image-modal-content { background: transparent; border: none; box-shadow: none; width: auto; max-width: 95vw; max-height: 95vh; overflow: visible; }
.image-modal-content img { display: block; max-width: 100%; max-height: 95vh; border-radius: var(--radius); box-shadow: var(--shadow-lg); }

/* ===== Install / consent / toast ===== */
.install-banner { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 900; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 12px; max-width: 380px; width: calc(100% - 32px); animation: rise 0.24s var(--ease); }
.install-icon { font-size: 1.5rem; }
.install-text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.install-text strong { font-size: 0.9rem; }
.install-text span { font-size: 0.77rem; }
.consent-banner { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1100; padding: 18px 22px; background: var(--bg); border-top: 1px solid var(--border); box-shadow: 0 -8px 32px rgba(0,0,0,0.1); display: flex; align-items: center; gap: 16px; flex-wrap: wrap; animation: slideUp 0.24s var(--ease); }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.consent-text { flex: 1; min-width: 240px; }
.consent-text strong { display: block; font-size: 0.92rem; margin-bottom: 4px; font-weight: 600; }
.consent-text p { margin: 0; font-size: 0.83rem; color: var(--text-muted); line-height: 1.55; }
.consent-text a { color: var(--primary); }
.consent-actions { display: flex; gap: 10px; align-items: center; }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--select); color: var(--on-select); padding: 11px 20px; border-radius: var(--radius-pill); font-size: 0.88rem; font-weight: 500; box-shadow: var(--shadow-lg); z-index: 2000; animation: rise 0.24s var(--ease); }

/* ===== Footer ===== */
footer { border-top: 1px solid var(--border); padding: 40px 20px; color: var(--text-muted); font-size: 0.83rem; text-align: center; }
.footer-inner { max-width: var(--shell); margin: 0 auto; }
footer p { margin: 5px 0; }
.footer-links { margin-top: 16px !important; display: inline-flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: center; }
.footer-links a, .footer-links button { color: var(--text-muted); text-decoration: none; font-size: 0.83rem; background: none; border: none; padding: 0; cursor: pointer; font-family: inherit; }
.footer-links a:hover, .footer-links button:hover { color: var(--text); }

/* ===== Container (guides / legal / share pages) ===== */
.container { max-width: 760px; margin: 0 auto; padding: 44px clamp(16px, 4vw, 24px) 28px; }
.container .hero { text-align: center; margin-bottom: 28px; }
.brand-link h1 { font-size: 1.5rem; margin: 0; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.subtitle { margin: 16px 0 0; color: var(--text-muted); font-size: 1.05rem; }
.subtitle strong { color: var(--text); font-weight: 600; }

.legal { background: var(--surface); border: 1px solid var(--border); padding: 40px clamp(20px, 4vw, 34px); border-radius: var(--radius-lg); margin: 12px 0 40px; }
.legal h2 { margin: 0 0 6px; font-size: clamp(1.4rem, 4vw, 1.6rem); font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.legal h3 { margin: 30px 0 10px; font-size: 1.06rem; font-weight: 600; }
.legal p, .legal ul { margin: 9px 0; color: var(--text); line-height: 1.75; }
.legal ul { padding-left: 22px; }
.legal li { margin: 6px 0; }
.legal li::marker { color: var(--text-light); }
.legal a { color: var(--primary); text-underline-offset: 2px; }
.legal strong { font-weight: 600; }
.legal .features-grid { margin: 14px 0; }
.back-link { margin-top: 34px; text-align: center; }
.back-link a { display: inline-block; padding: 13px 26px; border-radius: var(--radius-pill); background: var(--primary); color: var(--on-primary); text-decoration: none; font-weight: 600; transition: background var(--t), transform 0.06s ease; }
.back-link a:hover { background: var(--primary-hover); }
.back-link a:active { transform: translateY(1px); }
.error-404 { text-align: center; padding: 56px 30px; }
.error-404 .err-code { font-size: 4.5rem; font-weight: 700; line-height: 1; color: var(--text); letter-spacing: -0.03em; margin: 0 0 8px; }
.error-404 .err-emoji { font-size: 3rem; margin-bottom: 14px; }
.error-404 p { color: var(--text-muted); }

/* ===== Scroll fade-in ===== */
.fade-in { opacity: 0; transform: translateY(16px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.fade-in.in-view { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .fade-in { opacity: 1; transform: none; } }

/* ===== Mobile ===== */
@media (max-width: 999px) {
  .panel-output { min-height: 0; }
  .output-empty { display: none; } /* 모바일: 분석 전 빈 카드로 공간 낭비 방지 */
}
@media (max-width: 560px) {
  .brand-badge { display: none; }
  .pill-btn-label { display: none; }
  .pill-btn { width: 38px !important; padding: 0; }
  .help-btn { display: none; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .why-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: 1fr; }
  .modal-toolbar { flex-wrap: wrap; }
  .filter-select { max-width: 100%; width: 100%; }
  .history-stats { padding: 12px 16px; gap: 4px; }
  .stat strong { font-size: 1.2rem; }
  .consent-banner { padding: 14px 16px; }
  .consent-actions { width: 100%; justify-content: flex-end; }
  .install-banner { bottom: 12px; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-content { max-width: 100%; max-height: 90vh; border-radius: var(--radius) var(--radius) 0 0; animation: sheetUp 0.26s var(--ease); }
  @keyframes sheetUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
}

@supports (padding: max(0px)) {
  .topbar-inner, .shell, .footer-inner, .container { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
}

/* ===== Print ===== */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .topbar, .hero, .panel-input, .ad-slot, .why, .howto, .about, .faq, .followup-area,
  .result-actions, .modal, .toast, .install-banner, .consent-banner, footer, .turnstile-box, .output-empty { display: none !important; }
  .shell { max-width: 100%; padding: 0; }
  .workspace { display: block; }
  .panel-output { position: static; }
  .result { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
  .markdown a { color: #000; text-decoration: underline; }
  .disclaimer { background: none; border: 1px solid #ccc; color: #555; }
}
