:root {
  color-scheme: dark;
  --bg: #0a0d20;
  --panel: #151a38;
  --panel-2: #1c2248;
  --text: #f7f7ff;
  --muted: #a9b0d0;
  --accent: #ff4f91;
  --accent-2: #8c67ff;
  --success: #45d6a1;
  --danger: #ff7b86;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(140, 103, 255, 0.26), transparent 34rem),
    radial-gradient(circle at 90% 30%, rgba(255, 79, 145, 0.18), transparent 30rem),
    var(--bg);
}

button,
input {
  font: inherit;
}

button,
a,
summary,
label {
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: min(100%, 680px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.header {
  text-align: center;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.header h1 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 3.6rem);
  line-height: 1;
}

.header > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
}

main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-card {
  min-height: 340px;
  padding: 24px 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(28, 34, 72, 0.96), rgba(16, 20, 46, 0.98));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.timer {
  --progress: 1;
  width: 86px;
  height: 86px;
  padding: 6px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--progress) * 1turn), rgba(255, 255, 255, 0.09) 0);
  display: grid;
  place-items: center;
  transition: background 0.3s linear;
}

.timer::before {
  content: "";
  grid-area: 1 / 1;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--panel);
}

.timer span {
  z-index: 1;
  grid-area: 1 / 1;
  font-size: 1.8rem;
  font-weight: 900;
}

.timer.finished {
  background: var(--success);
}

.round-label,
.answer-label {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lyrics {
  margin: 14px 0 0;
  max-width: 560px;
  white-space: pre-line;
  font-size: clamp(1.25rem, 5vw, 1.75rem);
  font-weight: 720;
  line-height: 1.45;
}

.answer {
  width: 100%;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.answer h2 {
  margin: 8px 0 4px;
  font-size: clamp(1.5rem, 6vw, 2.25rem);
}

.answer p {
  margin: 0;
  color: var(--muted);
}

.youtube-link {
  display: inline-flex;
  margin-top: 16px;
  padding: 11px 16px;
  border-radius: 999px;
  color: white;
  background: #ff0033;
  font-weight: 800;
  text-decoration: none;
}

.controls {
  display: grid;
  gap: 10px;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 18px;
  color: white;
  font-weight: 850;
  cursor: pointer;
}

.primary-button {
  font-size: 1.15rem;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 28px rgba(255, 79, 145, 0.22);
}

.secondary-button {
  background: var(--panel-2);
}

.primary-button:active,
.secondary-button:active,
.file-button:active {
  transform: scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
}

.settings {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: rgba(21, 26, 56, 0.76);
  overflow: hidden;
}

.settings > summary {
  padding: 16px 18px;
  cursor: pointer;
  font-weight: 850;
}

.settings-body {
  padding: 0 18px 18px;
  display: grid;
  gap: 22px;
}

.import-panel,
.filter-section {
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.import-panel h2,
.filter-section h2 {
  margin: 0;
  font-size: 1rem;
}

.import-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

code {
  color: #e7dcff;
}

.import-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.file-button {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--accent-2);
  font-weight: 800;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.text-button {
  border: 0;
  padding: 0;
  color: #c9baff;
  background: none;
  font-weight: 750;
  text-decoration: underline;
  cursor: pointer;
}

.text-button.danger {
  color: var(--danger);
}

.import-message {
  min-height: 1.2em;
}

.chips {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.chip input {
  accent-color: var(--accent);
}

.empty-filter {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

footer {
  margin-top: auto;
  color: var(--muted);
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.45;
}

@media (min-width: 560px) {
  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .quiz-card {
    min-height: 390px;
    padding: 32px;
  }
}

@media (max-height: 720px) {
  .app {
    gap: 14px;
    padding-top: 12px;
  }

  .header > p:last-child,
  footer {
    display: none;
  }

  .quiz-card {
    min-height: 280px;
    padding: 18px;
  }

  .timer {
    width: 70px;
    height: 70px;
  }

  .timer::before {
    width: 58px;
    height: 58px;
  }

  .timer span {
    font-size: 1.45rem;
  }
}
