:root {
  --bg-main: #050510;
  --bg-panel: #0b0b1a;
  --bg-panel-soft: #101025;
  --accent-1: #ffdd55;
  --accent-2: #7f5bff;
  --accent-3: #33e8ff;
  --accent-danger: #ff3366;
  --text-main: #f5f5ff;
  --text-soft: #c0c0dd;
  --border-soft: rgba(255, 255, 255, 0.12);
  --radius-lg: 18px;
  --radius-md: 10px;
  --shadow-soft: 0 0 45px rgba(0, 0, 0, 0.7);
  --shadow-strong: 0 0 80px rgba(0, 0, 0, 0.95);
  --transition-fast: 0.18s ease-out;
}

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

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1d1640 0, #050510 55%, #020206 100%);
  color: var(--text-main);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 16px;
  background: var(--accent-2);
  color: #0c0c18;
  padding: 10px 14px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  transition: top var(--transition-fast);
  z-index: 10;
}

.skip-link:focus-visible {
  top: 16px;
}

.app-shell {
  max-width: none;
  width: 100%;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #1e1038 0, #050510 48%, #020207 100%);
  border-radius: 0;
  box-shadow: var(--shadow-strong);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 18px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: -40%;
  pointer-events: none;
  opacity: 0.7;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08) 0, transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(127, 91, 255, 0.22) 0, transparent 55%),
    radial-gradient(circle at 15% 85%, rgba(51, 232, 255, 0.16) 0, transparent 50%);
  mix-blend-mode: screen;
  filter: blur(4px);
  z-index: 0;
}

.app-shell-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

header.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-pill {
  font-size: 0.8rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(120deg, rgba(255, 221, 85, 0.06), rgba(127, 91, 255, 0.15));
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
}

.brand-sub {
  font-size: 0.86rem;
  color: var(--text-soft);
}

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

.tag-badge {
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.tag-badge.primary {
  border-color: rgba(255, 221, 85, 0.8);
  color: #ffef99;
  background: radial-gradient(circle at 20% 0, rgba(255, 221, 85, 0.25), transparent 55%);
}

.language-select {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(5, 5, 20, 0.6);
  color: var(--text-soft);
  font-size: 0.78rem;
  padding: 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.main-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 420px;
}

.visualizer-panel {
  background: linear-gradient(145deg, rgba(10, 10, 30, 0.96), rgba(5, 5, 22, 0.98));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-soft);
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.visualizer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.visualizer-header h2 {
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.visualizer-header span.sub {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.theme-indicator {
  font-size: 0.8rem;
  color: var(--accent-3);
  opacity: 0.9;
}

.visualizer-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.view-size-select {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(5, 5, 20, 0.6);
  color: var(--text-soft);
  font-size: 0.78rem;
  padding: 5px 12px;
}

.visualizer-stage {
  position: relative;
  border-radius: 0;
  overflow: hidden;
  margin-top: 4px;
  flex: 0 0 auto;
  height: var(--visualizer-height, 72vh);
  min-height: 480px;
  background:
    radial-gradient(circle at top, rgba(127, 91, 255, 0.35), transparent 55%),
    radial-gradient(circle at bottom, rgba(51, 232, 255, 0.12), transparent 55%),
    #050512;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.55);
  width: calc(100% + 28px);
  margin-left: -14px;
}

.visualizer-stage.size-full { --visualizer-height: 78vh; }
.visualizer-stage.size-half { --visualizer-height: 64vh; }
.visualizer-stage.size-quarter { --visualizer-height: 54vh; }
.visualizer-stage.size-small { --visualizer-height: 44vh; }

#visualizerCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

.bg-image-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.48;
  mix-blend-mode: screen;
  z-index: 0;
}

.bg-image-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.15) contrast(1.05) brightness(0.95);
}

.lyrics-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  padding: 0 20px;
  text-align: center;
  pointer-events: none;
  text-shadow:
    0 0 14px rgba(0, 0, 0, 0.9),
    0 0 26px rgba(0, 0, 0, 0.9);
  z-index: 2;
}

.lyrics-line-current {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fffaf1;
  padding: 5px 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, rgba(255, 221, 85, 0.96), rgba(255, 131, 65, 0.9));
  box-shadow:
    0 0 20px rgba(255, 221, 85, 0.75),
    0 0 60px rgba(255, 131, 65, 0.7);
  white-space: pre-wrap;
  max-width: 100%;
}

.lyrics-line-next {
  margin-top: 6px;
  font-size: 0.82rem;
  color: rgba(245, 245, 255, 0.78);
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
  margin-top: 4px;
  color: var(--text-soft);
}

.status-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff3366;
  box-shadow: 0 0 12px rgba(255, 51, 102, 0.6);
}

.status-dot.playing {
  background: #33ff99;
  box-shadow: 0 0 12px rgba(51, 255, 153, 0.7);
}

.status-chip {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(5, 5, 30, 0.9);
}

.controls-panel {
  background: radial-gradient(circle at top right, #1a1630 0, #080817 58%, #050510 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-soft);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.controls-panel h2 {
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.control-label {
  font-size: 0.85rem;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.control-label span.hint {
  font-size: 0.75rem;
  color: rgba(192, 192, 221, 0.75);
}

.file-input-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.file-input-wrapper input[type="file"] {
  display: none;
}

.control-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button {
  appearance: none;
  border: none;
  outline: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  background: radial-gradient(circle at top left, #ffdd55 0, #ff8135 38%, #ff3366 100%);
  color: #140814;
  box-shadow:
    0 0 10px rgba(255, 221, 85, 0.75),
    0 0 26px rgba(255, 99, 71, 0.9);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
  white-space: nowrap;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.05);
  box-shadow:
    0 0 18px rgba(255, 221, 85, 0.9),
    0 0 38px rgba(255, 99, 71, 0.95);
}

.button.secondary {
  background: linear-gradient(135deg, rgba(127, 91, 255, 0.16), rgba(21, 197, 255, 0.18));
  color: #f5f5ff;
  border: 1px solid rgba(127, 191, 255, 0.8);
  box-shadow: 0 0 16px rgba(127, 159, 255, 0.45);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  box-shadow: 0 0 24px rgba(127, 191, 255, 0.85);
}

.button.icon-only {
  padding-inline: 10px;
}

select,
textarea,
input[type="text"],
input[type="number"] {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(6, 6, 28, 0.92);
  color: var(--text-main);
  padding: 7px 10px;
  font-size: 0.84rem;
  outline: none;
  box-shadow: inset 0 0 0 rgba(0, 0, 0, 0);
  transition: border-color 0.16s ease-out, box-shadow 0.16s ease-out, background 0.16s ease-out;
}

select:focus-visible,
textarea:focus-visible,
input[type="text"]:focus-visible,
input[type="number"]:focus-visible {
  border-color: rgba(255, 221, 85, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 221, 85, 0.5);
  background: rgba(9, 9, 35, 0.98);
}

textarea {
  resize: vertical;
  min-height: 90px;
  max-height: 200px;
  line-height: 1.4;
}

.split-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 8px;
}

@media (max-width: 600px) {
  .split-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.small-text {
  font-size: 0.75rem;
  color: rgba(192, 192, 221, 0.78);
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.mini-chip {
  font-size: 0.73rem;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-soft);
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-soft);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 12px;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-link {
  color: var(--accent-1);
  text-decoration: none;
}

.footer-link:focus-visible,
.footer-link:hover {
  text-decoration: underline;
}

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