:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --ink: #fff8fb;
  --muted: #c5b9cf;
  --subtle: #998daa;
  --night: #171327;
  --night-deep: #0d0b18;
  --line: #524365;
  --pink: #ff8fb3;
  --pink-strong: #ff6f9e;
  --lavender: #a99cff;
  --yellow: #fff1ab;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -10%, #ff9fbe44 0, transparent 32%),
    radial-gradient(circle at 95% 4%, #a99cff38 0, transparent 30%),
    radial-gradient(circle at 48% 100%, #ff729f16 0, transparent 35%),
    var(--night-deep);
  -webkit-text-size-adjust: 100%;
}

button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

.shell { width: min(1120px, 94vw); margin: 34px auto; padding-bottom: 30px; display: grid; gap: 18px; }
.card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #261d38e8, #141123f2);
  border: 1px solid #624d76;
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 22px 70px #0008, inset 0 1px #ffffff10;
  backdrop-filter: blur(18px);
}
.card::after { content: ""; position: absolute; width: 170px; height: 170px; right: -90px; top: -96px; border-radius: 50%; background: #fff1ab16; pointer-events: none; }
.setup { background: linear-gradient(135deg, #38243f, #211a38 52%, #171329); }
.hero { display: grid; grid-template-columns: auto 1fr auto; gap: 14px 16px; align-items: center; }
.brand-mark { width: 70px; height: 70px; border-radius: 22px; box-shadow: 0 14px 32px #ff7ea655; }
.eyebrow { margin: 0 0 7px; color: #d7a9c7; font-size: 11px; letter-spacing: .18em; font-weight: 800; }
h1, h2 { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 42px); letter-spacing: -.05em; }
h2 { font-size: 19px; letter-spacing: -.02em; }
.subtitle { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.hero-badge, .hint-pill { white-space: nowrap; padding: 9px 12px; border: 1px solid #f7bdd047; border-radius: 999px; color: #ffe9a8; background: #6c4c3928; font-size: 12px; font-weight: 700; }
.sparkle { color: var(--yellow); margin-right: 4px; }
.row { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 220px auto; gap: 12px; align-items: end; margin-top: 10px; }
label { display: grid; gap: 7px; color: #d5c6dc; font-size: 13px; }
input, textarea { width: 100%; border: 1px solid #624d76; background: #0d0b18b8; color: var(--ink); border-radius: 14px; padding: 12px 13px; outline: none; transition: .2s ease; }
input:focus, textarea:focus { border-color: var(--pink); box-shadow: 0 0 0 4px #ff8fb326; }
textarea { resize: vertical; min-height: 84px; }
button { min-height: 43px; border: 0; border-radius: 14px; padding: 11px 16px; background: linear-gradient(135deg, var(--pink-strong), var(--lavender)); color: #fff; cursor: pointer; font-weight: 800; box-shadow: 0 9px 24px #ff729f2a; transition: transform .16s ease, filter .16s ease, box-shadow .16s ease; }
button:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 12px 28px #ff729f40; }
button:active { transform: translateY(0); }
button:disabled { cursor: wait; opacity: .6; transform: none; }
.danger { background: #8f4665; box-shadow: none; }
.secondary { background: #3b2f52; box-shadow: none; }
.status { grid-column: 1 / -1; margin: 3px 0 0; color: #a6f2bd; font-size: 13px; }
.status-dot, .live-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #a6f2bd; box-shadow: 0 0 12px #a6f2bd; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.stage-actions { display: flex; align-items: center; gap: 10px; }
.quality-control { display: flex; align-items: center; gap: 7px; color: #d5c6dc; font-size: 12px; }
.quality-control select { min-height: 36px; border: 1px solid #624d76; border-radius: 11px; padding: 7px 9px; background: #0d0b18b8; color: var(--ink); outline: none; }
.quality-control select:focus { border-color: var(--pink); box-shadow: 0 0 0 3px #ff8fb326; }
.live-pill { padding: 8px 12px; border: 1px solid #7f6b61; border-radius: 999px; color: #ffe8ad; background: #6e4d3428; font-size: 12px; font-weight: 700; }
.live-dot { width: 7px; height: 7px; background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }
.toolbar { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar button { background: #342949; box-shadow: none; }
.toolbar button:hover { background: #493660; }
.toolbar .danger { background: #8f4665; }
.screen-box { position: relative; margin: auto; width: min(720px, 100%); aspect-ratio: 9 / 16; max-height: 70vh; background: linear-gradient(145deg, #080711, #19132a); border: 1px solid #715f87; border-radius: 22px; overflow: hidden; display: grid; place-items: center; box-shadow: 0 0 0 5px #ff8fb30c, inset 0 0 60px #000b; outline: none; touch-action: none; }
.screen-box:focus-visible { border-color: var(--pink); box-shadow: 0 0 0 4px #ff8fb333, inset 0 0 60px #000b; }
video { width: 100%; height: 100%; object-fit: contain; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#empty { position: absolute; color: #a494b3; pointer-events: none; }
.stage-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.metrics { margin: 0; color: var(--subtle); font-size: 12px; }
.hint-pill { border-color: #74638e; color: #c9b8d9; background: #3b2f522e; font-size: 11px; }
.input-card { display: grid; grid-template-columns: 180px 1fr auto; gap: 14px; align-items: end; }
.input-title { align-self: start; }
.input-actions { display: grid; gap: 8px; }
.update-card { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: end; background: linear-gradient(135deg, #2f2340, #1a1730); }
.card-copy { margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.update-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 10px; align-items: end; }
.upload-progress { grid-column: 2; min-height: 18px; margin: 8px 0 0; color: #d7a9c7; font-size: 12px; }
.help-card p:last-child { margin: 10px 0 0; color: var(--muted); line-height: 1.8; }

@media (max-width: 760px) {
  .shell { width: 100%; margin: 0; padding: max(14px, env(safe-area-inset-top)) 11px max(28px, env(safe-area-inset-bottom)); gap: 12px; }
  .card { border-radius: 21px; padding: 16px; }
  .hero { grid-template-columns: auto 1fr; gap: 10px 12px; }
  .brand-mark { width: 54px; height: 54px; border-radius: 17px; }
  h1 { font-size: 30px; }
  .hero-badge { grid-column: 1 / -1; justify-self: start; }
  .row { grid-template-columns: 1fr; gap: 10px; margin-top: 4px; }
  .row button { width: 100%; }
  .section-head { margin-bottom: 12px; }
  .stage-actions { align-items: flex-end; flex-direction: column; gap: 7px; }
  .toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .toolbar button { width: 100%; padding: 10px 7px; font-size: 13px; }
  .screen-box { width: min(100%, 430px); max-height: none; border-radius: 17px; }
  .stage-footer { align-items: flex-start; flex-direction: column; }
  .input-card { grid-template-columns: 1fr; gap: 10px; }
  .input-actions { grid-template-columns: 1fr 1fr; }
  .input-actions button { padding-inline: 8px; }
  .update-card { grid-template-columns: 1fr; gap: 12px; }
  .update-row { grid-template-columns: 1fr; gap: 10px; }
.update-row button { width: 100%; }
#apkFile { display: none; }
label:has(#apkFile) { display: none; }
  .upload-progress { grid-column: auto; }
}
