:root {
  color-scheme: dark;
  --bg: #101322;
  --panel: #1a1e32;
  --panel-2: #222741;
  --line: #ffffff14;
  --text: #f7f7fc;
  --muted: #979bb0;
  --violet: #a182ff;
  --aqua: #51ddcf;
  --danger: #ff6b6b;
  --prepare: #ffc547;
  --work: #3ddc97;
  --rest: #4aa3ff;
  --set-rest: #a182ff;
  --done: #51ddcf;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at 90% 0, #292451, transparent 36rem), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
textarea { resize: vertical; line-height: 1.4; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: clamp(26px, 5vw, 36px); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset:disabled { opacity: 0.45; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.spacer { flex: 1; }

/* ---------- Botões e campos ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px;
  border: 0; border-radius: 12px;
  font-weight: 750; text-decoration: none; white-space: nowrap;
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--violet); color: #17122d; }
.btn.secondary { background: #ffffff14; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: #d9dbe8; }
.btn.danger { background: #ff6b6b22; color: var(--danger); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
:focus-visible { outline: 2px solid var(--aqua); outline-offset: 2px; }

input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid #ffffff1f; border-radius: 10px;
  background: #0e1120; color: #fff;
  font-size: 16px; /* evita zoom automático no iOS */
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #979bb0 50%), linear-gradient(135deg, #979bb0 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
label { display: grid; gap: 6px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 650; color: #c9ccdc; }
.form-error { min-height: 1.2em; margin: 0; color: var(--danger); font-size: 14px; font-weight: 600; }

/* ---------- Login ---------- */

/* Marca do ecossistema RX (2026-10-21): ícone do produto + logo empilhado RXBR/nome, ver logo.svg. */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { display: block; height: 44px; width: auto; }
/* Assinatura em linha (RXBR + nome ao lado): mais baixa que o ícone. */
.brand img + img { height: 22px; }
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: calc(20px + var(--safe-top)) 16px calc(20px + var(--safe-bottom)); }
.login-card { width: min(420px, 100%); padding: clamp(24px, 6vw, 38px); border-radius: 24px; background: var(--panel); box-shadow: 0 30px 80px #0008; }
.login-card > p { color: var(--muted); margin: 10px 0 26px; }
#loginForm { display: grid; gap: 16px; }
.login small { display: block; text-align: center; color: var(--muted); margin-top: 18px; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 86px; }
.password-field button { position: absolute; right: 4px; top: 4px; bottom: 4px; padding: 0 12px; border: 0; border-radius: 8px; background: #ffffff10; color: #c9c5d6; font-size: 13px; font-weight: 700; }
#loginStatus { min-height: 1.3em; margin: 0; color: var(--muted); }
#loginStatus.error { color: var(--danger); font-weight: 600; }
.rxbr-login { width: 100%; margin-top: 12px; }
.native .rxbr-login { display: none; }

/* ---------- Estrutura ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap;
  padding: calc(12px + var(--safe-top)) calc(20px + var(--safe-right)) 12px calc(20px + var(--safe-left));
  background: #101322e6; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #ffffff0a; }
.tabs a { padding: 7px 14px; border-radius: 9px; text-decoration: none; font-weight: 700; color: var(--muted); }
.tabs a.active { background: var(--panel-2); color: #fff; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user { font-weight: 700; }
.net { font-size: 13px; color: var(--work); }
.net::before { content: "● "; }
.net.offline { color: var(--prepare); }

.view {
  max-width: 1280px; margin: 0 auto;
  padding: 24px calc(20px + var(--safe-right)) calc(48px + var(--safe-bottom)) calc(20px + var(--safe-left));
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; }
.panel { padding: 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.empty { padding: 40px 24px; border: 1px dashed #ffffff26; border-radius: var(--radius); text-align: center; }
.empty p { max-width: 420px; margin: 8px auto 18px; }

/* ---------- Lista de salas ---------- */

.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.room-card {
  display: grid; gap: 10px; padding: 20px;
  border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line);
  text-decoration: none; transition: border-color 0.2s, transform 0.1s;
  border-top: 4px solid var(--accent);
}
.room-card:hover { border-color: #ffffff30; border-top-color: var(--accent); }
.room-card:active { transform: scale(0.99); }
.room-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.room-card-top h2 { font-size: 20px; }
.room-card p { margin: 0; }
.room-card-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 6px; }
.room-card-bottom strong { display: block; }
.room-card-bottom small { color: var(--muted); }
.room-card-clock { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); }
.badge { flex: none; padding: 4px 10px; border-radius: 99px; background: #ffffff12; font-size: 12px; font-weight: 750; color: #d9dbe8; }

[data-phase="idle"] { --accent: var(--violet); }
[data-phase="prepare"] { --accent: var(--prepare); }
[data-phase="work"] { --accent: var(--work); }
[data-phase="rest"] { --accent: var(--rest); }
[data-phase="setRest"] { --accent: var(--set-rest); }
[data-phase="done"] { --accent: var(--done); }
.room-card:not([data-phase="idle"]) .badge { background: var(--accent); color: #0d1020; }

/* ---------- Página da sala ---------- */

.back { display: inline-block; margin-bottom: 6px; color: var(--muted); text-decoration: none; font-weight: 650; }
.room-layout { display: grid; gap: 18px; align-items: start; }
.side { display: grid; gap: 18px; align-items: start; }

.timer-card {
  position: relative; overflow: hidden;
  display: grid; gap: 14px; justify-items: center; text-align: center;
  padding: clamp(20px, 4vw, 36px);
  border-radius: 24px;
  background: radial-gradient(circle at 50% 0, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%), var(--panel);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  transition: border-color 0.3s, background 0.3s;
}
.timer-top { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 12px; }
.phase-pill { padding: 6px 14px; border-radius: 99px; background: var(--accent); color: #0d1020; font-weight: 800; font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; }
.timer-name { color: #d9dbe8; font-weight: 650; }
.clock {
  font-size: clamp(76px, 20vw, 190px);
  line-height: 0.95; font-weight: 800; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  transition: color 0.3s;
}
.timer-card[data-status="paused"] .clock { opacity: 0.55; }
.timer-meta { font-size: clamp(16px, 2.4vw, 22px); font-weight: 700; }
.progress { width: 100%; height: 8px; border-radius: 99px; background: #ffffff12; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform 0.2s linear; }
.timer-sub { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; width: 100%; color: var(--muted); font-size: 14px; font-weight: 600; }
.controls { display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 10px; width: 100%; max-width: 520px; }
.controls .big { min-height: 60px; font-size: 20px; }
.controls .btn { min-height: 60px; }
.timer-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 16px 0; border-radius: 12px; background: #0e1120; }
.mode-switch button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; }
.mode-switch button.active { background: var(--panel-2); color: #fff; box-shadow: inset 0 0 0 1px #ffffff1a; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.mmss { display: flex; align-items: center; gap: 6px; }
.mmss input { width: 100%; min-width: 0; text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; padding: 10px 4px; }
.mmss span { color: var(--muted); font-size: 12px; }
.stepper { display: grid; grid-template-columns: 44px 1fr 44px; gap: 6px; }
.stepper button { min-height: 44px; border: 0; border-radius: 10px; background: #ffffff14; font-size: 20px; font-weight: 700; }
.stepper input { text-align: center; font-weight: 750; padding: 10px 4px; }
.config-summary { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: #0e1120; color: #d9dbe8; font-size: 14px; }
.lock-note { margin: 10px 0 0; color: var(--prepare); font-size: 14px; }

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 360px; overflow: auto; }
.history li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.history-info { display: grid; min-width: 0; }
.history-info strong, .history-info small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-info small { color: var(--muted); }
.tag { padding: 3px 9px; border-radius: 99px; background: #ffffff12; font-size: 12px; font-style: normal; font-weight: 700; }
.tag[data-status="Concluído"] { background: #3ddc9726; color: var(--work); }
.tag[data-status="Em execução"] { background: #ffc54726; color: var(--prepare); }
.tag[data-status="Interrompido"] { background: #ff6b6b1f; color: var(--danger); }

/* ---------- Modelos ---------- */

.target { min-width: 220px; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 38px; padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; }
.chip.active { background: var(--violet); border-color: var(--violet); color: #17122d; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.template-card { --accent: var(--violet); display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.template-card[data-cat="tabata"] { --accent: #ff7aa8; }
.template-card[data-cat="hiit"] { --accent: var(--prepare); }
.template-card[data-cat="emom"] { --accent: var(--rest); }
.template-card[data-cat="funcional"] { --accent: var(--work); }
.template-card[data-cat="cardio"] { --accent: var(--aqua); }
.template-card p { margin: 0; flex: 1; }
.cat { align-self: flex-start; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.t-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0; }
.t-stats div { padding: 8px 6px; border-radius: 10px; background: #0e1120; text-align: center; }
.t-stats dt { color: var(--muted); font-size: 11px; }
.t-stats dd { margin: 2px 0 0; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.t-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Som ---------- */

.sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.sound-option {
  display: grid; gap: 4px; align-content: start; text-align: left;
  min-height: 72px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #0e1120;
  touch-action: manipulation;
}
.sound-option small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.sound-option.active { border-color: var(--violet); background: #a182ff1c; box-shadow: inset 0 0 0 1px var(--violet); }
.sound-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.level { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.level i { width: 3px; border-radius: 2px; background: #ffffff1f; }
.level i:nth-child(1) { height: 4px; } .level i:nth-child(2) { height: 6px; } .level i:nth-child(3) { height: 8px; }
.level i:nth-child(4) { height: 10px; } .level i:nth-child(5) { height: 12px; } .level i:nth-child(6) { height: 14px; }
.level i.on { background: var(--work); }
.level i.on:nth-child(n+4) { background: var(--prepare); }
.level i.on:nth-child(n+6) { background: var(--danger); }
.sound-option[data-sound="sirene"].active { border-color: var(--danger); background: #ff6b6b1a; box-shadow: inset 0 0 0 1px var(--danger); }
.sound-play { align-self: flex-start; margin-top: 2px; padding: 2px 8px; border-radius: 99px; background: #ffffff10; color: #d9dbe8; font-size: 11px; font-weight: 700; }
.sound-option.playing .sound-play, [data-action="test-sound"].playing { background: var(--work); color: #0d1020; animation: pulse 0.6s ease-in-out infinite alternate; }
.sound-option.playing .sound-play::after { content: " · tocando"; }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.55; } }
.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--violet); flex: none; }
.owner-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; margin: 4px 0 0; padding: 10px 14px; border-radius: 12px; background: #ffffff0d; color: #d9dbe8; font-size: 14px; font-weight: 600; text-align: center; }
.owner-note.warn { background: #ffb02e1f; color: var(--prepare); }
.net { cursor: pointer; }
.net.syncing { color: var(--rest); }
body.focus .owner-note { font-size: clamp(14px, 1.8vw, 20px); }
.volume { margin-top: 14px; }
.volume b { color: #fff; }
input[type="range"] { min-height: 32px; padding: 0; border: 0; background: transparent; accent-color: var(--violet); }
.hint { margin: 8px 0 0; }

/* ---------- Editor de modelos ---------- */

.head-actions { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.template-card.custom { border-color: #a182ff55; background: linear-gradient(180deg, #a182ff14, transparent 60%), var(--panel); }
.mine { display: inline-block; margin-right: 6px; padding: 2px 8px; border-radius: 99px; background: var(--violet); color: #17122d; letter-spacing: 0.04em; }
.author { margin: 0; color: #c9ccdc; }
.chip b { margin-left: 4px; padding: 0 6px; border-radius: 99px; background: #ffffff1f; font-size: 12px; }
.danger-text { color: var(--danger); }
dialog.wide { width: min(640px, calc(100vw - 24px)); }
.dialog-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.tpl-fields .mode-switch { margin-top: 2px; }
.template-grid .empty { grid-column: 1 / -1; }

/* ---------- Diálogos e avisos ---------- */

dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto; overscroll-behavior: contain;
  padding: 22px; border: 1px solid var(--line); border-radius: 20px;
  background: var(--panel); color: var(--text);
  box-shadow: 0 30px 80px #000a;
}
dialog::backdrop { background: #05060dcc; backdrop-filter: blur(3px); }
dialog form { display: grid; gap: 14px; }
dialog p { margin: 0; color: #d9dbe8; }
.dialog-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.close { width: 40px; height: 40px; border: 0; border-radius: 10px; background: #ffffff12; font-size: 22px; line-height: 1; }
.dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + var(--safe-bottom)); z-index: 100;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 18px; border-radius: 14px;
  background: #2a2f4d; color: #fff; font-weight: 600; box-shadow: 0 12px 40px #0009;
  transform: translate(-50%, 140%); opacity: 0; transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; cursor: pointer; }

/* ---------- Tela cheia (TV, tablet na parede) ---------- */

body.focus .topbar, body.focus .room-head, body.focus .side { display: none; }
body.focus .view { max-width: none; padding: 0; }
body.focus .room-layout { display: block; }
body.focus .timer-card {
  min-height: 100vh; min-height: 100dvh;
  border-radius: 0; border: 0;
  align-content: center;
  padding: calc(24px + var(--safe-top)) calc(24px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(24px + var(--safe-left));
}
body.focus .clock { font-size: min(30vw, 44vh); }
body.focus .timer-meta { font-size: clamp(20px, 3.5vw, 40px); }
body.focus .phase-pill { font-size: clamp(16px, 2.4vw, 28px); padding: 8px 20px; }
body.focus .timer-name { font-size: clamp(16px, 2vw, 24px); }
body.focus .timer-sub { max-width: 900px; font-size: clamp(14px, 1.8vw, 22px); }
body.focus .progress { max-width: 900px; height: 12px; }

/* ---------- Responsivo ---------- */

@media (min-width: 760px) {
  .side { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1100px) {
  .room-layout { grid-template-columns: minmax(0, 1.4fr) minmax(360px, 1fr); }
  .timer-card { position: sticky; top: 90px; }
  .side { grid-template-columns: 1fr; }
  .clock { font-size: clamp(110px, 11vw, 190px); }
}

@media (max-width: 640px) {
  .topbar { gap: 10px; padding-left: calc(14px + var(--safe-left)); padding-right: calc(14px + var(--safe-right)); }
  .topbar .brand img { height: 36px; }
  .topbar .brand img + img { height: 17px; }
  .tabs { order: 3; width: 100%; }
  .tabs a { flex: 1; text-align: center; }
  .net, .user { display: none; }
  .view { padding: 18px calc(14px + var(--safe-right)) calc(40px + var(--safe-bottom)) calc(14px + var(--safe-left)); }
  .page-head > .btn { width: 100%; }
  .target { width: 100%; }
  .panel { padding: 16px; }
  .controls { grid-template-columns: 1fr 1fr; }
  .controls .big { grid-column: 1 / -1; order: -1; }
  .t-stats { grid-template-columns: repeat(2, 1fr); }
  .head-actions, .head-actions .btn { width: 100%; }
  .dialog-grid { grid-template-columns: 1fr; }
  dialog { padding: 18px; }
  .sound-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .field-grid { grid-template-columns: 1fr; }
}

/* Celular deitado: aproveita a largura para o relógio. */
@media (max-height: 500px) and (orientation: landscape) {
  .timer-card { gap: 8px; padding: 14px; }
  .clock { font-size: min(22vw, 44vh); }
  .controls .btn, .controls .big { min-height: 46px; }
  .topbar { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ---------- Spinning ---------- */

.kind-badge { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 3px 9px; border-radius: 99px; background: #ff8a3d22; color: #ffb27a; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
h1 .kind-badge { font-size: 13px; }
.intensity { display: block; width: 100%; height: 72px; margin: 4px 0 2px; }
.intensity .bar { fill: #ffffff26; }
.intensity .bar.rest { fill: color-mix(in srgb, var(--rest) 70%, transparent); }
.intensity .bar.prepare { fill: color-mix(in srgb, var(--prepare) 75%, transparent); }
.intensity .bar.work { fill: color-mix(in srgb, var(--work) 80%, transparent); }
.intensity .bar.active { fill: #fff; }
.spin-mini-chart { width: 100%; max-width: 900px; }
.spin-mini-chart .intensity { height: 44px; }
.block-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.block-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: #0e1120; border-left: 4px solid var(--accent); }
.block-row.current { box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 12%, #0e1120); }
.block-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 99px; background: #ffffff14; font-size: 13px; font-weight: 800; }
.block-info { display: grid; gap: 2px; min-width: 0; }
.block-info strong small { color: var(--muted); font-weight: 700; margin-left: 4px; }
.block-info small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.block-song .song b, .spin-song b { color: #e9eaf3; }
.block-actions { display: flex; gap: 4px; }
.icon-btn { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: transparent; font-size: 16px; }
.icon-btn:disabled { opacity: 0.3; }
.spin-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 12px; }
.field.inline { flex: 1 1 180px; }
.spin-now { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip-big { padding: 8px 14px; border-radius: 12px; background: #ffffff10; font-size: clamp(15px, 2.2vw, 20px); font-weight: 800; }
.chip-big.load { background: var(--accent); color: #0d1020; }
.spin-song { color: #d9dbe8; font-size: 15px; text-align: center; min-height: 1.3em; overflow-wrap: anywhere; }
.song-link { margin-left: 6px; color: var(--aqua); font-size: 12px; font-weight: 700; }
.spin-cue { padding: 8px 14px; border-radius: 12px; background: #ffffff0d; color: #e9eaf3; font-size: 15px; text-align: center; }
body.focus .chip-big { font-size: clamp(18px, 3vw, 34px); padding: 10px 20px; }
body.focus .spin-song, body.focus .spin-cue { font-size: clamp(16px, 2.2vw, 26px); }
.dialog-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rpm { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.rpm input { text-align: center; padding: 10px 4px; }
.blk-song { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: 10px; background: #0e1120; font-size: 14px; }
.blk-song img, .track img { border-radius: 6px; flex: none; }
.blk-song > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.search-row { display: flex; gap: 8px; }
.track-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 240px; overflow: auto; }
.track { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: transparent; text-align: left; }
.track:hover { background: #ffffff0a; }
.track span { display: grid; min-width: 0; }
.track small { color: var(--muted); }
.ai-preview:empty { display: none; }
.ai-preview { display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: #0e1120; }
.ai-preview h4 { margin: 0; font-size: 18px; }
.ai-preview .block-row { background: var(--panel); }
.ai-loading { display: flex; align-items: center; gap: 12px; }
.ai-loading span { width: 22px; height: 22px; flex: none; border: 3px solid #ffffff22; border-top-color: var(--violet); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.playlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.playlist li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
@media (max-width: 640px) {
  .dialog-grid.three { grid-template-columns: 1fr; }
  .block-row { grid-template-columns: 26px minmax(0, 1fr); }
  .block-actions { grid-column: 2; }
}
.filters .search { flex: 1 1 220px; min-height: 38px; padding: 8px 12px; border-radius: 99px; }
.class-card .intensity { height: 48px; }
.class-layout { display: grid; gap: 16px; }
@media (min-width: 1100px) { .class-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); align-items: start; } }
.part-line { display: flex; flex-wrap: wrap; gap: 4px; }
.part-line span { padding: 1px 7px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: #e9eaf3; font-size: 11.5px; }
.song-time { font-variant-numeric: tabular-nums; color: var(--muted); }
.parts { display: grid; gap: 6px; }
.parts-head, .part-row { display: grid; grid-template-columns: 64px minmax(0, 1.4fr) 62px 118px minmax(0, 1fr) 36px; gap: 6px; align-items: center; }
.parts-head span { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.part-row input, .part-row select { min-height: 40px; padding: 8px; font-size: 15px; }
.part-row select { padding-right: 24px; background-position: calc(100% - 12px) 50%, calc(100% - 7px) 50%; }
.part-row .rpm { gap: 4px; }
.part-at { text-align: center; font-variant-numeric: tabular-nums; }
.part-row input:disabled { opacity: 0.6; }
@media (max-width: 640px) {
  .parts-head { display: none; }
  .part-row { grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) 36px; grid-template-areas: "at name name rm" "load rpm pos pos"; padding: 8px; border-radius: 10px; background: #0e1120; }
  .part-row [data-p="at"] { grid-area: at; }
  .part-row [data-p="name"] { grid-area: name; }
  .part-row [data-part-remove] { grid-area: rm; }
  .part-row [data-p="load"] { grid-area: load; }
  .part-row .rpm { grid-area: rpm; }
  .part-row [data-p="position"] { grid-area: pos; }
}
.level-line { display: flex; align-items: center; gap: 8px; margin: 0; color: #c9ccdc; }
.level-badge { padding: 2px 8px; border-radius: 99px; background: #4aa3ff22; color: #8cc6ff; font-weight: 800; font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; }
.level-badge[data-level="intermediario"] { background: #ffc54722; color: #ffd57a; }
.level-badge[data-level="avancado"] { background: #ff6b6b22; color: #ff9b9b; }
.ai-check { align-self: end; margin: 0 0 10px; }

/* ---------- Cenário em movimento (tela cheia do spinning) ---------- */
.scenery { display: none; }
body.focus .spin-card.scenic { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px; background: #000; border: 0; overflow: hidden; }
/* Informações da fase no alto, botões embaixo e a estrada livre no meio. */
body.focus .spin-card.scenic .progress { margin-top: auto; }
body.focus .spin-card.scenic .timer-meta { font-size: clamp(16px, 2.4vw, 26px); }
body.focus .spin-card.scenic .controls .btn { min-height: 44px; }
body.focus .spin-card.scenic .timer-tools { opacity: 0.8; }
body.focus .spin-card.scenic .scenery { display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
body.focus .spin-card.scenic > :not(.scenery) { position: relative; z-index: 1; }
body.focus .spin-card.scenic .clock { font-size: min(13vw, 19vh); line-height: 1; color: #fff; text-shadow: 0 4px 30px #000c, 0 0 2px #000; }
body.focus .spin-card.scenic .timer-meta,
body.focus .spin-card.scenic .timer-name,
body.focus .spin-card.scenic .spin-song,
body.focus .spin-card.scenic .timer-sub { color: #fff; text-shadow: 0 2px 10px #000, 0 0 2px #000; }
body.focus .spin-card.scenic .chip-big:not(.load), body.focus .spin-card.scenic .spin-cue { background: #0b0d1ab3; backdrop-filter: blur(4px); }
body.focus .spin-card.scenic .timer-sub, body.focus .spin-card.scenic .progress { max-width: 900px; margin-inline: auto; width: 100%; }
body.focus .spin-card.scenic .progress { background: #00000066; }
body.focus .spin-card.scenic .controls .btn.secondary, body.focus .spin-card.scenic .timer-tools .btn { background: #0b0d1ab3; backdrop-filter: blur(4px); }
body.focus .spin-card.scenic .spin-mini-chart { opacity: 0.85; }
body.focus .spin-card.scenic .spin-song .muted, body.focus .spin-card.scenic .song-time { color: #e9eaf3; }
.focus-only { display: none; }
body.focus .focus-only { display: inline-flex; }

/* ---------- Comandos na tela ---------- */
.cue-line { display: grid; gap: 2px; margin-top: 2px; color: #c9ccdc !important; }
.spin-cues { display: grid; gap: 4px; width: 100%; max-width: 760px; margin: 0 auto; padding: 10px 14px; border-radius: 14px; background: #ffffff0d; text-align: left; }
.cues-title { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.cue { font-size: 15px; color: #e9eaf3; }
.cue b { display: inline-block; min-width: 64px; font-variant-numeric: tabular-nums; color: var(--muted); }
.cue.done { opacity: 0.4; text-decoration: line-through; }
.cue.next { font-size: 17px; font-weight: 700; color: #fff; }
.cue.next b { color: var(--accent); }
body.focus .cue { font-size: clamp(15px, 1.8vw, 22px); }
body.focus .cue.next { font-size: clamp(18px, 2.4vw, 30px); }
body.focus .spin-card.scenic .spin-cues { background: #0b0d1ab3; backdrop-filter: blur(4px); }

/* ---------- Contagem inicial: hora de dar play ---------- */
.play-now { margin: 0; padding: 10px 16px; border-radius: 14px; background: #1db95422; border: 1px solid #1db95466; color: #6ee59a; font-weight: 800; text-align: center; font-size: 16px; }
.play-now.go { background: #1db954; color: #04130a; font-size: clamp(20px, 3vw, 34px); animation: pulse 0.5s ease-in-out infinite alternate; }
body.focus .play-now { font-size: clamp(18px, 2.4vw, 28px); }
body.focus .play-now.go { font-size: clamp(28px, 5vw, 60px); }
.playlist-help { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: #0e1120; font-size: 14px; }
.playlist-help a { color: var(--aqua); }

/* ---------- Sala de spinning: abas recolhíveis e configurações ---------- */
.collapse summary { display: flex; align-items: center; gap: 6px; padding: 10px 2px; cursor: pointer; font-weight: 800; list-style: none; }
.collapse summary::-webkit-details-marker { display: none; }
.collapse summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform 0.2s; }
.collapse:not([open]) summary::after { transform: rotate(-90deg); }
.btn.icon-only { min-width: 44px; padding: 8px 12px; font-size: 18px; }
.settings-dialog { display: none; }
.settings-dialog[open] { display: grid; gap: 14px; }
.settings-section { display: grid; gap: 10px; }
.settings-section + .settings-section { padding-top: 14px; border-top: 1px solid var(--line); }
.voice-group { margin: 4px 0 0; font-size: 13px; font-weight: 800; color: #c9ccdc; }
.voice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inline-select { min-width: 180px; }
@media (max-width: 640px) { .voice-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Marca do professor (Pro) e selo do RX Timer (Free) ---------- */
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.timer-card[style*="--brand"] { box-shadow: inset 0 4px 0 var(--brand); }
.brand-strip { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 6px; color: var(--brand, var(--text)); font-weight: 800; font-size: clamp(16px, 2vw, 22px); letter-spacing: 0.02em; }
.brand-strip img { max-height: 48px; max-width: 200px; object-fit: contain; }
body.focus .brand-strip { position: absolute; left: calc(24px + var(--safe-left)); bottom: calc(18px + var(--safe-bottom)); font-size: clamp(18px, 2.4vw, 30px); }
body.focus .brand-strip img { max-height: clamp(40px, 7vh, 80px); max-width: 30vw; }
.brand-seal { position: absolute; right: 14px; bottom: 10px; font-size: 12px; font-weight: 700; color: var(--muted); opacity: 0.85; letter-spacing: 0.02em; pointer-events: none; }
.brand-colors { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset; }
#brandColor { width: 44px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: none; }
.brand-logo-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.file-btn { cursor: pointer; }
.brand-preview { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 64px; padding: 12px; border-radius: 14px; background: var(--panel-2); box-shadow: inset 0 4px 0 var(--brand, var(--violet)); color: var(--brand, var(--text)); font-weight: 800; font-size: 18px; }
.brand-preview img { max-height: 44px; max-width: 160px; object-fit: contain; }

/* ---------- Criar conta e Assinar o Pro ---------- */
#showSignup { width: 100%; margin-top: 14px; }
#signupForm { display: grid; gap: 14px; }
#signupForm[hidden], #loginForm[hidden] { display: none; }
#signupStatus.error { color: var(--danger); }
.pro-page { display: grid; gap: 18px; max-width: 760px; }
.pro-buy, .pro-status { display: grid; gap: 16px; }
.pro-tag { justify-self: start; padding: 4px 12px; border-radius: 99px; background: color-mix(in srgb, var(--violet) 22%, transparent); color: var(--violet); font-weight: 800; font-size: 13px; }
.pro-periods { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.pro-period { display: grid; gap: 4px; text-align: left; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit; }
.pro-period b { font-size: 24px; font-variant-numeric: tabular-nums; }
.pro-period b small { font-size: 13px; font-weight: 600; color: var(--muted); }
.pro-period > small { color: var(--muted); font-size: 13px; }
.pro-period.active { border-color: var(--violet); box-shadow: 0 0 0 1px var(--violet) inset; }
.pro-trial { margin: 0; color: var(--work); font-size: 14px; }
.card-element { padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.pro-items { margin: 10px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 18px; color: var(--text); }
.pro-items li::before { content: "✓ "; color: var(--work); font-weight: 800; }
#signupForm { margin-top: 12px; }
