/* ===== Neon Theme Variables ===== */
:root {
  /* Neon accent colors */
  --neon-purple: #7b68ee;
  --neon-purple-rgb: 123, 104, 238;
  --neon-purple-hover: #6a56e0;
  --neon-purple-light: #9b8aff;
  --neon-cyan: #4fc3f7;
  --neon-cyan-rgb: 79, 195, 247;
  --neon-cyan-light: #81d4fa;
  --neon-green: #66bb6a;
  --neon-green-rgb: 102, 187, 106;
  --neon-green-light: #81c784;
  --font-cyber: 'Orbitron', 'Century Gothic', Futura, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Background surfaces */
  --bg-base: #1a1a2e;
  --bg-base-rgb: 26, 26, 46;
  --bg-darker: #16162a;
  --bg-surface: #20203c;
  --bg-input: #12122a;

  /* Border colors */
  --border-subtle: #2a2a4a;
  --border-default: #3a3a5c;
  --border-strong: #4a4a6c;

  /* Text colors */
  --text-primary: #f0f0f0;
  --text-body: #e0e0e0;
  --text-secondary: #c0c0d8;
  --text-muted: #a0a0b8;
  --text-dim: #9494b8;
  --text-dimmer: #707090;
  --text-faint: #606080;
}

/* ===== Shared Screen Reader Utilities ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Skip Link ===== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 9999;
  padding: 0.75rem 1.5rem;
  background: var(--neon-purple);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 0 0 6px 0;
  text-decoration: none;
}

.skip-link:focus {
  position: fixed;
  left: 0;
  top: 0;
  width: auto;
  height: auto;
  overflow: visible;
}

#main-content {
  scroll-margin-top: 72px;
}

/* ===== Accent Button ===== */
.btn-accent {
  background: linear-gradient(95deg, #f433e5 0%, #2fd9fa 90%);
  color: #181830;
  border: none;
  font-weight: 700;
  padding: 0.48em 1.3em;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(244, 51, 229, 0.08);
  transition: box-shadow 0.18s, background 0.22s;
}

.btn-accent:hover {
  filter: brightness(1.07);
  box-shadow: 0 3px 12px rgba(47, 217, 250, 0.20);
}

.btn-accent:active {
  filter: brightness(0.98);
}

.btn-accent:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  pointer-events: none;
}

/* ===== Reset / Normalize ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--bg-base);
  min-height: 100vh;
  position: relative;
}

body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 4px
  );
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--neon-purple);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul, ol {
  list-style: none;
}

/* ===== Typography ===== */
h1, h2, h3, h4 {
  line-height: 1.25;
  color: var(--text-primary);
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

p {
  margin-bottom: 0.75rem;
}

small {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.style-page.container {
  max-width: 1250px;
}

.page-content {
  padding: 2rem 0 3rem;
}

/* ===== Creation Flow Header ===== */
.creation-flow {
  background: color-mix(in srgb, var(--bg-darker) 70%, var(--bg-surface) 30%);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
}

.creation-flow__steps {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  justify-content: space-between;
  list-style: none;
}

.creation-flow__step {
  flex: 1;
  min-width: 0;
  position: relative;
  padding-inline: 0.125rem;
}

.creation-flow__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -0.5rem;
  width: 1rem;
  height: 2px;
  background: var(--border-subtle);
  transform: translateY(-50%);
  transition: background 0.2s ease;
  pointer-events: none;
}

.creation-flow__link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  background: color-mix(in srgb, rgba(var(--bg-base-rgb), 0.9) 70%, var(--bg-surface) 30%);
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.creation-flow__link:hover {
  border-color: var(--border-strong);
  color: var(--text-body);
  background: color-mix(in srgb, var(--border-subtle) 35%, var(--bg-surface) 65%);
}

.creation-flow__link:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 3px;
}

