/* Made for Mama and Papa: 18 px base text (21 with "Groß", 24 with "Sehr groß"), buttons of at least
   56 px, every symbol with a word next to it, strong contrast. Sizes in rem follow the text size setting. */
:root {
  color-scheme: light dark;
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #ece7df;
  --line: #d9d1c5;
  --text: #191714;
  --muted: #5a534b;
  --accent: #1f4fd1;
  --accent-strong: #163ea8;
  --on-accent: #ffffff;
  --accent-soft: #e3eaff;
  --danger: #b3261e;
  --danger-soft: #fde8e6;
  --good: #1e7a4c;
  --radius: 20px;
  --shadow: 0 1px 3px rgb(40 30 20 / 0.12), 0 4px 14px rgb(40 30 20 / 0.08);
  --player-h: 0px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1f1f1f;
    --surface-2: #2b2b2b;
    --line: #3a3a3a;
    --text: #f4f2ef;
    --muted: #bdb6ad;
    --accent: #8fb0ff;
    --accent-strong: #b3c9ff;
    --on-accent: #0d1b44;
    --accent-soft: #1d2a4d;
    --danger: #ff8a80;
    --danger-soft: #3d1f1c;
    --good: #6fd39f;
    --shadow: 0 2px 12px rgb(0 0 0 / 0.5);
  }
}

