@font-face { font-family: 'Geist Mono'; src: url(fonts/geist-mono-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url(fonts/geist-mono-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --bg: #070b16;
  --panel: #0c1326;
  --line: #1a2747;
  --tile: #111b33;
  --tile-hover: #16244a;
  --line-hover: #3b6fd8;
  --accent: #5b9cff;
  --accent-strong: #2f6fe0;
  --text: #e6edf8;
  --muted: #8a9bbd;
  --user: #6f86b8;
  --danger: #ff7a8a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
}
main { width: 100%; max-width: 600px; position: relative; z-index: 1; }

/* constelação: atrás de tudo, sem pegar clique */
.sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* título */
.tbox {
  width: max-content; max-width: 100%;
  margin: 0 auto 22px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 14px 26px;
  display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap;
}
.u { font-size: 22px; color: var(--user); }
.at { font-size: 22px; color: var(--accent); margin: 0 2px; }
.d { font-size: 32px; font-weight: 500; letter-spacing: -0.5px; }
a.tbox { color: inherit; text-decoration: none; cursor: pointer; transition: border-color .15s, background .15s; background: rgba(7, 11, 22, .55); }
a.tbox:hover, a.tbox[aria-expanded=true] { border-color: var(--line-hover); }
a.tbox:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.typed { font-size: 16px; color: #a9c8ff; white-space: pre; }
.twrap { position: relative; width: max-content; max-width: 100%; margin: 0 auto 22px; }
.tbox { user-select: none; -webkit-user-select: none; }
.twrap .tbox { margin: 0; }
.mailmenu {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 3;
  background: var(--panel); border: 1px solid var(--line-hover); border-radius: 12px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px; min-width: 160px;
}
.mailmenu[hidden] { display: none; }
.mailmenu button, .mailmenu a {
  background: none; border: 0; border-radius: 8px; padding: 9px 12px; text-align: left;
  color: var(--text); font-size: 12px; text-decoration: none; display: block;
}
.mailmenu button:hover, .mailmenu a:hover, .mailmenu :focus-visible { background: var(--tile-hover); outline: none; }
.cur { font-size: 32px; color: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* painel e botões */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 18px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 18px;
}
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 72px; text-decoration: none; position: relative;
  -webkit-tap-highlight-color: transparent;
}
.sq {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--tile); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, transform .15s;
}
.sq svg, .ig svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sq svg .f, .ig svg .f { fill: #fff; stroke: none; }
.tile:hover .sq, .tile:focus-visible .sq { background: var(--tile-hover); border-color: var(--line-hover); transform: translateY(-2px); }
.tile:focus-visible { outline: none; }
.lb { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* login */
.login { flex-direction: column; align-items: stretch; gap: 10px; max-width: 320px; margin: 0 auto; font-size: 12px; color: var(--muted); }
.msg { font-size: 12px; color: var(--muted); text-align: center; margin: 0; }
.msg[role=alert], .err { color: var(--danger); }

input, button { font: inherit; }
input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; color: var(--text); font-size: 13px; width: 100%;
}
input:focus { outline: none; border-color: var(--line-hover); }
button, .bb {
  text-decoration: none; display: inline-block; line-height: 1.4;
  font-size: 12px; padding: 7px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--tile); color: var(--text);
}
button:hover { border-color: var(--line-hover); }
button.p { background: var(--accent-strong); border-color: var(--accent); }
button.danger { color: var(--danger); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* editor */
.bar { position: fixed; top: 14px; right: 14px; z-index: 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.bar .st { font-size: 11px; color: var(--muted); }
.bar form { margin: 0; }
.editing .tile { cursor: grab; touch-action: none; user-select: none; }
.editing .tile.sel .sq { border-color: var(--accent); background: var(--tile-hover); }
.editing .tile.off .sq { opacity: .45; }
.editing .tile.ghost { opacity: .35; }
.drag-clone { position: fixed; pointer-events: none; z-index: 10; opacity: .9; transform: scale(1.06); }
.x {
  position: absolute; top: -6px; right: -2px; width: 20px; height: 20px; padding: 0;
  border-radius: 50%; background: var(--line); border: 1px solid var(--line-hover);
  color: var(--text); font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.add .sq { background: transparent; border: 1.5px dashed var(--line-hover); color: var(--accent); font-size: 26px; }
.add { cursor: pointer; background: none; border: 0; padding: 0; font: inherit; }

.form {
  max-width: 340px; margin: 20px auto 0; background: var(--panel);
  border: 1px solid var(--line-hover); border-radius: 14px; padding: 14px;
  font-size: 12px; color: var(--muted);
}
.form .head { color: var(--text); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.form label { display: block; margin: 10px 0 4px; }
.ig { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ig button { width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; }
.ig svg { width: 18px; height: 18px; }
.ig button.on { border-color: var(--accent); background: var(--tile-hover); }
.form .row { display: flex; gap: 8px; margin-top: 14px; justify-content: space-between; flex-wrap: wrap; }
.form .hint { margin: 6px 0 0; font-size: 11px; }

@media (max-width: 480px) {
  .d, .cur { font-size: 24px; }
  .u, .at { font-size: 17px; }
  .typed { font-size: 13px; }
  .tbox { padding: 12px 18px; }
  .panel { gap: 14px; padding: 18px 12px; }
}

/* Em tela estreita a barra do editor entra no fluxo, acima do título. */
@media (max-width: 900px) {
  .bar { position: static; margin-bottom: 18px; justify-content: center; }
  body.editing { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .cur { animation: none; }
  .sq { transition: none; }
}
