:root {
  --ivory: #f5eedf;
  --cream: #fbf6ea;
  --ink: #263d3b;
  --sage: #88a38e;
  --deep: #294c45;
  --terra: #c9785a;
  --honey: #b8885c;
  --coral: #dc8b7b;
  --gold: #c8aa6b;
  --paper: #f7f1e3;
  --line: rgba(41, 76, 69, 0.14);
  --shadow: 0 10px 30px rgba(38, 28, 18, 0.28), 0 2px 6px rgba(38, 28, 18, 0.18);
  --font-head: 'Fredoka', 'Nunito', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --top-h: 80px;
  --action-h: 56px;
  --hand-h: 140px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #6f5238;
  color: var(--ink);
  font-family: var(--font-body);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#app {
  position: fixed;
  inset: 0;
}
#game {
  position: absolute;
  inset: 0;
}
#game canvas {
  display: block;
  touch-action: none;
}

button {
  font-family: inherit;
  color: inherit;
}
button:focus-visible,
[tabindex]:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- botões ---------- */
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  min-height: 48px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, #33594f, var(--deep));
  color: var(--cream);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.22),
    0 3px 0 #1b342f,
    0 6px 14px rgba(0, 0, 0, 0.22);
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease,
    opacity 0.2s,
    filter 0.2s;
}
.btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.2),
    0 1px 0 #1b342f,
    0 3px 8px rgba(0, 0, 0, 0.2);
}
.btn:disabled {
  opacity: 0.45;
  filter: grayscale(0.3);
  cursor: default;
  transform: none;
}
.btn.secondary {
  background: linear-gradient(180deg, #fffcf4, #efe6d3);
  color: var(--deep);
  box-shadow:
    inset 0 1.5px 0 #fff,
    0 3px 0 #cdbd9c,
    0 6px 14px rgba(0, 0, 0, 0.16);
}
.btn.secondary:active {
  box-shadow:
    inset 0 1.5px 0 #fff,
    0 1px 0 #cdbd9c;
}
.btn.terra {
  background: linear-gradient(180deg, #d88a6b, #bd6c4d);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.28),
    0 3px 0 #8e4c33,
    0 6px 14px rgba(0, 0, 0, 0.22);
}
.btn.gold {
  background: linear-gradient(180deg, #d8bd82, #b99a58);
  color: #3a2e1a;
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.4),
    0 3px 0 #8c7340,
    0 6px 14px rgba(0, 0, 0, 0.2);
}
.btn.small {
  min-height: 40px;
  font-size: 15px;
  padding: 0 16px;
}
.btn.block {
  width: 100%;
}

.icon-btn {
  appearance: none;
  border: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  background: linear-gradient(180deg, #fffcf4, #ece2cc);
  color: var(--deep);
  box-shadow:
    inset 0 1.5px 0 #fff,
    0 2px 0 #c9b993,
    0 4px 10px rgba(0, 0, 0, 0.2);
  transition: transform 0.08s ease;
  flex: none;
}
.icon-btn:active {
  transform: translateY(2px);
}
.icon-btn:disabled {
  opacity: 0.45;
}
.icon-btn svg {
  width: 22px;
  height: 22px;
}
.icon-btn.on {
  background: linear-gradient(180deg, #33594f, var(--deep));
  color: var(--cream);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.2),
    0 2px 0 #1b342f;
}

/* ---------- HUD da partida ---------- */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#hud[hidden] {
  display: none;
}

.hud-top {
  position: absolute;
  left: calc(8px + var(--safe-l));
  right: calc(8px + var(--safe-r));
  top: calc(8px + var(--safe-t));
  height: calc(var(--top-h) - 12px - var(--safe-t));
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.hud-top > * {
  pointer-events: auto;
}

.opp-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: rgba(251, 246, 234, 0.94);
  box-shadow: var(--shadow);
  min-width: 0;
  position: relative;
  transition: box-shadow 0.3s;
}
.opp-card.turn {
  box-shadow:
    0 0 0 3px rgba(201, 120, 90, 0.85),
    var(--shadow);
}
.opp-portrait {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #fff8ea, #e6d8bc);
  overflow: hidden;
  flex: none;
  position: relative;
}
.opp-portrait .char-wrap {
  position: absolute;
  inset: 4px -2px -6px -2px;
}
.opp-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.1;
}
.opp-name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 17px;
  white-space: nowrap;
}
.opp-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #5b6e69;
  white-space: nowrap;
}
.opp-backs {
  display: flex;
  align-items: center;
  height: 18px;
}
.opp-backs img {
  width: 9px;
  height: 18px;
  margin-right: -3px;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.25));
  border-radius: 2px;
}
.opp-count {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--deep);
  margin-left: 6px;
}
.diff-chip {
  padding: 1px 7px;
  border-radius: 999px;
  background: #e3ebdf;
  color: var(--deep);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.diff-chip.hard {
  background: #f3d9cc;
  color: #8e4c33;
}
.diff-chip.normal {
  background: #efe3c4;
  color: #6b5523;
}
.thinking {
  display: none;
  gap: 3px;
  margin-left: 4px;
}
.opp-card.thinking-on .thinking {
  display: inline-flex;
}
.thinking i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--terra);
  animation: dots 1s infinite ease-in-out;
}
.thinking i:nth-child(2) {
  animation-delay: 0.15s;
}
.thinking i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes dots {
  0%,
  80%,
  100% {
    transform: scale(0.5);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.hud-spacer {
  flex: 1;
}
.score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 12px;
  border-radius: 16px;
  background: rgba(251, 246, 234, 0.94);
  box-shadow: var(--shadow);
  line-height: 1.05;
}
.score-card[hidden] {
  display: none;
}
.score-row {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 18px;
  white-space: nowrap;
}
.score-row b {
  color: var(--deep);
}
.score-row .sep {
  color: #a9b3ae;
  margin: 0 4px;
}
.score-sub {
  font-size: 11.5px;
  font-weight: 800;
  color: #6b7c77;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hud-action {
  position: absolute;
  left: calc(10px + var(--safe-l));
  right: calc(12px + var(--safe-r));
  top: var(--action-top);
  height: var(--action-h);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.hud-action > * {
  pointer-events: auto;
}
.status-pill {
  flex: 1 1 auto;
  max-width: 560px;
  margin-right: auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(38, 61, 59, 0.86);
  color: var(--cream);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.15;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  min-height: 38px;
  pointer-events: none;
}
.status-pill .st-icon {
  width: 18px;
  height: 18px;
  flex: none;
  display: grid;
  place-items: center;
}
.status-pill .st-text {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.status-pill.you {
  background: rgba(41, 76, 69, 0.95);
}
.status-pill.warn {
  background: rgba(156, 79, 51, 0.94);
}
.pile-count {
  position: absolute;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--deep);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14px;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.action-main {
  min-width: 112px;
}
.ab-group {
  display: inline-flex;
  gap: 4px;
}
.ab-group .icon-btn {
  width: 38px;
  height: 38px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
}

.banner {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%) scale(0.6);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(40px, 11vw, 76px);
  color: var(--cream);
  text-shadow:
    0 3px 0 #9c4f33,
    0 8px 22px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s,
    transform 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
  white-space: nowrap;
}
.banner.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.banner.soft {
  text-shadow:
    0 3px 0 #294c45,
    0 8px 22px rgba(0, 0, 0, 0.4);
  font-size: clamp(30px, 8vw, 54px);
}

.bubble {
  position: absolute;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--cream);
  color: var(--ink);
  font-weight: 800;
  font-size: 14px;
  box-shadow: var(--shadow);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.2s,
    transform 0.2s;
  max-width: min(320px, 80vw);
  z-index: 5;
}
.bubble.show {
  opacity: 1;
  transform: translateY(0);
}
.bubble.hint {
  background: #fff8e6;
  border: 2px solid var(--gold);
}

.toast-stack {
  position: absolute;
  left: 50%;
  top: calc(var(--top-h) + 10px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 50;
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(38, 61, 59, 0.95);
  color: var(--cream);
  font-weight: 800;
  box-shadow: var(--shadow);
  animation: toast-in 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.gold {
  background: linear-gradient(180deg, #e1c78e, #c3a35f);
  color: #3a2e1a;
}
.toast img {
  height: 34px;
  border-radius: 4px;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- telas e modais ---------- */
#screens {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#screens > * {
  pointer-events: auto;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-t)) calc(14px + var(--safe-r)) calc(16px + var(--safe-b))
    calc(14px + var(--safe-l));
  background: radial-gradient(ellipse at 50% 40%, rgba(40, 28, 18, 0.15), rgba(40, 28, 18, 0.55));
  animation: fade-in 0.25s ease;
  overflow-y: auto;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.panel {
  width: min(460px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0) 50%),
    linear-gradient(180deg, #fbf6ea, #f1e8d5);
  border-radius: 26px;
  box-shadow:
    var(--shadow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  padding: 22px 20px 20px;
  position: relative;
  border: 1px solid var(--line);
}
.panel.wide {
  width: min(640px, 100%);
}
.panel h1,
.panel h2 {
  font-family: var(--font-head);
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--deep);
}
.panel h2 {
  font-size: 26px;
}
.panel h3 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 17px;
  margin: 18px 0 8px;
  color: var(--deep);
}
.panel p {
  margin: 6px 0;
  line-height: 1.45;
  font-weight: 600;
  color: #3c4f4c;
}
.panel .muted {
  color: #6b7c77;
  font-size: 14px;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.panel-head h2 {
  flex: 1;
  margin: 0;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.row.wrap {
  flex-wrap: wrap;
}
.row.end {
  justify-content: flex-end;
}
.grow {
  flex: 1;
}

/* título */
.title-screen {
  flex-direction: column;
  gap: 14px;
}
.logo {
  text-align: center;
  color: var(--cream);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}
.logo .l1 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(46px, 13vw, 78px);
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-shadow: 0 4px 0 #8e5c3a;
}
.logo .l2 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(22px, 6vw, 32px);
  color: #fff3dc;
  margin-top: 2px;
}
.logo .l3 {
  font-weight: 800;
  font-size: 15px;
  color: #fbebd0;
  margin-top: 6px;
  letter-spacing: 0.03em;
}
.title-art {
  position: relative;
  height: 128px;
  width: min(360px, 90vw);
}
.title-art .char-wrap {
  position: absolute;
  width: 104px;
  height: 106px;
  bottom: 0;
}
.title-art .tile-deco {
  position: absolute;
  height: 54px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}
.title-menu {
  width: min(340px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.title-menu .row .btn {
  flex: 1;
}
.lang-switch {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.lang-switch button {
  background: rgba(251, 246, 234, 0.2);
  color: var(--cream);
  border: 1px solid rgba(251, 246, 234, 0.5);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 800;
  cursor: pointer;
}
.lang-switch button.on {
  background: var(--cream);
  color: var(--deep);
}

/* seleção */
.seg {
  display: flex;
  gap: 6px;
  background: rgba(41, 76, 69, 0.08);
  padding: 4px;
  border-radius: 999px;
}
.seg button {
  flex: 1;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 9px 10px;
  border-radius: 999px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
  color: var(--deep);
  cursor: pointer;
  min-height: 40px;
}
.seg button.on {
  background: var(--deep);
  color: var(--cream);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.seg button:disabled {
  opacity: 0.4;
  cursor: default;
}

.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mode-card {
  appearance: none;
  border: 2px solid transparent;
  text-align: left;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.mode-card.on {
  border-color: var(--deep);
  background: #fff;
}
.mode-card b {
  display: block;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 17px;
  color: var(--deep);
}
.mode-card span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #5b6e69;
  margin-top: 3px;
  line-height: 1.3;
}

.opp-picks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.opp-pick {
  appearance: none;
  border: 2px solid transparent;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  padding: 6px 4px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.opp-pick.on {
  border-color: var(--terra);
  background: #fff;
}
.opp-pick .char-wrap {
  width: 72px;
  height: 74px;
}
.opp-pick b {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
}
.opp-pick small {
  font-size: 11px;
  font-weight: 700;
  color: #6b7c77;
  text-align: center;
  line-height: 1.15;
}

.swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.swatch {
  appearance: none;
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 64px;
}
.swatch.on {
  border-color: var(--deep);
  background: #fff;
}
.swatch:disabled {
  opacity: 0.45;
  cursor: default;
}
.swatch img {
  height: 46px;
}
.swatch small {
  font-size: 11px;
  font-weight: 800;
  color: #5b6e69;
}

/* campanha */
.chapters {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chapter {
  border-radius: 20px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.55);
}
.chapter-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chapter-head .char-wrap {
  width: 54px;
  height: 56px;
  flex: none;
}
.chapter-head b {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 17px;
  color: var(--deep);
  display: block;
}
.chapter-head small {
  font-weight: 700;
  color: #6b7c77;
  font-size: 13px;
}
.encounters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.enc {
  appearance: none;
  border: 0;
  border-radius: 16px;
  padding: 10px 6px;
  cursor: pointer;
  background: linear-gradient(180deg, #fffcf4, #efe6d3);
  box-shadow:
    inset 0 1px 0 #fff,
    0 2px 0 #cdbd9c;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  color: var(--deep);
  min-height: 74px;
}
.enc:disabled {
  opacity: 0.5;
  cursor: default;
}
.enc .seal {
  width: 34px;
  height: 34px;
}
.enc.done {
  background: linear-gradient(180deg, #f3e6c2, #e3cf9c);
}
.enc.next {
  box-shadow:
    0 0 0 3px var(--terra),
    inset 0 1px 0 #fff;
}

/* coleção e estatísticas */
.coll-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.coll-item {
  border-radius: 18px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  border: 2px solid transparent;
}
.coll-item.on {
  border-color: var(--deep);
  background: #fff;
}
.coll-item .tiles {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  height: 64px;
}
.coll-item .tiles img {
  height: 60px;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.25));
}
.coll-item b {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--deep);
}
.coll-item small {
  font-weight: 700;
  color: #6b7c77;
  font-size: 12px;
}
.coll-item .lock {
  font-size: 12px;
  font-weight: 800;
  color: #8e4c33;
}
.env-thumb {
  width: 100%;
  aspect-ratio: 21 / 10;
  height: auto;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat {
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.6);
}
.stat b {
  display: block;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 26px;
  color: var(--deep);
}
.stat span {
  font-size: 12.5px;
  font-weight: 800;
  color: #6b7c77;
}
table.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-weight: 700;
}
table.stats-table th,
table.stats-table td {
  padding: 6px 4px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
table.stats-table th:first-child,
table.stats-table td:first-child {
  text-align: left;
}
table.stats-table th {
  color: #6b7c77;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* configurações */
.setting {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.setting label,
.setting .lbl {
  flex: 1;
  font-weight: 800;
  font-size: 15px;
}
.setting input[type='range'] {
  width: 46%;
  accent-color: var(--deep);
}
.switch {
  appearance: none;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: #cfc6b1;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex: none;
  border: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}
.switch[aria-checked='true'] {
  background: var(--deep);
}
.switch[aria-checked='true']::after {
  transform: translateX(20px);
}
.kbd-list {
  font-size: 13px;
  font-weight: 700;
  color: #4d5f5b;
  line-height: 1.6;
}

/* resultado */
.result-title {
  text-align: center;
}
.result-title h2 {
  font-size: 28px;
}
.result-calc {
  text-align: center;
  font-weight: 800;
  color: #3c4f4c;
  margin: 6px 0 2px;
}
.result-points {
  text-align: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 34px;
  color: var(--terra);
  margin: 4px 0;
}
.hands {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}
.hand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}
.hand-row .who {
  width: 74px;
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--deep);
  flex: none;
  line-height: 1.1;
}
.hand-row .who small {
  display: block;
  font-family: var(--font-body);
  font-weight: 800;
  color: #6b7c77;
  font-size: 12px;
}
.hand-row .htiles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}
.hand-row .htiles img {
  height: 26px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}
.hand-row .sum {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 20px;
  color: var(--deep);
}
.hand-row .empty {
  font-weight: 800;
  color: #6b7c77;
  font-size: 13px;
}
.match-score {
  display: flex;
  justify-content: center;
  gap: 18px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 20px;
  margin: 6px 0 12px;
}
.match-score .bar {
  width: 120px;
  height: 10px;
  border-radius: 999px;
  background: rgba(41, 76, 69, 0.12);
  overflow: hidden;
  margin-top: 4px;
}
.match-score .bar i {
  display: block;
  height: 100%;
  background: var(--terra);
  border-radius: 999px;
  transition: width 0.8s ease;
}
.seal-big {
  width: 84px;
  height: 84px;
  margin: 0 auto;
  display: block;
  animation: seal-pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes seal-pop {
  from {
    transform: scale(0.3) rotate(-30deg);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.result-char {
  width: 92px;
  height: 94px;
  margin: -6px auto 0;
}

/* tutorial */
.tut-card {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  background: #fffbf1;
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border: 2px solid var(--gold);
  z-index: 40;
  pointer-events: auto;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.tut-card .char-wrap {
  width: 58px;
  height: 60px;
  flex: none;
}
.tut-card p {
  margin: 0 0 8px;
  font-weight: 800;
  line-height: 1.4;
  font-size: 15px;
}
.tut-card .row {
  justify-content: flex-end;
}
.tut-progress {
  font-size: 12px;
  font-weight: 800;
  color: #8c7a55;
}

/* personagens */
.char-wrap {
  position: relative;
}
.char-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.char .body {
  transform-box: view-box;
  transform-origin: 60px 122px;
  animation: char-breathe 3.8s ease-in-out infinite;
}
.char .head {
  transform-box: view-box;
  transform-origin: 60px 90px;
  animation: char-head 3.8s ease-in-out infinite;
  transition: transform 0.3s ease;
}
.char .ear {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform 0.25s;
}
@keyframes char-breathe {
  0%,
  100% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(1.03);
  }
}
@keyframes char-head {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-1px);
  }
}
.char .lid {
  transform-box: fill-box;
  transform-origin: 50% 0%;
  transform: scaleY(0);
}
.char.blink .lid {
  animation: char-blink 0.17s ease-in-out;
}
@keyframes char-blink {
  0%,
  100% {
    transform: scaleY(0);
  }
  50% {
    transform: scaleY(1);
  }
}
.char .m {
  display: none;
}
.char .fill {
  fill: #5a2e22;
}
.char-bento .fill {
  fill: #3b2a20;
}
.char[data-expr='neutral'] .m-neutral,
.char[data-expr='happy'] .m-smile,
.char[data-expr='grin'] .m-grin,
.char[data-expr='surprised'] .m-o,
.char[data-expr='thinking'] .m-flat,
.char[data-expr='sad'] .m-sad,
.char[data-expr='smug'] .m-smug {
  display: inline;
}
.char .eye-happy {
  display: none;
}
.char[data-expr='happy'] .eye-open,
.char[data-expr='grin'] .eye-open {
  display: none;
}
.char[data-expr='happy'] .eye-happy,
.char[data-expr='grin'] .eye-happy {
  display: inline;
}
.char .pupil {
  transition: transform 0.35s ease;
  transform-box: view-box;
}
.char[data-look='down'] .pupil {
  transform: translate(0, 1.6px);
}
.char[data-look='left'] .pupil {
  transform: translate(-1.8px, 0.4px);
}
.char[data-look='right'] .pupil {
  transform: translate(1.8px, 0.4px);
}
.char .brow {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition: transform 0.25s ease;
}
.char[data-expr='surprised'] .brow {
  transform: translateY(-3px);
}
.char[data-expr='happy'] .brow,
.char[data-expr='grin'] .brow {
  transform: translateY(-1.5px);
}
.char[data-expr='thinking'] .brow-l {
  transform: translateY(-2.5px) rotate(-6deg);
}
.char[data-expr='thinking'] .brow-r {
  transform: translateY(1px) rotate(6deg);
}
.char[data-expr='sad'] .brow-l {
  transform: rotate(-12deg) translateY(-1px);
}
.char[data-expr='sad'] .brow-r {
  transform: rotate(12deg) translateY(-1px);
}
.char[data-expr='smug'] .brow-r {
  transform: translateY(-3px) rotate(-6deg);
}
.char[data-expr='surprised'] .ear,
.react-perk .char .ear {
  transform: scaleY(1.08) translateY(-1px);
}
.react-hop svg {
  animation: r-hop 0.6s cubic-bezier(0.3, 1.6, 0.5, 1);
}
@keyframes r-hop {
  0% {
    transform: translateY(0);
  }
  35% {
    transform: translateY(-9%);
  }
  60% {
    transform: translateY(0);
  }
  78% {
    transform: translateY(-3%);
  }
  100% {
    transform: translateY(0);
  }
}
.react-tilt .char .head {
  transform: rotate(-7deg);
}
.react-shrug .char .head {
  transform: translateY(2px) rotate(4deg);
}
.react-nod svg {
  animation: r-nod 0.55s ease;
}
@keyframes r-nod {
  0%,
  100% {
    transform: none;
  }
  40% {
    transform: translateY(4%);
  }
}
.react-clap svg {
  animation: r-clap 0.7s ease;
}
@keyframes r-clap {
  0%,
  100% {
    transform: none;
  }
  25% {
    transform: rotate(-4deg);
  }
  50% {
    transform: rotate(4deg);
  }
  75% {
    transform: rotate(-2deg);
  }
}

.reduced .char .body,
.reduced .char .head {
  animation: none;
}
.reduced .react-hop svg,
.reduced .react-nod svg,
.reduced .react-clap svg {
  animation: none;
}
.reduced .banner {
  transition: opacity 0.15s;
}
.reduced .screen,
.reduced .toast {
  animation: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 380px) {
  .opp-name {
    font-size: 15px;
  }
  .opp-portrait {
    width: 46px;
    height: 46px;
  }
  .btn {
    font-size: 16px;
    padding: 0 16px;
  }
  .action-main {
    min-width: 100px;
  }
  .status-pill {
    font-size: 13.5px;
    padding: 5px 10px;
  }
  .icon-btn {
    width: 42px;
    height: 42px;
  }
}

@media (max-height: 520px) {
  .panel {
    padding: 14px 16px 14px;
    border-radius: 20px;
  }
  .panel h2 {
    font-size: 22px;
  }
  .result-char {
    width: 64px;
    height: 64px;
  }
  .result-title h2 {
    font-size: 22px;
  }
  .result-points {
    font-size: 26px;
    margin: 0;
  }
  .hands {
    margin: 6px 0;
    gap: 6px;
  }
  .hand-row {
    padding: 5px 8px;
  }
  .hand-row .htiles img {
    height: 22px;
  }
  .seal-big {
    width: 60px;
    height: 60px;
  }
  .screen {
    align-items: flex-start;
  }
  .title-screen {
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    gap: 10px 24px;
  }
  .title-screen .title-art {
    display: none;
  }
  .title-menu {
    width: min(330px, 46vw);
  }
  .tut-card {
    padding: 10px 12px;
  }
  .tut-card .char-wrap {
    width: 44px;
    height: 46px;
  }
  .tut-card p {
    font-size: 14px;
    margin-bottom: 4px;
  }
}
@media (min-width: 900px) and (min-height: 700px) {
  .opp-portrait {
    width: 58px;
    height: 58px;
  }
  .status-pill {
    font-size: 16px;
  }
}

/* telas estreitas: o placar desce para baixo da barra superior */
@media (max-width: 600px) {
  .score-card {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    flex-direction: column;
    gap: 8px;
    padding: 3px 12px;
    border-radius: 999px;
  }
  .score-row {
    font-size: 15px;
  }
  .score-sub {
    font-size: 10.5px;
  }
}

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: auto;
  z-index: 60;
  overflow: hidden;
}
.confetti i {
  position: absolute;
  top: -20px;
  border-radius: 3px;
  animation-name: confetti-fall;
  animation-timing-function: cubic-bezier(0.25, 0.6, 0.4, 1);
  animation-fill-mode: forwards;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
@keyframes confetti-fall {
  to {
    transform: translate(var(--dx), 105vh) rotate(var(--rx));
    opacity: 0.9;
  }
}

/* Optional image art: selectors activate only after successful decode. */
.score-sub {
  white-space: nowrap;
}
@media (max-width: 600px) {
  .score-card {
    flex-direction: column;
    gap: 2px;
    width: max-content;
    max-width: calc(100vw - 24px);
    border-radius: 10px;
  }
}
.art-ui-panel .panel,
.art-ui-panel .opp-card,
.art-ui-panel .score-card,
.art-ui-panel .toast,
.art-ui-panel .tut-card {
  border: 14px solid transparent;
  border-image: var(--art-ui-panel) 64 fill / 20px / 0 stretch;
  background: none;
  border-radius: 12px;
}
.art-ui-panel .opp-card {
  border-width: 5px;
}
.art-ui-panel .score-card {
  border-width: 5px;
}
.art-ui-btn-primary .btn {
  border-radius: 10px;
  background: none;
  border-image: var(--art-ui-btn-primary) 32 fill / 15px / 0 stretch;
}
.art-ui-btn-secondary .btn.secondary {
  background: none;
  border-image: var(--art-ui-btn-secondary) 32 fill / 15px / 0 stretch;
}
.art-ui-btn-accent .btn.terra {
  background: none;
  border-image: var(--art-ui-btn-accent) 32 fill / 15px / 0 stretch;
}
.art-ui-btn-gold .btn.gold {
  background: none;
  border-image: var(--art-ui-btn-gold) 32 fill / 15px / 0 stretch;
}
.art-ui-round-btn .icon-btn {
  background: var(--art-ui-round-btn) center / 100% 100% no-repeat;
  box-shadow: 0 3px 8px #261c1226;
}
.art-ui-round-btn .icon-btn.on {
  background-color: var(--sage);
}
.icon-btn svg {
  filter: drop-shadow(0 1px 0 #fff8);
  stroke-width: 1.8;
}
.brand-logo {
  display: block;
  width: min(350px, 75vw);
  height: auto;
  max-height: 150px;
  object-fit: contain;
  margin: auto;
}
.art-logo-title-portrait .title-screen {
  background: var(--art-logo-title-portrait) center / cover no-repeat;
  justify-content: space-between;
  padding-top: max(22px, env(safe-area-inset-top));
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  gap: 8px;
}
.art-logo-title-portrait .title-screen > .title-art {
  visibility: hidden;
  height: 14vh;
  flex: 1;
}
.art-logo-title-portrait .title-screen .logo {
  filter: none;
}
.art-logo-title-portrait .title-screen .logo .l2 {
  color: var(--deep);
  font-size: 24px;
}
.art-logo-title-portrait .title-screen .logo .l3 {
  color: #40584c;
  font-size: 13px;
}
.art-logo-title-portrait .title-menu {
  padding: 14px;
  background: #f5eedff0;
  border: 1px solid #c8aa6b;
  border-radius: 16px;
  box-shadow: 0 8px 30px #1c332d40;
}
.art-logo-title-portrait .lang-switch {
  background: #f5eedfee;
  border-radius: 12px;
  padding: 4px;
}
.chapter-art {
  display: block;
  width: 100%;
  height: 88px;
  object-fit: cover;
  border-radius: 9px;
  margin-bottom: 8px;
}
.art-campaign-ribbon-win .result-win h2 {
  border-image: var(--art-campaign-ribbon-win) 32 fill / 16px / 0 stretch;
  padding: 14px;
  color: var(--cream);
}
.art-campaign-ribbon-loss .result-loss h2 {
  border-image: var(--art-campaign-ribbon-loss) 32 fill / 16px / 0 stretch;
  padding: 14px;
}
.art-campaign-ribbon-draw .result-draw h2 {
  border-image: var(--art-campaign-ribbon-draw) 32 fill / 16px / 0 stretch;
  padding: 14px;
}
.result-win .result-char {
  background: radial-gradient(ellipse, #e5c87988, transparent 70%);
}
#boot {
  background: var(--art-env-atelier-wood, #6f5238) center / 512px;
}
#art-progress {
  display: block;
  width: 180px;
  height: 5px;
  margin: 18px auto;
  accent-color: #c8aa6b;
}
.raster-seal {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
}
.raster-seal img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.raster-seal b {
  position: relative;
  color: #294c45;
  background: #f5eedfd9;
  border-radius: 50%;
  padding: 1px 4px;
  font: 700 12px var(--font-head);
}
.art-ui-panel-header .panel-head {
  border-image: var(--art-ui-panel-header) 32 fill / 12px / 0 stretch;
  padding: 6px;
}
.art-ui-hud-opponent .opp-card {
  border-image: var(--art-ui-hud-opponent) 32 fill / 12px / 0 stretch;
}
.art-ui-hud-score .score-card {
  border-image: var(--art-ui-hud-score) 32 fill / 12px / 0 stretch;
}
.art-ui-hud-status .status-pill {
  border-radius: 10px;
  background: none;
  border-image: var(--art-ui-hud-status) 32 fill / 12px / 0 stretch;
}
.art-ui-hud-alert .status-pill.warn {
  background: none;
  border-image: var(--art-ui-hud-alert) 32 fill / 12px / 0 stretch;
}
.art-ui-round-btn-active .icon-btn.on {
  background-image: var(--art-ui-round-btn-active);
  color: var(--cream);
}
.art-ui-round-btn-pressed .icon-btn:active {
  background-image: var(--art-ui-round-btn-pressed);
}
.art-ui-btn-primary-pressed .btn:active {
  border-image-source: var(--art-ui-btn-primary-pressed);
}
.art-ui-btn-accent-pressed .btn.terra:active {
  border-image-source: var(--art-ui-btn-accent-pressed);
}
.art-ui-btn-secondary-pressed .btn.secondary:active {
  border-image-source: var(--art-ui-btn-secondary-pressed);
}
.art-ui-btn-gold-pressed .btn.gold:active {
  border-image-source: var(--art-ui-btn-gold-pressed);
}
.art-logo-title-portrait .lang-switch button {
  color: var(--deep);
}
@media (orientation: landscape) {
  .art-logo-title-landscape .title-screen {
    background-image: var(--art-logo-title-landscape);
    display: grid;
    grid-template-columns: 1fr minmax(250px, 350px);
    grid-template-rows: 1fr auto;
    padding: 24px 6vw;
    column-gap: 8vw;
  }
  .art-logo-title-landscape .title-screen .logo {
    align-self: start;
  }
  .art-logo-title-landscape .title-screen .title-menu {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    width: 100%;
  }
  .art-logo-title-landscape .title-screen .lang-switch {
    grid-column: 2;
    justify-self: center;
  }
  .art-logo-title-landscape .title-screen > .title-art {
    display: none;
  }
}
@media (orientation: landscape) and (max-height: 500px) {
  .art-logo-title-landscape .title-screen {
    padding: 10px 4vw;
    grid-template-columns: 1fr 300px;
    grid-template-rows: 1fr auto;
    gap: 6px 20px;
  }
  .art-logo-title-landscape .title-menu {
    padding: 10px;
    gap: 6px;
  }
  .art-logo-title-landscape .title-menu .btn {
    min-height: 36px;
    font-size: 15px;
  }
  .art-logo-title-landscape .title-menu .toast {
    font-size: 11px;
    padding: 4px;
  }
  .art-logo-title-landscape .brand-logo {
    max-height: 110px;
  }
}
.boot-logo {
  display: block;
  width: min(300px, 75vw);
  height: 130px;
  object-fit: contain;
  margin: auto auto 12px;
}
#boot:has(.boot-logo) span {
  display: none;
}
/* Small screens keep the whole score and action sentence inside their plaques. */
.art-ui-hud-score .score-card {
  padding: 8px 16px;
  line-height: 1.2;
  box-shadow: 0 2px 7px #241a1226;
}
.art-ui-hud-status .status-pill,
.art-ui-hud-alert .status-pill.warn {
  padding-top: 10px;
  padding-bottom: 10px;
}
@media (max-width: 600px) {
  .hud-action {
    gap: 6px;
  }
  .hud-action > .icon-btn {
    width: 40px;
    height: 40px;
  }
  .hud-action .action-main {
    min-width: 94px;
    padding: 0 12px;
    font-size: 16px;
    gap: 4px;
  }
  .hud-action .action-main > span {
    display: none !important;
  }
  .hud-action .status-pill {
    font-size: 12px;
    padding: 8px;
    line-height: 1.2;
  }
  .hud-action .st-icon {
    display: none !important;
  }
}
.art-ui-panel .toast {
  color: var(--ink);
}
.art-logo-title-portrait .title-screen .logo .l2,
.art-logo-title-portrait .title-screen .logo .l3 {
  display: table;
  margin: 4px auto 0;
  padding: 3px 10px;
  border-radius: 6px;
  background: #f5eedfe8;
}
@media (orientation: landscape) {
  .art-logo-title-landscape .title-screen {
    background-position: left center;
  }
}

/* End of game/assets/styles-CKoiGKUt.css */
