/* Songless Unlimited: an unofficial recreation of Songless with instant resets. */

:root {
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-heading: 'Clash Display', 'DM Sans', system-ui, sans-serif;
  --font-poppins: 'Poppins', 'DM Sans', system-ui, sans-serif;

  --black: #161819;
  --white: #ececec;
  --max: #141415;
  --gray-50: #e7e7e7;
  --gray-100: #e2e2e2;
  --gray-200: #c9cdcf;
  --gray-300: #aeb4b7;
  --gray-400: #939b9f;
  --gray-500: #696e72;
  --gray-600: #55595c;
  --gray-700: #424548;
  --gray-800: #303436;
  --gray-900: #27282a;
  --gray-950: #1e2021;
  --green: #55b725;
  --red: #c62121;
  --yellow: #dac316;
  --blue: #3a8dca;
  --orange: #e67e22;
  --deezer: #a238ff;

  --correct: var(--green);
  --present: var(--yellow);
  --incorrect: var(--red);

  --row-h: clamp(2.5rem, 5vh, 3rem);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
}

html[data-colorblind='true'] {
  --correct: var(--blue);
  --present: var(--orange);
}

html,
html.dark {
  color-scheme: dark;
  --bg: var(--black);
  --fg: var(--white);
  --fg-muted: var(--gray-400);
  --fg-subtle: var(--gray-500);
  --fg-inverted: var(--black);
  --bg-muted: var(--gray-900);
  --bg-subtle: var(--gray-950);
  --bg-emphasized: var(--gray-800);
  --bg-panel: var(--gray-950);
  --bg-inverted: var(--white);
  --bg-recessed: var(--max);
  --border: var(--gray-800);
  --border-emphasized: var(--gray-700);
  --gray-solid: var(--white);
  --gray-contrast: var(--black);
  --gray-fg: var(--gray-200);
  --gray-muted: var(--gray-800);
  --gray-subtle: var(--gray-900);
  --gray-emphasized: var(--gray-700);
  --focus: var(--gray-400);
  --backdrop: rgba(0, 0, 0, 0.36);
  --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.64), inset 0 0 1px color-mix(in srgb, var(--gray-300) 20%, transparent);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.64), inset 0 0 1px color-mix(in srgb, var(--gray-300) 30%, transparent);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.64), inset 0 0 1px color-mix(in srgb, var(--gray-300) 30%, transparent);
}

html.light {
  color-scheme: light;
  --bg: var(--white);
  --fg: var(--black);
  --fg-muted: var(--gray-600);
  --fg-subtle: var(--gray-400);
  --fg-inverted: var(--gray-50);
  --bg-muted: var(--gray-100);
  --bg-subtle: var(--gray-50);
  --bg-emphasized: var(--gray-200);
  --bg-panel: var(--white);
  --bg-inverted: var(--black);
  --bg-recessed: var(--white);
  --border: var(--gray-200);
  --border-emphasized: var(--gray-300);
  --gray-solid: var(--gray-900);
  --gray-contrast: var(--white);
  --gray-fg: var(--gray-800);
  --gray-muted: var(--gray-200);
  --gray-subtle: var(--gray-100);
  --gray-emphasized: var(--gray-300);
  --focus: var(--gray-500);
  --backdrop: rgba(0, 0, 0, 0.36);
  --shadow-xs: 0 1px 2px color-mix(in srgb, var(--gray-900) 10%, transparent), 0 0 1px color-mix(in srgb, var(--gray-900) 20%, transparent);
  --shadow-sm: 0 2px 4px color-mix(in srgb, var(--gray-900) 10%, transparent), 0 0 1px color-mix(in srgb, var(--gray-900) 30%, transparent);
  --shadow-lg: 0 8px 16px color-mix(in srgb, var(--gray-900) 10%, transparent), 0 0 1px color-mix(in srgb, var(--gray-900) 30%, transparent);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

svg {
  display: block;
  flex-shrink: 0;
}

[hidden] {
  display: none !important;
}

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

html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* ---------- Layout ---------- */

.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 32px;
}

