/* ROÇASIMS — design system do jogo, derivado da identidade visual da Solunar
   (cerebro-solunar/_configuracao/identidade-visual) e do Talhão. Creme como
   papel, verde-floresta como tinta, limão só como sol/ganho/seleção, barro só
   como perigo e perda, azul-céu (do gradiente da marca) só como água.
   Londrina Solid para rótulos e números; Nunito para ler. */

@font-face { font-family: "Londrina Solid"; font-weight: 400; font-display: swap; src: url("public/fonts/londrina-solid-400.woff2") format("woff2"); }
@font-face { font-family: "Londrina Solid"; font-weight: 900; font-display: swap; src: url("public/fonts/londrina-solid-900.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400 800; font-display: swap; src: url("public/fonts/nunito-latin-wght.woff2") format("woff2"); }

:root {
  --ink: #17290F;
  --mid: #37462F;
  --sage: #5E6855;
  --cream: #ECE7E1;
  --paper: #F4F1EB;
  --n200: #DCD8CF;
  --n300: #C3C1B4;
  --taupe: #626056;
  --lime: #E6F819;
  --clay: #C73100;
  --sky: #ACC9EA;
  --water: #7b95ab;
  --display: "Londrina Solid", "Trebuchet MS", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(23, 41, 15, .18), 0 2px 6px rgba(23, 41, 15, .12);
  --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='16' viewBox='0 0 56 16'%3E%3Cpath d='M3 13 C3 4 11 3 12 9 C13 14 19 15 24 10 S 36 3 44 8 S 52 12 54 9' fill='none' stroke='%235E6855' stroke-width='2.6' stroke-linecap='round'/%3E%3Ccircle cx='31' cy='3.5' r='1.6' fill='%235E6855'/%3E%3C/svg%3E");
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 10px; }
.ic { width: 22px; height: 22px; flex: none; display: block; }

#app { height: 100dvh; position: relative; overflow: hidden; }
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: default; }
#app[data-screen="play"] #world { cursor: pointer; }
#app[data-mode="plan"] #world { cursor: crosshair; }
.screen { position: absolute; inset: 0; }

.eyebrow { font-family: var(--display); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--sage); margin: 0; }

/* botões no padrão do site da Solunar: pílula verde-floresta com texto limão */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 11px 24px; border-radius: 999px; border: 0;
  background: var(--ink); color: var(--lime);
  font-family: var(--display); font-weight: 900; font-size: 20px; letter-spacing: .02em;
  cursor: pointer; transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: #24391a; }
