:root {
  --bg: #0B0B10;
  --panel: #14141C;
  --line: #262633;
  --text: #F3F2F7;
  --muted: #9A99AA;
  --accent: #FF5A36;
  --accent-2: #FFB547;
  --radius: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.5 Manrope, system-ui, sans-serif;
  background-image: radial-gradient(900px 500px at 85% -10%, rgba(255, 90, 54, .16), transparent 60%),
                    radial-gradient(700px 500px at -10% 30%, rgba(255, 181, 71, .07), transparent 60%);
  background-attachment: fixed;
}
button, input { font: inherit; color: inherit; }

.announce { background: linear-gradient(90deg, var(--accent), #FF7A3D); color: #fff; text-align: center; font-weight: 800; font-size: 14px; padding: 9px 16px; }
.announce.off { background: #3A1F1F; color: #FFB4B4; }
.top { display: flex; align-items: center; gap: 12px; max-width: 1180px; margin: 0 auto; padding: 22px 20px 0; }
.logo { font: 800 26px/1 Montserrat, sans-serif; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.logo span { color: var(--accent); }
.tag { font-size: 12px; font-weight: 700; color: var(--accent-2); border: 1px solid rgba(255, 181, 71, .4); padding: 2px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: .06em; }

.hero { max-width: 1180px; margin: 0 auto; padding: 36px 20px 8px; }
.hero h1 { font: 800 clamp(28px, 4.6vw, 52px)/1.08 Montserrat, sans-serif; letter-spacing: -.03em; margin: 0 0 12px; max-width: 820px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--muted); font-size: 17px; max-width: 620px; margin: 0; }

.app { max-width: 1180px; margin: 0 auto; padding: 24px 20px 40px; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 28px; align-items: start; }

.panel { display: grid; gap: 14px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; }
.step h2 { margin: 0; font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.step h2 b { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; }

.drop { position: relative; display: flex; align-items: center; gap: 16px; min-height: 120px; border: 1.5px dashed #3A3A4A; border-radius: 14px; padding: 16px; cursor: pointer; transition: border-color .2s, background .2s; }
.drop:hover, .drop.over { border-color: var(--accent); background: rgba(255, 90, 54, .06); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop img { width: 96px; height: 96px; object-fit: contain; border-radius: 10px; background: repeating-conic-gradient(#2a2a35 0 25%, #1f1f28 0 50%) 0 0/16px 16px; }
.drop-text { display: grid; gap: 4px; }
.drop-text small { color: var(--muted); }

input:not([type]), input[type="text"] {
  width: 100%; background: #0F0F15; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none; transition: border-color .15s;
}
input:not([type]):focus { border-color: var(--accent); }
input::placeholder { color: #5E5D6E; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid label { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.grid .wide { grid-column: 1 / -1; }

.seg { display: inline-flex; background: #0F0F15; border: 1px solid var(--line); border-radius: 10px; padding: 3px; width: max-content; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 700; }
.seg button.on { background: #2A2A38; color: var(--text); }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid var(--line); background: #1E1E29; padding: 12px 18px; border-radius: 12px; font-weight: 800; cursor: pointer; text-decoration: none; transition: transform .1s, opacity .2s, background .2s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #FF7A3D); border-color: transparent; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.big { width: 100%; padding: 16px; font-size: 17px; }
.btn.loading { pointer-events: none; opacity: .8; }
.btn.loading::before { content: ""; width: 16px; height: 16px; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status { margin: 0; font-size: 13.5px; color: var(--muted); min-height: 1em; }
.status.err { color: #FF7A7A; }
.status.ok { color: #6FDCA2; }

.tpls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tpls button { display: grid; gap: 2px; text-align: left; background: #0F0F15; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; font-weight: 800; }
.tpls button small { color: var(--muted); font-weight: 500; font-size: 12px; }
.tpls button.on { border-color: var(--accent); background: rgba(255, 90, 54, .07); }
.sw { display: block; height: 34px; border-radius: 8px; margin-bottom: 8px; }
.sw-d { background: linear-gradient(120deg, #1F4E79 0 55%, #FFC857 55%); }
.sw-e { background: radial-gradient(circle at 50% 60%, rgba(232, 196, 138, .55), transparent 55%), #0f0c12; border: 1px solid rgba(232, 196, 138, .5); }
.sw-m { background: #F4F1EB; border: 1px solid #ddd; box-shadow: inset 0 0 0 10px #F4F1EB, inset 0 0 0 12px rgba(0, 0, 0, .08); }

.cut { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; font-weight: 700; font-size: 14px; }
.cut .switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.cut .tol { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.cut .tol input { width: 140px; accent-color: var(--accent); }
.cut .hint { flex-basis: 100%; margin: 0; color: var(--muted); font-weight: 500; font-size: 13px; }
.cut .hint.warn { color: #FFC56B; }
.colors { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.colors label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.colors input[type="color"] { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: #0F0F15; cursor: pointer; }
.switch input { display: none; }
.switch span { width: 42px; height: 24px; border-radius: 99px; background: #2A2A38; position: relative; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

.stage { position: sticky; top: 16px; display: grid; gap: 12px; }
.phone { background: #000; border-radius: 28px; padding: 8px; border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.phone canvas { display: block; width: 100%; aspect-ratio: 9 / 16; height: auto; border-radius: 20px; background: #111; }
.controls { display: flex; align-items: center; gap: 12px; }
.controls button { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--text); cursor: pointer; display: grid; place-items: center; }
.controls svg { width: 22px; height: 22px; fill: #111; }
#play .ico-pause, #play.playing .ico-play { display: none; }
#play.playing .ico-pause { display: block; }
.controls input[type="range"] { flex: 1; accent-color: var(--accent); }
#time { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; width: 38px; text-align: right; }

.progress { height: 8px; border-radius: 99px; background: #22222E; overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s linear; }
.note { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.result { display: grid; gap: 10px; }
.result video { width: 100%; border-radius: 14px; background: #000; max-height: 360px; }

.foot { text-align: center; color: #55546A; font-size: 13px; padding: 10px 20px 30px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .stage { position: static; max-width: 420px; width: 100%; margin: 0 auto; }
}
@media (max-width: 520px) {
  .top, .hero, .app { padding-left: 16px; padding-right: 16px; }
  .grid { grid-template-columns: 1fr; }
  .tpls { grid-template-columns: 1fr; }
  .tpls button { grid-template-columns: 56px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; }
  .tpls .sw { grid-row: 1 / 3; margin: 0; }
}
