:root {
  --bg: #0A0A0B; --bg-2: #0c0c0f; --surface: #121214; --surface-2: #16161b;
  --border: #1f1f25; --border-2: #2a2a33;
  --text: #ededef; --muted: #9a9aa6; --muted-2: #8a8a96;
  --accent: #a78bfa; --accent-strong: #8b5cf6; --accent-glow: #c4b5fd;
  --accent2: #fbbf24; --accent2-strong: #f59e0b;
  --ok: #4ade80; --perigo: #f87171;
  --duo: linear-gradient(110deg, var(--accent-glow) 8%, var(--accent2) 92%);
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.23, 1, 0.32, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-body);
  padding-bottom: 84px; min-height: 100vh;
  line-height: 1.5; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* brilhos de fundo (motif) */
.glows { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.glows::before, .glows::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(90px); opacity: .14;
}
.glows::before { width: 380px; height: 380px; top: -120px; right: -80px; background: var(--accent); }
.glows::after { width: 320px; height: 320px; bottom: 40px; left: -120px; background: var(--accent2); }

/* ---------- Header ---------- */
.topo { padding: 22px 18px 12px; max-width: 660px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  font-size: 1.4rem; width: 46px; height: 46px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 13px;
  box-shadow: 0 0 24px -10px var(--accent);
}
.brand h1 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.grad { background: var(--duo); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mono-sub { font-family: var(--font-mono); font-size: .74rem; color: var(--muted); margin-top: 1px; }
.mono-sub .dim { color: var(--accent); }

main { padding: 10px 14px 20px; max-width: 660px; margin: 0 auto; }

.aba { display: none; }
.aba.ativa { display: block; animation: rise .4s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 17px; margin-bottom: 14px;
}
.rotulo {
  display: block; font-family: var(--font-mono); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2); margin-bottom: 12px;
}
.rotulo::before { content: "// "; color: var(--accent); }

/* Foco — herói */
.foco {
  position: relative; overflow: hidden;
  background: radial-gradient(120% 120% at 0% 0%, #17141f 0%, var(--surface) 55%);
  border-color: var(--border-2);
}
.foco::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--duo); opacity: .8;
}
.foco-materia {
  display: inline-flex; align-items: center; font-family: var(--font-mono); font-size: .72rem;
  font-weight: 500; padding: 4px 11px; border-radius: 999px; color: #0A0A0B; margin-bottom: 10px;
}
.foco-titulo {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 700;
  line-height: 1.2; letter-spacing: -.02em;
}
.foco-acoes { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* Timer */
.timer-card { text-align: center; }
#cronometro {
  font-family: var(--font-mono); font-size: 2.9rem; font-weight: 500;
  font-variant-numeric: tabular-nums; letter-spacing: 1px; margin: 6px 0 16px;
  transition: color .3s, text-shadow .3s;
}
.timer-card.rodando #cronometro { color: var(--accent-glow); text-shadow: 0 0 28px var(--accent); }
.timer-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- Botões ---------- */
.btn {
  font-family: var(--font-body); background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-2); padding: 11px 18px; border-radius: 12px;
  font-size: .92rem; font-weight: 600; cursor: pointer;
  transition: transform .18s var(--ease-spring), box-shadow .3s, filter .2s, background .2s;
}
.btn:active { transform: scale(.95); }
.btn.primario { background: var(--duo); border: none; color: #0A0A0B; }
.btn.primario:hover { box-shadow: 0 12px 36px -12px var(--accent2); filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-glow); }
.btn.perigo { background: transparent; border-color: #4a2230; color: var(--perigo); }
.btn.perigo:hover { background: #1c0f14; box-shadow: 0 10px 30px -14px var(--perigo); }
.btn.mini { padding: 7px 13px; font-size: .8rem; border-radius: 10px; }

/* ---------- Inputs ---------- */
input, textarea, select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border-2);
  color: var(--text); border-radius: 12px; padding: 12px; font-size: .95rem;
  font-family: inherit; margin-bottom: 10px; resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #a78bfa22;
}
input[type=color] { width: 48px; height: 46px; padding: 4px; margin: 0; cursor: pointer; }
.linha { display: flex; gap: 10px; align-items: flex-end; }
.linha .btn { flex: 1; }
.peso-label { font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase;
  letter-spacing: .03em; color: var(--muted-2); display: flex; flex-direction: column; gap: 5px; }
