:root {
  --bg0: #070b14;
  --bg1: #10182a;
  --card: rgba(220, 235, 255, 0.05);
  --panel: rgba(14, 22, 38, 0.94);
  --stroke: rgba(170, 210, 255, 0.14);
  --text: #eef5ff;
  --muted: #93a6c4;
  --accent: #3de0c5;
  --accent-2: #4aa8ff;
  --accent-deep: #1fb89f;
  --danger: #ff8f7a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  --radius: 22px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Outfit", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font-body);
  background: var(--bg0);
}
body { padding: 0 0 40px; }

.glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 8% -8%, rgba(61, 224, 197, 0.22), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(74, 168, 255, 0.2), transparent 50%),
    linear-gradient(180deg, #0b1220 0%, #070b14 45%, #0c1424 100%);
}
.glow::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 75%);
  opacity: 0.3;
  pointer-events: none;
}

.shell {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 18px 16px 0;
  animation: rise 0.55s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulse-cta {
  0%, 100% { box-shadow: 0 12px 30px rgba(61, 224, 197, 0.22); }
  50% { box-shadow: 0 14px 36px rgba(74, 168, 255, 0.36); }
}
@keyframes preview-in {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: none; }
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}
.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.7rem;
  letter-spacing: -0.04em;
  background: linear-gradient(120deg, #ffffff 10%, var(--accent) 55%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sub { color: var(--muted); font-size: 0.86rem; margin-top: 2px; }
.head-actions { display: flex; gap: 8px; align-items: center; }
.pill-soft, .hist-toggle {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(61, 224, 197, 0.12);
  border: 1px solid rgba(61, 224, 197, 0.3);
  color: var(--accent);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.hist-toggle.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #061018;
  border-color: transparent;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.section-title {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  font-weight: 700;
  margin-bottom: 10px;
}

.chips { display: flex; gap: 8px; }
.chips.wrap { flex-wrap: wrap; }
.chip {
  border: 1px solid transparent;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.chip.active {
  background: linear-gradient(135deg, rgba(61,224,197,0.28), rgba(74,168,255,0.22));
  border-color: rgba(61,224,197,0.45);
  color: #f0fbff;
}
.chip.gold {
  width: 100%;
  background: linear-gradient(90deg, rgba(74,168,255,0.16), rgba(61,224,197,0.14));
  border-color: rgba(61,224,197,0.22);
}
.chip.gold.active {
  border-color: rgba(74,168,255,0.55);
  color: #061018;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.banner-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.banner-btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.08);
  background: #0a101c;
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 16 / 9;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.banner-btn:active { transform: scale(0.97); }
.banner-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.95;
}
.banner-btn span {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(0,0,0,0.55);
  padding: 3px 7px;
  border-radius: 999px;
}
.banner-btn .sound-dot {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(61,224,197,0.7);
}
.banner-btn.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(61,224,197,0.5), 0 8px 20px rgba(74,168,255,0.18);
}
.banner-btn.active span {
  background: var(--accent);
  color: #061018;
}

.banner-preview-wrap {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #05080f;
  min-height: 180px;
  border: 1px solid rgba(61,224,197,0.22);
  animation: preview-in 0.35s ease both;
  box-shadow: 0 10px 28px rgba(0,0,0,0.28);
}
.banner-preview {
  width: 100%;
  display: block;
  max-height: 260px;
  min-height: 160px;
  object-fit: contain;
  background: #05080f;
}
.banner-preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.banner-preview-empty.hidden { display: none; }
.sound-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(6, 12, 22, 0.78);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.sound-btn[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #061018;
  border-color: transparent;
}

.field {
  width: 100%;
  border: 1px solid rgba(170,210,255,0.16);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  outline: none;
}
.field:focus { border-color: rgba(61,224,197,0.5); }
.split {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 10px 0;
}
.file-chip {
  display: block;
  text-align: center;
  border: 1px dashed rgba(61,224,197,0.35);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
  background: rgba(61,224,197,0.05);
}
.file-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  word-break: break-all;
}

.btn-gold, .btn-navy, .btn-ghost {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 15px;
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  margin: 4px 0 10px;
}
.btn-gold {
  color: #061018;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 30px rgba(61, 224, 197, 0.22);
  animation: pulse-cta 2.4s ease-in-out infinite;
}
.btn-gold:disabled {
  opacity: 0.55;
  cursor: wait;
  animation: none;
}
.btn-navy {
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border: 1px solid rgba(61,224,197,0.24);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--stroke);
}

.status { font-weight: 700; margin-bottom: 8px; }
.track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.track-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .35s ease;
}
.hint { color: var(--muted); font-size: 0.82rem; margin: 10px 0 0; }

.player-frame {
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(61,224,197,0.22);
  margin-bottom: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}
.player {
  width: 100%;
  display: block;
  max-height: 520px;
  min-height: 220px;
  background: #000;
  object-fit: contain;
}
.meta {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 10px;
  line-height: 1.4;
}
.audio-box { margin-top: 8px; }
.file-chip.slim { margin-top: 8px; }

.history-list { display: grid; gap: 10px; }
.history-empty {
  color: var(--muted);
  text-align: center;
  padding: 18px 8px;
  font-size: 0.92rem;
}
.history-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(170,210,255,0.1);
}
.history-item img, .history-thumb {
  width: 72px;
  height: 96px;
  object-fit: cover;
  border-radius: 12px;
  background: #0a101c;
  display: block;
}
.history-thumb.fallback {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 800;
  font-size: 0.75rem;
}
.history-info { min-width: 0; }
.history-title {
  font-weight: 800;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-meta {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 4px;
  line-height: 1.35;
}
.history-actions { display: grid; gap: 6px; }
.history-actions button {
  border: 0;
  border-radius: 12px;
  padding: 8px 10px;
  font: inherit;
  font-weight: 800;
  font-size: 0.72rem;
  cursor: pointer;
  white-space: nowrap;
}
.history-actions .go {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #061018;
}
.history-actions .del {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--stroke);
}

.hidden { display: none !important; }

.err {
  color: var(--danger);
  font-size: 0.86rem;
  margin-top: 8px;
}

@media (max-width: 400px) {
  .banner-grid { grid-template-columns: 1fr; }
  .history-item { grid-template-columns: 64px 1fr; }
  .history-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
}
