:root {
  --bg: #0d0f12;
  --panel: #15181d;
  --panel-soft: #1a1e24;
  --line: #2b3038;
  --text: #f1f2f3;
  --muted: #9aa1ad;
  --faint: #626a77;
  --accent: #d8ff61;
  --accent-ink: #172000;
  --danger: #ff8c91;
  --radius: 18px;
  --shadow: 0 18px 60px rgb(0 0 0 / 0.25);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% -8%, rgb(216 255 97 / 0.07), transparent 32rem),
    radial-gradient(circle at 98% 18%, rgb(91 114 255 / 0.07), transparent 28rem),
    var(--bg);
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
  line-height: 1.5;
}

button, a, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 36px;
  border-bottom: 1px solid rgb(43 48 56 / 0.65);
  background: rgb(13 15 18 / 0.9);
  backdrop-filter: blur(14px);
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgb(216 255 97 / 0.45);
  border-radius: 12px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: 0.03em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; }

.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.health-badge::before { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); content: ""; }
.health-badge.ready { color: var(--accent); }
.health-badge.ready::before { background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.health-badge.error { color: var(--danger); }
.health-badge.error::before { background: var(--danger); }

.page-shell { max-width: 1400px; margin: 0 auto; padding: 42px 36px 80px; }
.hero-row { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr); gap: clamp(32px, 7vw, 120px); align-items: start; margin-bottom: 54px; }
.hero { max-width: 760px; margin-bottom: 0; }
.eyebrow, .card-kicker { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: 0.2em; }
.hero h1 { margin: 12px 0 18px; font-size: clamp(42px, 6vw, 76px); font-weight: 500; letter-spacing: -0.07em; line-height: 0.98; }
.hero h1 em { color: var(--accent); font-style: normal; }