.creation-flow__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--border-subtle);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.creation-flow__label {
  flex: 1;
  min-width: 0;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.creation-flow__label::first-letter {
  text-transform: uppercase;
}

/* Active step */
[data-flow-step="workshop"] .creation-flow__step[data-step="workshop"] .creation-flow__link,
[data-flow-step="style"] .creation-flow__step[data-step="style"] .creation-flow__link {
  border-color: var(--neon-purple);
  background: linear-gradient(120deg, rgba(var(--neon-purple-rgb), 0.28), rgba(var(--neon-cyan-rgb), 0.24));
  color: var(--text-primary);
  box-shadow: 0 0 0 1px rgba(var(--neon-purple-rgb), 0.4), 0 10px 24px rgba(0, 0, 0, 0.38);
}

[data-flow-step="workshop"] .creation-flow__step[data-step="workshop"] .creation-flow__number,
[data-flow-step="style"] .creation-flow__step[data-step="style"] .creation-flow__number {
  background: var(--neon-purple);
  color: #fff;
  box-shadow: 0 0 10px rgba(var(--neon-purple-rgb), 0.6);
}

[data-flow-step="workshop"] .creation-flow__step[data-step="workshop"]::after,
[data-flow-step="style"] .creation-flow__step[data-step="style"]::after {
  background: rgba(var(--neon-purple-rgb), 0.5);
}

/* Completed steps */
[data-flow-step="style"] .creation-flow__step[data-step="workshop"] .creation-flow__link {
  border-color: var(--neon-green);
  background: color-mix(in srgb, rgba(var(--neon-green-rgb), 0.25) 55%, var(--bg-surface) 45%);
  color: var(--text-primary);
  box-shadow: 0 0 0 1px rgba(var(--neon-green-rgb), 0.32);
}

[data-flow-step="style"] .creation-flow__step[data-step="workshop"] .creation-flow__number {
  background: var(--neon-green);
  color: #06150a;
  box-shadow: 0 0 8px rgba(var(--neon-green-rgb), 0.5);
}

[data-flow-step="style"] .creation-flow__step[data-step="workshop"]::after {
  background: rgba(var(--neon-green-rgb), 0.8);
}

@media (max-width: 900px) {
  .creation-flow__steps {
    gap: 0.75rem;
  }
}

@media (max-width: 768px) {
  .creation-flow {
    padding: 0.85rem 1rem;
    margin-bottom: 1.5rem;
  }

  .creation-flow__steps {
    flex-direction: column;
    gap: 0.65rem;
  }

  .creation-flow__step {
    padding-inline: 0;
  }

  .creation-flow__step::after {
    display: none;
  }

  .creation-flow__link {
    padding: 0.8rem 0.9rem;
  }
}

/* ===== Navigation ===== */
.site-nav {
  background: var(--bg-darker);
  border-bottom: none;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-nav::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-purple), var(--neon-cyan), var(--neon-purple), transparent);
  animation: neon-pulse 3s ease-in-out infinite;
}

.site-nav .container {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 56px;
  justify-content: space-between;
}

/* ===== Sticky Action Bar ===== */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  position: sticky;
  top: 122px; /* below nav (120px) + 2px neon border */
  z-index: 90; /* below nav's 100, below scanline overlay 9998 */
  background: var(--bg-base, #1a1a2e);
  padding: 0.75rem 1rem;
  margin: 0 -1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle, #2a2a4a);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border-radius: 0;
}

/* ===== Save Bar (non-sticky; scrolls with style builder content) ===== */
.save-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--bg-base, #1a1a2e);
  padding: 0.75rem 1rem;
  margin: 0 -1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle, #2a2a4a);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border-radius: 0;
}

.site-nav__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.site-nav__brand-logo {
  height: 32px;
  width: auto;
  filter: drop-shadow(0 0 8px rgba(123, 104, 238, 0.3));
}

.site-nav__brand:hover {
  text-decoration: none;
  color: var(--neon-purple);
}

.site-nav__links {
  display: flex;
  gap: 1rem;
}

.site-nav__link {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.site-nav__link:hover {
  color: var(--text-body);
  text-decoration: none;
}

.site-nav__link.active {
  color: var(--neon-purple);
  border-bottom-color: var(--neon-purple);
}

/* ===== Buttons ===== */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
}

button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--neon-purple);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--neon-purple);
  color: #fff;
  border-color: var(--neon-purple);
}