.peso-label select { margin: 0; padding: 9px; }

/* ---------- Plano / listas ---------- */
.plano-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 0; border-top: 1px solid var(--border);
}
.plano-item:first-child { border-top: none; }
.bolinha { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; box-shadow: 0 0 10px -1px currentColor; }
.plano-texto { flex: 1; min-width: 0; }
.plano-texto small { font-family: var(--font-mono); color: var(--muted); display: block; font-size: .7rem; }
.plano-texto span { font-size: .96rem; }

/* ---------- Stats ---------- */
.stats { display: flex; gap: 10px; }
.stat {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 15px 8px; text-align: center;
}
.stat b { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; display: block; }
.stat:first-child b { background: var(--duo); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-family: var(--font-mono); font-size: .64rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2); }

/* ---------- Matérias ---------- */
.materia-bloco { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; margin-bottom: 12px; overflow: hidden; transition: border-color .25s; }
.materia-bloco.aberta { border-color: var(--border-2); }
.materia-cab { display: flex; align-items: center; gap: 11px; padding: 15px 16px; cursor: pointer; }
.materia-cab .nome { flex: 1; font-weight: 600; font-size: 1rem; }
.materia-cab .prog { font-family: var(--font-mono); font-size: .76rem; color: var(--muted); }
.barra { height: 4px; background: var(--bg-2); overflow: hidden; }
.barra > i { display: block; height: 100%; background: var(--duo); transition: width .5s var(--ease); }
.materia-caps { padding: 4px 16px 14px; display: none; }
.materia-bloco.aberta .materia-caps { display: block; animation: rise .3s var(--ease); }
.cap-item { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-top: 1px solid var(--border); }
.cap-item .titulo { flex: 1; font-size: .92rem; transition: color .2s; }
.cap-item.concluido .titulo { color: var(--muted-2); text-decoration: line-through; }
.check {
  width: 23px; height: 23px; border-radius: 8px; border: 2px solid var(--border-2); cursor: pointer;
  flex-shrink: 0; display: grid; place-items: center; font-size: .78rem; color: transparent;
  transition: background .2s, border-color .2s, transform .15s var(--ease-spring);
}
.check:active { transform: scale(.85); }
.check.on { background: var(--ok); border-color: var(--ok); color: #06210f; }
.cap-add { display: flex; gap: 8px; margin-top: 12px; }
.cap-add input { margin: 0; }
.lixo { background: none; border: none; color: var(--muted-2); cursor: pointer; font-size: 1rem; padding: 4px; transition: color .2s, transform .15s; }
.lixo:hover { color: var(--perigo); transform: scale(1.1); }

/* ---------- Notas ---------- */
.nota-item { border: 1px solid var(--border); border-radius: 13px; padding: 13px; margin-bottom: 10px; background: var(--surface); }
.nota-item .conteudo { white-space: pre-wrap; word-break: break-word; font-size: .95rem; }
.nota-item .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; }
.nota-item small { font-family: var(--font-mono); color: var(--muted-2); font-size: .68rem; }

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 4px;
  background: rgba(10,10,11,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  max-width: 660px; margin: 0 auto;
}
.tab {
  flex: 1; background: none; border: none; color: var(--muted-2); padding: 9px 0 7px;
  font-family: var(--font-body); font-size: .76rem; font-weight: 600; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 12px;
  transition: color .2s, background .2s;
}
.tab .ico { font-size: 1.1rem; line-height: 1; }
.tab.ativa { color: var(--accent-glow); background: #a78bfa10; }

.vazio { color: var(--muted); font-size: .9rem; padding: 6px 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  padding: 12px 18px; border-radius: 12px; font-size: .88rem; font-weight: 500; opacity: 0;
  pointer-events: none; transition: .3s var(--ease); z-index: 50; max-width: 90%;
  box-shadow: 0 16px 40px -16px #000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (hover: none) {
  .btn.primario:hover, .btn.perigo:hover, .btn.ghost:hover { box-shadow: none; }
}
