:root {
  --bg: #f7f2e7;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: #ffffff;
  --text: #111111;
  --muted: #6e675b;
  --line: rgba(17, 17, 17, 0.12);
  --gold: #d9a729;
  --gold-strong: #b98213;
  --gold-soft: rgba(217, 167, 41, 0.16);
  --black: #0c0c0c;
  --danger: #b42318;
  --success: #157a46;
  --shadow: 0 24px 60px rgba(15, 11, 2, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

[data-theme='dark'] {
  --bg: #0e0d0a;
  --panel: rgba(24, 22, 18, 0.86);
  --panel-strong: #171511;
  --text: #fff8ea;
  --muted: #b5aa96;
  --line: rgba(255, 248, 234, 0.14);
  --gold: #f4c95d;
  --gold-strong: #f0ad2e;
  --gold-soft: rgba(244, 201, 93, 0.16);
  --black: #050505;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(244, 201, 93, 0.28), transparent 34rem),
    linear-gradient(135deg, var(--bg), #fffdf7 54%, #f4ecd9);
  min-height: 100vh;
}

[data-theme='dark'] body,
body[data-theme='dark'] {
  background:
    radial-gradient(circle at top left, rgba(244, 201, 93, 0.2), transparent 35rem),
    linear-gradient(135deg, #0e0d0a, #15120b 56%, #080808);
}

button, input { font: inherit; }
button { cursor: pointer; }

.shell-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  min-width: max-content;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--black), #3a2c0d 56%, var(--gold));
  color: #fff;
  font-weight: 900;
  letter-spacing: -0.06em;
}

.brand strong { display: block; letter-spacing: -0.03em; }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.top-nav {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

.nav-pill {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 9px 14px;
}

.nav-pill.active,
.nav-pill:hover {
  color: var(--text);
  background: var(--gold-soft);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 20px;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 38px 0 80px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 28px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.card,
.phone-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: clamp(26px, 5vw, 56px);
  overflow: hidden;
  position: relative;
}

.hero-copy:after {
  content: "";
  position: absolute;
  right: -100px;
  bottom: -120px;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  background: var(--gold-soft);
  filter: blur(6px);
}

.mode-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.mode-badge,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.38);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mode-badge.android,
.chip.gold {
  color: #2f2102;
  border-color: color-mix(in srgb, var(--gold) 60%, transparent);
  background: linear-gradient(135deg, var(--gold), #ffdf83);
}

.mode-badge.browser { color: var(--text); background: var(--gold-soft); }
.subtle { color: var(--muted); font-size: 12px; }

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(42px, 7vw, 76px); line-height: 0.9; letter-spacing: -0.08em; max-width: 780px; margin-bottom: 22px; }
h2 { font-size: clamp(24px, 3vw, 34px); line-height: 1.02; letter-spacing: -0.05em; margin-bottom: 0; }
h3 { margin-bottom: 6px; letter-spacing: -0.03em; }
.lead { color: var(--muted); font-size: 18px; line-height: 1.6; max-width: 680px; margin-bottom: 28px; }
.eyebrow { color: var(--gold-strong); text-transform: uppercase; letter-spacing: 0.14em; font-size: 12px; font-weight: 900; margin-bottom: 8px; }

.hero-actions, .input-row, .dialog-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 800;
  color: var(--text);
  background: var(--panel-strong);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.btn:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--gold) 60%, var(--line)); }
.btn-primary { background: linear-gradient(135deg, var(--black), #2d230d 58%, var(--gold)); color: #fff; border-color: transparent; }
.btn-secondary { background: var(--panel); }
.btn-ghost { background: transparent; }
.btn[disabled] { opacity: 0.55; cursor: wait; }

.phone-preview {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 400px;
  background: linear-gradient(160deg, var(--black), #241d10 70%, #4d3507);
  color: #fff8ea;
  position: relative;
  overflow: hidden;
}

.phone-preview:before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
}

.phone-top { width: 78px; height: 8px; background: rgba(255,255,255,0.22); border-radius: 999px; margin: 0 auto; }
.mini-card { position: relative; margin-top: 80px; padding: 18px; border-radius: 22px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.12); }
.mini-label { display: block; color: rgba(255,255,255,0.6); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 8px; }
.mini-card strong { font-size: 24px; letter-spacing: -0.04em; }
.mini-progress { height: 8px; background: rgba(255,255,255,0.12); border-radius: 999px; margin-top: 16px; overflow: hidden; }
.mini-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--gold); transition: width 0.4s ease; }
.phone-list { position: relative; display: grid; gap: 10px; }
.phone-list span { height: 44px; border-radius: 16px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.08); }

