/* CSV 엑셀 변환기: 배치(어디에 무엇을 놓을지)만 맡아요.
   색·글꼴·모서리는 루트의 bistar.css가 정해요 (DESIGN.md 참고). */

:root {
  --ink: #1c2140; --ink-2: #4a5070; --ink-3: #7d829b; --line: #dfe2ec;
  --bg: #f4f5f9; --card: #fff; --accent: #3b4bc8; --tint: #eceef5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: var(--bg); line-height: 1.6; word-break: keep-all; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 머리글 ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1200px; margin: 0 auto; padding: 16px 20px;
}
.logo { text-decoration: none; white-space: nowrap; }
.site-header nav { display: flex; gap: 18px; font-size: 14px; align-items: center; }
.site-header nav a { text-decoration: none; }
.site-header nav button { border: 0; background: none; padding: 0; cursor: pointer; font-size: 14px; }

main { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---------- 첫 화면 ---------- */
.hero { padding: 40px 0 24px; text-align: center; }
.hero h1 { margin: 0 0 16px; }
.hero.compact { padding-bottom: 8px; }
.points {
  list-style: none; padding: 0; margin: 0 0 28px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; font-size: 15px;
}
.points li::before { content: "✓ "; font-weight: 700; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  max-width: 640px; margin: 0 auto; min-height: 180px; padding: 24px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.hero.compact .drop { min-height: 110px; }
.drop-title { display: inline-block; padding: 12px 26px; font-weight: 700; font-size: 16px; }
.drop-sub { font-size: 13px; }

.paste-toggle { margin-top: 14px; }
.paste-box { max-width: 640px; margin: 10px auto 0; text-align: right; }
.paste-box .textbox { width: 100%; padding: 12px; border: 1px solid #cdd2e0; background: var(--card); resize: vertical; font-size: 14px; margin-bottom: 8px; }

/* ---------- 광고 자리 (승인 전에는 보이지 않음) ---------- */
.ad-slot { margin: 24px auto; max-width: 970px; }
.ad-slot:empty { margin: 0; }
body.show-ad-slots .ad-slot:empty {
  min-height: 90px; margin: 24px auto; border: 1px dashed #c8c8c8;
  display: flex; align-items: center; justify-content: center;
}
body.show-ad-slots .ad-slot:empty::after { content: "광고 자리 (" attr(data-ad) ")"; color: var(--ink-3); font-size: 13px; }
html[lang="en"] body.show-ad-slots .ad-slot:empty::after { content: "Ad slot (" attr(data-ad) ")"; }

/* ---------- 작업 공간 ---------- */
.workspace { max-width: 920px; margin: 8px auto 24px; display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 12px; }
.group { background: var(--card); border: 1px solid var(--line); padding: 16px; min-width: 0; }
.group h2 { margin: 0 0 12px; }

.file-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.file-meta { min-width: 0; }
.file-meta strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta span { font-size: 13px; color: var(--ink-2); }

.opts, .opts-inner { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.opts { margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.field select { padding: 8px 10px; border: 1px solid #cdd2e0; background: var(--card); font-size: 14px; color: var(--ink); min-width: 180px; }

.hint { font-size: 12.5px; color: var(--ink-3); margin: 10px 0 0; }

/* 미리보기 표: 옆으로 길면 이 상자 안에서만 밀어서 봐요 */
.preview-wrap { overflow: auto; max-height: 420px; border: 1px solid var(--line); border-radius: 10px; }
.preview { border-collapse: collapse; font-size: 13px; width: max-content; min-width: 100%; }
.preview td, .preview th { padding: 6px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); white-space: pre; max-width: 280px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.preview tr:first-child td { font-weight: 700; background: var(--tint); }
.preview td.num { text-align: right; font-variant-numeric: tabular-nums; }
.preview th.rownum { position: sticky; left: 0; background: var(--tint); color: var(--ink-3); font-weight: 400; text-align: right; min-width: 40px; }

/* 형식 탭 */
.seg { display: flex; border: 1px solid var(--line); overflow: hidden; }
.seg-btn { flex: 1; border: 0; background: #fff; padding: 9px 14px; cursor: pointer; font-size: 14px; font-weight: 700; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn small { display: block; font-size: 11.5px; font-weight: 400; opacity: .75; }
.panel-body { margin-top: 14px; }
.panel-body > .btn-primary { margin-top: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: 12px 0; font-size: 14px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.checks select { padding: 4px 8px; border: 1px solid #cdd2e0; border-radius: 8px; background: var(--card); }
.textbox.code {
  width: 100%; padding: 12px; border: 1px solid #cdd2e0; background: #fbfbfd; resize: vertical;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "D2Coding", monospace; font-size: 13px; line-height: 1.5;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* 버튼 */
.btn-primary, .btn-line { padding: 10px 16px; cursor: pointer; font-weight: 700; font-size: 14px; border: 1px solid; }
.btn-sm { padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.btn-text { border: 0; background: none; padding: 6px 0; cursor: pointer; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 설명 글 ---------- */
.content { max-width: 820px; margin: 24px auto 40px; }
.content section { padding: 28px 0; border-top: 1px solid var(--line); }
.content h1 { font-size: 28px; margin: 8px 0 4px; }
.content h2 { margin: 0 0 12px; }
.content p, .content li { font-size: 15.5px; }
.content ol, .content ul { padding-left: 20px; }
.content li { margin-bottom: 8px; }
.code-sample {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow-x: auto;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "D2Coding", monospace; font-size: 13.5px; line-height: 1.5;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font-weight: 700; white-space: nowrap; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 700; font-size: 16px; }
.faq details p { margin: 8px 0 0; }

.site-footer { border-top: 1px solid var(--line); padding: 28px 20px 40px; text-align: center; font-size: 13px; }
.site-footer nav { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.site-footer a { text-decoration: none; }

.busy {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 11;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: 14px;
}
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  max-width: calc(100% - 32px); color: #fff; font-size: 14px;
  padding: 10px 16px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 10;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 휴대폰 ---------- */
@media (max-width: 720px) {
  main { padding: 0 14px; }
  .site-header { padding: 12px 14px; }
  .site-header nav { gap: 12px; font-size: 13px; }
  .site-header nav a[href$="faq.html"], .site-header nav a[href="#guide"] { display: none; }
  .logo { font-size: 19px !important; }
  .hero { padding: 24px 0 16px; }
  .points { font-size: 13px; gap: 4px 12px; margin-bottom: 18px; }
  .drop { min-height: 150px; }
  .field { flex: 1 1 100%; }
  .field select { width: 100%; min-width: 0; }
  .seg-btn { padding: 8px 6px; font-size: 13px; }
  .panel-body > .btn-primary, .actions .btn-primary { width: 100%; }
  .actions .btn-line { width: 100%; }
  .preview-wrap { max-height: 340px; }
}