.btn-primary:hover {
  background: var(--neon-purple-hover);
  border-color: var(--neon-purple-hover);
  box-shadow: 0 0 10px rgba(var(--neon-purple-rgb), 0.5), 0 0 20px rgba(var(--neon-purple-rgb), 0.35), 0 0 40px rgba(var(--neon-purple-rgb), 0.2), inset 0 0 10px rgba(var(--neon-purple-rgb), 0.15);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  background: var(--border-subtle);
  border-color: var(--border-strong);
  color: var(--text-body);
}

.btn-danger {
  background: transparent;
  color: #ef5350;
  border-color: #ef5350;
}

.btn-danger:hover {
  background: #ef5350;
  color: #fff;
}

.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

.btn-copy {
  background: var(--border-subtle);
  color: var(--text-secondary);
  border-color: var(--border-default);
}

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

.btn-copy.copied {
  background: #2e7d32;
  color: #fff;
  border-color: #2e7d32;
}

/* ===== Form Elements ===== */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-body);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--neon-purple);
  box-shadow: 0 0 0 2px rgba(var(--neon-purple-rgb), 0.3), 0 0 10px rgba(var(--neon-purple-rgb), 0.15);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--neon-purple);
  outline-offset: 2px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

textarea.lyrics-editor {
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono",
    "Courier New", monospace;
  font-size: 0.88rem;
  line-height: 1.65;
  min-height: 250px;
}

/* ===== Combobox ===== */
.combobox,
.preset-combobox {
  position: relative;
}

.combobox__input,
.preset-combobox input {
  width: 100%;
}

.combobox__dropdown,
.preset-dropdown {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.25rem 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
  z-index: 60;
  display: none;
}

.combobox.is-open .combobox__dropdown,
.preset-dropdown.open {
  display: block;
}

.combobox__group-label,
.preset-dropdown-header {
  padding: 0.45rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(var(--bg-base-rgb), 0.85);
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
}

.combobox__item,
.preset-dropdown-item {
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-body);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.combobox__item:hover,
.combobox__item.is-focused,
.preset-dropdown-item:hover,
.preset-dropdown-item.focused {
  background: rgba(var(--neon-purple-rgb), 0.18);
  color: var(--text-primary);
}

.combobox__item.is-focused,
.preset-dropdown-item.focused {
  outline: 2px solid var(--neon-purple);
  outline-offset: -2px;
}

.combobox__item.is-active,
.preset-dropdown-item.active {
  background: rgba(var(--neon-purple-rgb), 0.28);
  color: var(--text-primary);
}