.container {
  width: 100%;
  margin-inline: auto;
  padding-inline: 16px;
}

.w-lg {
  max-width: 32rem;
}

.w-2xl {
  max-width: 42rem;
}

.w-3xl {
  max-width: 48rem;
}

@media (min-width: 768px) {
  .container {
    padding-inline: 24px;
  }
}

@media (min-width: 1024px) {
  .container {
    padding-inline: 32px;
  }
}

/* ---------- Header ---------- */

.header {
  max-width: 1536px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-block: 12px;
}

.header-left {
  flex: 0 0 auto;
}

.header-center {
  position: relative;
  text-align: center;
  min-width: 0;
}

.header-right {
  flex: 1 1 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 24px;
  line-height: 1;
  white-space: nowrap;
  cursor: default;
}

.subtitle {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin: -2px 0 0;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--fg-muted);
  font-size: 16px;
  line-height: 1;
  white-space: nowrap;
}

@media (min-width: 480px) {
  .header {
    padding-block: 8px;
  }
  .title {
    font-size: 36px;
    letter-spacing: -0.025em;
  }
  .subtitle {
    font-size: 18px;
  }
}

@media (min-width: 768px) {
  .header-left {
    flex: 1 1 0;
  }
  .title {
    font-size: 48px;
  }
  .subtitle {
    font-size: 20px;
  }
}

@media (min-width: 1024px) {
  .title {
    font-size: 72px;
  }
  .subtitle {
    font-size: 30px;
    margin-top: -3px;
  }
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 9999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--gray-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  background: var(--gray-subtle);
}

.icon-btn.outline {
  border-color: var(--border);
}

.icon-btn.outline.strong {
  border-color: var(--gray-emphasized);
}

.icon-btn.active {
  background: var(--gray-muted);
}

.icon-btn.avatar-btn {
  background: var(--gray-muted);
  border-color: var(--fg-subtle);
}

.icon-btn.avatar-btn:hover {
  background: var(--gray-emphasized);
}

@media (min-width: 768px) {
  .icon-btn.hdr {
    width: 48px;
    height: 48px;
  }
  .icon-btn.hdr svg {
    width: 20px;
    height: 20px;
  }
}

.text-btn {
  border: 0;
  background: none;
  padding: 0;
  font-family: var(--font-poppins);
  font-weight: 500;
  font-size: 14px;
  color: var(--fg-muted);
  white-space: nowrap;
  transition: color 0.2s ease;
}

.text-btn:hover {
  color: var(--fg);
}

@media (min-width: 768px) {
  .text-btn {
    font-size: 16px;
    padding: 4px;
  }
}

.hide-below-md {
  display: none !important;
}

@media (min-width: 768px) {
  .hide-below-md {
    display: inline-flex !important;
  }
  .hide-from-md {
    display: none !important;
  }
}

/* ---------- Category tabs ---------- */

.tabs-wrap {
  margin-bottom: 8px;
}

.tabs {
  display: flex;
  height: var(--row-h);
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  white-space: nowrap;
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-muted);
  font-size: clamp(0.75rem, 1.5vh, 0.875rem);
  font-weight: 500;
  line-height: 20px;
  padding: 0 16px;
  transition: color 0.15s, background-color 0.15s;
}

.tab:hover:not(:disabled) {
  color: var(--fg);
}

.tab[aria-selected='true'] {
  background: var(--bg);
  color: var(--gray-fg);
  box-shadow: var(--shadow-xs);
}

.tab:disabled {
  opacity: 0.5;
}

/* ---------- Board ---------- */

