@font-face { font-family: "TS Scholar"; src: url("fonts/scholar-italic.otf") format("opentype"); font-style: italic; font-weight: 400; font-display: swap; }

:root {
  --roxo: #52206F;
  --roxo-2: #401860;
  --noite: #14081c;
  --ink: #fff;
  --muted: rgba(255, 255, 255, .62);
  --glass: rgba(255, 255, 255, .08);
  --glass-line: rgba(255, 255, 255, .16);
  --ok: #3ddc84;
  --bad: #ff5a5f;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
  --serif: "TS Scholar", "Scholar", Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: #000; color: var(--ink); font-family: var(--sans);
  -webkit-user-select: none; user-select: none; overscroll-behavior: none;
}
body.brand, body.controle, body.roteiros {
  background: radial-gradient(120% 80% at 100% 0%, var(--roxo) 0%, var(--roxo-2) 35%, var(--noite) 75%) fixed, var(--noite);
  min-height: 100%;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; }
h1, h2 { margin: 0; letter-spacing: -0.02em; }
.muted { color: var(--muted); }

.glass {
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%);
  border-radius: 22px;
}
.btn { padding: 12px 18px; border-radius: 14px; font-weight: 600; }
.btn.ghost { background: rgba(255, 255, 255, .1); }
.btn.solid { background: #fff; color: var(--roxo); }
.btn.danger { background: var(--bad); color: #fff; }
.row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ---------- home ---------- */
.home { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 48px) 16px 32px; }
.home h1 { font-size: 44px; font-weight: 700; }
.home .sub { color: var(--muted); margin: 6px 0 28px; }
.cards { display: grid; gap: 12px; }
.card { text-align: left; padding: 20px 22px; display: grid; gap: 4px; }
.card b { font-size: 22px; }
.card span { color: var(--muted); font-size: 15px; }
.card:active { transform: scale(.98); }

/* ---------- tela (iPad) ---------- */
.stage { position: fixed; inset: 0; overflow: hidden; background: #000; --size: 64px; --guide: 30vh; }
.stage.mh { transform: scaleX(-1); }
.stage.mv { transform: scaleY(-1); }
.stage.mh.mv { transform: scale(-1, -1); }
.text {
  position: absolute; left: 0; right: 0; top: 0;
  padding: var(--guide) 7vw 100vh;
  font-size: var(--size); line-height: 1.3; font-weight: 600; color: #fff;
  will-change: transform; overflow-wrap: break-word;
}
.guide {
  position: absolute; left: 0; right: 0; top: calc(var(--guide) - .08 * var(--size));
  height: calc(1.3 * var(--size) + .08 * var(--size));
  background: rgba(255, 255, 255, .07); border-left: 10px solid var(--roxo); pointer-events: none;
}
.msg { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, .5); font-size: 28px; text-align: center; padding: 24px; pointer-events: none; }
.msg:empty { display: none; }
.count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30vmin; font-weight: 700; color: #fff; pointer-events: none; text-shadow: 0 0 40px var(--roxo); }
.count:empty { display: none; }

.panel {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px)); padding: 18px; display: grid; gap: 14px;
  background: rgba(82, 32, 111, .55); z-index: 5;
}
.panel.hidden { display: none; }
.p-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.p-row.top { gap: 10px; }
.room small, .pick small, .step small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.room b { font-size: 34px; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); margin-left: 8px; }
.dot.ok { background: var(--ok); }
.st { color: var(--muted); }
.link { margin-left: auto; color: var(--muted); text-decoration: underline; font-size: 14px; }
.pick { text-align: left; padding: 12px 14px; border-radius: 14px; background: rgba(0, 0, 0, .25); }
.pick b { font-size: 18px; }
.play { flex: 1; padding: 16px; border-radius: 16px; background: #fff; color: var(--roxo); font-weight: 700; font-size: 20px; }
.step { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.step small { width: 100%; }
.step button { width: 48px; height: 48px; border-radius: 14px; background: rgba(255, 255, 255, .12); font-size: 24px; }
.step b { min-width: 40px; text-align: center; font-size: 20px; font-variant-numeric: tabular-nums; }
.tog { flex: 1; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .1); font-weight: 600; }
.tog.on { background: #fff; color: var(--roxo); }

/* ---------- folhas (listas e confirmações próprias) ---------- */
.sheet-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet { width: min(560px, 100vw); max-height: 80vh; display: flex; flex-direction: column; border-radius: 22px 22px 0 0; background: rgba(40, 14, 56, .92); padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px); }
.sheet header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet h2 { font-size: 20px; }
.sheet .x { width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.sheet-body { overflow: auto; -webkit-overflow-scrolling: touch; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list button { width: 100%; text-align: left; padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, .07); display: grid; gap: 2px; }
.list button.on { background: #fff; color: var(--roxo); }
.list small { color: var(--muted); }
.list button.on small { color: var(--roxo); opacity: .7; }

/* ---------- controle (iPhone) ---------- */
.ctl { max-width: 520px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 16px); display: grid; gap: 12px; }
.ctl-top { display: flex; align-items: center; gap: 8px; }
.ctl-top .dot { margin-left: 0; }
.ctl-top small { color: var(--muted); }
.room-chip { margin-left: auto; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: 13px; font-variant-numeric: tabular-nums; }
.ctl-top .link { margin-left: 4px; }
.preview { height: 150px; overflow: hidden; padding: 12px 14px; position: relative; }
.words { font-size: 19px; line-height: 1.45; font-weight: 500; color: rgba(255, 255, 255, .55); }
.words span { border-radius: 6px; padding: 0 1px; }
.words .cur { background: var(--roxo); color: #fff; box-shadow: 0 0 0 3px var(--roxo); }
.full-btn { justify-self: center; }
.bigplay { width: 136px; height: 136px; border-radius: 50%; justify-self: center; background: #fff; color: var(--roxo); font-size: 44px; font-weight: 700; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.bigplay.on { background: var(--roxo); color: #fff; box-shadow: 0 0 0 3px #fff inset, 0 10px 40px rgba(0, 0, 0, .35); }
.bigplay:active { transform: scale(.96); }
.bigplay.small { width: 64px; height: 64px; font-size: 22px; }
.nav3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nav3 button { padding: 16px 6px; border-radius: 16px; background: rgba(255, 255, 255, .1); font-weight: 600; font-size: 16px; }
.nav3 button:active, .step button:active { background: rgba(255, 255, 255, .25); }
.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.steps .step { padding: 10px; justify-content: space-between; }
.hint { color: var(--muted); text-align: center; margin: 0; min-height: 1em; }

.full { position: fixed; inset: 0; z-index: 20; background: var(--noite); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.full.hidden { display: none; }
.full header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.full .x { width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.full-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 8px 16px 40vh; position: relative; }
.full-body .words { font-size: 22px; color: rgba(255, 255, 255, .8); }
.full-bar { display: flex; align-items: center; gap: 14px; padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px); background: rgba(0, 0, 0, .35); }
.full-bar small { color: var(--muted); }

.keypad-wrap { max-width: 360px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 40px) 16px 24px; text-align: center; display: grid; gap: 14px; }
.keypad-wrap h1 { font-size: 34px; }
.code { display: flex; gap: 12px; justify-content: center; margin: 8px 0; }
.code span { width: 56px; height: 68px; border-radius: 16px; background: rgba(255, 255, 255, .1); display: grid; place-items: center; font-size: 34px; font-weight: 700; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { height: 64px; border-radius: 18px; background: rgba(255, 255, 255, .1); font-size: 26px; font-weight: 600; }
.keypad button:disabled { visibility: hidden; }
.keypad button:active { background: rgba(255, 255, 255, .25); }
.keypad-wrap .link { margin: 8px auto 0; }

/* ---------- roteiros ---------- */
.rot { max-width: 760px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 20px) 16px calc(env(safe-area-inset-bottom) + 24px); display: grid; gap: 14px; }
.rot-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rot-top h1 { font-size: 36px; }
.rot .link { justify-self: center; margin: 0; }
.field { width: 100%; font: inherit; color: #fff; background: rgba(255, 255, 255, .08); border: 1px solid var(--glass-line); border-radius: 14px; padding: 14px; font-size: 17px; -webkit-user-select: text; user-select: text; outline: none; }
.field:focus { border-color: rgba(255, 255, 255, .5); }
.field.area { min-height: 55vh; resize: vertical; line-height: 1.5; }