.combobox__empty,
.preset-dropdown-empty {
  padding: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.combobox__dropdown::-webkit-scrollbar,
.preset-dropdown::-webkit-scrollbar {
  width: 6px;
}

.combobox__dropdown::-webkit-scrollbar-thumb,
.preset-dropdown::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

.form-group {
  margin-bottom: 1rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row > * {
  flex: 1;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--neon-purple);
  margin-right: 0.4rem;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.25rem;
  --card-hover-transform: translateY(-2px);
  --card-hover-shadow: 0 0 20px rgba(var(--neon-purple-rgb), 0.15), 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  border-color: var(--border-default);
  transform: var(--card-hover-transform);
  box-shadow: var(--card-hover-shadow);
}

section.card,
.sidebar__content > .card,
.preset-panel.card,
.test-panel.card,
.ai-generate-panel.card {
  --card-hover-transform: none;
  --card-hover-shadow: none;
}

section.card:hover,
.sidebar__content > .card:hover,
.preset-panel.card:hover,
.test-panel.card:hover,
.ai-generate-panel.card:hover {
  transform: none;
  box-shadow: none;
}

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

.card-description {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

/* Nav card variant -- clickable cards on landing page */
.nav-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-left: 3px solid var(--neon-purple);
}

.nav-card:hover {
  text-decoration: none;
  border-color: var(--neon-purple-light);
  box-shadow: 0 4px 16px rgba(var(--neon-purple-rgb), 0.2);
  transform: translateY(-2px);
}

.nav-card .card-title {
  color: var(--neon-purple);
}

.nav-card:hover .card-title {
  color: var(--neon-purple-light);
}

/* ===== Tags / Chips ===== */
.tag {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
  background: var(--border-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
}

.tag:hover {
  background: var(--border-default);
  color: var(--text-body);
}

.tag.active {
  background: var(--neon-purple);
  color: #fff;
  border-color: var(--neon-purple);
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

/* ===== Character Counter ===== */
.char-counter {
  font-size: 0.82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.char-counter.normal {
  color: var(--neon-green);
}

.char-counter.warning {
  color: #ffa726;
}

.char-counter.over {
  color: #ef5350;
  font-weight: 700;
}

/* ===== Prompt Output ===== */
.prompt-output {
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 60px;
  position: relative;
}

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

/* ===== Toast / Notification ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.65rem 1.1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #fff;
  background: #2e7d32;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  animation: toast-in 0.25s ease-out;
}

.toast.error {
  background: #c62828;
}

.toast.fade-out {
  animation: toast-out 0.3s ease-in forwards;
}

/* ===== Neon Animations ===== */
@keyframes neon-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

@keyframes neon-flicker {
  0%, 100% { opacity: 1; }
  10% { opacity: 0.85; }
  20% { opacity: 1; }
  30% { opacity: 0.9; }
  40% { opacity: 1; }
  50% { opacity: 0.8; }
  60% { opacity: 1; }
  70% { opacity: 0.95; }
  80% { opacity: 0.85; }
  90% { opacity: 1; }
}

/* ===== Neon Utility Classes ===== */
.neon-text {
  text-shadow: 0 0 10px rgba(var(--neon-purple-rgb), 0.6), 0 0 20px rgba(var(--neon-purple-rgb), 0.4), 0 0 40px rgba(var(--neon-purple-rgb), 0.2);
  animation: neon-pulse 3s ease-in-out infinite;
}

.cyber-border {
  border-image: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan), var(--neon-green), var(--neon-purple)) 1;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ===== Modal / Panel ===== */
body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: fade-in 0.15s ease-out;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: modal-in 0.2s ease-out;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.modal-actions .btn {
  min-width: 110px;
}

.modal-message {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.picker-list {
  max-height: 300px;
  overflow-y: auto;
  margin-top: 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-input);
  display: flex;
  flex-direction: column;
}

.picker-item {
  display: block;
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  border-left: none;
  border-right: none;
  border-top: none;
  background: transparent;
  color: var(--text-body);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.picker-item:hover {
  background: var(--border-subtle);
  border-color: var(--border-default);
}

.picker-item:focus-visible {
  outline: 2px solid var(--neon-purple);
  outline-offset: 2px;
}

.picker-item:last-child {
  border-bottom: none;
}

.picker-item__name {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.picker-item__detail {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== Saved Items Sidebar / List ===== */
.saved-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  animation: item-in 0.25s ease-out;
}

@keyframes item-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.saved-item:hover {
  border-color: var(--border-strong);
  background: #262644;
}

.saved-item.active {
  border-color: var(--neon-purple);
}

.saved-item__name {
  font-size: 0.88rem;
  color: var(--text-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-item__date {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.saved-item__actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

/* ===== Sidebar Layout ===== */
/* Reusable two-column layout with a sticky left sidebar.
   Used by Songs, Lyrics, and Style pages for searchable saved-item lists.
   BEM naming: .sidebar, .sidebar__header, .sidebar__search, etc.
   Layers on top of existing .saved-list / .saved-item classes. */

/* --- Sidebar: Page container (flex row, stacks on mobile) --- */
.page-with-sidebar {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

/* --- Sidebar: Left panel (280px, sticky, scrollable) --- */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 5rem; /* below the sticky nav */
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1rem;
}

/* --- Sidebar: Header row with title and count badge --- */
.sidebar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.sidebar__header h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.sidebar__count {
  font-size: 0.75rem;
  color: var(--text-dim);
  background: var(--bg-darker);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

/* --- Sidebar: Search input (neon-themed focus glow) --- */
.sidebar__search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  color: var(--text-body);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}
.sidebar__search:focus {
  border-color: var(--neon-purple);
  box-shadow: 0 0 0 2px rgba(var(--neon-purple-rgb), 0.2);
}
.sidebar__search::placeholder {
  color: var(--text-dim);
}

/* --- Sidebar: List overrides (tighter spacing for sidebar context) --- */
.sidebar__list .saved-item {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}
.sidebar__list .saved-item__actions {
  flex-direction: column;
  gap: 0.2rem;
}
.sidebar__list .saved-item__actions .btn {
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
}

/* --- Sidebar: Empty state (no items or no search matches) --- */
.sidebar__empty {
  text-align: center;
  padding: 1.5rem 0.5rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

/* --- Sidebar: Main content area (fills remaining space) --- */
.sidebar__content {
  flex: 1;
  min-width: 0;
}

/* --- Sidebar: Mobile toggle button (hidden on desktop) --- */
.sidebar__toggle {
  display: none;
  width: 100%;
  padding: 0.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 0.75rem;
  text-align: left;
}
.sidebar__toggle:hover {
  background: var(--bg-darker);
}
.sidebar__toggle .chevron {
  display: inline-block;
  transition: transform 0.2s;
  margin-right: 0.3rem;
}
.sidebar__toggle .chevron.open {
  transform: rotate(90deg);
}

/* --- Sidebar: Custom scrollbar (thin, unobtrusive) --- */
.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 2px;
}
/* --- end Sidebar Layout --- */

/* ===== Splash (index.html) ===== */
.splash-hero__title {
  font-family: var(--font-cyber);
}

/* ===== Dev Test Panel (style.html, gated by ?dev=1) ===== */
#testPanel {
  display: none;
}

body.dev-mode #testPanel {
  display: block;
}

/* ===== Hero / Landing ===== */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 0.6rem;
}

.hero p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 2rem;
}

/* ===== Site Footer ===== */
.site-footer {
  background:
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(var(--neon-purple-rgb), 0.05) 39px, rgba(var(--neon-purple-rgb), 0.05) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(var(--neon-purple-rgb), 0.05) 39px, rgba(var(--neon-purple-rgb), 0.05) 40px),
    var(--bg-darker);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  padding: 1.5rem 0;
  margin-top: 3rem;
}

.site-footer p {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0;
}

/* ===== Nav Auth ===== */
.site-nav__auth {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.site-nav__user {
  font-size: 0.88rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.site-nav__logout {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-default);
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
}

.site-nav__logout:hover {
  background: var(--border-subtle);
  color: var(--text-body);
  border-color: var(--border-strong);
}

/* ===== Button Loading ===== */
.btn-loading {
  opacity: 0.6;
  cursor: wait;
  pointer-events: none;
  animation: btn-pulse 1.2s ease-in-out infinite;
}

@keyframes btn-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.4; }
}

/* ===== Modal Body ===== */
.modal-body {
  margin-bottom: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-body label {
  margin-bottom: 0.4rem;
}

.modal-body input[type="text"] {
  width: 100%;
  margin-top: 0.25rem;
}

.modal-body p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-dim);
  border: 1px dashed var(--border-subtle);
  border-radius: 8px;
  background: #1a1a30;
}

.empty-state__icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.6;
}

