:root {
  --bg-main: #0e0f1f;
  --bg-top: #181928;
  --bg-card: #242533;
  --bg-card-soft: rgba(255, 255, 255, 0.05);
  --bg-card-strong: rgba(255, 255, 255, 0.08);
  --text-main: #ffffff;
  --text-muted: #a0a0b5;
  --accent: #7540ef;
  --accent-soft: rgba(117, 64, 239, 0.22);
  --green: #1ccc8d;
  --danger: #ff5579;
  --line: rgba(255, 255, 255, 0.09);
  --shadow: 0 0 4px rgba(14, 15, 31, 0.12), 0 8px 28px rgba(14, 15, 31, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text-main);
  background: radial-gradient(circle at 12% -15%, #3d267b 0%, transparent 45%),
    radial-gradient(circle at 88% 120%, #251553 0%, transparent 40%),
    linear-gradient(180deg, #181928 0%, #0e0f1f 34%, #0e0f1f 100%);
  font-family: Inter, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.clone-app {
  min-height: 100vh;
}

.clone-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right))
    14px calc(20px + env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: rgba(24, 25, 40, 0.88);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__icon {
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand__meta {
  display: flex;
  flex-direction: column;
  line-height: 1;
  gap: 4px;
}

.brand__title {
  font-family: "AtypDisplay", Inter, sans-serif;
  font-size: 17px;
  letter-spacing: 0.01em;
}

.brand__subtitle {
  color: var(--text-muted);
  font-size: 12px;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  color: #fff;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-card-soft);
  font-size: 13px;
  font-weight: 600;
  transition: transform 120ms ease, border-color 120ms ease;
}

.topbar-link:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.25);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.clone-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  max-width: 980px;
  margin: 0 auto;
  padding: 22px;
}

.clone-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.clone-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel--hero {
  background: linear-gradient(160deg, rgba(117, 64, 239, 0.22), rgba(117, 64, 239, 0.08)),
    var(--bg-card);
}

.crumbs {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "AtypDisplay", Inter, sans-serif;
  font-weight: 500;
}

h1 {
  font-size: 32px;
  line-height: 1.08;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 18px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--accent-soft);
  border: 1px solid rgba(117, 64, 239, 0.45);
}

.hero-copy,
.panel-head p,
.muted {
  margin: 9px 0 0;
  color: var(--text-muted);
  line-height: 1.5;
  font-size: 14px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 13px;
  color: #d3d4e2;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  height: 42px;
  padding: 0 12px;
  font-size: 14px;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(117, 64, 239, 0.8);
  box-shadow: 0 0 0 2px rgba(117, 64, 239, 0.18);
}

.field select option {
  color: #11111a;
}

.field--file input {
  padding-top: 8px;
  padding-bottom: 8px;
  height: auto;
}

.field--file input::file-selector-button {
  margin-right: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-card-soft);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 10px;
  cursor: pointer;
}

.inline-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.panel-head--spells {
  margin-bottom: 14px;
}

.multiplier-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--bg-card-soft);
  color: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  min-height: 42px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, background 120ms ease;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.25);
}

.chip[aria-checked="true"] {
  background: var(--accent-soft);
  border-color: rgba(117, 64, 239, 0.55);
}

.chip__media-wrap {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.chip__media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.chip__label {
  white-space: nowrap;
}

.chip__meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 11px;
  font-weight: 700;
  padding: 0 5px;
}

.spell-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.screenshot-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.screenshot-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-card-soft);
  overflow: hidden;
}

.screenshot-item__preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: rgba(255, 255, 255, 0.04);
}

.screenshot-item__actions {
  padding: 8px;
}

.screenshot-item__actions .btn {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.spell-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.03));
}

.spell-item--empty {
  padding: 18px 14px;
}

.spell-item__main {
  min-width: 0;
}

.spell-item__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spell-item__media-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.spell-item__media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.spell-item__title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.spell-item__desc {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.spell-item__meta {
  margin-top: 10px;
  color: #d7d7e4;
  font-size: 12px;
}

.spell-item__controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 3px 5px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.qty {
  min-width: 34px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: #f0f0fa;
}

.icon-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #fff;
  background: var(--bg-card-soft);
  cursor: pointer;
  font-weight: 700;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.icon-btn:active {
  transform: translateY(1px);
}

.icon-btn--step {
  min-width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 16px;
  line-height: 1;
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.26);
}

.icon-btn--danger {
  color: #ffdce5;
  border-color: rgba(255, 85, 121, 0.4);
  background: rgba(255, 85, 121, 0.12);
}

.icon-btn--remove {
  min-width: 82px;
  font-size: 12px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease,
    background 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  color: #fff;
  background: linear-gradient(130deg, #7540ef, #8f5dff);
}

.btn--secondary {
  color: #fff;
  background: var(--bg-card-soft);
  border: 1px solid var(--line);
}

.btn--secondary:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.btn--ghost {
  width: 100%;
  margin-top: 12px;
  color: #d8d8e6;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  min-height: 42px;
}

.btn--ghost:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.05);
}

.btn--full {
  width: 100%;
  margin-top: 14px;
}

.panel--total {
  background: linear-gradient(160deg, rgba(117, 64, 239, 0.16), transparent), var(--bg-card);
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.total-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.total-value {
  margin: 3px 0 0;
  font-size: 24px;
  font-weight: 800;
}

.total-discount {
  margin: 6px 0 0;
  color: #d7d7e4;
  font-size: 13px;
}

.per-round {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 7px 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.budget-row {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.tip-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.tip-list li {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-card-soft);
  font-size: 13px;
}

.setup-pill-row {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.setup-pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card-soft);
  color: #d8d8e7;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.spell-dialog {
  border: 0;
  padding: 0;
  width: min(560px, calc(100vw - 24px));
  border-radius: 20px;
  color: var(--text-main);
  background: transparent;
}

.spell-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.spell-dialog__content {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #181928;
  box-shadow: var(--shadow);
  padding: 14px;
}

.spell-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.close-button {
  border: 1px solid var(--line);
  background: var(--bg-card-soft);
  color: #fff;
  border-radius: 10px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-weight: 700;
}

.spell-catalog {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.spell-choice {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-card-soft);
}

.spell-choice__main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.spell-choice__media-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.spell-choice__media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.spell-choice__name {
  margin: 0;
  font-weight: 600;
}

.spell-choice__price {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.spell-choice .btn {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.toast {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  pointer-events: none;
  color: #fff;
  border-radius: 999px;
  background: rgba(28, 204, 141, 0.22);
  border: 1px solid rgba(28, 204, 141, 0.45);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  transition: transform 150ms ease, opacity 150ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 980px) {
  .clone-layout {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }
}

@media (max-width: 640px) {
  .clone-topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .clone-layout {
    padding: 14px;
    gap: 12px;
  }

  .panel {
    border-radius: 16px;
    padding: 14px;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-actions .btn {
    width: 100%;
  }

  .hero-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-badge {
    margin-top: 4px;
  }

  .topbar-link {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .spell-item {
    grid-template-columns: 1fr;
  }

  .spell-item__controls {
    justify-content: flex-start;
  }

  .icon-btn--remove {
    margin-left: auto;
  }
}
