:root {
  color-scheme: dark;
  --bg: #101111;
  --surface: rgba(27, 29, 29, 0.78);
  --surface-strong: rgba(35, 39, 38, 0.94);
  --surface-soft: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #f4f7f5;
  --muted: #aab5ae;
  --dim: #78847d;
  --accent: #31f6b0;
  --accent-2: #ff6f61;
  --accent-3: #f7d44c;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
  --radius: 8px;
  --fast: 160ms ease;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(49, 246, 176, 0.12), transparent 34%),
    linear-gradient(225deg, rgba(255, 111, 97, 0.1), transparent 32%),
    var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 26%),
    linear-gradient(180deg, rgba(16, 17, 17, 0.1), rgba(16, 17, 17, 0.92));
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

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

.top-nav,
.footer nav,
.legal-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.top-nav a,
.footer a,
.legal-tabs a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  transition:
    color var(--fast),
    background var(--fast),
    border-color var(--fast);
}

.top-nav a:hover,
.footer a:hover,
.legal-tabs a:hover,
.legal-tabs a.is-active {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.07);
}

.language-picker {
  display: inline-grid;
  gap: 4px;
  min-width: 132px;
}

.language-picker span {
  color: var(--dim);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.language-picker select {
  min-height: 38px;
  padding-right: 34px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.04;
}

h1 {
  font-size: clamp(2rem, 4vw, 4.25rem);
  letter-spacing: 0;
}

h2 {
  font-size: 1.4rem;
}

h3 {
  font-size: 1rem;
}

.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid rgba(49, 246, 176, 0.28);
  border-radius: var(--radius);
  color: #dffcf2;
  background: rgba(49, 246, 176, 0.08);
  box-shadow: 0 0 24px rgba(49, 246, 176, 0.08);
  white-space: nowrap;
}

.privacy-chip strong {
  font-size: 0.92rem;
}

.privacy-chip span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(360px, 1.3fr) minmax(250px, 0.75fr);
  gap: 18px;
  align-items: stretch;
}

.panel,
.preview-stage {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.control-stack {
  display: grid;
  gap: 14px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field,
.slider-field {
  display: grid;
  gap: 8px;
}

.field span,
.slider-field span,
.upload-box label span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.slider-field span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

input[type="text"],
input[type="url"],
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  outline: none;
  transition:
    border-color var(--fast),
    box-shadow var(--fast),
    background var(--fast);
}

input[type="text"],
input[type="url"] {
  padding: 0 13px;
}

select {
  padding: 0 12px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 13px) 19px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

input[type="text"]:focus,
input[type="url"]:focus,
select:focus {
  border-color: rgba(49, 246, 176, 0.72);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 4px rgba(49, 246, 176, 0.12);
}

input[type="color"] {
  width: 100%;
  height: 46px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

output {
  color: var(--text);
  font-weight: 800;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.preset,
.ghost-button,
.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.075);
  transition:
    transform var(--fast),
    border-color var(--fast),
    background var(--fast),
    box-shadow var(--fast);
}

.preset:hover,
.ghost-button:hover,
.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.105);
}

.preset-cyber {
  color: #ccfff0;
  border-color: rgba(49, 246, 176, 0.35);
}

.preset-mint {
  color: #f2ffe5;
  border-color: rgba(188, 255, 93, 0.32);
}

.preset-ember {
  color: #ffe6e1;
  border-color: rgba(255, 111, 97, 0.34);
}

.ghost-button {
  padding: 0 12px;
}

.upload-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.upload-box label {
  display: grid;
  gap: 5px;
}

.upload-box strong {
  font-size: 0.95rem;
}

input[type="file"] {
  width: 100%;
  color: var(--muted);
}

.preview-stage {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 18px;
  min-height: 720px;
  padding: 24px;
  overflow: hidden;
  position: relative;
}

.preview-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
}

.preview-copy,
.qr-frame,
.status-line,
.action-bar {
  position: relative;
  z-index: 1;
}