.empty-state__message {
  font-size: 0.9rem;
  color: var(--text-dimmer);
  line-height: 1.5;
  margin-bottom: 0;
}

/* ===== Responsive ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero {
    padding: 2rem 0 1.5rem;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .site-nav .container {
    flex-wrap: wrap;
    height: auto;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    gap: 0.5rem 1rem;
  }

  .site-nav__links {
    order: 3;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.25rem;
  }

  .site-nav__link {
    font-size: 0.82rem;
  }

  .site-nav__auth {
    order: 2;
  }

  .modal {
    width: 95%;
    padding: 1.25rem;
  }

  .toast-container {
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
  }

  .toast {
    text-align: center;
  }

  .saved-item {
    flex-wrap: wrap;
  }

  .saved-item__actions {
    width: 100%;
    justify-content: flex-end;
  }

  .action-bar {
    top: 60px;
    position: sticky;
    margin: 0 -1rem 1rem;
    padding: 0.5rem 0.75rem;
  }

  .save-bar {
    margin: 0 -1rem 1rem;
    padding: 0.5rem 0.75rem;
  }

  /* --- Sidebar: Responsive — stack vertically, show toggle --- */
  .page-with-sidebar {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    position: static;
    max-height: none;
  }
  .sidebar__toggle {
    display: block;
  }
  .sidebar.collapsed .sidebar__list,
  .sidebar.collapsed .sidebar__search,
  .sidebar.collapsed .sidebar__header {
    display: none;
  }
}
