/* Sazly guest page. Colours are the app's tokens (Sazly/Design/Theme.swift):
   plum surfaces, hot-pink accent, white type. Dark only — the app is dark only.
   Every inline offset is a logical property so Arabic flips for free. */

:root {
  --accent: #e20271;
  --accent-deep: #db017a;
  --bg: #2a1b2e;
  --bg-elevated: #3a2440;
  --bg-sunken: #1e1221;
  --plum: #5e1e54;

  --text: #ffffff;
  --text-2: rgba(255, 255, 255, 0.62);
  --text-3: rgba(255, 255, 255, 0.38);
  --hairline: rgba(255, 255, 255, 0.09);

  --radius: 16px;
  --radius-pill: 999px;
  --row-h: 60px;
  --tabbar-h: 58px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui,
    "Noto Sans Arabic", "Geeza Pro", Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg-sunken);
  color: var(--text);
  font-family: var(--font);
  /* 16px floor: anything smaller and iOS Safari zooms when an input is focused. */
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body {
  background:
    radial-gradient(120% 80% at 100% 0%, var(--bg-elevated) 0%, transparent 60%),
    radial-gradient(120% 90% at 0% 100%, var(--plum) 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

#app {
  min-height: 100%;
  min-height: 100dvh; /* dvh keeps Safari's collapsing toolbar from cropping the page */
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

input {
  font: inherit;
  color: inherit;
}

/* ---------------------------------------------------------------- centred screens */

.screen {
  min-height: 100vh; /* iOS 15.0–15.3 has no dvh */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  max-width: 520px;
  margin-inline: auto;
}

.screen-loading {
  align-items: center;
}

.brand {
  text-align: center;
}

.brand h1 {
  margin: 10px 0 6px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-compact h1 {
  font-size: 26px;
}

.tagline,
.body {
  margin: 0;
  color: var(--text-2);
}

.eyebrow {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}

.logo {
  width: 62px;
  height: 62px;
  margin-inline: auto;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 30px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 12px 32px rgba(226, 2, 113, 0.35);
}

.logo-muted {
  background: var(--bg-elevated);
  color: var(--text-2);
  box-shadow: none;
}

.code-chip {
  display: inline-block;
  margin: 12px auto 0;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.22em;
  font-weight: 700;
}

.card {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(8px);
}

.card label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.card-notice {
  text-align: center;
  gap: 14px;
  align-items: center;
}

.card-notice h1 {
  margin: 0;
  font-size: 24px;
}

.hint,
.fine {
  margin: 0;
  color: var(--text-3);
  font-size: 14px;
}

.error {
  margin: 0;
  min-height: 0;
  color: #ff9ec4;
  font-size: 14px;
}

.error:empty {
  display: none;
}

.text-input,
.code-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: rgba(0, 0, 0, 0.28);
  outline: none;
}

.text-input:focus-visible,
.code-input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.code-input {
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-indent: 0.3em; /* keeps the tracking from shoving the text off-centre */
  text-transform: uppercase;
}

.primary,
.secondary {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 15px 20px;
  font-weight: 700;
  min-height: 50px;
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  box-shadow: 0 10px 24px rgba(226, 2, 113, 0.3);
}

.primary:disabled {
  opacity: 0.45;
  box-shadow: none;
}

.secondary {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
}

.danger {
  background: linear-gradient(135deg, #b3235c, #8f1247);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

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

.screen-foot-column {
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

.lang {
  background: rgba(255, 255, 255, 0.09);
  border: 0;
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

/* ------------------------------------------------------------------ live session */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 620px;
  margin-inline: auto;
}

.app-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(30, 18, 33, 0.85);
  backdrop-filter: blur(10px);
}

.bar-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  text-align: center;
}

.bar-title {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-sub {
  font-size: 12px;
  color: var(--text-3);
}

.ghost {
  background: none;
  border: 0;
  padding: 8px 6px;
  color: var(--accent);
  font-weight: 600;
}

.banners:empty {
  display: none;
}

.banner {
  margin: 8px 12px 0;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13px;
  background: var(--bg-elevated);
  border: 1px solid rgba(226, 2, 113, 0.4);
  color: var(--text);
}

.banner-offline,
.banner-stale {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text-2);
}

.panels {
  flex: 1;
  min-height: 0;
  display: flex;
}

.panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  outline: none;
}

.panel[hidden] {
  display: none;
}

.search-field {
  display: flex;
  gap: 8px;
  position: sticky;
  top: -12px;
  z-index: 2;
  padding: 4px 0;
  background: linear-gradient(var(--bg-sunken) 60%, transparent);
}

.search-input {
  flex: 1;
  border-radius: var(--radius-pill);
  padding: 12px 16px;
  -webkit-appearance: none;
  appearance: none;
}

.search-go {
  border: 0;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  font-size: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list-note {
  margin: 0;
  color: var(--text-3);
  font-size: 13px;
}

.list-status:empty {
  display: none;
}

.section {
  margin: 14px 0 2px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}

.section-count {
  font-weight: 500;
  color: var(--text-3);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--row-h);
  padding: 8px 2px;
  border-bottom: 1px solid var(--hairline);
}

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.row-title,
.row-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-title {
  font-size: 15px;
  font-weight: 600;
}

.row-sub {
  font-size: 13px;
  color: var(--text-2);
}

.row-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row.playing .row-title {
  color: var(--accent);
}

.status {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  white-space: nowrap;
}

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

.add,
.vote {
  border: 0;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  border-radius: var(--radius-pill);
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 12px;
  font-weight: 700;
}

.add-glyph {
  font-size: 22px;
  line-height: 1;
  color: var(--accent);
}

.add.added {
  background: var(--accent);
  color: #fff;
}

.vote {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

.vote.voted {
  background: rgba(226, 2, 113, 0.22);
  color: #fff;
}

.vote-glyph {
  font-size: 11px;
}

.art {
  flex: 0 0 auto;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  color: var(--text-3);
}

.art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.art-ring {
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(226, 2, 113, 0.55);
}

.playing-card {
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline);
  padding: 4px 12px 8px;
}

.playing-card .row {
  border-bottom: 0;
}

.empty {
  margin: 12px 2px;
  color: var(--text-2);
  font-size: 14px;
}

.more[hidden] {
  display: none;
}

.more {
  margin: 12px auto 0;
}

/* -------------------------------------------------------------- now playing bar */

.now-playing {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  margin: 0 8px 6px;
  border-radius: 14px;
  background: rgba(58, 36, 64, 0.92);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(10px);
}

.now-playing[hidden] {
  display: none;
}

.np-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.np-title {
  font-size: 14px;
  font-weight: 600;
}

.np-title,
.np-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.np-sub {
  font-size: 12px;
  color: var(--text-2);
}

.eq {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
}

.eq i {
  width: 3px;
  height: 6px;
  border-radius: 2px;
  background: var(--accent);
  animation: bounce 900ms ease-in-out infinite;
}

.eq i:nth-child(2) {
  animation-delay: 150ms;
}

.eq i:nth-child(3) {
  animation-delay: 300ms;
}

.now-playing.paused .eq i {
  animation: none;
  height: 4px;
  background: var(--text-3);
}

@keyframes bounce {
  0%,
  100% {
    height: 5px;
  }
  50% {
    height: 17px;
  }
}

/* ------------------------------------------------------------------------ tabbar */

.tabbar {
  display: flex;
  border-top: 1px solid var(--hairline);
  background: rgba(30, 18, 33, 0.95);
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(10px);
}

.tab {
  flex: 1;
  border: 0;
  background: none;
  min-height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
}

.tab-glyph {
  display: block;
  height: 22px;
}

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

/* ------------------------------------------------------------- toast / overlay */

.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: calc(var(--tabbar-h) + 78px + env(safe-area-inset-bottom));
  margin-inline: auto;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid rgba(226, 2, 113, 0.5);
  text-align: center;
  font-size: 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
  z-index: 5;
}

.toast.in {
  opacity: 1;
  transform: none;
}

/* Nothing playing means no bar to clear. */
.app:not(.has-np) .toast {
  bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 6, 14, 0.6);
  display: flex;
  align-items: flex-end;
  z-index: 10;
}

.overlay[hidden] {
  display: none;
}

.sheet {
  width: 100%;
  max-width: 620px;
  margin-inline: auto;
  background: var(--bg-elevated);
  border-radius: 24px 24px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  text-align: center;
}

.sheet h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

/* ----------------------------------------------------------------------- spinner */

.spinner-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  font-size: 14px;
  padding: 8px 2px;
}

.spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  animation: spin 800ms linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner,
  .eq i {
    animation: none;
  }
  .toast {
    transition: none;
  }
}

/* Wider phones / small tablets: nothing fancy, just stop the rows getting silly. */
@media (min-width: 560px) {
  .row {
    padding-inline: 6px;
  }
}