.terms-banner {
  max-width: 560px;
  margin: 18px 0 0;
  padding: 22px 26px;
  border: 1px solid rgb(216 255 97 / 0.18);
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgb(216 255 97 / 0.07), rgb(21 24 29 / 0.9));
  box-shadow: var(--shadow);
}
.terms-banner h2 { margin-top: 6px; font-size: 22px; }
.terms-list { display: grid; gap: 7px; margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.terms-list li::marker { color: var(--accent); }
.terms-emphasis { margin: 12px 0 0; color: var(--accent); font-size: 12px; font-weight: 700; }

.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.main-column { display: grid; gap: 24px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgb(21 24 29 / 0.88); box-shadow: var(--shadow); }
.panel { padding: 26px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-heading > div { display: flex; align-items: baseline; gap: 13px; }
.progress-meta { display: flex; align-items: center; gap: 12px; }
.step-number { color: var(--accent); font-family: Consolas, monospace; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; }
h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.035em; }
.hint, .job-label { color: var(--muted); font-size: 11px; }
.progress-elapsed { color: var(--accent); font-family: Consolas, monospace; font-size: 11px; white-space: nowrap; }
.selection-badge { padding: 6px 10px; border: 1px solid rgb(216 255 97 / 0.28); border-radius: 99px; color: var(--accent); font-size: 11px; }

.drop-zone { display: grid; min-height: 210px; place-items: center; align-content: center; gap: 8px; padding: 28px; border: 1px dashed #4b535f; border-radius: 14px; color: var(--muted); text-align: center; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.dragging { border-color: var(--accent); background: rgb(216 255 97 / 0.05); outline: none; transform: translateY(-1px); }
.drop-zone strong { color: var(--text); font-size: 15px; }
.drop-zone span { font-size: 12px; }
.upload-icon { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid rgb(216 255 97 / 0.4); border-radius: 50%; color: var(--accent); font-size: 28px; font-weight: 300; line-height: 1; }
.source-card { display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; gap: 16px; align-items: center; margin-top: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-soft); }
.source-card img { width: 104px; height: 82px; border-radius: 9px; object-fit: cover; }
.source-meta { min-width: 0; }
.source-meta strong, .source-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-meta strong { font-size: 13px; }
.source-meta span { margin-top: 4px; color: var(--muted); font-size: 11px; }

.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.preset-card { min-height: 92px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #111419; }
.preset-card .preset-index { color: var(--accent); font-family: Consolas, monospace; font-size: 10px; }
.preset-card strong, .preset-card span { display: block; }
.preset-card strong { margin-top: 6px; font-size: 12px; font-weight: 600; }
.preset-card span { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.35; }

.primary-button, .secondary-button, .danger-button, .text-button, .icon-button { border: 0; border-radius: 10px; transition: opacity 160ms ease, transform 160ms ease, background 160ms ease; }
.primary-button:hover:not(:disabled), .secondary-button:hover, .danger-button:hover, .text-button:hover, .icon-button:hover { transform: translateY(-1px); }
.primary-button:focus-visible, .secondary-button:focus-visible, .danger-button:focus-visible, .text-button:focus-visible, .icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary-button { display: flex; width: 100%; align-items: center; justify-content: space-between; margin-top: 22px; padding: 16px 18px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.primary-button:disabled { cursor: not-allowed; opacity: 0.35; }
.secondary-button { display: inline-flex; align-items: center; padding: 10px 12px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 800; text-decoration: none; }
.danger-button { padding: 10px 12px; background: transparent; color: var(--danger); font-size: 12px; }
.text-button { padding: 5px; background: transparent; color: var(--accent); font-size: 12px; white-space: nowrap; }
.icon-button { width: 36px; height: 36px; background: var(--panel-soft); color: var(--text); font-size: 25px; line-height: 1; }

.progress-track { height: 6px; overflow: hidden; border-radius: 99px; background: #292e35; }
.progress-track span { display: block; width: 34%; height: 100%; border-radius: inherit; background: var(--accent); animation: progress 1.8s ease-in-out infinite; }
.progress-message { margin: 15px 0 0; color: var(--muted); font-size: 13px; }
@keyframes progress { 0% { transform: translateX(-120%); } 50% { transform: translateX(120%); } 100% { transform: translateX(330%); } }

.results-heading { align-items: center; }
.result-actions { display: flex; align-items: center; gap: 6px; }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.result-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #111419; }
.result-card img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.result-card-body { padding: 11px; }
.result-card-body strong { display: block; font-size: 11px; }
.result-card-actions { display: flex; gap: 7px; margin-top: 9px; }
.result-card-actions a, .result-card-actions button { flex: 1; padding: 7px 4px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--muted); font-size: 10px; text-align: center; text-decoration: none; }
.result-card-actions a:hover, .result-card-actions button:hover { border-color: var(--accent); color: var(--accent); }
.expiry-note { margin: 18px 0 0; color: var(--faint); font-size: 11px; }

.card-kicker { display: block; }

.modal { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / 0.8); backdrop-filter: blur(6px); }
.modal-card { position: relative; width: min(100%, 960px); max-height: calc(100vh - 48px); overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h2 { margin-top: 5px; }
.original-progress-card { width: min(100%, 520px); }
.original-progress-elapsed { margin: 10px 0 0; color: var(--accent); font-family: Consolas, monospace; font-size: 11px; }
.original-progress-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.compare-grid figure { margin: 0; }
.compare-grid img { display: block; width: 100%; max-height: 70vh; border-radius: 10px; background: #090a0c; object-fit: contain; }
.compare-grid figcaption { margin-top: 8px; color: var(--muted); font-size: 12px; text-align: center; }

.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 10px; background: #252b32; color: var(--text); box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity 160ms ease, transform 160ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.is-hidden { display: none !important; }

@media (max-width: 980px) {
  .hero-row { grid-template-columns: 1fr; gap: 0; }
  .hero { margin-bottom: 34px; }
  .terms-banner { max-width: none; margin-top: 0; }
  .studio-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .site-header, .page-shell { padding-right: 18px; padding-left: 18px; }
  .site-header { padding-top: 18px; padding-bottom: 18px; }
  .page-shell { padding-top: 30px; }
  .hero h1 { font-size: 49px; }
  .terms-banner { padding: 18px; }
  .panel { padding: 18px; }
  .section-heading { display: block; }
  .section-heading .hint, .selection-badge, .job-label { display: inline-block; margin: 9px 0 0 25px; }
  .progress-meta { margin: 9px 0 0 25px; }
  .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .results-heading { display: block; }
  .result-actions { margin-top: 13px; }
  .source-card { grid-template-columns: 72px minmax(0, 1fr); }
  .source-card img { width: 72px; height: 72px; }
  .source-card .text-button { grid-column: 2; justify-self: start; }
  .compare-grid { grid-template-columns: 1fr; }
  .modal { padding: 12px; }
}
