:root {
  --bg-base: #f0eee6;
  --bg-warm: #f5f4ef;
  --bg-elevated: #faf9f5;
  --bg-secondary: #f1eee4;
  --bg-tertiary: #e6e3d6;
  --bg-inset: #ebe8dd;

  --text: #1f1e1d;
  --text-secondary: #63605a;
  --text-tertiary: #97928a;

  --accent: #d97757;
  --accent-deep: #c15f3c;
  --accent-hover: #e08a6e;
  --accent-soft: rgba(217, 119, 87, 0.1);
  --accent-glow: rgba(217, 119, 87, 0.2);

  --gold: #b08d57;
  --gold-soft: rgba(176, 141, 87, 0.12);

  --green: #6a9b6e;
  --green-soft: rgba(106, 155, 110, 0.2);
  --orange: #d4915a;
  --red: #c5584f;

  --border: rgba(31, 30, 29, 0.1);
  --border-strong: rgba(31, 30, 29, 0.16);

  --shadow-soft: 0 1px 2px rgba(31, 30, 29, 0.05);
  --shadow-md: 0 1px 3px rgba(31, 30, 29, 0.05), 0 10px 30px -14px rgba(31, 30, 29, 0.14);
  --shadow-lg: 0 1px 3px rgba(31, 30, 29, 0.04), 0 28px 56px -24px rgba(31, 30, 29, 0.2);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.6);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 999px;

  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --transition: 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2vh 2vw;
  position: relative;
  overflow: hidden;
}

/* Calm ambient background */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(217, 119, 87, 0.1) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 85%, rgba(176, 141, 87, 0.08) 0%, transparent 55%),
    linear-gradient(165deg, #f0eee6 0%, #f5f3ec 45%, #ece9df 100%);
}

.app {
  position: relative;
  z-index: 1;
  width: 90vw;
  height: 90vh;
  max-width: 1320px;
  display: flex;
  flex-direction: column;
}

.header__tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--accent);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}

.theme-toggle:hover {
  color: var(--accent-deep);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.theme-toggle svg { width: 19px; height: 19px; }

/* Theme picker popover */
.theme-picker { position: relative; }

.theme-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 50;
  min-width: 200px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: theme-menu-in 0.16s cubic-bezier(0.32, 0.72, 0, 1);
}

.theme-menu.hidden { display: none; }

@keyframes theme-menu-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.theme-option:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

.theme-option--active {
  color: var(--text);
  font-weight: 600;
}

.theme-option--active .theme-option__name::after {
  content: '✓';
  margin-left: 8px;
  color: var(--accent);
  font-weight: 700;
}

.theme-option__name { flex: 1; }

.theme-swatch {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  flex-shrink: 0;
  background:
    linear-gradient(135deg, var(--sw-accent) 0% 50%, var(--sw-bg) 50% 100%);
  border: 1px solid rgba(127, 127, 127, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-shrink: 0;
  padding: 0 6px;
}

.header__title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
}

.header__subtitle {
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
}

.header__badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 7px 13px;
  border-radius: var(--radius-full);
  background: var(--bg-warm);
  border: 1px solid var(--border);
}

.header__badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

/* Main workspace */
.workspace {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-lg), var(--shadow-inner);
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 22px;
  align-content: start;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.workspace::-webkit-scrollbar { width: 6px; }
.workspace::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 6px;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
  margin-top: 4px;
}

.custom-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.custom-section .section-label {
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
}

/* Password block */
.password-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.password-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 6px 18px;
  background: var(--bg-warm);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.password-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#passwordOutput {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  padding: 12px 0;
}

#passwordOutput.masked {
  -webkit-text-security: disc;
  text-security: disc;
}

.pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}

.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover {
  background: var(--bg-tertiary);
  color: var(--accent);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Relocated export controls — sit right under the main actions */
.action-row--export {
  align-items: center;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
  margin-top: 2px;
}

.action-row__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-right: 4px;
}

/* Export results (fallback link + QR preview) */
.export-extra {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.export-extra:empty { display: none; }

/* Strength */
.strength-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.strength__value {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  min-width: 72px;
}

.strength__value--idle { color: var(--text-tertiary); }
.strength__value--weak { color: var(--red); }
.strength__value--fair { color: var(--orange); }
.strength__value--strong { color: var(--accent); }
.strength__value--elite { color: var(--green); }

.strength__bar {
  flex: 1;
  min-width: 100px;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.strength__fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent-hover), var(--accent));
  transition: width 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

