* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 20% -10%, #1db95433, transparent),
    linear-gradient(160deg, #0e1116, #171a21);
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  background: rgba(14, 17, 22, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
}

.topbar h1 {
  font-size: 20px;
  font-weight: 700;
}

.link {
  color: #7ee2a0;
  text-decoration: none;
  font-size: 14px;
}

.link:hover {
  text-decoration: underline;
}

.layout {
  display: flex;
  gap: 24px;
  padding: 24px 28px;
  flex: 1;
  align-items: flex-start;
}

/* ------------------------------------------------------------------ */
/* Preview                                                             */
/* ------------------------------------------------------------------ */
.preview-panel {
  flex: 0 0 420px;
  position: sticky;
  top: 92px;
}

.preview-stage {
  position: relative;
  height: 300px;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(135deg, #20242c, #0e1116);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.6);
}

.preview-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.preview-stage iframe {
  border: 0;
  position: absolute;
  top: 16px;
  left: 16px;
  transform-origin: top left;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.preview-toolbar select {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 13px;
}

.preview-stage.bg-dark { background: linear-gradient(135deg, #20242c, #0e1116); }
.preview-stage.bg-light { background: linear-gradient(135deg, #f5f7fa, #c3cfe2); box-shadow: none; }
.preview-stage.bg-colorful { background: linear-gradient(135deg, #f953c6 0%, #b91d73 50%, #1db954 100%); }
.preview-stage.bg-photo { background: linear-gradient(160deg, #2b5876 0%, #4e4376 45%, #c94b4b 100%); }
.preview-stage.bg-none { background: transparent; box-shadow: none; }
.preview-stage.bg-checker {
  background-color: #ffffff;
  background-image: repeating-conic-gradient(#d7d7d7 0% 25%, #ffffff 0% 50%);
  background-size: 24px 24px;
  box-shadow: none;
}

.preview-caption {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Controls                                                            */
/* ------------------------------------------------------------------ */
.controls {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.section {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.section h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7ee2a0;
  margin-bottom: 14px;
}

.presets-section {
  grid-column: 1 / -1;
}

.presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  min-width: 74px;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.preset-chip:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.preset-chip:active {
  transform: translateY(1px);
}

.preset-chip.active {
  border-color: #1db954;
  background: rgba(29, 185, 84, 0.14);
  color: #fff;
}

.swatch {
  width: 44px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.preset-name {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.field {
  margin-bottom: 14px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 6px;
}

.field .value {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-variant-numeric: tabular-nums;
}

input[type='range'] {
  width: 100%;
  accent-color: #1db954;
}

input[type='color'] {
  width: 44px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

select,
input[type='text'] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 13px;
}

input[type='text']:focus,
select:focus {
  outline: none;
  border-color: #1db954;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: #1db954;
}

/* ------------------------------------------------------------------ */
/* URL bar                                                             */
/* ------------------------------------------------------------------ */
.urlbar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 17, 22, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.urlbar-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

.urlbar code {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
  color: #7ee2a0;
  word-break: break-all;
}

.btn {
  padding: 10px 20px;
  border-radius: 999px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.btn.copy {
  background: #1db954;
  color: #06130a;
}

.btn.copy:hover {
  background: #1ed760;
}

.btn.reset {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
}

.btn.reset:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn:active {
  transform: translateY(1px);
}

.name-input {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 14px;
  min-width: 180px;
}

.name-input:focus {
  outline: none;
  border-color: #1db954;
}

.save-status {
  font-size: 13px;
  color: #7ee2a0;
}