.qr-frame {
  display: grid;
  place-items: center;
  align-self: stretch;
  min-height: 420px;
  border: 1px solid rgba(49, 246, 176, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(49, 246, 176, 0.11), transparent 36%),
    linear-gradient(315deg, rgba(255, 111, 97, 0.1), transparent 38%),
    rgba(255, 255, 255, 0.045);
}

#qrPreview {
  display: grid;
  place-items: center;
  max-width: 100%;
  padding: 18px;
  transition:
    opacity var(--fast),
    transform var(--fast);
}

#qrPreview.is-refreshing {
  opacity: 0.55;
  transform: scale(0.985);
}

#qrPreview canvas,
#qrPreview svg {
  display: block;
  max-width: min(100%, 62vh);
  height: auto;
  border-radius: var(--radius);
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.33),
    0 0 42px rgba(49, 246, 176, 0.08);
}

.status-line {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.action-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.primary-button {
  border-color: rgba(49, 246, 176, 0.5);
  color: #061512;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #baff5d);
  box-shadow: 0 12px 38px rgba(49, 246, 176, 0.18);
}

.primary-button:hover {
  background: linear-gradient(135deg, #67ffd0, #d6ff8e);
}

.secondary-button {
  font-weight: 800;
}

.tip-list {
  display: grid;
  gap: 12px;
}

.privacy-note,
.ad-slot {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.privacy-note {
  padding: 15px;
}

.tip-card {
  padding: 0 0 13px;
  border-bottom: 1px solid var(--line);
}

.tip-card:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.tip-card p,
.privacy-note p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.ad-slot {
  display: grid;
  place-items: center;
  min-height: 250px;
  margin: 16px 0;
  padding: 18px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(247, 212, 76, 0.1), rgba(255, 255, 255, 0.035)),
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(255, 255, 255, 0.035) 12px 24px);
}

.ad-slot strong {
  font-size: 1.2rem;
}

.ad-slot span {
  color: var(--dim);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(49, 246, 176, 0.36);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(20, 23, 22, 0.94);
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  transition:
    opacity var(--fast),
    transform var(--fast);
}

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

.legal-shell,
.footer {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.legal-shell {
  padding: 20px;
}

.legal-tabs {
  margin-bottom: 18px;
}

.legal-panel {
  display: grid;
  gap: 16px;
}

.legal-page-shell {
  display: grid;
  gap: 34px;
  min-height: 560px;
}

.legal-panel h2 {
  font-size: clamp(1.7rem, 3vw, 2.55rem);
}

.legal-panel h1 {
  font-size: clamp(2rem, 4vw, 4rem);
}

.legal-panel .legal-intro {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

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

.legal-block {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.legal-block p {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-line;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.contact-actions a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 13px;
  border: 1px solid rgba(49, 246, 176, 0.32);
  border-radius: var(--radius);
  color: #dffcf2;
  background: rgba(49, 246, 176, 0.08);
  font-weight: 900;
}

.page-back {
  width: fit-content;
  min-width: 180px;
  margin-top: 10px;
  padding: 12px 16px;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
}

.footer p {
  margin: 0;
  color: var(--dim);
  font-size: 0.9rem;
  text-align: right;
}

@media (max-width: 1160px) {
  .workspace {
    grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  }

  .insight-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 22px, 720px);
    padding: 18px 0;
  }

  .topbar,
  .workspace,
  .control-grid,
  .action-bar,
  .legal-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .top-nav,
  .language-picker,
  .privacy-chip {
    width: 100%;
  }

  .top-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-nav a {
    width: 100%;
  }

  .privacy-chip {
    white-space: normal;
  }

  .workspace {
    display: grid;
  }

  .preview-stage {
    min-height: 580px;
    padding: 18px;
  }

  .qr-frame {
    min-height: 340px;
  }

  .footer {
    display: grid;
  }

  .footer p {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .preset-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .preview-stage {
    padding: 15px;
  }

  h1 {
    font-size: 2.1rem;
  }

  .top-nav {
    grid-template-columns: 1fr;
  }

  .legal-shell,
  .footer {
    padding: 14px;
  }
}