.board {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row {
  position: relative;
  height: var(--row-h);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  text-align: center;
  min-width: 0;
}

.row[data-state='correct'],
.row[data-state='present'],
.row[data-state='incorrect'],
.row[data-state='skipped'] {
  border-width: 0;
}

.row[data-state='correct'] {
  background: var(--correct);
}

.row[data-state='present'] {
  background: var(--present);
  color: var(--black);
}

.row[data-state='incorrect'] {
  background: var(--incorrect);
}

.row[data-state='skipped'] {
  background: var(--gray-muted);
}

.row-text {
  margin: 0;
  padding: 0 8px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 16px;
  line-height: 24px;
}

.row-text b {
  font-weight: 600;
}

@media (min-width: 480px) {
  .row-text {
    font-size: 18px;
    line-height: 27px;
  }
}

@media (min-width: 768px) {
  .row-text {
    font-size: 20px;
    line-height: 30px;
  }
}

/* ---------- Snippet player ---------- */

.player-wrap {
  padding-block: 12px;
}

@media (min-width: 768px) {
  .player-wrap {
    padding-block: 32px;
  }
}

.player {
  width: 97.5%;
  margin-inline: auto;
}

@media (min-width: 1024px) {
  .player {
    width: 100%;
  }
}

.bar {
  display: flex;
  gap: 2px;
  width: 100%;
  margin-top: 40px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .bar {
    margin-bottom: 32px;
  }
}

.seg {
  position: relative;
  flex: 0 1 auto;
  height: 24px;
  background: var(--gray-muted);
}

.seg:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.seg:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.bar.disabled .seg {
  background: var(--gray-subtle);
}

.seg-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}

.seg-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--bg-inverted);
}

.bar.won .seg-fill {
  background: var(--correct);
}

.marker {
  position: absolute;
  right: 0;
  top: 0;
  transform: translate(50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  white-space: nowrap;
  pointer-events: none;
}

.marker-text {
  margin: 0;
  width: 192px;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 500;
  line-height: 27px;
}

.marker svg {
  width: 20px;
  height: 20px;
  margin-top: -4px;
}

.play-wrap {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-btn {
  width: 64px;
  height: 64px;
  border-radius: 9999px;
  border: 0;
  background: var(--green);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s, opacity 0.15s;
}

.play-btn svg {
  width: 24px;
  height: 24px;
}

.play-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--green) 90%, transparent);
}

.play-btn:disabled {
  opacity: 0.5;
}

.play-btn .spinner {
  width: 24px;
  height: 24px;
  border-width: 3px;
  border-color: rgba(255, 255, 255, 0.9);
  border-right-color: transparent;
}

/* ---------- Buttons ---------- */

.btn {
  height: var(--row-h);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
  transition: background-color 0.15s, opacity 0.15s, border-color 0.15s;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:disabled {
  opacity: 0.5;
}

.btn.green {
  background: var(--green);
  color: #fff;
}

.btn.green:hover:not(:disabled) {
  background: color-mix(in srgb, var(--green) 90%, transparent);
}

.btn.gray {
  background: var(--gray-solid);
  color: var(--gray-contrast);
}

.btn.gray:hover:not(:disabled) {
  background: color-mix(in srgb, var(--gray-solid) 90%, transparent);
}

.btn.outline {
  background: transparent;
  border-color: var(--border);
  color: var(--gray-fg);
}

.btn.outline:hover:not(:disabled) {
  background: var(--bg-emphasized);
}

.btn.subtle {
  background: var(--gray-subtle);
  color: var(--gray-fg);
}

.btn.subtle:hover:not(:disabled) {
  background: var(--gray-muted);
}

.btn.red {
  background: var(--red);
  color: #fff;
}

.btn.lg {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 500;
}

/* ---------- Guess input ---------- */

.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-box {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  padding-inline: 12px;
  display: flex;
  align-items: center;
  color: var(--fg-muted);
  pointer-events: none;
}

.input-icon svg {
  width: 16px;
  height: 16px;
}

.search-input {
  width: 100%;
  height: var(--row-h);
  padding: 0 42px 0 36px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--bg-muted);
  color: var(--fg);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.05em;
  outline: 0;
  transition: border-color 0.15s;
}

