:root {
  --bg-deep: #12151a;
  --bg-panel: #1a1f27;
  --bg-elevated: #222831;
  --text: #e8e4dc;
  --text-muted: #9a958a;
  --accent: #c45c3e;
  --accent-soft: rgba(196, 92, 62, 0.15);
  --border: rgba(232, 228, 220, 0.12);
  --radius: 14px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-deep);
  background-image:
    radial-gradient(ellipse 120% 80% at 10% -20%, rgba(196, 92, 62, 0.18), transparent 50%),
    radial-gradient(ellipse 80% 60% at 100% 100%, rgba(80, 120, 180, 0.12), transparent 45%);
}

.rhc-tool-nav {
  position: relative;
  z-index: 2;
  background: rgba(26, 31, 39, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.rhc-tool-nav-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0.65rem clamp(1rem, 4vw, 1.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
}

.rhc-tool-back {
  color: #7eb8ff;
  text-decoration: none;
  font-weight: 600;
}

.rhc-tool-back:hover {
  text-decoration: underline;
}

.rhc-tool-site {
  color: var(--text-muted);
  font-weight: 500;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem);
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

@media (min-width: 880px) {
  .layout {
    grid-template-columns: 1fr 340px;
    grid-template-rows: auto 1fr;
    align-items: start;
  }

  .hero {
    grid-column: 1 / -1;
  }

  .controls {
    grid-column: 1;
  }

  .preview {
    grid-column: 2;
    grid-row: 2;
    position: sticky;
    top: clamp(1rem, 3vw, 2rem);
  }
}

.hero .eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3rem);
  font-weight: 700;
  font-optical-sizing: auto;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0;
  max-width: 42ch;
  color: var(--text-muted);
  font-size: 1rem;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
}

.field:last-of-type {
  margin-bottom: 0;
}

.label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

textarea,
select,
input[type="range"] {
  font: inherit;
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 120px;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea:focus {
  outline: none;
  border-color: rgba(196, 92, 62, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
}

.hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: -0.15rem;
}

.field-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.field-half {
  flex: 1;
  min-width: 140px;
  margin-bottom: 0;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 6px;
}

.output {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
}

.colors input[type="color"] {
  width: 100%;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.primary:not(:disabled):hover {
  filter: brightness(1.08);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn.ghost:not(:disabled):hover {
  background: var(--bg-elevated);
  border-color: rgba(232, 228, 220, 0.22);
}

.preview-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

.preview-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 1.25rem;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
}

.placeholder {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 16ch;
}

.placeholder[hidden] {
  display: none;
}

.qr-host {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: content-box;
}

.qr-host img,
.qr-host canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.status {
  margin: 0.85rem 0 0;
  min-height: 1.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