.strength__meta {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
}

/* Export — calm rich highlight */
.export-panel {
  padding: 28px 30px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, var(--gold-soft) 0%, var(--accent-soft) 100%);
  border: 1px solid rgba(166, 139, 91, 0.25);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.export-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--accent), transparent);
  opacity: 0.6;
  pointer-events: none;
}

.export-panel__head {
  margin-bottom: 22px;
}

.export-panel__title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent-deep);
}

.export-panel__desc {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

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

.export-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px 22px;
  min-height: 148px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  font-family: var(--font);
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.export-card:hover {
  transform: translateY(-3px);
  border-color: rgba(61, 92, 92, 0.25);
  box-shadow: 0 12px 28px var(--accent-glow);
}

.export-card:active { transform: translateY(-1px); }

.export-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent-soft), var(--gold-soft));
  color: var(--accent);
}

.export-card__icon svg { width: 24px; height: 24px; }

.export-card__label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.export-card__hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

.export-card--bulk.export-card--inactive,
.export-card:disabled {
  opacity: 0.42;
  border-style: dashed;
  background: var(--bg-secondary);
  cursor: not-allowed;
  pointer-events: none;
}

.export-card--bulk.export-card--inactive:hover,
.export-card:disabled:hover {
  transform: none;
  box-shadow: var(--shadow-soft);
}

.export-fallback {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px dashed rgba(61, 92, 92, 0.28);
}

.export-fallback__text {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-deep);
  margin-bottom: 10px;
}

.export-fallback__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.export-fallback__hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.45;
}

.export-fallback__hint code {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-inset);
}

/* Fields */
.custom-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.field__rule {
  font-weight: 500;
  color: var(--text-tertiary);
  font-size: 11px;
}

.field input {
  width: 100%;
  padding: 13px 15px;
  font-family: var(--font);
  font-size: 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field input::placeholder { color: #c5c0b8; }

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field--invalid input { border-color: var(--red); }

.field__error {
  display: block;
  min-height: 16px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--red);
}

/* Toggles */
.inline-toggles, .inline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
}

.inline-controls label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.inline-controls input[type="range"] { width: 90px; }

.toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  padding: 4px 0;
}

.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle__track {
  width: 42px;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition);
}

.toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(42, 41, 38, 0.15);
  transition: transform var(--transition);
}

.toggle input:checked + .toggle__track { background: var(--accent); }
.toggle input:checked + .toggle__track .toggle__thumb { transform: translateX(18px); }

.toggle__text {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Settings */
.settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.segmented {
  display: flex;
  width: 100%;
  padding: 4px;
  background: var(--bg-inset);
  border-radius: var(--radius-md);
  gap: 3px;
  border: 1px solid var(--border);
}

.segmented__btn {
  flex: 1;
  padding: 9px 14px;
  border: none;
  border-radius: calc(var(--radius-md) - 4px);
  background: transparent;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition), background var(--transition), box-shadow var(--transition);
}

.segmented__btn:hover { color: var(--text-secondary); }

.segmented__btn--active {
  background: var(--bg-elevated);
  color: var(--accent-deep);
  font-weight: 600;
  box-shadow: var(--shadow-soft);
}

.length-control {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.length-control.hidden { display: none; }
.length-control input[type="range"] { width: 120px; }

/* Length control placed as a block beneath the character toggles */
.length-control--block {
  width: 100%;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.length-control--block input[type="range"] { flex: 1; width: auto; }
.length-control--block label { font-weight: 600; color: var(--text); }

.slider-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  min-width: 24px;
}

input[type="range"] {
  height: 6px;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-elevated);
  box-shadow: 0 1px 4px rgba(31, 30, 29, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }

.options-group.hidden { display: none; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all var(--transition);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(193, 95, 60, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn--primary:hover {
  background: var(--accent-deep);
}

.btn--primary:active { transform: translateY(0.5px); }

.btn--secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn--secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  color: var(--accent-deep);
}

.btn--compact { padding: 8px 14px; font-size: 13px; }
.btn--large { padding: 13px 26px; font-size: 15px; }
.btn--icon { width: 48px; padding: 0; }
.btn--icon.btn--large { width: 52px; }

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Bulk */
.bulk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-warm);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.bulk-row__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.bulk-row input[type="number"] {
  width: 52px;
  padding: 8px 10px;
  text-align: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--bg-elevated);
  color: var(--text);
}

