/* ================================================================
   LOUSA DIGITAL PELO CELULAR (lousa-digital.html)
   Mesma lousa verde com moldura de madeira do topo da home.
   ================================================================ */
.lousa-page {
  --lousa-verde: #24553f;
  --madeira: linear-gradient(180deg, #a86b3c, #7a4a26);
}

/* ---------- início ---------- */
.ld-hero {
  text-align: center;
  max-width: 720px;
  margin: 1.5rem auto 1.75rem;
}

.ld-hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  margin: 0.6rem 0 0.5rem;
}

.ld-hero p {
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.55;
}

.ld-selo {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full, 999px);
  background: var(--warning-soft);
  color: #fcd34d;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ld-escolha {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1rem;
  max-width: 960px;
  margin: 0 auto;
}

.ld-cartao {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.ld-cartao-tv {
  border-color: rgba(134, 239, 172, 0.35);
}

.ld-cartao h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  margin: 0;
}

.ld-cartao p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.ld-btn-grande {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 52px;
  font-size: 1.05rem;
  font-weight: 700;
}

.ld-cartao .ld-btn-grande {
  margin-top: auto;
}

.ld-form-codigo {
  display: flex;
  gap: 0.5rem;
}

.ld-form-codigo input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
}

.ld-nota {
  font-size: 0.85rem;
  color: var(--text-muted) !important;
}

.ld-nota a {
  color: inherit;
}

/* Lousinha de exemplo nos cartões */
.ld-mini-lousa {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  aspect-ratio: 16 / 7;
  padding: 0.8rem 1.1rem;
  border: 8px solid #8a5630;
  border-radius: 10px;
  background:
    radial-gradient(ellipse at 30% 25%, rgba(255, 255, 255, 0.07), transparent 60%),
    var(--lousa-verde);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.45), 0 10px 24px rgba(0, 0, 0, 0.35);
  font-family: 'Caveat', 'Comic Sans MS', cursive;
  font-weight: 700;
  line-height: 1.1;
}

.ld-mini-l1 {
  color: #f8fafc;
  font-size: clamp(1.6rem, 3.6vw, 2.3rem);
}

.ld-mini-l2 {
  color: #fde68a;
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
}

.ld-passos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  max-width: 960px;
  margin: 1.25rem auto 0;
  padding: 0;
  list-style: none;
}

.ld-passos li {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.45;
}

.ld-passos b {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--lousa-verde);
  color: #fde68a;
  font-size: 0.9rem;
}

.ld-teste {
  max-width: 960px;
  margin: 1rem auto 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 760px) {
  .ld-escolha,
  .ld-passos {
    grid-template-columns: 1fr;
  }

  .ld-hero {
    margin-top: 1rem;
  }
}

/* ---------- a lousa (TV e celular) ---------- */
/* O quadro é a superfície verde em 16:9; a moldura fica por fora, para o desenho não distorcer */
.ld-quadro {
  --moldura: 12px;
  position: relative;
  border-radius: 4px;
  box-shadow: 0 0 0 var(--moldura) #8a5630, 0 0 0 calc(var(--moldura) + 1px) rgba(255, 255, 255, 0.1), 0 24px 50px rgba(0, 0, 0, 0.55);
}

.ld-quadro::before {
  content: '';
  position: absolute;
  inset: calc(var(--moldura) * -1);
  z-index: -1;
  border-radius: 8px;
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 9px),
    var(--madeira);
}

.ld-superficie {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 4px;
  background:
    radial-gradient(ellipse at 30% 25%, rgba(255, 255, 255, 0.07), transparent 60%),
    radial-gradient(ellipse at 75% 80%, rgba(255, 255, 255, 0.05), transparent 55%),
    var(--lousa-verde);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.45);
}

.ld-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------- TV ---------- */
body.ld-modo-tv,
body.ld-modo-cel {
  overflow: hidden;
  background: #101113;
}

body.ld-modo-tv > .slim-header,
body.ld-modo-tv #ldSeo,
body.ld-modo-tv #ldRodape,
body.ld-modo-cel > .slim-header,
body.ld-modo-cel #ldSeo,
body.ld-modo-cel #ldRodape {
  display: none !important;
}

body.ld-sem-cursor,
body.ld-sem-cursor * {
  cursor: none !important;
}

.ld-tv {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #101113;
}

.ld-convite {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: min(760px, calc(100vw - 48px));
  padding: 1.5rem;
  border-radius: 18px;
  background: rgba(16, 17, 19, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55);
  transform: translate(-50%, -50%);
}