.btn:active { transform: scale(.96); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.ghost:hover { background: rgba(23, 41, 15, .06); }
.btn.small { min-height: 44px; padding: 8px 16px; font-size: 18px; }
.btn.lime { background: var(--lime); color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.paper { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------------------------------------------------------------- abertura */
#title { display: flex; align-items: center; padding: 32px clamp(16px, 5vw, 72px) 110px; pointer-events: none; }
.title-card { pointer-events: auto; max-width: 480px; padding: 28px 32px 30px; background: rgba(244, 241, 235, .94); border-radius: var(--radius); box-shadow: var(--shadow); }
.title-card h1 { font-family: var(--display); font-weight: 900; font-size: clamp(56px, 9vw, 112px); line-height: .9; margin: 8px 0 14px; letter-spacing: .01em; }
.title-card .lead { font-size: clamp(16px, 1.5vw, 19px); color: var(--mid); margin: 0 0 24px; }
.title-foot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 16px; padding: 22px clamp(16px, 5vw, 72px) 18px; font-size: 14px; color: var(--taupe); background: var(--paper) var(--wave) repeat-x top / 56px 16px; pointer-events: auto; }
.title-foot img { width: 110px; height: auto; flex: none; }

/* ---------------------------------------------------------------- crie sua pessoa */
#cas { display: grid; place-items: center; padding: 16px; background: rgba(236, 231, 225, .55); overflow-y: auto; }
.cas-card { display: grid; grid-template-columns: 300px minmax(0, 380px); gap: 8px; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; max-width: 100%; }
.cas-stage { background: linear-gradient(#ACC9EA, #F9EDBB); display: grid; place-items: end center; min-height: 360px; position: relative; }
.cas-stage::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 22%; background: #939A76; border-top: 4px solid #5E6855; }
#cas-preview { width: 100%; height: 100%; position: absolute; inset: 0; z-index: 1; }
.cas-form { padding: 22px 26px 24px; display: grid; gap: 12px; }
.cas-form h2 { font-family: var(--display); font-weight: 900; font-size: 34px; margin: 0; line-height: 1; }
.field { display: grid; gap: 4px; font-family: var(--display); font-size: 16px; }
.field input { font-family: var(--body); font-size: 18px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--n300); background: #fff; min-height: 48px; }
.field input:focus { border-color: var(--ink); outline: none; }
.choice { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; }
.choice legend { font-family: var(--display); font-size: 16px; padding: 0; margin-bottom: 4px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { min-width: 44px; height: 44px; border-radius: 999px; border: 3px solid transparent; box-shadow: inset 0 0 0 2px rgba(23, 41, 15, .12); cursor: pointer; padding: 0 12px; font-family: var(--display); font-size: 16px; background: var(--cream); }
.swatch.color { width: 44px; padding: 0; }
.swatch[aria-checked="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--lime); }
.toggle { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 17px; min-height: 44px; cursor: pointer; }
.toggle input { width: 22px; height: 22px; accent-color: var(--ink); }

/* ---------------------------------------------------------------- HUD */
.hud { position: absolute; left: 0; right: 0; z-index: 5; pointer-events: none; }
.hud > * { pointer-events: auto; }
#topbar { top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 12px; }
.queue { list-style: none; margin: 0; padding: 6px; display: flex; gap: 6px; min-height: 60px; min-width: 60px; background: rgba(244, 241, 235, .9); border-radius: 18px; box-shadow: var(--shadow); flex: 0 1 auto; overflow: hidden; }
.queue:empty::before { content: "à toa"; font-family: var(--display); color: var(--sage); align-self: center; padding: 0 12px; }
.queue li { position: relative; }
.queue button { width: 48px; height: 48px; border-radius: 14px; border: 0; background: var(--cream); display: grid; place-items: center; cursor: pointer; position: relative; }
.queue li.active button { background: var(--ink); color: var(--lime); }
.queue li.auto button { box-shadow: inset 0 0 0 2px var(--sage); }
.queue button .ic { width: 24px; height: 24px; }
.queue .ring { position: absolute; inset: -3px; pointer-events: none; }
.queue .x { position: absolute; top: -4px; right: -4px; width: 18px; height: 18px; border-radius: 99px; background: var(--clay); color: var(--cream); display: none; place-items: center; font-size: 12px; line-height: 1; font-family: var(--display); }
.queue li:hover .x, .queue li:focus-within .x { display: grid; }
.queue .count { position: absolute; bottom: 2px; right: 4px; font-family: var(--display); font-size: 12px; color: inherit; }
.clock { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; background: rgba(244, 241, 235, .92); border-radius: 18px; box-shadow: var(--shadow); }
.clock-sun { width: 34px; height: 34px; border-radius: 99px; background: var(--lime); display: grid; place-items: center; color: var(--cream); }
.clock-sun.night { background: #2e4057; color: var(--cream); }
.clock-sun .ic { width: 26px; height: 26px; }
.clock-text { display: grid; line-height: 1; font-family: var(--display); }
.clock-text strong { font-size: 24px; font-weight: 900; }
.clock-text span { font-size: 13px; color: var(--sage); margin-top: 2px; }
.speeds { display: flex; gap: 2px; background: var(--cream); border-radius: 14px; padding: 3px; }
.speeds button { width: 40px; height: 40px; border-radius: 11px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--sage); }
.speeds button[aria-pressed="true"] { background: var(--ink); color: var(--lime); }
.tools { display: flex; gap: 6px; padding: 6px; background: rgba(244, 241, 235, .9); border-radius: 18px; box-shadow: var(--shadow); }
.tool { width: 46px; height: 46px; border-radius: 14px; border: 0; background: var(--cream); display: grid; place-items: center; cursor: pointer; }
.tool[aria-pressed="true"] { background: var(--ink); color: var(--lime); }

.goals { position: absolute; top: 84px; right: 12px; z-index: 4; width: 290px; max-height: calc(100dvh - 84px - 170px); overflow-y: auto; padding: 16px 18px 18px; background: rgba(244, 241, 235, .94); border-radius: var(--radius); box-shadow: var(--shadow); }
.goals h2 { font-family: var(--display); font-weight: 900; font-size: 24px; margin: 0 0 6px; line-height: 1; }
.goals h3 { font-family: var(--display); font-size: 17px; margin: 14px 0 6px; color: var(--sage); }
.goals .next { margin: 0 0 10px; font-size: 15px; background: var(--lime); padding: 8px 12px; border-radius: 14px; }
.goals .next:empty { display: none; }
.goal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.goal-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 15px; line-height: 1.3; padding: 3px 0; }
.goal-list li .box { width: 20px; height: 20px; border-radius: 7px; box-shadow: inset 0 0 0 2px var(--n300); flex: none; display: grid; place-items: center; margin-top: 1px; }
.goal-list li.done { color: var(--sage); }
.goal-list li.done .box { background: var(--ink); color: var(--lime); box-shadow: none; }
.goal-list li.done .box .ic { width: 15px; height: 15px; }
.goal-list li.pop { animation: pop .6s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); background: var(--lime); } 100% { transform: scale(1); } }
.wishes li { font-size: 14px; }

#bottombar { bottom: 0; display: flex; align-items: stretch; gap: 14px; padding: 18px 14px 12px; background: var(--paper) var(--wave) repeat-x top / 56px 16px; box-shadow: 0 -4px 20px rgba(23, 41, 15, .08); }
.portrait { display: flex; align-items: center; gap: 10px; min-width: 190px; }
#portrait { width: 72px; height: 88px; background: linear-gradient(#ACC9EA, #F9EDBB); border-radius: 18px; flex: none; }
.who { display: grid; line-height: 1.15; }
.who strong { font-family: var(--display); font-weight: 900; font-size: 22px; }
.who span { font-size: 14px; color: var(--taupe); max-width: 22ch; }
.needs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 6px 16px; align-content: center; flex: 1 1 auto; max-width: 460px; }
.need { display: grid; grid-template-columns: 22px 64px 1fr; align-items: center; gap: 6px; font-family: var(--display); font-size: 15px; }
.need .bar { display: block; height: 12px; border-radius: 99px; background: var(--n200); overflow: hidden; }
.need .fill { display: block; height: 100%; border-radius: 99px; background: var(--lime); transition: width .3s ease, background .3s ease; box-shadow: inset 0 0 0 1.5px rgba(23, 41, 15, .25); }
.need.mid .fill { background: #b7c46b; }
.need.low .fill { background: var(--clay); }
.need.low { color: var(--clay); }
.water { display: flex; gap: 10px; align-items: center; }
.gauge { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: center; padding: 6px 12px 6px 8px; background: var(--cream); border-radius: 16px; min-height: 60px; }
.gauge .ic { width: 26px; height: 26px; grid-row: span 2; color: var(--mid); }
.gauge strong { font-family: var(--display); font-size: 20px; line-height: 1; }
.gauge span { font-size: 12px; color: var(--taupe); line-height: 1.1; }
.gauge.on .ic { color: var(--water); }
.gauge .tank { width: 12px; height: 38px; border-radius: 5px; background: var(--n200); position: relative; overflow: hidden; grid-row: span 2; box-shadow: inset 0 0 0 1.5px rgba(23, 41, 15, .25); }
.gauge .tank i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--sky); }
.zoom { display: flex; flex-direction: column; gap: 4px; margin-left: auto; }
.zoom button { width: 40px; height: 32px; border-radius: 10px; border: 0; background: var(--cream); display: grid; place-items: center; cursor: pointer; }
.zoom .ic { width: 18px; height: 18px; }

.hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: 130px; z-index: 6; max-width: min(640px, calc(100vw - 24px)); padding: 10px 18px; border-radius: 16px; background: var(--ink); color: var(--cream); font-size: 16px; text-align: center; box-shadow: var(--shadow); pointer-events: none; opacity: 0; transition: opacity .25s ease, transform .25s ease; }
.hint.show { opacity: 1; }
.hint.warn { background: var(--clay); }
.hint.good { background: var(--lime); color: var(--ink); }