.search-input:focus-visible,
.search-input:focus {
  border-color: var(--focus);
  outline: 1px solid var(--focus);
  outline-offset: 0;
}

.search-input::placeholder {
  color: color-mix(in srgb, var(--fg-muted) 80%, transparent);
}

.search-input:disabled {
  opacity: 0.5;
}

.input-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  color: var(--gray-fg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-clear:hover {
  background: var(--gray-subtle);
}

.input-clear svg {
  width: 16px;
  height: 16px;
}

.guess-btn {
  flex: 0 0 auto;
  width: 96px;
}

@media (min-width: 768px) {
  .input-icon svg {
    width: 20px;
    height: 20px;
  }
  .search-input {
    font-size: 18px;
    padding-left: 48px;
  }
  .guess-btn {
    width: 112px;
  }
}

.results {
  position: absolute;
  left: 0;
  width: calc(100vw - 32px);
  top: -8px;
  transform: translateY(-100%);
  max-height: 18rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 100ms ease-in;
}

.results.open {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 100ms ease-out;
}

.results:empty {
  display: none;
}

@media (min-width: 480px) {
  .results {
    max-height: 24rem;
  }
}

@media (min-width: 768px) {
  .results {
    width: 100%;
  }
}

.result {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  text-align: left;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
}

.result:last-child {
  border-bottom: 0;
}

.result:hover,
.result.active {
  background: var(--bg-muted);
}

.result b {
  font-weight: 600;
}

.result-empty {
  padding: 12px 16px;
  color: var(--fg-muted);
  font-size: 15px;
}

@media (min-width: 768px) {
  .result {
    font-size: 18px;
    line-height: 28px;
  }
}

/* ---------- Finished round ---------- */

.end-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 28rem;
  margin-inline: auto;
  padding-inline: 16px;
}

.end-actions .btn {
  flex: 1 1 0;
}

