:root {
  color-scheme: dark;
  --bg: #080d14;
  --panel: #101720;
  --panel-2: #151f2b;
  --line: #263342;
  --text: #f3f6f8;
  --muted: #8d9baa;
  --orange: #ff4d2e;
  --orange-2: #ff765f;
  --cyan: #73e5f2;
  --green: #56d69b;
  --red: #ff6b6b;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(115deg, rgba(255, 77, 46, .07), transparent 36%),
    radial-gradient(circle at 82% 0%, rgba(115, 229, 242, .08), transparent 28%),
    var(--bg);
}
button, input { font: inherit; }
button { touch-action: manipulation; }

.app-shell { width: min(1440px, 100%); margin: 0 auto; padding: 0 28px 44px; }
.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--orange); color: #fff; font-size: 22px; font-style: italic; font-weight: 900;
  clip-path: polygon(0 0, 100% 0, 82% 100%, 0 100%);
}
.brand strong { display: block; font-size: 17px; letter-spacing: .02em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; letter-spacing: .17em; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.connection { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.connection i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.connection.online i { background: var(--green); box-shadow: 0 0 0 4px rgba(86, 214, 155, .1); }
.connection.offline i { background: var(--red); }

.hero { min-height: 250px; display: grid; grid-template-columns: 1fr 300px; align-items: end; gap: 40px; padding: 52px 0 38px; }
.eyebrow, .step { color: var(--orange-2); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { max-width: 760px; margin: 7px 0 10px; font-size: clamp(42px, 6vw, 82px); line-height: .98; letter-spacing: -.055em; }
.lead { max-width: 680px; margin: 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.readiness { padding: 20px 22px; border-left: 3px solid var(--muted); background: rgba(16, 23, 32, .78); }
.readiness.ready { border-color: var(--green); }
.readiness.blocked { border-color: var(--orange); }
.readiness-label { display: block; color: var(--muted); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.readiness strong { display: block; margin: 6px 0; font-size: 20px; }
.readiness > span:last-child { color: var(--muted); font-size: 13px; line-height: 1.45; }

.workspace { display: grid; grid-template-columns: 1.15fr 1fr .65fr; border: 1px solid var(--line); }
.panel { min-width: 0; min-height: 334px; padding: 26px; background: rgba(16, 23, 32, .92); }
.panel + .panel { border-left: 1px solid var(--line); }
.panel-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: 28px; }
.panel-head h2 { margin: 3px 0 0; font-size: 22px; letter-spacing: -.02em; }
.tag { padding: 6px 9px; border: 1px solid var(--line); color: var(--cyan); font-size: 12px; letter-spacing: .1em; }
.field-label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 13px; }
.source-row { display: flex; gap: 10px; }
input {
  min-width: 0; flex: 1; height: 48px; padding: 0 14px; border: 1px solid #354456; border-radius: 2px;
  outline: none; background: #080e16; color: var(--text); font-size: 16px;
}
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(115, 229, 242, .08); }
.field-help { margin: 10px 0 22px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.source-meta { display: grid; grid-template-columns: 1.25fr .75fr .8fr; gap: 8px; }
.source-meta div { min-width: 0; padding: 13px; background: #0b1119; }
.source-meta span { display: block; color: var(--muted); font-size: 11px; }
.source-meta strong { display: block; overflow: hidden; margin-top: 5px; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }

.percentage { color: var(--cyan); font-size: 28px; font-weight: 300; font-variant-numeric: tabular-nums; }
.progress-track { position: relative; height: 7px; overflow: hidden; background: #26313e; }
.progress-track i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--orange), var(--orange-2)); transition: width .25s ease; }
.progress-copy { display: flex; justify-content: space-between; gap: 16px; margin: 14px 0 28px; }
.progress-copy strong { font-size: 14px; }
.progress-copy span { color: var(--muted); font-size: 12px; text-align: right; }
.download-actions { display: flex; flex-wrap: wrap; gap: 9px; }

.button { min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 2px; cursor: pointer; font-weight: 750; }
.button:disabled { cursor: not-allowed; opacity: .38; }
.button-primary { height: 48px; background: #e9eef2; color: #091019; white-space: nowrap; }
.button-accent { background: var(--orange); color: #fff; }
.button-danger { border-color: #734047; background: transparent; color: #ff9ca5; }
.button-quiet { border-color: var(--line); background: transparent; color: var(--text); }
.button:hover:not(:disabled) { filter: brightness(1.09); }

.play-panel { display: flex; flex-direction: column; }
.launch-graphic { flex: 1; display: flex; align-items: center; gap: 7px; opacity: .6; }
.launch-graphic span { width: 26px; height: 64px; background: #273443; transform: skewX(-14deg); }
.launch-graphic span:nth-child(2) { background: #38495b; }
.launch-graphic span:nth-child(3) { background: var(--orange); }
.button-play { min-height: 62px; display: flex; align-items: center; justify-content: space-between; background: var(--text); color: #080d14; font-size: 17px; }
.button-play b { font-size: 25px; }
.play-panel p { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.lower-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; margin-top: 18px; }
.status-board, .log-panel { padding: 22px 24px; border: 1px solid var(--line); background: rgba(11, 17, 25, .78); }
.status-board h2 { margin: 0 0 18px; font-size: 15px; }
.checks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; }
.checks div { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 10px; min-width: 0; }
.checks i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.checks i.ok { background: var(--green); }
.checks i.bad { background: var(--red); }
.checks span { color: var(--muted); font-size: 13px; }
.checks strong { font-size: 12px; }
.log-panel summary { display: flex; justify-content: space-between; gap: 16px; cursor: pointer; font-size: 14px; font-weight: 750; }
.log-panel summary span { overflow: hidden; color: var(--muted); font-size: 12px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
#log { max-height: 180px; overflow: auto; margin-top: 16px; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: #aeb9c5; }
#log div.error { color: #ff9ca5; }
#log div.success { color: #88e8ba; }

@media (max-width: 1020px) {
  .workspace { grid-template-columns: 1fr 1fr; }
  .play-panel { grid-column: 1 / -1; min-height: 230px; border-left: 0 !important; border-top: 1px solid var(--line); }
  .launch-graphic { display: none; }
  .hero { grid-template-columns: 1fr 260px; }
}

@media (max-width: 720px) {
  .app-shell { padding: 0 15px 28px; }
  .topbar { min-height: 66px; }
  .connection { display: none; }
  .hero { min-height: 0; grid-template-columns: 1fr; gap: 24px; padding: 36px 0 28px; }
  h1 { font-size: clamp(40px, 13vw, 62px); }
  .workspace, .lower-grid { grid-template-columns: 1fr; }
  .panel + .panel { border-left: 0; border-top: 1px solid var(--line); }
  .play-panel { grid-column: auto; }
  .panel { min-height: auto; padding: 22px 18px; }
  .source-row { flex-direction: column; }
  .source-meta { grid-template-columns: 1fr 1fr; }
  .source-meta div:first-child { grid-column: 1 / -1; }
  .checks { grid-template-columns: 1fr; }
}

@media (display-mode: standalone) {
  .app-shell { padding-top: env(safe-area-inset-top); padding-left: max(15px, env(safe-area-inset-left)); padding-right: max(15px, env(safe-area-inset-right)); }
}
