body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #ddd;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;           /* permite quebrar em mais linhas em telas menores */
}

header input[type="text"] {
  padding: 0.35rem 0.5rem;
}

header button,
header select {
  padding: 0.35rem 0.6rem;
}

#fileName {
  width: 280px;
}

#titleInput {
  width: 180px;
}

main {
  flex: 1;
  display: flex;
  min-height: 0;
}

.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pane-title {
  padding: 0.4rem 0.7rem;
  border-bottom: 1px solid #eee;
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

textarea {
  flex: 1;
  width: 100%;
  border: none;
  resize: none;
  padding: 0.7rem;
  font-family: ui-monospace, "Fira Code", monospace;
  font-size: 0.9rem;
  outline: none;
  box-sizing: border-box;
}

#preview {
  flex: 1;
  padding: 0.7rem;
  overflow: auto;
}

#status {
  font-size: 0.75rem;
  padding: 0.2rem 0.7rem 0.4rem;
  color: #999;
}

/* ===============================
   Cheat sheet lateral
=============================== */

.pane-cheats {
  flex: 0 0 260px;
  max-width: 280px;
  border-left: 1px solid #eee;
  background: #fafafa;
  font-size: 0.8rem;
  display: none; /* começa oculto */
}

body.show-cheats .pane-cheats {
  display: flex;
}

.cheat-content {
  flex: 1;
  padding: 0.5rem 0.7rem;
  overflow: auto;
}

/* Deixa o cheat sheet legível */
.cheat-content h1,
.cheat-content h2,
.cheat-content h3 {
  font-size: 1rem;
  margin: 0.75rem 0 0.25rem;
}

.cheat-content code,
.cheat-content pre {
  font-size: 0.75rem;
}

/* ===============================
   Responsividade
=============================== */

@media (max-width: 800px) {
  main {
    flex-direction: column;   /* empilha as colunas */
  }

  .pane {
    flex: 0 0 auto;
    width: 100%;              /* garante 100% da largura */
  }

  .pane-title {
    display: none;            /* opcional: some com os títulos pra economizar espaço */
  }

  .pane-cheats {
    max-width: 100%;
    flex: 0 0 auto;
    border-left: none;
    border-top: 1px solid #eee;
  }

  header {
    align-items: flex-start;  /* header mais confortável quando quebra */
  }

  #fileName {
    width: 100%;              /* campos ocupam a largura toda */
    max-width: 100%;
  }

  #titleInput {
    width: 100%;
    max-width: 100%;
  }
}
