/* LifeVerse, identidade "Varanda": as mesmas cores e letras do jogo. De dia o papel é claro; à noite escurece e aquece. */
@font-face { font-family: "Nunito Sans LV"; src: url("fonts/NunitoSans-Medium.ttf") format("truetype"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Nunito Sans LV"; src: url("fonts/NunitoSans-Bold.ttf") format("truetype"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Nunito Sans LV"; src: url("fonts/NunitoSans-ExtraBold.ttf") format("truetype"); font-weight: 800 900; font-display: swap; }
@font-face { font-family: "Fraunces LV"; src: url("fonts/Fraunces-Medium.ttf") format("truetype"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Fraunces LV"; src: url("fonts/Fraunces-SemiBold.ttf") format("truetype"); font-weight: 600 700; font-display: swap; }

:root {
  --paper: #F8F1E4; --raised: #FFFCF5; --sand: #EBDFC9; --sand-strong: #DDCBAA; --line: #D9C7A6;
  --ink: #2E2420; --soft: #55443A; --faint: #75604F; --clay: #B4472F; --sea: #146B64; --sea-hover: #0F534D; --sun: #E39A2D; --wood: #9C6B45; --on-fill: #FFF8EC;
  --clay-text: #A83F28; --sea-text: #11625B; --good: #176B42; --warn: #835400; --bad: #A82019;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #2C2320; --raised: #1F1816; --sand: #43362E; --sand-strong: #57473C; --line: #5A4A3E;
    --ink: #F2E8D9; --soft: #D5C5B2; --faint: #B6A390; --clay: #A8432D; --sea: #146B64; --sea-hover: #1A8078; --sun: #E8AC4C; --wood: #77502F;
    --clay-text: #F29B7E; --sea-text: #7AD3C6; --good: #6FD79E; --warn: #F2C062; --bad: #FF9A8E;
  }
}
:root[data-theme="dark"] {
  --paper: #2C2320; --raised: #1F1816; --sand: #43362E; --sand-strong: #57473C; --line: #5A4A3E;
  --ink: #F2E8D9; --soft: #D5C5B2; --faint: #B6A390; --clay: #A8432D; --sea: #146B64; --sea-hover: #1A8078; --sun: #E8AC4C; --wood: #77502F;
  --clay-text: #F29B7E; --sea-text: #7AD3C6; --good: #6FD79E; --warn: #F2C062; --bad: #FF9A8E;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); color: var(--ink); font: 500 15px/1.5 "Nunito Sans LV", "Nunito Sans", system-ui, sans-serif; }
h1, h2, h3 { font-family: "Fraunces LV", Georgia, serif; line-height: 1.2; margin: 0; }
h1 { font-size: 28px; font-weight: 600; }
h2 { font-size: 17px; font-weight: 500; color: var(--clay-text); padding-bottom: 6px; margin-bottom: 12px; border-bottom: 2px solid var(--sand); }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0 0 10px; }
a { color: var(--sea-text); }
code { font-size: 12px; color: var(--soft); overflow-wrap: anywhere; }
.muted { color: var(--soft); }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

/* ---- botões e campos ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 6px 18px; border: 2px solid transparent; border-radius: 20px; background: var(--sand); color: var(--ink); font: inherit; cursor: pointer; text-decoration: none; transition: background-color .14s; }
.btn:hover { background: var(--sand-strong); }
.btn.primary { background: var(--sea); color: var(--on-fill); font-weight: 700; }
.btn.primary:hover { background: var(--sea-hover); }
.btn.danger { background: transparent; border-color: var(--clay); color: var(--clay-text); }
.btn.danger:hover { background: var(--clay); color: var(--on-fill); }
.btn.small { min-height: 30px; padding: 2px 13px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--soft); margin-bottom: 3px; }
.field small { display: block; font-size: 12px; color: var(--faint); margin-top: 3px; }
input, select, textarea { width: 100%; min-height: 40px; padding: 7px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--raised); color: var(--ink); font: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--sea-text); outline: none; }
textarea { resize: vertical; min-height: 76px; }
input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--sea); }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row > .field { flex: 1 1 180px; }
.row > .btn { margin-bottom: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions.end { justify-content: flex-end; margin-top: 8px; }

/* ---- entrada ---- */
.entrance { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: #0B1015 url("img/background.png") center / cover no-repeat; }
.entrance .card { width: min(420px, 100%); border-bottom: 7px solid var(--wood); padding: 28px; }
.brand { font: 600 38px "Fraunces LV", Georgia, serif; margin: 0; }
.entrance .btn.primary { width: 100%; margin-top: 6px; }
.error-line { color: var(--bad); min-height: 22px; margin: 8px 0 0; }
.entrance .links { margin: 14px 0 0; text-align: center; font-size: 14px; }

/* ---- moldura ---- */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 20px 14px; background: var(--sand); border-right: 6px solid var(--wood); }
.side .brand { font-size: 27px; padding: 0 8px 12px; }
.side h3 { font-size: 13px; color: var(--clay-text); padding: 10px 10px 3px; }
.side a { display: flex; align-items: center; gap: 11px; padding: 6px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.side a:hover { background: var(--paper); }
.side a[aria-current="page"] { background: var(--sea); color: var(--on-fill); font-weight: 700; }
.side .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 10px; border-radius: 12px; background: var(--paper); }
.face { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--sea); color: #fff; display: grid; place-items: center; font-weight: 800; }
.who div { min-width: 0; }
.who b, .who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--soft); font-size: 12px; }
.topbar { display: none; }
main { padding: 28px 32px 60px; max-width: 1200px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-end; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }

