/* Portal Trilha do Trabalho — identidade do Professor Sérgio (azul #699EB8 / #2E5A72) */
:root {
  --bg: #f4f7f9; --card: #ffffff; --ink: #1b2033; --soft: #4b5563; --line: #dbe4ea;
  --brand: #699eb8; --brand-d: #2e5a72; --good: #1f7a4d; --bad: #b3261e; --chip: #e7f0f5;
  --shadow: 0 1px 2px rgba(20, 40, 60, .06), 0 6px 18px rgba(20, 40, 60, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a22; --card: #16232d; --ink: #e8eef2; --soft: #a9b7c2; --line: #263743;
    --brand: #7fb4cf; --brand-d: #9cc9df; --good: #55c48a; --bad: #ff8a80; --chip: #1d3241;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--brand-d); }
.muted { color: var(--soft); }
.lead { color: var(--soft); max-width: 60ch; }

.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-in { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand img { height: 30px; width: auto; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-light { display: none; } :root:not([data-theme="light"]) .logo-dark { display: inline; } }
.nav { display: flex; gap: 4px; flex: 1 1 auto; flex-wrap: nowrap; overflow-x: auto; }
.nav a { white-space: nowrap; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--soft); font-weight: 600; }
.nav a:hover { background: var(--chip); }
.nav a.on { background: var(--chip); color: var(--brand-d); }
.who { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--soft); }
.who-mail { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-link { background: none; border: 0; color: var(--brand-d); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 4px; }
.demo-bar { background: #fff4d6; color: #5c4400; text-align: center; padding: 8px 16px; font-size: 14px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .demo-bar { background: #3b3113; color: #f1dc9b; } }

.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.7rem; margin: 0 0 12px; color: var(--brand-d); text-wrap: balance; }
h2 { font-size: 1.15rem; margin: 28px 0 12px; color: var(--brand-d); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 18px; }
.foot { text-align: center; color: var(--soft); font-size: 13px; padding: 20px 16px 32px; }

.btn { display: inline-block; background: var(--brand-d); color: #fff; border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible, .nav a:focus-visible, .btn-link:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--brand-d); border: 2px solid var(--brand); }
.btn.small { padding: 6px 12px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn { background: var(--brand); color: #0b1720; } }

.login { max-width: 480px; margin: 32px auto; }
.login label { display: block; font-weight: 600; margin: 16px 0 6px; }
.login input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--bg); color: var(--ink); margin-bottom: 14px; }
.msg { margin-top: 14px; color: var(--soft); min-height: 1.4em; }

.rank { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rank-in { display: flex; align-items: center; gap: 16px; }
.rank-num { font-size: 2.6rem; font-weight: 800; color: var(--brand-d); min-width: 72px; text-align: center; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.game { border-top: 5px solid var(--c, var(--brand)); display: flex; flex-direction: column; }
.game h3 { margin: 4px 0 6px; font-size: 1.1rem; }
.game p { margin: 0 0 8px; }
.game-n { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--c, var(--brand-d)); }
.bar { height: 8px; background: var(--chip); border-radius: 99px; overflow: hidden; margin: 6px 0 8px; }
.bar i { display: block; height: 100%; background: var(--c, var(--brand)); border-radius: 99px; }
.status { font-size: 14px; font-weight: 600; }
.chip { display: inline-block; background: var(--chip); color: var(--brand-d); border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 700; margin-bottom: 8px; align-self: flex-start; }
.actions { margin-top: auto; padding-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.game.locked { opacity: .65; }
.game.soon { border-top-color: var(--line); opacity: .8; border-style: dashed; }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--chip); color: var(--brand-d); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.q { min-width: 320px; }
.sel { display: inline-flex; gap: 8px; align-items: center; margin: 4px 0 14px; font-weight: 600; }
select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; }

.err { margin-bottom: 12px; }
.err-q { font-weight: 600; margin: 4px 0 10px; }
.bad { color: var(--bad); margin: 4px 0; }
.good { color: var(--good); margin: 4px 0; }

.player-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.save-status { margin-left: auto; font-size: 14px; color: var(--soft); }
.game-frame { width: 100%; height: calc(100vh - 150px); min-height: 560px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

@media (max-width: 860px) {
  .topbar { position: static; }
  .nav { order: 3; flex-basis: 100%; flex-wrap: wrap; overflow-x: visible; }
  .nav a { padding: 6px 10px; }
  .who { margin-left: auto; }
}
@media (max-width: 640px) {
  .who-mail { display: none; }
  h1 { font-size: 1.4rem; }
  .game-frame { height: calc(100vh - 190px); }
  .save-status { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: no-preference) { .btn { transition: filter .15s; } }

.tabs { display: flex; gap: 6px; margin: 14px 0 4px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: inherit; font-weight: 700; color: var(--soft); cursor: pointer; }
.tab.on { color: var(--brand-d); border-bottom-color: var(--brand); }
.tab:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.small { font-size: 14px; }

.reset-box { margin: 0 0 14px; }
.code { font: 700 1.2rem ui-monospace, Consolas, monospace; letter-spacing: .12em; background: var(--chip); padding: 2px 10px; border-radius: 8px; color: var(--brand-d); user-select: all; }

.tip { border-left: 5px solid var(--brand); }

.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0 0; text-decoration: none; color: var(--ink); border-left: 5px solid var(--brand); }
.banner strong { color: var(--brand-d); }
.banner .btn { margin-left: auto; }

.fb-form { max-width: 720px; }
.fb-form label { display: block; font-weight: 600; margin: 14px 0 6px; }
.fb-form select, .fb-form textarea, .msg-edit textarea, .msg-edit select { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--bg); color: var(--ink); }
.fb-form .check { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 0 0 4px; }
.fb-form .check input { width: auto; }
.ctx { background: var(--chip); color: var(--ink); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 6px 0; overflow-wrap: anywhere; }
.msg-card { margin-bottom: 12px; }
.msg-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.msg-h .chip { margin-bottom: 0; }
.msg-date { margin-left: auto; }
.st-novo { background: #ffe7b8; color: #6b4300; }
.st-em_analise { background: #d8e8fb; color: #12467f; }
.st-resolvido { background: #d4f0e0; color: #14603a; }
.st-descartado { background: #e8e8e8; color: #444; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .st-novo { background: #4a3a12; color: #ffe0a0; }
  :root:not([data-theme="light"]) .st-em_analise { background: #183350; color: #b9d6f7; }
  :root:not([data-theme="light"]) .st-resolvido { background: #163d2a; color: #a4e3c0; }
  :root:not([data-theme="light"]) .st-descartado { background: #333; color: #ccc; }
}
.reply { border-left: 4px solid var(--good); background: var(--chip); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
.msg-edit { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 8px; }
.msg-edit label { font-weight: 600; font-size: 14px; display: block; }
.msg-edit .grow { flex: 1 1 260px; }
.msg-edit select { width: auto; }

/* ---- Meu progresso (painel gamificado) ---- */
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 16px; align-items: start; }
.lvl { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.lvl-badge { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-d); color: #fff; display: grid; place-items: center; font-size: 1.9rem; font-weight: 800; flex: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lvl-badge { background: var(--brand); color: #0b1720; } }
.lvl-body { flex: 1 1 240px; min-width: 200px; }
.lvl-t { font-weight: 800; font-size: 1.15rem; color: var(--brand-d); margin-bottom: 6px; }
.xpbar { height: 12px; background: var(--chip); border-radius: 99px; overflow: hidden; margin-bottom: 4px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-d)); border-radius: 99px; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; }
.stats div { text-align: center; }
.stats strong { display: block; font-size: 1.4rem; color: var(--brand-d); }
.stats span { font-size: 12px; color: var(--soft); }
.xphelp { margin: 6px 2px 0; }
.nodes { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.node { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--ink); width: 92px; text-align: center; }
.node:hover .ring { transform: scale(1.06); }
.ring { transition: transform .15s; }
.node-t { font-weight: 700; font-size: 13px; margin-top: 4px; }
.node-s { font-size: 12px; color: var(--soft); }
.node-arrow { align-self: center; font-size: 26px; color: var(--line); margin-top: -26px; }
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--soft); }
.lg i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; }
.hc { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--chip); min-width: 10px; }
.hc.h1 { background: #a9cfe0; } .hc.h2 { background: var(--brand); } .hc.h3 { background: var(--brand-d); }
.hc.h-none { background: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hc.h1 { background: #2c5b73; } :root:not([data-theme="light"]) .hc.h3 { background: #b8e0f2; } }
.weak { margin-bottom: 14px; }
.weak-h { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.badge { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--card); display: flex; flex-direction: column; gap: 2px; }
.badge.on { border-color: var(--brand); box-shadow: var(--shadow); }
.badge.off { opacity: .55; filter: grayscale(.6); }
.b-i { font-size: 1.8rem; line-height: 1.2; }