.after {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.after-block {
  width: 100%;
  max-width: 32rem;
  margin-inline: auto;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.caps {
  font-family: var(--font-poppins);
  font-size: 14px;
  font-weight: 500;
  line-height: 21px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0;
}

.caps.subtle {
  color: var(--fg-subtle);
}

.caps .clock {
  color: var(--fg-muted);
  margin-left: 12px;
  font-variant-numeric: tabular-nums;
}

.strip {
  display: flex;
  gap: 6px;
  align-items: center;
}

.cal-tile {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: var(--radius-lg);
  border: 0;
  background: var(--gray-muted);
  color: var(--fg-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.cal-tile svg {
  width: 14px;
  height: 14px;
}

.cal-tile:hover {
  background: var(--gray-emphasized);
}

.dot {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 9999px;
  border: 0;
  background: var(--gray-muted);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 16px;
}

.dot.won {
  background: var(--correct);
  color: #fff;
}

.dot.lost {
  background: var(--incorrect);
  color: #fff;
}

.new-song {
  flex: 1 1 auto;
  height: 48px;
  border-radius: 9999px;
  border: 0;
  background: var(--green);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 18px;
  transition: background-color 0.15s, transform 0.15s;
}

.new-song svg {
  width: 20px;
  height: 20px;
}

.new-song:hover {
  background: color-mix(in srgb, var(--green) 90%, transparent);
}

.new-song:active {
  transform: scale(0.98);
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.card-btn {
  height: 64px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--gray-subtle);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.1;
  transition: background-color 0.15s, border-color 0.15s;
}

.card-btn small {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  color: var(--fg-muted);
}

.card-btn:hover {
  background: var(--gray-muted);
  border-color: var(--border-emphasized);
}

.footer-note {
  margin: 24px auto 0;
  max-width: 32rem;
  text-align: center;
  font-size: 12px;
  line-height: 18px;
  color: var(--fg-subtle);
}

.footer-note a {
  color: inherit;
}

/* ---------- Dialogs ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  overflow-y: auto;
  animation: fade-in 150ms ease-out;
}

.backdrop.closing {
  animation: fade-out 120ms ease-in forwards;
}

.dialog {
  position: relative;
  width: 100%;
  max-width: 28rem;
  margin: auto;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  color: var(--fg);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  line-height: 20px;
  animation: scale-in 150ms ease-out;
}

.backdrop.closing .dialog {
  animation: scale-out 120ms ease-in forwards;
}

.dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--gray-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.dialog-close:hover {
  background: var(--gray-subtle);
}

.dialog-close svg {
  width: 16px;
  height: 16px;
}

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

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

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

@keyframes scale-out {
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

/* How to play */

.htp {
  max-width: 423px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--bg-emphasized);
  background: var(--bg-subtle);
  box-shadow: none;
  padding: 16px 24px 8px;
}

.htp-title {
  margin: 8px 0 0;
  padding-top: 16px;
  font-family: var(--font-poppins);
  font-weight: 500;
  font-size: 36px;
  line-height: 28px;
  text-align: center;
}

.htp-body {
  padding: 24px 0 16px;
}

.htp-desc {
  margin: 0;
  font-family: var(--font-poppins);
  font-size: 16px;
  line-height: 20px;
  color: var(--fg-muted);
  text-align: center;
}

.htp-panel {
  margin-top: 16px;
  border-radius: var(--radius-2xl);
  background: var(--bg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: var(--font-poppins);
  font-weight: 500;
  font-size: 15px;
  color: var(--gray-fg);
}

.htp-bar {
  display: flex;
  gap: 4px;
  height: 32px;
}

.htp-bar span {
  border-radius: var(--radius-sm);
  background: var(--gray-muted);
}

.htp-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.htp-play {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.htp-play svg {
  width: 14px;
  height: 14px;
  margin-left: 2px;
}

.htp-next {
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  background: var(--gray-solid);
  color: var(--gray-contrast);
  display: flex;
  align-items: center;
  font-size: 17px;
  flex: 0 0 auto;
}

.htp-rule {
  height: 1px;
  background: var(--border-emphasized);
  margin: 4px 0;
}

.htp-swatch {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  flex: 0 0 auto;
}

.htp-footer {
  margin: 16px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--fg-muted);
}

.htp-footer b {
  color: var(--fg);
  font-weight: 600;
}

/* Results */

.results-dialog {
  overflow: hidden;
}

.rd-header {
  position: relative;
  padding: 16px 24px;
  display: flex;
  justify-content: center;
  background: var(--incorrect);
}

.rd-header.won {
  background: var(--correct);
}

.rd-title {
  margin: 0;
  color: var(--white);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 30px;
  line-height: 28px;
  letter-spacing: -0.025em;
}

.rd-x {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rd-x svg {
  width: 20px;
  height: 20px;
}

@media (min-width: 480px) {
  .rd-x {
    display: none;
  }
}

.rd-body {
  padding: 16px 24px;
}

@media (min-width: 480px) {
  .rd-body {
    padding-block: 24px;
  }
}

.reveal {
  margin: 0 0 12px;
  text-align: center;
}

.reveal dt {
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.reveal dd {
  margin: 4px 0 0;
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 500;
  line-height: 32px;
  letter-spacing: -0.025em;
}

.stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.segmented {
  display: inline-flex;
  padding: 1px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--bg-muted);
}

.segmented button {
  height: 24px;
  padding: 0 20px;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  line-height: 16px;
}

.segmented button[aria-pressed='true'] {
  background: var(--bg);
  color: var(--fg);
  box-shadow: var(--shadow-xs);
}

.stat-box {
  width: fit-content;
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-2xl);
  background: var(--bg);
}

.stat-box .sep {
  width: 1px;
  background: var(--border);
}

.stat {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.stat dt {
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
  color: var(--fg-muted);
  white-space: nowrap;
}

.stat dd {
  margin: 4px 0 0;
  font-family: var(--font-heading);
  font-size: 30px;
  font-weight: 500;
  line-height: 32px;
  letter-spacing: -0.025em;
}

@media (min-width: 480px) {
  .stat-box {
    gap: 24px;
    padding-inline: 24px;
  }
}

.dist {
  width: 100%;
  margin-top: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-2xl);
  background: var(--bg);
}

@media (min-width: 480px) {
  .dist {
    padding: 16px 24px;
  }
}

.dist-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.dist-head span:first-child {
  font-size: 16px;
  font-weight: 500;
  color: var(--fg-muted);
}

.dist-head span:last-child {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-subtle);
}

.chart {
  display: grid;
  grid-template-columns: 18px 1fr;
  row-gap: 6px;
  padding: 20px 0 16px;
  position: relative;
}

.chart-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-muted);
  text-align: right;
  padding-right: 8px;
  line-height: 18px;
  align-self: center;
}

.chart-track {
  position: relative;
  height: 18px;
  border-left: 1px solid var(--fg-muted);
}

.chart-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 0 4px 4px 0;
  background: var(--gray-emphasized);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-size: 12px;
  color: #fff;
}

