:root {
  --bg: #080b19;
  --panel: #10152b;
  --panel-2: #161c38;
  --line: #262e52;
  --text: #e8ebf4;
  --muted: #9aa3bd;
  --red: #ec1c24;
  --red-dk: #8b151b;
  --blue: #c0d4ed;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(139, 21, 27, 0.35), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(60, 70, 140, 0.25), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

.top { max-width: 1180px; margin: 0 auto; padding: 28px 20px 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 20px; letter-spacing: 0.2px; }
.sub { color: var(--muted); margin: 6px 0 0; }

.layout {
  max-width: 1180px; margin: 0 auto; padding: 16px 20px 48px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; align-items: start;
}
.preview-col { position: sticky; top: 16px; display: grid; gap: 20px; }
.controls { display: grid; gap: 20px; }

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
}
.card h2 { margin: 0 0 14px; font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 650; }

.photo-row { display: flex; gap: 18px; align-items: center; }
.crop-wrap {
  width: 128px; height: 128px; flex: none; border-radius: 50%; padding: 4px;
  background: conic-gradient(var(--red), #ff6b70, var(--red));
  box-shadow: 0 0 0 4px #fff inset;
}
.crop-wrap canvas { width: 100%; height: 100%; border-radius: 50%; display: block; background: #d0def1; border: 3px solid #fff; }
.photo-actions { display: grid; gap: 10px; min-width: 0; }
.sliders { display: grid; gap: 8px; margin-top: 16px; }
.sliders label { display: grid; grid-template-columns: 96px 1fr; align-items: center; color: var(--muted); font-size: 13px; }
input[type=range] { width: 100%; accent-color: var(--red); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label { font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=tel] {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #0b1024; color: var(--text); font: inherit; outline: none; transition: border-color .15s, opacity .15s;
}
input:focus-visible { border-color: #5b6aa8; box-shadow: 0 0 0 3px rgba(91, 106, 168, .25); }
.field.off input[type=text], .field.off input[type=email], .field.off input[type=tel] { opacity: .4; }

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--text); user-select: none; }
.toggle small { color: var(--muted); }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 34px; height: 20px; border-radius: 20px; background: #2a3260; position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + .switch { background: var(--red); }
.toggle input:checked + .switch::after { transform: translateX(14px); }
.toggle input:focus-visible + .switch { box-shadow: 0 0 0 3px rgba(236, 28, 36, .35); }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 0; border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer; transition: filter .15s, opacity .15s; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn.primary { background: var(--red); color: #fff; width: 100%; margin-top: 16px; font-size: 16px; padding: 13px 18px; box-shadow: 0 8px 24px rgba(236, 28, 36, .25); }
.btn.secondary { background: #232b52; color: var(--text); }
.btn.file { position: relative; overflow: hidden; width: fit-content; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.hint { color: var(--muted); font-size: 13px; margin: 0; }
.preview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.status { font-size: 12px; color: var(--muted); }
.status.busy::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 6px; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .2; } }

.mail { background: #fff; border-radius: 10px; padding: 18px 18px 20px; color: #222; overflow-x: auto; }
.mail-lines { display: grid; gap: 7px; margin-bottom: 18px; }
.mail-lines span { height: 7px; border-radius: 4px; background: #eceef3; }
.mail-lines span.short { width: 45%; }
.sig { min-height: 132px; }
.copy-msg { min-height: 20px; margin: 10px 0 0; font-size: 13px; color: #7ee2a0; text-align: center; }
.copy-msg.err { color: #ff8a8f; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { background: #0b1024; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.tab.active { background: #232b52; color: var(--text); border-color: #3a4580; }
.steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 6px; }
kbd { background: #0b1024; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 12px; }

@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .preview-col { position: static; order: -1; }
}
@media (max-width: 480px) {
  .layout, .top { padding-left: 16px; padding-right: 16px; }
  .photo-row { flex-direction: column; align-items: flex-start; }
}