/* ---- blocos ---- */
.card { background: var(--raised); border: 1px solid var(--line); border-bottom: 4px solid var(--sand-strong); border-radius: 14px; padding: 18px; margin-bottom: 18px; min-width: 0; }
.grid { display: grid; gap: 14px; margin-bottom: 18px; }
.grid > .card { margin-bottom: 0; }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.grid.photos { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid.items { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.stat { background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.card .stat { background: var(--paper); }
.stat span { display: block; font-size: 12px; color: var(--soft); }
.stat b { display: block; font: 600 24px "Fraunces LV", Georgia, serif; color: var(--clay-text); overflow-wrap: anywhere; }
.stat b.good { color: var(--good); } .stat b.warn { color: var(--warn); } .stat b.bad { color: var(--bad); }
.tag { display: inline-block; padding: 1px 11px 2px; border-radius: 20px; background: var(--sand); font-size: 12px; white-space: nowrap; }
.tag.good { background: transparent; border: 1px solid var(--good); } .tag.bad { background: transparent; border: 1px solid var(--bad); } .tag.warn { background: transparent; border: 1px solid var(--warn); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.empty, .loading { color: var(--soft); padding: 14px 0; }
.table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--sand); vertical-align: top; }
th { font-size: 12px; color: var(--soft); font-weight: 700; }
tr.click { cursor: pointer; }
tr.click:hover { background: var(--sand); }
.in { color: var(--good); font-weight: 700; } .out { color: var(--bad); font-weight: 700; }
.pager { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 14px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--sand); }
.tabs button { border: 0; border-radius: 18px; background: transparent; color: var(--ink); font: inherit; padding: 6px 16px; cursor: pointer; }
.tabs button:hover { background: var(--sand); }
.tabs button.on { background: var(--sea); color: var(--on-fill); font-weight: 700; }
progress { width: 100%; height: 12px; accent-color: var(--sea); }

/* ---- fotos grandes e quadradas ---- */
.photo { position: relative; width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--sand); color: var(--clay-text); display: grid; place-items: center; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile { background: var(--raised); border: 1px solid var(--line); border-bottom: 4px solid var(--sand-strong); border-radius: 14px; padding: 8px; min-width: 0; }
.tile h3 { margin: 10px 4px 2px; overflow-wrap: anywhere; }
.tile p { margin: 0 4px 6px; font-size: 13px; color: var(--soft); }
.tile .tags { margin: 4px 4px 4px; }
a.tile { display: block; color: inherit; text-decoration: none; padding: 10px; }
a.tile:hover { background: var(--sand); }
a.tile h3 { display: flex; align-items: center; gap: 9px; margin-top: 4px; }
.profile { display: grid; grid-template-columns: minmax(220px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.profile .portrait { position: relative; }
.profile .portrait > .small { position: absolute; left: 14px; bottom: 14px; width: 96px; height: 96px; }
.profile .portrait > .small .photo { border-radius: 50%; border: 5px solid var(--raised); }

/* ---- gráficos, diálogos e avisos ---- */
.bars { width: 100%; height: 140px; display: block; }
.bars rect { fill: var(--sea); }
.bars text { fill: var(--soft); font-size: 9px; }
dialog { width: min(460px, 92vw); border: 1px solid var(--line); border-bottom: 6px solid var(--wood); border-radius: 14px; background: var(--paper); color: var(--ink); padding: 22px; }
dialog::backdrop { background: rgba(20, 12, 8, .6); }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 20; max-width: min(420px, 92vw); }
.toast { background: var(--raised); border: 1px solid var(--line); border-left: 6px solid var(--sun); border-radius: 10px; padding: 10px 16px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.toast.good { border-left-color: var(--sea); } .toast.bad { border-left-color: var(--clay); }

/* ---- telas estreitas ---- */
@media (max-width: 880px) {
  .shell { display: block; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 10; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--sand); border-bottom: 4px solid var(--wood); }
  .topbar .brand { font-size: 23px; }
  .side { display: none; position: fixed; inset: 58px 0 0 0; height: auto; z-index: 9; border-right: 0; }
  .shell.open .side { display: flex; }
  .side .brand { display: none; }
  main { padding: 18px 16px 50px; }
  .profile { grid-template-columns: 1fr; }
  .grid.two { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table tr { display: block; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; padding: 4px 0; }
  .table td { display: flex; justify-content: space-between; gap: 14px; border: 0; padding: 4px 12px; text-align: right; overflow-wrap: anywhere; }
  .table td::before { content: attr(data-label); color: var(--soft); font-size: 12px; text-align: left; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
