:root {
  color-scheme: dark;
  --bg: #05070b;
  --panel: #0d131e;
  --panel-2: #111722;
  --line: #27384d;
  --line-soft: rgba(143, 164, 191, 0.22);
  --text: #f7f9fc;
  --muted: #8fa4bf;
  --blue: #1877f2;
  --red: #e0252a;
  --green: #35d07f;
  --pink: #ff0054;
  --purple: #7c3aed;
  --amber: #ffb84d;
  --radius: 10px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  color: var(--text);
  cursor: pointer;
}

.app-shell,
.screen {
  width: 100vw;
  height: 100vh;
}

.screen {
  display: none;
  background:
    radial-gradient(circle at 72% 20%, rgba(24, 119, 242, 0.18), transparent 32%),
    linear-gradient(135deg, #05070b 0%, #0d131e 100%);
}

.app-shell[data-screen="hub"] .hub-screen,
.app-shell[data-screen="create"] .create-screen,
.app-shell[data-screen="studio"] .studio-screen {
  display: flex;
}

.control,
.icon-button,
.left-rail button,
.right-rail button,
.scene,
.strip-action {
  min-height: 38px;
  border-radius: 8px;
  background: #202838;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.control:active,
.icon-button:active,
.left-rail button:active,
.right-rail button:active,
.scene:active,
.strip-action:active,
.toggle-card:active,
.session-card:active {
  transform: translateY(1px);
}

.primary {
  background: var(--blue);
}

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  background: #202838;
}

.hub-screen {
  flex-direction: column;
  padding: 26px 34px 24px;
  gap: 18px;
}

.hub-header,
.simple-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark,
.rail-brand {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 14px;
  background: var(--blue);
  font-size: 24px;
  font-weight: 1000;
}

.brand-lockup strong {
  display: block;
  font-size: 30px;
  line-height: 1;
}

.brand-lockup small,
.hub-status small,
.create-side span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.session-grid {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.session-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: rgba(13, 19, 30, 0.92);
  text-align: left;
}

.session-thumb {
  position: relative;
  display: grid;
  flex: 1;
  min-height: 230px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #38506b;
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(5, 7, 11, 0.62), transparent 40%, rgba(5, 7, 11, 0.56)),
    radial-gradient(circle at 50% 42%, #172941, #07111f 72%);
}

.session-thumb strong {
  font-size: clamp(30px, 4vw, 58px);
  font-weight: 1000;
}

.session-thumb small {
  margin-top: -60px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 15px;
  font-weight: 900;
}

.portrait-guide::after {
  content: "";
  position: absolute;
  top: 24px;
  bottom: 56px;
  left: 50%;
  width: 170px;
  transform: translateX(-50%);
  border: 2px solid var(--purple);
}

.live-chip,
.thumb-lower {
  position: absolute;
  left: 14px;
  z-index: 1;
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--red);
  font-size: 12px;
  font-weight: 1000;
}

.live-chip {
  top: 14px;
}

.live-chip.purple {
  background: var(--purple);
}

.live-chip.dark {
  background: #303846;
}

.thumb-lower {
  right: 14px;
  bottom: 14px;
  background: rgba(0, 0, 0, 0.82);
}

.session-card h2 {
  margin: 14px 0 4px;
  font-size: 21px;
  line-height: 1.15;
}

.session-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.session-card > span {
  color: var(--green);
  font-size: 13px;
  font-weight: 1000;
}

.hub-status {
  display: grid;
  grid-template-columns: 1fr 1fr 160px;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: rgba(5, 7, 11, 0.7);
}

.hub-status strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
}

.create-screen {
  flex-direction: column;
  padding: 24px 34px;
  gap: 18px;
}

.simple-header {
  min-height: 74px;
}

.simple-header h1 {
  margin: 0;
  font-size: 34px;
}

.simple-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 750;
}

.icon-button {
  width: 52px;
  height: 52px;
  font-size: 30px;
  line-height: 0;
}

.create-layout {
  display: grid;
  flex: 1;
  grid-template-columns: 1fr 330px;
  gap: 18px;
  min-height: 0;
}

.create-main,
.create-side {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(13, 19, 30, 0.92);
}

.create-main {
  padding: 22px;
}