/* ---------------------------------------------------------------- menu radial */
.pie { position: absolute; z-index: 8; width: 0; height: 0; }
.pie-center { position: absolute; transform: translate(-50%, -50%); width: 150px; min-height: 72px; padding: 10px 12px; border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); text-align: center; display: grid; align-content: center; gap: 2px; animation: pie-in .16s ease-out; }
.pie-center strong { font-family: var(--display); font-weight: 900; font-size: 18px; line-height: 1.05; }
.pie-center span { font-size: 13px; color: var(--taupe); line-height: 1.2; }
.pie-opt { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 8px; min-height: 48px; width: max-content; max-width: 290px; padding: 8px 16px 8px 10px; border-radius: 999px; border: 0; background: var(--ink); color: var(--cream); font-family: var(--display); font-size: 17px; line-height: 1.05; text-align: left; box-shadow: var(--shadow); cursor: pointer; white-space: normal; animation: pie-in .18s ease-out both; }
.pie-opt .ic { color: var(--lime); }
.pie-opt:hover, .pie-opt:focus-visible { background: var(--lime); color: var(--ink); }
.pie-opt:hover .ic, .pie-opt:focus-visible .ic { color: var(--ink); }
.pie-opt[aria-disabled="true"] { background: var(--n200); color: var(--taupe); cursor: default; }
.pie-opt[aria-disabled="true"] .ic { color: var(--taupe); }
.pie-opt small { display: block; font-family: var(--body); font-size: 12px; font-weight: 600; opacity: .9; }
.pie-opt .risk { display: block; font-family: var(--body); font-size: 12px; margin-top: 2px; }
.pie-opt.alto .risk, .pie-opt.medio .risk { color: #ffb08f; }
.pie-opt.aceiro .risk { color: var(--lime); }
.pie-opt:hover .risk { color: var(--clay); }
.pie-opt.aceiro:hover .risk { color: var(--mid); }
.pie-opt .key { font-family: var(--display); font-size: 12px; opacity: .6; margin-left: 2px; }
@keyframes pie-in { from { opacity: 0; scale: .8; } to { opacity: 1; scale: 1; } }

.planbar { position: absolute; left: 50%; transform: translateX(-50%); bottom: 132px; z-index: 7; width: min(640px, calc(100vw - 24px)); padding: 12px 14px; border-radius: 20px; background: var(--ink); color: var(--cream); box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.planbar p { margin: 0; flex: 1 1 260px; font-size: 15px; }
.planbar p strong { font-family: var(--display); font-size: 18px; color: var(--lime); }
.planbar .btn.ghost { color: var(--cream); box-shadow: inset 0 0 0 2px var(--cream); }
.planbar .btn:not(.ghost) { background: var(--lime); color: var(--ink); }

/* ---------------------------------------------------------------- diálogo */
.dialog { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(23, 41, 15, .35); }
.dialog-card { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 26px 28px 24px; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); background-image: var(--wave); background-repeat: repeat-x; background-size: 56px 16px; background-position: top 10px left; padding-top: 38px; }
.dialog-card h2 { font-family: var(--display); font-weight: 900; font-size: 34px; margin: 6px 0 10px; line-height: 1; }
.dialog-card p { margin: 0 0 12px; }
.dialog-card .facts { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.dialog-card .facts li { display: flex; gap: 10px; align-items: flex-start; background: var(--cream); border-radius: 14px; padding: 10px 12px; }
.dialog-card .facts li .ic { margin-top: 2px; color: var(--mid); }
.dialog-card .facts li.up { background: var(--lime); }
.dialog-card .facts li.down { background: #f3d6c9; }
.dialog-card .big { font-family: var(--display); font-weight: 900; font-size: 26px; }
.dialog-card kbd { font-family: var(--display); background: var(--cream); border-radius: 6px; padding: 1px 6px; }

/* ---------------------------------------------------------------- celular */
@media (max-width: 760px) {
  #title { align-items: flex-start; padding-top: 18px; }
  .title-card { padding: 20px 20px 22px; }
  .cas-card { grid-template-columns: 1fr; }
  .cas-stage { min-height: 210px; }
  #topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "clock clock" "queue tools"; padding: 8px; gap: 6px; }
  .clock { grid-area: clock; justify-self: start; padding: 4px 6px 4px 8px; gap: 6px; }
  .queue { grid-area: queue; min-height: 50px; min-width: 0; padding: 4px; }
  .tools { grid-area: tools; padding: 4px; gap: 4px; }
  .queue button { width: 42px; height: 42px; }
  .clock-sun { width: 28px; height: 28px; }
  .clock-text strong { font-size: 20px; }
  .speeds button { width: 36px; height: 36px; }
  .tool { width: 42px; height: 42px; }
  #btn-mute { display: none; }
  .goals { top: auto; bottom: 186px; right: 8px; left: 8px; width: auto; max-height: 42dvh; }
  #bottombar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 16px 8px 8px; }
  .portrait { grid-column: 1 / -1; min-width: 0; gap: 8px; }
  #portrait { width: 40px; height: 44px; border-radius: 12px; }
  .who { grid-auto-flow: column; justify-content: start; align-items: baseline; gap: 8px; }
  .who strong { font-size: 18px; }
  .who span { font-size: 13px; max-width: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .water { display: contents; }
  .gauge { grid-template-columns: auto minmax(0, 1fr); min-height: 44px; padding: 4px 6px; column-gap: 5px; border-radius: 12px; }
  .gauge strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gauge span { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gauge .ic { width: 18px; height: 18px; }
  .gauge .tank { width: 9px; height: 30px; }
  .needs { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 12px; max-width: none; }
  .need { grid-template-columns: 16px 54px 1fr; font-size: 13px; gap: 5px; }
  .need .ic { width: 16px; height: 16px; }
  .need .bar { height: 9px; }
  .zoom { position: absolute; right: 8px; bottom: calc(100% + 8px); }
  .zoom button { width: 44px; height: 44px; }
  .hint { bottom: 186px; font-size: 15px; }
  .planbar { bottom: 182px; }
  .pie-opt { font-size: 16px; }
  .pie-center { width: 128px; }
}
@media (prefers-reduced-motion: reduce) {
  .pie-opt, .pie-center, .goal-list li.pop { animation: none; }
}
