/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --secondary: #64748b;
  --success: #06b6d4;
  --warning: #f59e0b;
  --error: #ef4444;
  --background: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --border-focus: #0ea5e9;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 8px;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  min-height: 100vh;
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.header {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding: 2rem 0;
  text-align: center;
  color: white;
}

.header-title-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
  text-align: left;
}

.header-icon {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 18px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.25));
}

.title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  font-weight: 400;
}

/* Main content */
.main {
  padding: 2rem 0;
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.25rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  overflow-x: auto;
  gap: 0.25rem;
}

.tab {
  flex: 1;
  min-width: 120px;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab:hover {
  background: var(--background);
  color: var(--text);
}

.tab.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow);
}

/* Tab content */
.tab-content {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.tab-content > * > .card:last-child {
  margin-bottom: 0;
}

/* Form elements */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.2s ease;
  background: var(--surface);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.form-input:read-only {
  background: var(--background);
  cursor: default;
}

.symbol-chips-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.symbol-chips-header .form-label {
  margin-bottom: 0;
}

.symbol-chips-actions {
  display: flex;
  gap: 0.375rem;
}

.chip-action {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.chip-action:hover {
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.symbol-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.symbol-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: monospace;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.symbol-chip:hover {
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.symbol-chip.active {
  border-color: var(--primary);
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary);
}

.leet-chip {
  width: auto;
  padding: 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}

.emoji-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.emoji-toggle-row .form-label {
  margin-bottom: 0;
  flex-shrink: 0;
}

.emoji-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--background);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1.4;
}

.emoji-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.emoji-toggle-btn.active {
  border-color: var(--primary);
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary);
}

.emoji-toggle-icon {
  font-style: normal;
  line-height: 1;
}

.emoji-toggle-label {
  font-variant-numeric: tabular-nums;
  min-width: 1.8rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover {
  background: #475569;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.card-header {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* Sliders */
.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow);
}

.slider-value {
  min-width: 60px;
  text-align: center;
  font-weight: 600;
  color: var(--text);
}

.stepper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
  font-size: 1rem;
}

.stepper-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.stepper-btn:active {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.stepper-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.stepper-label-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  min-width: 56px;
  text-align: center;
}

/* Checkboxes and switches */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  background: var(--surface);
}

.checkbox:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

/* Radio buttons */
.radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.radio-item:hover {
  background: var(--background);
}

.radio {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  background: var(--surface);
}

.radio:checked {
  border-color: var(--primary);
}

.radio:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

/* Password display */
.password-display {
  position: relative;
  margin-bottom: 0;
}

.password-input {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 1.1rem;
  padding-right: 3rem;
  background: var(--background);
  border: 2px solid var(--border);
}

.password-input.has-length-pill {
  padding-right: 6rem;
}

.length-pill {
  position: absolute;
  right: 2.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary-dark);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.copy-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: var(--border);
  color: var(--text);
}