.ld-convite-oculto {
  display: none;
}

.ld-convite-qr {
  flex: 0 0 auto;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  line-height: 0;
}

.ld-convite-qr img,
.ld-convite-qr canvas {
  display: block;
  width: 220px !important;
  height: 220px !important;
}

.ld-convite-qr p {
  width: 200px;
  color: #111;
  line-height: 1.4;
}

.ld-convite-txt {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.45;
}

.ld-convite-txt strong {
  color: #fff;
  font-size: 1.45rem;
  line-height: 1.2;
}

.ld-convite-txt b {
  color: #fff;
}

.ld-codigo {
  color: #fde68a;
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
}

.ld-status {
  align-self: flex-start;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.ld-status.ok {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.4);
}

.ld-convite-fechar {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
}

.ld-convite-fechar:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.ld-barra {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  display: flex;
  gap: 0.4rem;
  padding: 0.35rem;
  border-radius: 14px;
  background: rgba(16, 17, 19, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: opacity 0.4s ease;
}

.ld-barra-oculta {
  opacity: 0;
  pointer-events: none;
}

.ld-barra-btn,
.ld-chip-codigo {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-body);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.ld-barra-btn:hover,
.ld-chip-codigo:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.ld-chip-codigo {
  color: #fde68a;
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  letter-spacing: 0.08em;
}

@media (max-width: 760px) {
  .ld-convite {
    flex-direction: column;
    text-align: center;
  }

  .ld-status {
    align-self: center;
  }

  .ld-barra-btn span {
    display: none;
  }
}

/* ---------- celular ---------- */
.ld-cel {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: none;
  background: #101113;
  padding-bottom: env(safe-area-inset-bottom);
}

.ld-cel[hidden] {
  display: none;
}

.ld-cel-topo {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  padding-top: max(0.55rem, env(safe-area-inset-top));
  background: rgba(16, 17, 19, 0.96);
  border-bottom: 1px solid var(--border);
}

.ld-cel-titulo {
  flex: 1;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
}

.ld-cel-titulo b {
  color: #fde68a;
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  letter-spacing: 0.08em;
}

.ld-conn {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.ld-conn.ok {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.4);
}

.ld-conn.erro {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.ld-cel-sair {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.ld-cel-entrar {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 1.5rem 1.1rem 2rem;
  text-align: center;
}

.ld-cel-entrar h1 {
  margin: 0.4rem 0 0;
  font-size: 1.5rem;
}

.ld-cel-entrar p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.ld-cel-app {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0.9rem 0.5rem 1.2rem;
}

.ld-cel-app[hidden],
.ld-cel-entrar[hidden] {
  display: none;
}

.ld-cel-palco {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 6px;
}

.ld-quadro-cel {
  --moldura: 6px;
}

.ld-canvas-pad {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.ld-apagando .ld-canvas-pad {
  cursor: cell;
}

.ld-aviso-toque {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem 0.5rem 0.9rem;
  border-radius: 999px;
  background: rgba(16, 17, 19, 0.92);
  color: #fde68a;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.ld-aviso-toque[hidden] {
  display: none;
}

.ld-aviso-toque button {
  padding: 0.3rem 0.7rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  pointer-events: auto;
}

.ld-ferramentas {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

.ld-digitar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 54px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #2f6b50, var(--lousa-verde));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 8px 18px rgba(0, 0, 0, 0.35);
  color: #fff;
  font: inherit;
  font-size: 1.08rem;
  font-weight: 800;
  cursor: pointer;
}

.ld-digitar .ico {
  width: 1.35em;
  height: 1.35em;
}

.ld-linha {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

#ldCores,
.ld-cores-txt {
  justify-content: space-between;
}

.ld-cores-txt .ld-cor {
  max-width: 40px;
}

.ld-cor {
  flex: 1;
  max-width: 54px;
  aspect-ratio: 1;
  border: 3px solid transparent;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.ld-cor.on {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.6);
}

.ld-seg {
  display: flex;
  flex: 1;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.ld-seg button {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.ld-seg button.on {
  background: var(--surface-hover);
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--border-hover);
}

.ld-seg i {
  display: block;
  width: 26px;
  height: var(--t);
  border-radius: 99px;
  background: #f8fafc;
}

.ld-ferr {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 48px;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-body);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.ld-ferr.on {
  border-color: #fde68a;
  color: #fde68a;
  background: rgba(253, 230, 138, 0.1);
}

.ld-ferr-perigo {
  color: #fca5a5;
}

.ld-dica-girar {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

/* Celular deitado: lousa grande à esquerda, ferramentas numa coluna */
body.ld-deitado .ld-cel-app {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.4rem 0.4rem 0.4rem 0;
}

body.ld-deitado .ld-cel-palco {
  flex: 1;
  padding: 6px;
}

body.ld-deitado .ld-ferramentas {
  flex: 0 0 210px;
  gap: 0.45rem;
  padding: 0;
}

body.ld-deitado .ld-digitar {
  min-height: 46px;
  font-size: 0.98rem;
}

body.ld-deitado #ldCores {
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-start;
}

body.ld-deitado .ld-cor {
  flex: 0 0 30px;
}

body.ld-deitado .ld-seg button {
  min-height: 34px;
}

body.ld-deitado .ld-ferr {
  min-height: 38px;
  font-size: 0.78rem;
  white-space: nowrap;
  padding: 0 0.4rem;
}

body.ld-deitado .ld-dica-girar {
  display: none;
}

/* ---------- folha "Digitar" ---------- */
.ld-folha-fundo {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

.ld-folha-fundo[hidden] {
  display: none;
}

.ld-folha {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 560px;
  max-height: 100%;
  overflow-y: auto;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.45);
}

.ld-folha-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ld-folha-topo h2 {
  margin: 0;
  font-size: 1.15rem;
}

.ld-folha-fechar {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.ld-folha textarea {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.4;
  resize: vertical;
}

.ld-opcao {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ld-opcao > span {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ld-seg-txt button {
  min-height: 40px;
  padding: 0 0.3rem;
  font-size: 0.86rem;
}

.ld-f-forma { font-family: 'Andika', sans-serif; font-size: 0.98rem !important; }
.ld-f-cursiva { font-family: 'Playwrite BR', cursive; font-size: 0.8rem !important; }
.ld-f-giz { font-family: 'Caveat', cursive; font-weight: 700 !important; font-size: 1.15rem !important; }

.ld-previa {
  overflow: hidden;
  padding: 0.7rem 1rem;
  border: 6px solid #8a5630;
  border-radius: 8px;
  background: var(--lousa-verde);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.5;
}

@media (min-width: 700px) {
  .ld-folha-fundo {
    align-items: center;
  }

  .ld-folha {
    border-radius: 18px;
  }
}

/* ---------- escrever direto no computador ---------- */
.ld-tv .ld-quadro {
  touch-action: none;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Crect x='11' y='-2' width='7' height='22' rx='2' fill='%23f8fafc' stroke='%2394a3b8' transform='rotate(35 14 14)'/%3E%3C/svg%3E") 3 25, crosshair;
}

.ld-tv .ld-quadro.ld-apagando {
  cursor: cell;
}

.ld-tv .ld-aviso-toque {
  top: 16px;
  bottom: auto;
}

.ld-tv-ferr {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: calc(100vw - 32px);
  padding: 0.4rem;
  border-radius: 16px;
  background: rgba(16, 17, 19, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transform: translateX(-50%);
  transition: opacity 0.4s ease;
}

.ld-tv-ferr.ld-barra-oculta {
  opacity: 0;
  pointer-events: none;
}

body.ld-desenhando .ld-tv-ferr,
body.ld-desenhando .ld-barra {
  opacity: 0.15;
  pointer-events: none;
}

.ld-tv-digitar {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(180deg, #2f6b50, var(--lousa-verde));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.ld-tv-cores {
  display: flex;
  gap: 0.3rem;
}

.ld-tv-cores .ld-cor {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
}

.ld-tv-seg {
  flex: 0 0 auto;
}

.ld-tv-seg button {
  min-height: 34px;
  padding: 0 0.55rem;
}

.ld-barra-btn.on {
  color: #fde68a;
  background: rgba(253, 230, 138, 0.12);
}

.ld-escrever-aqui {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

@media (max-width: 900px) {
  .ld-tv-ferr .ld-barra-btn span {
    display: none;
  }

  .ld-tv-cores .ld-cor {
    flex-basis: 24px;
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 760px) {
  .ld-escrever-aqui {
    align-self: center;
  }
}

/* ---------- celular em pé: a tela gira para a lousa ficar deitada ---------- */
body.ld-girado .ld-cel {
  inset: auto;
  top: 0;
  transform-origin: top left;
  transform: rotate(90deg);
}