.bulk-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bulk-results.hidden { display: none; }

.bulk-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.bulk-list li {
  padding: 11px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-deep);
}

/* QR */
.qr-preview {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.qr-preview.hidden { display: none; }

.qr-preview__canvas {
  padding: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.qr-preview__canvas canvas,
.qr-preview__canvas img {
  display: block;
  width: 160px;
  height: 160px;
}

.password-row.generating #passwordOutput {
  opacity: 0.45;
  transition: opacity 0.2s ease;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  padding: 12px 22px;
  background: var(--accent-deep);
  color: #f5f3ef;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* Responsive */
@media (max-width: 900px) {
  .app { width: 94vw; height: auto; min-height: 90vh; }
  .workspace { grid-template-columns: 1fr; overflow-y: auto; }
}

@media (max-width: 600px) {
  body { padding: 1vh 1vw; }
  .workspace { padding: 22px 18px; gap: 20px; }
  .password-block { padding: 18px; }
  .custom-row { grid-template-columns: 1fr; }
  .settings-row { flex-direction: column; align-items: stretch; }
  .segmented { flex-wrap: wrap; }
  .header__title { font-size: 24px; }
}

/* ============================================================
   THEMES — base :root above is "Claude Light".
   data-theme is always set explicitly (default: dark).
   ============================================================ */

/* Claude Dark (default) */
:root[data-theme="dark"] {
  --bg-base: #1f1e1d;
  --bg-warm: #262624;
  --bg-elevated: #30302e;
  --bg-secondary: #262624;
  --bg-tertiary: #3a3a37;
  --bg-inset: #1a1a19;

  --text: #eceae0;
  --text-secondary: #b5b0a5;
  --text-tertiary: #8a857c;

  --accent: #e0876a;
  --accent-deep: #c15f3c;
  --accent-hover: #ea9a80;
  --accent-soft: rgba(217, 119, 87, 0.16);
  --accent-glow: rgba(217, 119, 87, 0.28);

  --gold: #c4a574;
  --gold-soft: rgba(196, 165, 116, 0.12);

  --green: #7bb07f;
  --green-soft: rgba(123, 176, 127, 0.2);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.14);

  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 56px -20px rgba(0, 0, 0, 0.5);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

:root[data-theme="dark"] .ambient {
  background:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(217, 119, 87, 0.1) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 85%, rgba(196, 165, 116, 0.07) 0%, transparent 55%),
    linear-gradient(165deg, #1f1e1d 0%, #262624 45%, #1c1b1a 100%);
}

/* Midnight — deep indigo + blue */
:root[data-theme="midnight"] {
  --bg-base: #0f1729;
  --bg-warm: #131c30;
  --bg-elevated: #1a2540;
  --bg-secondary: #16203a;
  --bg-tertiary: #26314f;
  --bg-inset: #0c1322;

  --text: #e6ebf5;
  --text-secondary: #a3afc9;
  --text-tertiary: #6f7c99;

  --accent: #6d8eff;
  --accent-deep: #4f6fe0;
  --accent-hover: #88a3ff;
  --accent-soft: rgba(109, 142, 255, 0.16);
  --accent-glow: rgba(109, 142, 255, 0.3);

  --gold: #c4a574;
  --gold-soft: rgba(196, 165, 116, 0.12);

  --green: #57c9a6;
  --green-soft: rgba(87, 201, 166, 0.2);
  --orange: #e0a050;
  --red: #e76d6d;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.14);

  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 56px -20px rgba(0, 0, 0, 0.55);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

:root[data-theme="midnight"] .ambient {
  background:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(109, 142, 255, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 85%, rgba(87, 201, 166, 0.1) 0%, transparent 55%),
    linear-gradient(165deg, #0f1729 0%, #131c30 45%, #0c1322 100%);
}

/* Forest — deep green + emerald */
:root[data-theme="forest"] {
  --bg-base: #0f1a14;
  --bg-warm: #14201a;
  --bg-elevated: #1b2a22;
  --bg-secondary: #16231b;
  --bg-tertiary: #26372d;
  --bg-inset: #0c1611;

  --text: #e7efe8;
  --text-secondary: #a6b8aa;
  --text-tertiary: #71857a;

  --accent: #46b985;
  --accent-deep: #2f9463;
  --accent-hover: #62cf9d;
  --accent-soft: rgba(70, 185, 133, 0.16);
  --accent-glow: rgba(70, 185, 133, 0.3);

  --gold: #c4a574;
  --gold-soft: rgba(196, 165, 116, 0.12);

  --green: #5ec98c;
  --green-soft: rgba(94, 201, 140, 0.2);
  --orange: #e0a050;
  --red: #e0706a;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.14);

  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 56px -20px rgba(0, 0, 0, 0.55);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

:root[data-theme="forest"] .ambient {
  background:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(70, 185, 133, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 85%, rgba(196, 165, 116, 0.07) 0%, transparent 55%),
    linear-gradient(165deg, #0f1a14 0%, #14201a 45%, #0c1611 100%);
}

/* Ocean — deep teal + cyan */
:root[data-theme="ocean"] {
  --bg-base: #0c1820;
  --bg-warm: #112028;
  --bg-elevated: #16252f;
  --bg-secondary: #122029;
  --bg-tertiary: #213541;
  --bg-inset: #0a141b;

  --text: #e4eef2;
  --text-secondary: #a0b4bd;
  --text-tertiary: #6e828c;

  --accent: #36c2cf;
  --accent-deep: #2197a4;
  --accent-hover: #54d5e0;
  --accent-soft: rgba(54, 194, 207, 0.16);
  --accent-glow: rgba(54, 194, 207, 0.3);

  --gold: #c4a574;
  --gold-soft: rgba(196, 165, 116, 0.12);

  --green: #4fc9a0;
  --green-soft: rgba(79, 201, 160, 0.2);
  --orange: #e0a050;
  --red: #e76d6d;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.14);

  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 56px -20px rgba(0, 0, 0, 0.55);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

:root[data-theme="ocean"] .ambient {
  background:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(54, 194, 207, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 85%, rgba(79, 201, 160, 0.1) 0%, transparent 55%),
    linear-gradient(165deg, #0c1820 0%, #112028 45%, #0a141b 100%);
}

/* Rose — soft light with rose accent */
:root[data-theme="rose"] {
  --bg-base: #f7f0f1;
  --bg-warm: #fbf5f6;
  --bg-elevated: #fdf9f9;
  --bg-secondary: #f6eef0;
  --bg-tertiary: #ecdde1;
  --bg-inset: #f1e6e9;

  --text: #2a1f23;
  --text-secondary: #6e5b61;
  --text-tertiary: #9c8a90;

  --accent: #d9577f;
  --accent-deep: #bd3e66;
  --accent-hover: #e56e92;
  --accent-soft: rgba(217, 87, 127, 0.1);
  --accent-glow: rgba(217, 87, 127, 0.2);

  --gold: #b08d57;
  --gold-soft: rgba(176, 141, 87, 0.12);

  --green: #5a9e7a;
  --green-soft: rgba(90, 158, 122, 0.2);
  --orange: #d4915a;
  --red: #c5584f;
  --border: rgba(42, 31, 35, 0.1);
  --border-strong: rgba(42, 31, 35, 0.16);

  --shadow-soft: 0 1px 2px rgba(42, 31, 35, 0.05);
  --shadow-md: 0 1px 3px rgba(42, 31, 35, 0.05), 0 10px 30px -14px rgba(42, 31, 35, 0.14);
  --shadow-lg: 0 1px 3px rgba(42, 31, 35, 0.04), 0 28px 56px -24px rgba(42, 31, 35, 0.2);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

:root[data-theme="rose"] .ambient {
  background:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(217, 87, 127, 0.1) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 85%, rgba(176, 141, 87, 0.07) 0%, transparent 55%),
    linear-gradient(165deg, #f7f0f1 0%, #fbf5f6 45%, #f2e8eb 100%);
}

/* Lighter placeholders on dark themes */
:root[data-theme="dark"] .field input::placeholder,
:root[data-theme="midnight"] .field input::placeholder,
:root[data-theme="forest"] .field input::placeholder,
:root[data-theme="ocean"] .field input::placeholder {
  color: rgba(255, 255, 255, 0.32);
}

/* Custom inclusion section dims when the active mode ignores it */
.custom-section--inactive {
  opacity: 0.5;
  filter: grayscale(0.3);
}

.custom-section--inactive::after {
  content: 'Custom inclusions apply in Random mode';
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

/* Accessible focus indicator for keyboard users */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.toggle input:focus-visible + .toggle__track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