html { font-size: 18px; -webkit-text-size-adjust: 100%; }
html[data-size="large"] { font-size: 21px; }
html[data-size="xlarge"] { font-size: 24px; }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
h1 { font-size: 1.8rem; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; margin: 0; }
p { margin: 0; }
a { color: var(--accent); }
img { display: block; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.big { font-size: 1.2rem; }
.center { text-align: center; }
.error { color: var(--danger); font-weight: 600; }
.good { color: var(--good); font-weight: 600; }
.hidden { display: none !important; }

/* ---------- Page frame ---------- */
.view {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(0.8rem + env(safe-area-inset-top)) 16px calc(var(--player-h) + 2rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.topbar { display: flex; align-items: center; gap: 0.75rem; min-height: 3.5rem; }
.topbar h1 { flex: 1; min-width: 0; }
.section { display: flex; flex-direction: column; gap: 0.75rem; }
.section-title { font-size: 0.95rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; display: flex; flex-direction: column; gap: 0.9rem; }

/* ---------- Buttons ---------- */
button, .button {
  font: inherit;
  font-weight: 650;
  min-height: 3.1rem;
  min-width: 3.1rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  border: 2px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { opacity: 0.45; cursor: default; }
button:active:not(:disabled), .button:active { transform: scale(0.97); }
button svg, .button svg { width: 1.35em; height: 1.35em; flex: none; }
.primary { background: var(--accent); color: var(--on-accent); }
.primary:active:not(:disabled) { background: var(--accent-strong); }
.outline { background: transparent; border-color: var(--line); }
.danger { background: var(--danger-soft); color: var(--danger); }
.wide { width: 100%; min-height: 3.6rem; font-size: 1.1rem; }
.plain { background: none; color: var(--accent); padding-inline: 0.4rem; }
.back { background: none; padding-inline: 0.3rem 0.8rem; color: var(--accent); }
.row-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.row-buttons > * { flex: 1 1 auto; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Forms ---------- */
form { display: flex; flex-direction: column; gap: 1rem; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 650; }
input {
  font: inherit;
  font-size: max(1rem, 16px); /* below 16 px the iPhone zooms in */
  min-height: 3.2rem;
  padding: 0.6rem 0.9rem;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
input:focus { border-color: var(--accent); outline: none; }
.hint { color: var(--muted); font-size: 0.85rem; font-weight: 400; }
.code-input { font-size: 1.5rem; letter-spacing: 0.15em; text-transform: uppercase; text-align: center; font-weight: 700; }

/* ---------- Station logos ---------- */
.logo {
  aspect-ratio: 1;
  border-radius: 16px;
  background: #ffffff;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.06);
}
.logo img { width: 100%; height: 100%; object-fit: contain; padding: 8%; }
.logo.letter { color: #ffffff; font-weight: 800; font-size: 2.2em; letter-spacing: -0.02em; }

/* ---------- Start page tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  padding: 0.7rem 0.7rem 0.9rem;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 3px solid transparent;
  min-height: 0;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
}
.tile .logo { width: 100%; font-size: 1.6rem; }
.tile .name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
.tile .logo { box-shadow: none; }
.tile.on { border-color: var(--accent); background: var(--accent-soft); }
.badge {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 750;
  background: var(--accent);
  color: var(--on-accent);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.badge.broken { background: var(--danger); color: #fff; }

/* Three bars that move while a station plays. */
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 0.8em; }
.bars i { width: 3px; background: currentColor; border-radius: 1px; animation: bar 0.9s ease-in-out infinite; }
.bars i:nth-child(2) { animation-delay: -0.3s; }
.bars i:nth-child(3) { animation-delay: -0.6s; }
@keyframes bar { 0%, 100% { height: 30%; } 50% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .bars i { animation: none; height: 70%; } }

.empty { text-align: center; padding: 2rem 1rem; display: flex; flex-direction: column; gap: 1rem; align-items: center; }

/* ---------- Lists (all stations, search, order) ---------- */
.list { display: flex; flex-direction: column; gap: 0.6rem; }
.item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.item .logo { width: 3.6rem; font-size: 1.1rem; border-radius: 12px; }
.item .text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.item .title { font-weight: 700; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
.item .sub { color: var(--muted); font-size: 0.85rem; }
.item.on { outline: 3px solid var(--accent); }
.item-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.8rem; background: none; padding: 0; border-radius: 12px; text-align: left; justify-content: flex-start; font-weight: inherit; }
.toggle { min-width: 7.5rem; padding-inline: 0.8rem; }
.toggle[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.stack-buttons { display: flex; flex-direction: column; gap: 0.4rem; }

/* ---------- Segmented choice (text size, sleep timer) ---------- */
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); gap: 0.5rem; }
.choice button { border-radius: 14px; padding-inline: 0.5rem; }
.choice button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ---------- Player bar ---------- */
.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: var(--surface);
  box-shadow: 0 -2px 16px rgb(0 0 0 / 0.14);
  border-radius: 24px 24px 0 0;
  padding: 0.75rem 16px calc(0.75rem + env(safe-area-inset-bottom));
}
.player-inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 0.8rem; }
.player .open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.8rem; background: none; padding: 0; text-align: left; justify-content: flex-start; border-radius: 12px; }
.player .logo { width: 3.6rem; font-size: 1.2rem; border-radius: 12px; }
.player .text { min-width: 0; display: flex; flex-direction: column; }
.player .title { font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .sub { color: var(--muted); font-size: 0.85rem; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.player .sub.error { color: var(--danger); font-weight: 650; }
.playbtn {
  width: 4.2rem;
  height: 4.2rem;
  border-radius: 50%;
  padding: 0;
  background: var(--accent);
  color: var(--on-accent);
  flex: none;
  flex-direction: column;
  gap: 0;
  font-size: 0.7rem;
}
.playbtn svg { width: 1.9rem; height: 1.9rem; }
.playbtn.big { width: 6.5rem; height: 6.5rem; font-size: 0.95rem; }
.playbtn.big svg { width: 2.8rem; height: 2.8rem; }
.spinner { width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 4px solid currentColor; border-right-color: transparent; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Full player ---------- */
.now { align-items: center; text-align: center; gap: 1rem; }
.now .logo { width: min(62vw, 15rem); font-size: 4rem; border-radius: 28px; box-shadow: var(--shadow); }
.now .station { font-size: 1.5rem; font-weight: 800; }
.now .song { font-size: 1.15rem; min-height: 1.6em; }
.sleep-note { font-weight: 650; color: var(--accent); }

/* ---------- Invite card ---------- */
.code { font-size: 2rem; font-weight: 800; letter-spacing: 0.12em; text-align: center; padding: 0.6rem; border-radius: 14px; background: var(--surface-2); -webkit-user-select: all; user-select: all; }
.swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.swatch { width: 3rem; height: 3rem; min-width: 0; border-radius: 50%; padding: 0; border: 3px solid transparent; }
.swatch[aria-pressed="true"] { border-color: var(--text); }
.app-logo { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; padding-top: 1.5rem; }
.app-logo img { width: 5rem; height: 5rem; border-radius: 22%; box-shadow: var(--shadow); }
.footer { text-align: center; font-size: 0.85rem; padding-top: 0.5rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--player-h) + 1rem + env(safe-area-inset-bottom));
  z-index: 20;
  max-width: 600px;
  margin: 0 auto;
  padding: 0.9rem 1.1rem;
  border-radius: 16px;
  background: var(--text);
  color: var(--bg);
  font-weight: 650;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(1rem);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- Smaller pieces ---------- */
.topbar { flex-wrap: wrap; }
.toggle { min-width: 8.5rem; }
.order-buttons { display: flex; gap: 0.4rem; flex: none; }
.order-buttons button { padding: 0; width: 3.1rem; }
.item.link { color: inherit; text-decoration: none; min-height: 3.6rem; padding-inline: 1rem 0.6rem; }
.item.link svg { width: 1.4rem; height: 1.4rem; color: var(--muted); flex: none; }
.item .sub.error { color: var(--danger); font-weight: 650; }
.with-icon { display: flex; align-items: center; gap: 0.5rem; }
.with-icon svg { width: 1.2em; height: 1.2em; }
.label { font-weight: 650; }
.edit-head { display: flex; align-items: center; gap: 1rem; }
.edit-head .logo { width: 6rem; font-size: 2rem; }
details > summary { font-weight: 700; cursor: pointer; min-height: 2.4rem; display: flex; align-items: center; color: var(--accent); }
details[open] > summary { margin-bottom: 0.4rem; }
.card h2 { font-size: 1.15rem; }
.card p svg { width: 1.1em; height: 1.1em; vertical-align: -0.15em; }

/* ---------- Big text: rows wrap instead of squeezing names to a letter per line ---------- */
.item { flex-wrap: wrap; }
.item .text { flex: 1 1 5rem; }
.item-main { flex: 1 1 11rem; }
.order-buttons, .stack-buttons { margin-left: auto; }
.choice.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice button { line-height: 1.15; }
.player .title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.player .sub { -webkit-line-clamp: 1; }
.tile .logo.letter { font-size: 3.2rem; }