.card { padding: clamp(20px, 3vw, 30px); margin-bottom: 24px; }
.glass { backdrop-filter: blur(16px); }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }

.input-row { align-items: center; }
.input-row input {
  flex: 1 1 420px;
  min-height: 54px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  padding: 0 20px;
  outline: none;
}
.input-row input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0;
}
.workflow-step {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  color: var(--muted);
  background: rgba(255,255,255,0.24);
}
.workflow-step b {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  margin-right: 8px;
  color: var(--text);
  background: var(--gold-soft);
}
.workflow-step.active,
.workflow-step.done { border-color: color-mix(in srgb, var(--gold) 72%, transparent); color: var(--text); background: var(--gold-soft); }

.status-panel {
  display: flex;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-strong);
}
.status-panel p { color: var(--muted); margin: 0; }
.status-icon { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-strong); font-weight: 900; flex: 0 0 auto; }

.split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.video-list, .link-list, .log-list, .media-options { display: grid; gap: 12px; }
.video-item, .link-item, .log-item, .media-option {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--panel-strong);
}
.video-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; }
.video-thumb { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, var(--black), var(--gold)); }
.video-item strong, .link-item strong { display: block; margin-bottom: 5px; }
.video-item small, .link-item small, .log-item { color: var(--muted); }
.link-item { display: flex; justify-content: space-between; gap: 14px; }
.log-list { max-height: 360px; overflow: auto; }
.log-item { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; }
.empty-state { margin: 0; color: var(--muted); }

.media-dialog, .settings-dialog { border: 0; padding: 0; background: transparent; width: min(860px, calc(100% - 24px)); }
.settings-dialog { width: min(640px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(0,0,0,0.62); backdrop-filter: blur(10px); }
.dialog-shell { border: 1px solid var(--line); border-radius: 30px; padding: 24px; background: var(--panel-strong); color: var(--text); box-shadow: var(--shadow); }
.dialog-header { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 18px; }
.source-summary { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--gold-soft); color: var(--muted); overflow: hidden; margin-bottom: 16px; }
.source-summary span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-option { display: grid; grid-template-columns: 22px 64px 1fr; gap: 12px; align-items: center; cursor: pointer; }
.media-option input { accent-color: var(--gold-strong); }
.media-thumb { width: 64px; height: 64px; border-radius: 18px; background: linear-gradient(135deg, var(--black), #3c2b0a, var(--gold)); }
.media-title { display: block; margin-bottom: 8px; }
.media-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.chip.success { background: rgba(21, 122, 70, 0.12); color: var(--success); }
.chip.warning { background: rgba(217, 167, 41, 0.18); color: var(--gold-strong); }
.download-preview { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-md); margin-top: 16px; }
.download-head { display: flex; justify-content: space-between; margin-bottom: 10px; }
.progress-bar { height: 10px; background: var(--gold-soft); border-radius: 999px; overflow: hidden; }
.progress-bar span { display: block; width: 0; height: 100%; background: var(--gold); transition: width 0.2s ease; }
.dialog-actions { justify-content: flex-end; margin-top: 20px; }

.switch-row { display: flex; justify-content: space-between; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.switch-row small { display: block; color: var(--muted); margin-top: 4px; }
.switch-row input { width: 48px; accent-color: var(--gold-strong); }

.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 40; display: grid; gap: 10px; }
.toast { border: 1px solid var(--line); border-radius: 18px; padding: 13px 16px; background: var(--panel-strong); color: var(--text); box-shadow: var(--shadow); }

.offline-gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); padding: 20px; }
.offline-card { width: min(480px, 100%); border: 1px solid var(--line); border-radius: 32px; background: var(--panel-strong); box-shadow: var(--shadow); padding: 30px; text-align: center; }
.offline-mark { width: 64px; height: 64px; border-radius: 22px; background: var(--gold); color: #111; display: grid; place-items: center; font-size: 32px; font-weight: 900; margin: 0 auto 18px; }
.hidden { display: none !important; }

@media (max-width: 920px) {
  .top-nav { display: none; }
  .hero-grid, .split-grid { grid-template-columns: 1fr; }
  .phone-preview { min-height: 300px; }
  .workflow-strip { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .shell-header { padding: 12px 14px; }
  .brand small { display: none; }
  .page-shell { width: min(100% - 20px, 1180px); padding-top: 20px; }
  h1 { font-size: 44px; }
  .input-row .btn { width: 100%; }
  .workflow-strip { grid-template-columns: 1fr; }
  .video-item { grid-template-columns: 48px 1fr; }
  .video-item .chip { grid-column: 2; justify-self: start; }
  .media-option { grid-template-columns: 22px 1fr; }
  .media-thumb { display: none; }
}