.create-main h2 {
  margin: 0 0 14px;
  font-size: 23px;
}

.create-main h2:not(:first-child) {
  margin-top: 28px;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.features {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.toggle-card {
  min-height: 112px;
  border: 2px solid #303846;
  border-radius: 12px;
  background: #111722;
  text-align: left;
  padding: 16px;
}

.toggle-card span {
  display: block;
  font-size: 21px;
  font-weight: 1000;
}

.toggle-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.toggle-card.active {
  border-color: var(--blue);
  background: rgba(24, 119, 242, 0.18);
}

.toggle-card.red.active {
  border-color: var(--red);
  background: rgba(224, 37, 42, 0.18);
}

.toggle-card.purple.active {
  border-color: var(--purple);
  background: rgba(124, 58, 237, 0.18);
}

.toggle-card.green.active {
  border-color: var(--green);
  background: rgba(53, 208, 127, 0.16);
}

.toggle-card.amber.active {
  border-color: var(--amber);
  background: rgba(255, 184, 77, 0.16);
}

.toggle-card.blue.active {
  border-color: #00a6ff;
  background: rgba(0, 166, 255, 0.16);
}

.create-side {
  padding: 18px;
}

.create-side label {
  display: block;
  margin-bottom: 16px;
}

.create-side input,
.modal-card input {
  width: 100%;
  height: 44px;
  margin-top: 7px;
  border: 1px solid #334257;
  border-radius: 8px;
  background: #151c27;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
  outline: none;
  padding: 0 11px;
}

.studio-screen {
  display: none;
  background: #000;
}

.app-shell[data-screen="studio"] .studio-screen {
  display: grid;
  grid-template-columns: 104px 1fr 104px;
}

.left-rail,
.right-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #05070b;
  padding: 14px 10px;
}

.rail-brand {
  width: 66px;
  height: 60px;
  margin-bottom: 18px;
}

.left-rail button,
.right-rail button {
  width: 76px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
}

.audio-meter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 76px;
  margin-top: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.meter-bars {
  display: flex;
  height: 122px;
  flex-direction: column-reverse;
  gap: 4px;
}

.meter-bars i {
  display: block;
  height: 8px;
  border-radius: 2px;
  background: #1b2430;
}

.meter-bars i.on {
  background: var(--green);
}

.meter-bars i.hot {
  background: var(--amber);
}

.studio-main {
  display: grid;
  min-width: 0;
  grid-template-rows: 58px minmax(0, 1fr) 106px;
  background: #000;
}

.studio-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 12px;
  background: #0d131e;
}

.studio-top > strong {
  min-width: 220px;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-pills,
.stage-pills {
  display: flex;
  gap: 8px;
}

.platform-pills {
  flex: 1;
  min-width: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  height: 30px;
  border-radius: 999px;
  padding: 0 13px;
  background: #303846;
  color: #fff;
  font-size: 12px;
  font-weight: 1000;
  white-space: nowrap;
}

.pill.facebook { background: var(--blue); }
.pill.youtube { background: var(--red); }
.pill.instagram { background: var(--purple); }
.pill.rtmp { background: #606a78; }
.pill.green { background: var(--green); color: #06100a; }

.kbps {
  width: 116px;
  height: 36px;
  border: 1px solid #26384d;
  border-radius: 8px;
  background: #07111f;
  color: var(--green);
  font-size: 15px;
  font-weight: 1000;
}

.studio-top > span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 1000;
}

.program-stage {
  position: relative;
  overflow: hidden;
  margin: 8px;
  border: 1px solid #26374d;
  border-radius: 10px;
  background: #0c131b;
}

#cameraVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #070a0e;
}

.camera-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(37, 61, 91, 0.88), rgba(7, 17, 31, 0.92)),
    linear-gradient(135deg, #101820, #07111f);
}

.camera-fallback strong {
  font-size: clamp(40px, 8vw, 88px);
  font-weight: 1000;
}

.camera-fallback span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 16px;
  font-weight: 850;
}

.safe-area {
  position: absolute;
  top: 10%;
  bottom: 15%;
  left: 21%;
  right: 28%;
  display: grid;
  place-items: center;
  border: 2px solid rgba(85, 112, 143, 0.9);
  color: rgba(255, 255, 255, 0.56);
  font-size: 16px;
  font-weight: 1000;
  pointer-events: none;
}

