:root {
  --ink: #102922;
  --muted: #64736f;
  --paper: #f4f2ec;
  --card: #fffefb;
  --line: #dfe3dd;
  --green: #174b3f;
  --green-2: #26705c;
  --mint: #dff2e9;
  --orange: #d86e3a;
  --orange-soft: #fff0e6;
  --red: #b64040;
  --shadow: 0 20px 55px rgba(31, 48, 42, .10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 0%, rgba(38, 112, 92, .13), transparent 28rem),
    var(--paper);
  font-family: "Gmarket Sans", "Noto Sans KR", "Malgun Gothic", sans-serif;
}
button, textarea { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1220px, calc(100% - 40px)); margin: 0 auto; padding: 56px 0 72px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 10px; color: var(--orange); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(36px, 5vw, 62px); line-height: 1; letter-spacing: -.055em; }
.lead { max-width: 650px; margin: 18px 0 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.server-pill { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 99px; background: rgba(255,255,255,.65); color: var(--muted); font-size: 13px; white-space: nowrap; }
.server-pill span { width: 9px; height: 9px; border-radius: 50%; background: #a6aaa8; box-shadow: 0 0 0 5px rgba(166,170,168,.12); }
.server-pill.online span { background: #30a476; box-shadow: 0 0 0 5px rgba(48,164,118,.13); }
.mode-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; padding: 6px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.65); }
.mode-tab { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 58px; padding: 11px 18px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); transition: background .18s, color .18s, box-shadow .18s; }
.mode-tab strong { color: inherit; font-size: 15px; }
.mode-tab span { font-size: 11px; opacity: .72; }
.mode-tab.active { background: var(--green); color: white; box-shadow: 0 8px 20px rgba(23,75,63,.18); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; }
.input-panel, .summary-panel, .results-panel { border: 1px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.input-panel { padding: 26px; }
.summary-panel { padding: 26px; background: var(--ink); color: white; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading > div { display: flex; align-items: center; gap: 12px; }
.step { display: inline-grid; place-items: center; min-width: 35px; height: 27px; border-radius: 8px; background: var(--mint); color: var(--green); font-size: 12px; font-weight: 800; }
.summary-panel .step { background: rgba(255,255,255,.13); color: white; }
h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.text-button { border: 0; background: none; color: var(--muted); font-size: 13px; }
.text-button:hover { color: var(--red); }
textarea { width: 100%; min-height: 210px; resize: vertical; padding: 20px; border: 1px solid #ccd4cf; border-radius: 14px; outline: none; background: #fbfcfa; color: var(--ink); font-family: Consolas, "Malgun Gothic", monospace; font-size: 15px; line-height: 1.8; transition: border-color .2s, box-shadow .2s; }
textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 4px rgba(38,112,92,.1); }
.format-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 14px 2px 22px; color: var(--muted); font-size: 12px; }
.format-note strong { color: var(--green); }
.format-note code { padding: 5px 8px; border-radius: 6px; background: #f0f3ef; color: #3f524c; }
.primary-button, .download-button { width: 100%; border: 0; border-radius: 12px; font-weight: 800; transition: transform .18s, background .18s, opacity .18s; }
.primary-button { display: flex; justify-content: space-between; padding: 16px 20px; background: var(--green); color: white; }
.primary-button:hover, .download-button:not(:disabled):hover { transform: translateY(-1px); }
.primary-button:hover { background: #0f3b31; }
.metric-list { margin: 25px 0; }
.metric-list > div { display: flex; align-items: baseline; justify-content: space-between; padding: 15px 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.metric-list span { color: rgba(255,255,255,.68); font-size: 13px; }
.metric-list strong { font-size: 30px; }
.metric-list .success strong { color: #85deb9; }
.metric-list .failed strong { color: #ff9c79; }
.download-button { padding: 16px; background: var(--orange); color: white; }
.download-button:disabled { cursor: not-allowed; opacity: .35; }
.download-note { margin: 13px 2px 0; color: rgba(255,255,255,.54); font-size: 11px; line-height: 1.55; }
.upscale-summary { margin: 0 0 10px; padding: 11px 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 10px; background: rgba(255,255,255,.06); }
.upscale-summary span, .upscale-summary strong { display: block; }
.upscale-summary span { margin-bottom: 4px; color: rgba(255,255,255,.55); font-size: 10px; }
.upscale-summary strong { font-size: 12px; line-height: 1.45; }
.settings-button { padding: 11px 14px; border: 1px solid rgba(255,255,255,.24); border-radius: 10px; background: transparent; color: inherit; font-size: 12px; font-weight: 700; }
.summary-panel .settings-button { width: 100%; margin-bottom: 9px; color: white; }
.upscale-start { background: #8059d5; }
.result-download { margin-top: 10px; background: #2f9c76; }
.job-panel { margin-top: 11px; padding: 12px; border-radius: 10px; background: rgba(255,255,255,.08); }
.job-panel.completed { background: rgba(56,174,127,.16); }
.job-panel.failed { background: rgba(216,84,67,.18); }
.job-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; }
.progress-track { height: 7px; margin: 9px 0 7px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.14); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: #8de1bd; transition: width .35s ease; }
.job-panel p { margin: 0; overflow: hidden; color: rgba(255,255,255,.7); font-size: 10px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.results-panel { margin-top: 18px; padding: 26px; }
.result-heading { margin-bottom: 20px; }
.result-caption { color: var(--muted); font-size: 13px; }
.empty-state { display: grid; place-items: center; padding: 60px 20px 72px; color: var(--muted); text-align: center; }
.empty-state strong { margin: 13px 0 7px; color: var(--ink); }
.empty-state span { font-size: 13px; }
.empty-mark { display: grid; place-items: center; width: 54px; height: 54px; border: 1px dashed #9aaba4; border-radius: 16px; color: var(--green-2); font-weight: 900; transform: rotate(-4deg); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 13px; }
.hidden { display: none; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th { padding: 13px 14px; background: #f2f4f1; color: #60706b; font-size: 12px; text-align: left; white-space: nowrap; }
td { padding: 13px 14px; border-top: 1px solid #eaede9; font-size: 13px; vertical-align: middle; }
tbody tr:hover { background: #fafbf9; }
.preview { display: grid; place-items: center; width: 66px; height: 66px; overflow: hidden; border-radius: 10px; background: #eef1ed; }
.preview img { width: 100%; height: 100%; object-fit: contain; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.status.ok { background: var(--mint); color: var(--green); }
.status.ok::before { background: #35a879; }
.status.error { background: var(--orange-soft); color: #9d4828; }
.status.error::before { background: var(--orange); }
.single-download { display: inline-flex; align-items: center; justify-content: center; padding: 9px 11px; border: 1px solid #b9cdc4; border-radius: 9px; color: var(--green); font-size: 11px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.single-download:hover { border-color: var(--green-2); background: var(--mint); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 10; max-width: calc(100% - 32px); padding: 13px 18px; border-radius: 10px; background: #142a24; color: white; box-shadow: 0 12px 35px rgba(0,0,0,.25); font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(13,26,22,.62); backdrop-filter: blur(4px); }
.modal-backdrop.hidden { display: none; }
.modal-card { width: min(580px, 100%); padding: 26px; border-radius: 20px; background: white; box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.modal-heading, .modal-heading > div { display: flex; align-items: center; gap: 12px; }
.modal-heading { justify-content: space-between; margin-bottom: 22px; }
.modal-close { width: 36px; height: 36px; border: 0; border-radius: 10px; background: #eff2ef; color: var(--muted); font-size: 24px; line-height: 1; }
.setting-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.setting-grid label { display: grid; gap: 7px; }
.setting-grid label.hidden { display: none; }
.setting-grid label.full { grid-column: 1 / -1; }
.setting-grid label > span { color: #52645e; font-size: 12px; font-weight: 700; }
.setting-grid select { width: 100%; padding: 12px 38px 12px 12px; border: 1px solid #cbd4cf; border-radius: 10px; outline: none; background: white; color: var(--ink); font: inherit; font-size: 13px; }
.setting-grid select:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(38,112,92,.1); }
.setting-help { margin: 18px 0; padding: 12px 14px; border-radius: 10px; background: #f0f5f2; color: #536861; font-size: 11px; line-height: 1.6; }
.modal-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; }
.modal-actions .settings-button { border-color: var(--line); color: var(--muted); }
.modal-actions .download-button { padding: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 820px) {
  .shell { width: min(100% - 24px, 680px); padding-top: 28px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .mode-tabs { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .summary-panel { display: grid; grid-template-columns: 1fr; }
  .metric-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
  .metric-list > div { display: block; padding: 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; }
  .metric-list span, .metric-list strong { display: block; }
  .metric-list strong { margin-top: 7px; }
}

@media (max-width: 520px) {
  .input-panel, .summary-panel, .results-panel { padding: 18px; border-radius: 16px; }
  h1 { font-size: 39px; }
  .metric-list { grid-template-columns: 1fr; }
  .format-note span { display: block; width: 100%; }
  .mode-tab { align-items: flex-start; flex-direction: column; gap: 2px; }
  .setting-grid { grid-template-columns: 1fr; }
}