.chart-fill.mark {
  background: var(--green);
}

.chart-fill.mark.x {
  background: var(--red);
}

@media (min-width: 768px) {
  .chart-track {
    height: 24px;
  }
}

.placement {
  margin: 8px 0 0;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
  color: var(--fg-subtle);
}

.mini-player {
  margin: 16px auto 0;
  width: 100%;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 4px;
  border-radius: 9999px;
  background: #fff;
  color: #424548;
  box-shadow: var(--shadow-sm);
}

.mini-play {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 9999px;
  border: 0;
  background: var(--deezer);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-play:hover:not(:disabled) {
  background: #8a1ff0;
}

.mini-play svg {
  width: 12px;
  height: 12px;
}

.mini-play .spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
  border-color: #fff;
  border-right-color: transparent;
}

.mini-range {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: var(--deezer);
  height: 16px;
  margin: 0;
}

.mini-time {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mini-link {
  flex: 0 0 auto;
  color: var(--deezer);
  display: flex;
}

.mini-link svg {
  width: 18px;
  height: 18px;
}

.rd-footer {
  padding: 16px 24px;
  display: flex;
  gap: 8px;
}

.rd-footer .btn {
  flex: 1 1 0;
}

/* Settings */

.settings {
  max-width: 42rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.settings-nav {
  display: flex;
  gap: 8px;
  padding: 16px 56px 12px 16px;
  border-bottom: 1px solid var(--border);
}

.avatar {
  display: none;
}

.nav-item {
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  white-space: nowrap;
}

.nav-item svg {
  width: 16px;
  height: 16px;
}

.nav-item[aria-selected='true'] {
  background: var(--gray-muted);
  color: var(--fg);
  box-shadow: var(--shadow-xs);
}

.nav-item:hover:not([aria-selected='true']) {
  color: var(--fg);
}

.settings-main {
  flex: 1 1 auto;
  padding: 20px 16px 24px;
  overflow-y: auto;
  max-height: min(70dvh, 560px);
}

.settings-title {
  margin: 0 0 16px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 30px;
  line-height: 36px;
  letter-spacing: -0.025em;
}

.pref {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.pref-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}

.pref-head > svg {
  width: 20px;
  height: 20px;
  color: var(--fg-muted);
}

.pref-name {
  flex: 1 1 auto;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 20px;
  line-height: 28px;
}

.pref-sub {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.pref-sub .pct {
  width: 40px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.accordion-btn {
  width: 100%;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
}

.accordion-btn .chev {
  width: 20px;
  height: 20px;
  color: var(--fg);
  transition: transform 0.2s;
}

.accordion-btn[aria-expanded='true'] .chev {
  transform: rotate(180deg);
}

.sub-pref {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 0;
  font-size: 16px;
}

.sub-pref + .sub-pref {
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.choice {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--radius-md);
  background: var(--bg-muted);
}

.choice button {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-muted);
  font-size: 13px;
}

.choice button[aria-pressed='true'] {
  background: var(--bg);
  color: var(--fg);
  box-shadow: var(--shadow-xs);
}

.about p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 22px;
  color: var(--fg-muted);
}

.about p b {
  color: var(--fg);
}

.about a {
  color: var(--fg);
}

.about .btn {
  margin-top: 4px;
}

@media (min-width: 640px) {
  .settings {
    flex-direction: row;
    height: 500px;
  }
  .settings-nav {
    flex-direction: column;
    align-items: center;
    width: 200px;
    flex: 0 0 auto;
    padding: 24px 24px;
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }
  .avatar {
    display: flex;
    width: 64px;
    height: 64px;
    margin-bottom: 32px;
    border-radius: 9999px;
    background: var(--gray-muted);
    color: var(--fg);
    align-items: center;
    justify-content: center;
  }
  .avatar svg {
    width: 26px;
    height: 26px;
  }
  .nav-item {
    width: 152px;
    justify-content: flex-start;
  }
  .settings-main {
    max-height: none;
    padding: 24px;
  }
}

/* Switch + slider */

.switch {
  position: relative;
  width: 48px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 9999px;
  border: 0;
  padding: 0;
  background: var(--gray-muted);
  transition: background-color 0.15s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: var(--white);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}

.switch[aria-checked='true'] {
  background: var(--green);
}

.switch[aria-checked='true']::after {
  transform: translateX(24px);
}

.slider {
  flex: 1 1 auto;
  appearance: none;
  -webkit-appearance: none;
  height: 20px;
  background: transparent;
  --pct: 50%;
}

.slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 9999px;
  background: linear-gradient(to right, var(--fg) 0 var(--pct), var(--gray-muted) var(--pct) 100%);
}

.slider::-moz-range-track {
  height: 8px;
  border-radius: 9999px;
  background: var(--gray-muted);
}

.slider::-moz-range-progress {
  height: 8px;
  border-radius: 9999px;
  background: var(--fg);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -6px;
  border-radius: 9999px;
  background: var(--white);
  border: 2px solid var(--black);
  box-shadow: 0 0 0 1px var(--white);
}

.slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background: var(--white);
  border: 2px solid var(--black);
}

