/* ============================================================
   Matilda Design System — Dark, premium, editorial
   ============================================================ */

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

[hidden] {
  display: none !important;
}

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface-2: #161616;
  --border: #222222;
  --border-2: #2e2e2e;
  --text: #ffffff;
  --text-secondary: #999999;
  --accent: #e8a045;
  --link: #3b82f6;
  --radius-sm: 8px;
  --radius: 14px;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', system-ui, sans-serif;
  --max-width: 760px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  background: #000;
}

body {
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Universe background ── */
#nebula-canvas {
  position: fixed;
  top: 0; left: 0;
  z-index: 0;
  opacity: 0.4;
  pointer-events: none;
}

#star-canvas {
  position: fixed;
  top: 0; left: 0;
  z-index: 1;
  pointer-events: none;
}

.vignette {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,10,0.7) 100%);
}

.site-header, main.container, .site-footer {
  position: relative;
  z-index: 10;
}

/* ── Layout ── */
.container {
  width: 100%;
  padding: 0 100px;
}

main.container {
  flex: 1;
  padding-top: 32px;
  padding-bottom: 40px;
}

/* ── Header ── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

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

.song-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, transform 0.15s ease;
  flex-shrink: 0;
}

.header-icon-btn:hover {
  border-color: #999;
  background: #999;
  color: var(--text);
}

.header-icon-btn:active {
  transform: scale(0.9);
}

.header-icon-btn:hover .header-sound-icon {
  content: url('/static/icons/sound-hover.svg');
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Hero ── */
.hero {
  padding: 28px 0 24px;
  text-align: left;
  max-width: 432px;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 20px;
}

.accent {
  color: var(--accent);
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 520px;
  line-height: 1.7;
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 28px;
  max-width: 432px;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 432px;
}

.card--center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.card--error {
  border-color: #3d1a1a;
  background: #130d0d;
}

/* ── Drop zone ── */
.drop-zone {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius-sm);
  padding: 28px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(232, 160, 69, 0.04);
}

.drop-zone.has-file {
  border-color: #3a3a3a;
  background: var(--surface-2);
}

.drop-zone__icon {
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.drop-zone__text {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 500;
}

.drop-zone__hint {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.link-text {
  color: var(--link);
  text-decoration: underline;
  cursor: pointer;
}

.file-name {
  font-size: 0.82rem;
  color: var(--accent);
  margin-top: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ── Toggle group ── */
.toggle-group {
  display: flex;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.toggle-btn {
  flex: 1;
  padding: 9px 14px;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: none;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-right: 1px solid var(--border-2);
}

.toggle-btn:last-child {
  border-right: none;
}

.toggle-btn--active {
  background: var(--accent);
  color: #000;
  font-weight: 600;
}

.toggle-btn:not(.toggle-btn--active):hover {
  background: #1e1e1e;
  color: var(--text);
}


/* ── Options grid ── */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

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

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.select {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 10px 14px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Checkboxes ── */
.checkboxes {
  gap: 14px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkbox-box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-2);
  border-radius: 4px;
  background: var(--surface-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}

.checkbox-label input:checked + .checkbox-box {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-label input:checked + .checkbox-box::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid #000;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* ── Experimental tag ── */
.tag-experimental {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(232, 160, 69, 0.12);
  border: 1px solid rgba(232, 160, 69, 0.25);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  letter-spacing: 0.03em;
}

.tag-warning {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(232, 160, 69, 0.12);
  border: 1px solid rgba(232, 160, 69, 0.25);
  border-radius: 4px;
  padding: 4px 8px;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ── Info tooltip ── */
.info-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
}

.info-icon {
  width: 16px;
  height: 16px;
  cursor: help;
  flex-shrink: 0;
  user-select: none;
  vertical-align: middle;
}

.info-tooltip:hover .info-icon {
  content: url('/static/icons/info-hover.svg');
}

.info-tooltip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e1e;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.78rem;
  font-style: normal;
  color: var(--text);
  white-space: normal;
  width: 220px;
  z-index: 20;
  line-height: 1.5;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.info-tooltip:hover .info-tooltip-text {
  display: block;
}

/* ── Warning note ── */
.warning-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 0.78rem;
  color: #f5c542;
  line-height: 1.45;
}
.warning-note img {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  text-decoration: none;
  padding: 12px 28px;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--text);
  color: #000;
  border-color: var(--text);
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.88;
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-2);
  width: 100%;
  max-width: 240px;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: #555;
}

/* ── Progress ── */
.status-message {
  font-size: 0.95rem;
  color: var(--text);
  min-height: 1.4em;
}

.progress-track {
  width: 100%;
  height: 4px;
  background: var(--border-2);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.4s ease;
  will-change: width;
}

.progress-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ── Complete ── */
.complete-icon { margin-bottom: 4px; }

.complete-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
}

.output-list {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.output-list li {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: left;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Error ── */
.error-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: #e05555;
}

.error-message {
  font-size: 0.88rem;
  color: var(--text-secondary);
  max-width: 480px;
  line-height: 1.6;
}

/* ── Form error ── */
.form-error {
  color: #e05555;
  font-size: 0.84rem;
  margin-bottom: 16px;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 12px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-right: 20px;
  border-right: 1px solid var(--border-2);
}

.footer-brand svg {
  color: var(--accent);
}

.footer-logo {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  padding: 0 20px;
  align-self: stretch;
  display: flex;
  align-items: center;
}

.footer-copy {
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding-left: 20px;
}

/* ── Coming Soon Overlay ── */
.coming-soon-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.45);
}

.coming-soon-content {
  text-align: center;
  max-width: 560px;
  padding: 0 24px;
}

.coming-soon-title {
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 6vw, 4.2rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 20px;
}

.coming-soon-desc {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