.instagram-guide {
  position: absolute;
  top: 10%;
  bottom: 15%;
  left: 45%;
  width: 160px;
  display: grid;
  place-items: start center;
  border: 2px solid var(--purple);
  color: #d6c8ff;
  font-size: 13px;
  font-weight: 1000;
  padding-top: 10px;
}

.camera-dock {
  position: absolute;
  top: 50%;
  left: 14px;
  display: grid;
  width: 54px;
  gap: 8px;
  padding: 12px 8px;
  transform: translateY(-50%);
  border: 1px solid #1f2c3d;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.66);
}

.camera-dock button {
  height: 28px;
  border-radius: 6px;
  background: transparent;
  color: #c8d2df;
  font-size: 11px;
  font-weight: 1000;
}

.stage-pills {
  position: absolute;
  top: 14px;
  right: 280px;
  flex-direction: column;
}

.lower-third {
  position: absolute;
  left: 20px;
  bottom: 56px;
  width: min(520px, 50%);
  height: 44px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.82);
  font-size: 17px;
  font-weight: 1000;
  padding: 0 18px;
  white-space: nowrap;
}

#webOverlay {
  position: absolute;
  top: 58px;
  right: 18px;
  bottom: 76px;
  width: 236px;
  border: 3px solid var(--green);
  border-radius: 10px;
  background: #07111f;
}

.marquee {
  position: absolute;
  right: 278px;
  bottom: 16px;
  left: 20px;
  height: 32px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.92);
}

.marquee span {
  position: absolute;
  display: inline-block;
  min-width: 100%;
  white-space: nowrap;
  animation: marquee 12s linear infinite;
  font-size: 15px;
  font-weight: 1000;
  line-height: 32px;
}

@keyframes marquee {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

.scene-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  background: #0d131e;
}

.scene-strip > span {
  width: 58px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 1000;
}

.scene {
  width: 98px;
  height: 70px;
  border: 1px solid #303846;
  background: #171d27;
}

.scene.active {
  border: 2px solid var(--pink);
  background: #26344c;
}

.strip-action {
  width: 104px;
  height: 50px;
  margin-left: auto;
}

.strip-action + .strip-action {
  margin-left: 0;
}

.right-rail {
  justify-content: center;
}

.go-button {
  width: 76px !important;
  height: 78px;
  margin-bottom: 18px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: var(--pink) !important;
  font-size: 28px !important;
}

.right-rail strong {
  margin-bottom: 20px;
  color: var(--green);
  font-size: 14px;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.84);
}

.modal-layer[hidden] {
  display: none;
}

.modal-card {
  width: min(620px, calc(100vw - 44px));
  border: 1px solid #2d3f55;
  border-radius: 14px;
  background: #0d121b;
  padding: 20px;
}

.modal-card.wide {
  width: min(680px, calc(100vw - 44px));
}

.modal-card h2 {
  margin: 0 0 16px;
  font-size: 28px;
}

.modal-card p {
  margin: 8px 0;
  color: #c8d2df;
  font-weight: 760;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid #253348;
  border-radius: 8px;
  background: #111722;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 900;
}

.status-row em {
  color: var(--green);
  font-style: normal;
}

.reconnect-title {
  color: var(--text);
  font-size: clamp(30px, 5vw, 46px);
  text-align: center;
}

.hidden {
  display: none !important;
}

@media (orientation: portrait) {
  .app-shell::after {
    content: "Gire o celular para usar a mesa KR LIVE";
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    background: #05070b;
    color: var(--text);
    font-size: 24px;
    font-weight: 1000;
    text-align: center;
    padding: 28px;
  }
}

@media (max-width: 900px) {
  .session-grid {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .hub-status {
    grid-template-columns: 1fr;
  }

  .create-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .toggle-grid,
  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell[data-screen="studio"] .studio-screen {
    grid-template-columns: 82px 1fr 86px;
  }

  .left-rail button,
  .right-rail button {
    width: 62px;
  }

  .studio-top > strong {
    min-width: 120px;
  }
}