.slider:disabled {
  opacity: 0.4;
}

/* ---------- Sidebar ---------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--backdrop);
  animation: fade-in 150ms ease-out;
}

.drawer-backdrop.closing {
  animation: fade-out 150ms ease-in forwards;
}

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(320px, 100vw);
  background: var(--bg-panel);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  animation: slide-in 200ms ease-out;
}

.drawer-backdrop.closing .drawer {
  animation: slide-out 150ms ease-in forwards;
}

@keyframes slide-in {
  from {
    transform: translateX(-100%);
  }
}

@keyframes slide-out {
  to {
    transform: translateX(-100%);
  }
}

.drawer-title {
  margin: 0 0 32px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.025em;
}

.drawer-item {
  width: 100%;
  border: 0;
  background: none;
  padding: 6px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--fg);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  text-align: left;
}

.drawer-item svg {
  width: 18px;
  height: 18px;
  color: var(--fg-muted);
}

.drawer-item:hover {
  color: var(--fg-muted);
}

.drawer-rule {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.activity-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.activity-head .caps {
  font-family: var(--font-body);
}

.activity-head .ready {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
}

.activity-head .ready svg {
  width: 14px;
  height: 14px;
}

.days {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.day {
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  background: var(--gray-subtle);
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13px;
}

.day.played {
  background: var(--gray-muted);
  color: var(--fg);
}

.day.won {
  background: var(--green);
  color: #fff;
}

.activity-note {
  margin: 14px 0 0;
  font-family: var(--font-poppins);
  font-size: 14px;
  color: var(--fg-muted);
}

.drawer-spacer {
  flex: 1 1 auto;
  min-height: 24px;
}

.drawer-btn {
  width: 100%;
  height: 40px;
  margin-top: 12px;
  border-radius: var(--radius-sm);
  border: 0;
  background: var(--gray-subtle);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.drawer-btn svg {
  width: 16px;
  height: 16px;
}

.drawer-btn:hover {
  background: var(--gray-muted);
}

.drawer-fine {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 18px;
  color: var(--fg-subtle);
  text-align: center;
}

/* ---------- Archive ---------- */