.copy-btn.copied {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.copy-btn.copied:hover {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  color: var(--primary);
}

/* Notifications */
.notification {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  color: white;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.notification.success {
  background: var(--success);
}

.notification.error {
  background: var(--error);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Separator chip grid */
.separator-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.sep-option {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.sep-option:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(14, 165, 233, 0.05);
}

.sep-option.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.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;
}

.custom-sep-row {
  margin-top: 0.5rem;
}

.structure-chip span {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

/* Mad Lib */
.madlib-template-preview {
  margin-top: 0.75rem;
  padding: 0.6rem 0.9rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.madlib-template-text {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.88rem;
  color: var(--text-secondary);
  word-break: break-word;
}

.madlib-template-text .slot {
  color: var(--primary);
  font-weight: 600;
}

.madlib-preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.madlib-preview-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.madlib-preview-phrase {
  font-size: 1rem;
  color: var(--text);
  font-style: italic;
  word-break: break-word;
}

/* Prefix / Suffix affix pickers */
.affix-pair {
  display: flex;
  gap: 0;
}

.affix-block {
  flex: 1;
  min-width: 0;
}

.affix-label {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.affix-divider {
  width: 1px;
  background: var(--border);
  margin: 0 1.25rem;
  flex-shrink: 0;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 0 0.5rem;
  }
  
  .title {
    font-size: 2rem;
  }

  .header-icon {
    width: 60px;
    height: 60px;
  }
  
  .tabs {
    flex-direction: column;
  }
  
  .tab {
    flex: none;
  }
  
  .radio-group {
    grid-template-columns: 1fr;
  }
  
  .slider-container {
    flex-direction: column;
    align-items: stretch;
  }

  .affix-pair {
    flex-direction: column;
  }

  .affix-divider {
    width: 100%;
    height: 1px;
    margin: 1rem 0;
  }
}

/* ── Slot builder ─────────────────────────────────────── */

.slot-add-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.slot-add-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  white-space: nowrap;
}

.slot-add-btn {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 2px solid transparent;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: 0.03em;
}

.slot-add-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.slot-add-btn:not(:disabled):hover { opacity: 0.85; transform: scale(1.04); }

.slot-add-btn.slot-adj  { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.slot-add-btn.slot-adv  { background: #ccfbf1; color: #0f766e; border-color: #5eead4; }
.slot-add-btn.slot-noun { background: #f1f5f9; color: #334155; border-color: #94a3b8; }
.slot-add-btn.slot-verb { background: #fef3c7; color: #92400e; border-color: #fcd34d; }

.slot-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.slot-pill {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 2px solid transparent;
  min-width: 90px;
}

.slot-adj  { background: #dbeafe; border-color: #93c5fd; }
.slot-adv  { background: #ccfbf1; border-color: #5eead4; }
.slot-noun { background: #f1f5f9; border-color: #94a3b8; }
.slot-verb { background: #fef3c7; border-color: #fcd34d; }

.slot-pill-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
}

.slot-pill-actions {
  display: flex;
  gap: 2px;
}

.slot-arrow,
.slot-remove {
  background: rgba(0,0,0,0.06);
  border: none;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  padding: 0;
  line-height: 1;
}

.slot-arrow:disabled { opacity: 0.25; cursor: default; }
.slot-arrow:not(:disabled):hover,
.slot-remove:hover { background: rgba(0,0,0,0.14); }

.slot-remove { margin-left: auto; color: #dc2626; }

.slot-cat-select {
  font-size: 0.75rem;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 5px;
  padding: 0.2rem 0.3rem;
  background: rgba(255,255,255,0.6);
  color: var(--text);
  cursor: pointer;
  width: 100%;
}

.slot-empty {
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 1rem 0;
}

/* ── Mad Lib template token preview ──────────────────── */

.madlib-template-preview {
  margin-top: 0.85rem;
  padding: 0.6rem 0.75rem;
  background: var(--background);
  border-radius: 6px;
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem;
  font-size: 0.95rem;
  line-height: 1.8;
}

.madlib-literal {
  color: var(--text-secondary);
  white-space: pre;
}

.madlib-token {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: 5px;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.6;
}

.madlib-token.slot-adj  { background: #dbeafe; color: #1d4ed8; }
.madlib-token.slot-adv  { background: #ccfbf1; color: #0f766e; }
.madlib-token.slot-noun { background: #f1f5f9; color: #334155; border: 1px solid #94a3b8; }
.madlib-token.slot-verb { background: #fef3c7; color: #92400e; }

/* ── Word cat label accent dots ──────────────────────── */

.word-cat-label { display: flex; align-items: center; gap: 0.4rem; }
.word-cat-label::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wc-label-adj::before  { background: #1d4ed8; }
.wc-label-adv::before  { background: #0f766e; }
.wc-label-noun::before { background: #64748b; }
.wc-label-verb::before { background: #92400e; }

.wc-ordinal {
  font-weight: 400;
  opacity: 0.6;
  font-size: 0.78rem;
}

.word-cat-row + .word-cat-row {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

/* ── Header meta row (privacy notice + history control) ─── */

.header-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.privacy-notice {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
}

.header-docs-link {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
}

.docs-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.docs-link:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.7);
}

.history-max-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.history-max-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255, 255, 255, 0.7);
}

.history-max-chips {
  display: flex;
  gap: 0.3rem;
}

.history-max-chip {
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.history-max-chip:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
  color: white;
}

.history-max-chip.active {
  background: white;
  border-color: white;
  color: var(--primary-dark);
}

@media (max-width: 600px) {
  .header-meta { flex-direction: column; align-items: stretch; }
  .history-max-control { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ── Word pills (per-word regeneration) ─────────────────── */

.word-pills-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.word-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1;
}

.lock-affixes-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--background);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-size: 1rem;
  margin-top: 1px;
}

.lock-affixes-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(14, 165, 233, 0.07);
}

.lock-affixes-btn.active {
  border-color: var(--primary);
  background: rgba(14, 165, 233, 0.12);
  color: var(--primary);
}

.word-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem 0.35rem 0.75rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--background);
  color: var(--text);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}

.word-pill:hover {
  border-color: var(--primary);
  background: rgba(14, 165, 233, 0.07);
  color: var(--primary);
}

.word-pill:hover .word-pill-icon {
  opacity: 1;
  transform: rotate(30deg);
}

.word-pill-icon {
  font-size: 0.8rem;
  opacity: 0.35;
  transition: opacity 0.15s, transform 0.25s;
}

/* Slot-type color accents on passphrase word pills */
.word-pill-adj  { border-color: #93c5fd; background: #dbeafe; color: #1d4ed8; }
.word-pill-adj:hover  { border-color: #1d4ed8; background: #bfdbfe; }
.word-pill-adv  { border-color: #5eead4; background: #ccfbf1; color: #0f766e; }
.word-pill-adv:hover  { border-color: #0f766e; background: #99f6e4; }
.word-pill-noun { border-color: #94a3b8; background: #f1f5f9; color: #334155; }
.word-pill-noun:hover { border-color: #334155; background: #e2e8f0; }
.word-pill-verb { border-color: #fcd34d; background: #fef3c7; color: #92400e; }
.word-pill-verb:hover { border-color: #92400e; background: #fde68a; }

/* ── History strip ──────────────────────────────────────── */

.history-strip {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.history-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.history-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: none;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.history-item:hover {
  background: var(--background);
  border-color: var(--border);
  color: var(--text);
}

.history-item-active {
  background: rgba(14, 165, 233, 0.07);
  border-color: var(--primary);
  color: var(--primary);
}

.history-item-warn {
  border-color: var(--warning, #f59e0b);
  color: var(--warning, #f59e0b);
}

.history-warn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--warning, #f59e0b);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  margin-left: 4px;
  line-height: 1;
  flex-shrink: 0;
}

/* ── Site footer ────────────────────────────────────────── */

.site-footer {
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 1.25rem 0;
  margin-top: 2rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-credit {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.footer-link {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-link:hover {
  color: white;
}

.footer-link-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.github-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
  vertical-align: middle;
}

@media (max-width: 560px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
/* Alliteration toggle */
.alliteration-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
  white-space: nowrap;
}

.alliteration-toggle:hover {
  background: var(--surface-hover, rgba(0,0,0,0.04));
  color: var(--text);
}

.alliteration-toggle.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.alliteration-letter {
  font-weight: 700;
  font-size: 0.9rem;
  background: rgba(255,255,255,0.25);
  border-radius: 4px;
  padding: 0 0.3rem;
  min-width: 1.4em;
  text-align: center;
  letter-spacing: 0.05em;
}
