/* Telefonos csengő-távirányító — mobilra szabva: nagy, hüvelykujjal könnyen nyomható gombok,
   a telefon világos/sötét témáját követi, a "notch"/home-sáv körüli biztonsági margókkal. */
:root {
  --bg: #F4F5F7; --surface: #FFFFFF; --border: #E2E5EA; --ink: #131826; --muted: #6B7280;
  --accent: #22D3AA; --accent-ink: #04342C; --danger: #C0263B; --danger-bg: #FBE7EA;
  --bell: #FEF3C7; --bell-ink: #78350F; --bell-border: #FCD34D;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0F131B; --surface: #181D28; --border: #2A3140; --ink: #EEF1F6; --muted: #8C95A5; --danger-bg: #3B1220; --danger: #F87171; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 16px; }
body { padding-bottom: env(safe-area-inset-bottom); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--danger); margin: 0; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 0.6rem;
  padding: calc(0.6rem + env(safe-area-inset-top)) 1rem 0.6rem;
  background: #131826; color: #fff;
}
.brand { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.bell { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: #FBBF24; flex-shrink: 0; }
.title { font-weight: 800; font-size: 1.1rem; }
.sub { font-size: 0.72rem; color: #9CA3AF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.top-right { display: flex; align-items: center; gap: 0.4rem; }
.pill { font-size: 0.75rem; font-weight: 700; padding: 0.25rem 0.6rem; border-radius: 999px; background: #374151; white-space: nowrap; }
.pill.ok { background: #123B2E; color: #4ADE80; }
.pill.off { background: #3B1220; color: #F87171; }
.icon-btn { background: none; border: none; color: #fff; font-size: 1.5rem; padding: 0.2rem 0.5rem; cursor: pointer; }

.menu {
  position: fixed; right: 0.6rem; top: calc(3.6rem + env(safe-area-inset-top)); z-index: 10;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25); min-width: 240px; overflow: hidden;
}
.menu-user { padding: 0.8rem 1rem; font-weight: 700; border-bottom: 1px solid var(--border); }
.menu-item { display: block; width: 100%; text-align: left; padding: 0.85rem 1rem; background: none; border: none; color: var(--ink); font: inherit; text-decoration: none; cursor: pointer; }
.menu-item.danger { color: var(--danger); }

.wrap { padding: 0.8rem; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 0.8rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.card h1 { margin: 0 0 0.3rem; font-size: 1.4rem; }
.card h2 { margin: 0 0 0.7rem; font-size: 1.05rem; }
.eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.15rem; }
.row { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.row.between { justify-content: space-between; margin-top: 0; }
.row.three > * { flex: 1; }
.grow { flex: 1; min-width: 0; }

label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.7rem; }
label.check { flex-direction: row; align-items: center; font-weight: 500; }
input, select {
  font: inherit; font-size: 16px; /* iOS ne nagyítson rá */
  padding: 0.7rem 0.75rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); width: 100%;
}
label.check input { width: auto; }

.btn {
  font: inherit; font-weight: 600; padding: 0.75rem 0.9rem; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink); min-height: 48px;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.btn.light { background: #fff; color: #7F1D1D; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.big { font-size: 1.05rem; min-height: 54px; }
.btn.wide { width: 100%; margin-top: 0.6rem; }
.small-btn { min-height: 38px; padding: 0.4rem 0.8rem; font-size: 0.9rem; }
body.viewer .btn, body.viewer .bell-btn, body.viewer .chip-btn, body.viewer .switch { pointer-events: none; opacity: 0.45; }

.banner { border-radius: var(--radius); padding: 0.8rem 1rem; font-size: 0.92rem; }
.banner.warn { background: #FEF3C7; color: #78350F; }
.banner.mute { background: #DC2626; color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 0.7rem; flex-wrap: wrap; }

.master-state { font-weight: 800; font-size: 1.15rem; }
.master-state .on { color: #059669; }
.master-state .off { color: var(--danger); }
.switch { position: relative; display: inline-block; width: 4.2rem; height: 2.4rem; flex-shrink: 0; margin: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.track { position: absolute; inset: 0; border-radius: 999px; background: #9CA3AF; transition: background 0.2s; }
.track::after { content: ''; position: absolute; top: 0.25rem; left: 0.25rem; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.switch input:checked + .track { background: #10B981; }
.switch input:checked + .track::after { transform: translateX(1.8rem); }

.next { margin-top: 1rem; }
.next-label { font-size: 1.05rem; }
.countdown { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.today { margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--border); }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.75rem; border-radius: 999px; font-weight: 700; font-size: 0.95rem;
  background: color-mix(in srgb, var(--chip, #3b82f6) 18%, transparent); }
.chip::before { content: ''; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--chip, #3b82f6); }
.chip.off { --chip: #9CA3AF; }
.chip.special { --chip: #F59E0B; }

.bells { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
.bell-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 64px; min-width: 0;
  padding: 0.6rem; border-radius: 14px; border: 1px solid var(--bell-border); background: var(--bell); color: var(--bell-ink);
  font: inherit; font-weight: 700; text-align: center; line-height: 1.2; cursor: pointer;
}
.bell-btn .ico { flex-shrink: 0; font-size: 1.2rem; }
.bell-btn .name { min-width: 0; overflow-wrap: break-word; }
.bell-btn:active, .bell-btn.pressed { background: #FCD34D; transform: scale(0.96); }

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip-btn { font: inherit; font-weight: 600; padding: 0.6rem 0.9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); min-height: 44px; cursor: pointer; }
.chip-btn:active { background: #FEE2E2; }
.custom-mute { margin-top: 0.8rem; }
.custom-mute summary { cursor: pointer; font-weight: 600; padding: 0.4rem 0; }
.custom-mute form { margin-top: 0.6rem; }

.list { display: flex; flex-direction: column; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; padding: 0.65rem 0; border-top: 1px solid var(--border); }
.list-row.active { background: color-mix(in srgb, #EF4444 8%, transparent); }
.tag { font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 999px; }
.tag.mute { background: #FEE2E2; color: #991B1B; }
.dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; margin-right: 0.4rem; }
.dot.on { background: #10B981; }
.dot.off { background: #EF4444; }

.login-card form { margin-top: 1rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  background: #131826; color: #fff; padding: 0.75rem 1.1rem; border-radius: 12px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3); max-width: calc(100vw - 2rem);
}
.toast.ok { background: #065F46; }
.toast.err { background: #991B1B; }
/* Vissza a főmenübe (közös telepített app — iPhone-on nincs "vissza" gomb) */
.home-btn { color: #fff; text-decoration: none; font-size: 2rem; line-height: 1; padding: 0 0.35rem 0.15rem 0; margin-right: 0.1rem; }
.top { justify-content: flex-start; }
.top .top-right { margin-left: auto; }
/* Élő óra (a szerver idejéhez igazítva) + mi van most + mi jön utána */
.now-row { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--border); }
.clock { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.phase { font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.next { margin-top: 0.7rem; }
.after-label { margin-top: 0.3rem; font-size: 0.9rem; color: var(--muted); }