.archive {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 24px;
}

.archive-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.select {
  height: 40px;
  min-width: 200px;
  padding: 0 36px 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23939b9f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
  appearance: none;
  font-size: 14px;
}

.streak {
  height: 44px;
  min-width: 68px;
  padding: 0 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--orange);
  background: color-mix(in srgb, var(--orange) 12%, transparent);
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 18px;
}

.streak svg {
  width: 18px;
  height: 18px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  padding: 16px;
}

.played-panel {
  display: flex;
  justify-content: space-around;
  text-align: center;
}

.played-panel dt {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.played-panel dd {
  margin: 0;
  font-family: var(--font-body);
  font-size: 28px;
  line-height: 36px;
}

.played-panel dl {
  margin: 0;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.cal-head h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.025em;
}

.cal-sub {
  margin: 0 0 12px;
  text-align: center;
  font-size: 13px;
  color: var(--green);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-dow {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-subtle);
  padding-bottom: 4px;
}

.cal-day {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  background: var(--gray-subtle);
  color: var(--fg-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  gap: 3px;
}

.cal-day small {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 10px;
  opacity: 0.85;
}

.cal-day.blank {
  background: transparent;
}

.cal-day.played {
  background: var(--gray-muted);
  color: var(--fg);
}

.cal-day.won {
  background: var(--correct);
  color: #fff;
}

.cal-day.today {
  outline: 2px solid var(--fg);
  outline-offset: -2px;
}

.cal-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--fg-muted);
}

.cal-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-legend i {
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  display: inline-block;
}

.hist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hist-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hist-row .row {
  flex: 1 1 auto;
}

.hist-row .row-text {
  font-size: 16px;
}

.hist-meta {
  flex: 0 0 auto;
  width: 64px;
  text-align: center;
  font-size: 12px;
  line-height: 16px;
  color: var(--fg-muted);
}

.hist-row .icon-btn {
  flex: 0 0 auto;
}

.empty {
  margin: 0;
  text-align: center;
  color: var(--fg-muted);
  padding: 12px 0;
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

.toast {
  width: 100%;
  max-width: 384px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--gray-solid);
  color: var(--gray-contrast);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  font-size: 14px;
  line-height: 20px;
  animation: toast-in 200ms ease-out;
}

.toast.leaving {
  animation: toast-out 150ms ease-in forwards;
}

.toast svg {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.toast.success {
  background: var(--green);
  color: #fff;
}

.toast.error {
  background: var(--red);
  color: #fff;
}

.toast-title {
  font-weight: 500;
}

.toast-desc {
  opacity: 0.9;
}

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

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

/* ---------- Misc ---------- */

.spinner {
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  border: 2px solid var(--fg-muted);
  border-right-color: transparent;
  animation: spin 0.6s linear infinite;
}

.results .spinner {
  margin: 16px auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  color: var(--fg);
  padding: 24px;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-direction: column;
  gap: 16px;
}

.rotate svg {
  width: 64px;
  height: 64px;
  animation: tilt 2.4s ease-in-out infinite;
}

.rotate p {
  margin: 0;
  font-size: 18px;
  color: var(--fg-muted);
}

.rotate h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 20px;
}

@keyframes tilt {
  0%,
  20% {
    transform: rotate(-90deg);
  }
  50%,
  100% {
    transform: rotate(0deg);
  }
}

@media (orientation: landscape) and (max-width: 992px) and (pointer: coarse) {
  .rotate {
    display: flex;
  }
}

.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
}
