@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;500;600;700;800&display=swap');

@font-face {
  font-family: 'Caramel Sauce';
  src: local('Caramel Sauce Regular'), local('Caramel Sauce'),
       url('./assets/fonts/Caramel%20Sauce%20Regular.woff2') format('woff2'),
       url('./assets/fonts/CaramelSauce-Regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --ink: #f6f0df;
  --muted: rgba(246, 240, 223, .68);
  --green: #0b3f35;
  --green2: #126050;
  --deep: #061b18;
  --water: #3fb5a3;
  --sand: #d8b77a;
  --gold: #e8b558;
  --danger: #df866b;
  font-family: 'Lexend', system-ui, sans-serif;
  color: var(--ink);
  background: var(--deep);
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { min-height: 100dvh; background: #061b18; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

#app-bg {
  position: fixed; inset: 0;
  background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Pantanal_Sunset.JPG/960px-Pantanal_Sunset.JPG');
  background-size: cover; background-position: center;
  transform: scale(1.025);
  filter: saturate(.82) contrast(1.03);
}
#app-shade {
  position: fixed; inset: 0;
  background:
    radial-gradient(circle at 50% 44%, rgba(12, 66, 58, .28), rgba(3, 18, 16, .66) 58%, rgba(2, 12, 11, .88)),
    linear-gradient(180deg, rgba(1, 12, 10, .28), rgba(1, 12, 10, .62));
  backdrop-filter: blur(1px);
}

#app { position: relative; width: 100%; height: 100%; z-index: 1; }
.screen { position: absolute; inset: 0; }
.hidden { display: none !important; }
.glass {
  background: linear-gradient(150deg, rgba(8, 53, 46, .90), rgba(5, 31, 28, .86));
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 28px 80px rgba(0,0,0,.36), inset 0 1px rgba(255,255,255,.06);
  backdrop-filter: blur(22px);
}
.glass-soft {
  background: rgba(6, 35, 31, .68);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 14px 34px rgba(0,0,0,.2);
  backdrop-filter: blur(16px);
}

.lobby-screen { display: grid; place-items: center; padding: 24px; overflow: auto; }
.lobby-card { width: min(840px, 100%); border-radius: 28px; padding: clamp(28px, 5vw, 54px); }
.eyebrow { margin: 0 0 8px; font-size: 11px; letter-spacing: .18em; font-weight: 700; color: rgba(246,240,223,.6); }
h1, h2 { font-family: 'Caramel Sauce', 'Segoe Print', 'Bradley Hand', cursive; font-weight: 400; }
h1 { font-size: clamp(46px, 7vw, 82px); letter-spacing: -.045em; line-height: .94; margin: 0; }
h1 span { color: #eab55a; font-style: italic; }
.lead { width: min(610px, 100%); line-height: 1.6; color: var(--muted); margin: 20px 0 32px; font-size: 16px; }
.setup-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 28px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: 13px; font-weight: 700; margin-bottom: 12px; color: rgba(246,240,223,.82); }
.second-legend { padding-top: 23px; }
.choice { display: flex; gap: 13px; align-items: center; padding: 14px; border-radius: 15px; border: 1px solid rgba(255,255,255,.1); margin-bottom: 9px; cursor: pointer; transition: .18s ease; background: rgba(255,255,255,.025); }
.choice:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.2); }
.choice.selected { background: rgba(62, 179, 161, .15); border-color: rgba(86, 202, 183, .5); }
.choice input { display: none; }
.choice-icon { font-size: 26px; }
.choice strong, .choice small { display: block; }
.choice small { margin-top: 2px; color: var(--muted); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 5px; border-radius: 13px; background: rgba(0,0,0,.18); }
.segmented button { border: 0; border-radius: 9px; padding: 10px 8px; color: var(--muted); background: transparent; cursor: pointer; }
.segmented button.active { color: var(--ink); background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); }
.field-hint { font-size: 11px; margin: 8px 2px 0; color: rgba(246,240,223,.5); }
.primary-btn, .secondary-btn, .play-btn {
  border: 0; border-radius: 14px; padding: 15px 20px; font-weight: 700; cursor: pointer; transition: .18s ease;
}
.primary-btn { width: 100%; margin-top: 30px; background: #e7b45c; color: #18332e; box-shadow: 0 10px 28px rgba(232,181,88,.22); }
.primary-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.04); }
.primary-btn span { margin-left: 8px; }
.primary-btn.compact { width: auto; margin: 0; }
.secondary-btn { color: var(--ink); background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.12); }
.lobby-links { display: flex; justify-content: center; gap: 20px; margin-top: 18px; }
.link-btn { border: 0; background: none; color: rgba(246,240,223,.55); font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.game-screen { overflow: hidden; }
#game-canvas { position: absolute; inset: 0; }
#game-canvas canvas { display: block; }
.topbar { position: absolute; z-index: 10; top: max(12px, env(safe-area-inset-top)); left: 16px; right: 16px; height: 58px; border-radius: 17px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 14px 0 18px; pointer-events: none; }
.brand-mini { font-family: 'Caramel Sauce', 'Segoe Print', 'Bradley Hand', cursive; font-size: 15px; opacity: .9; }
.brand-mini strong { color: var(--gold); }
.phase-chip { display: flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 12px; background: rgba(255,255,255,.07); white-space: nowrap; }
.phase-chip b { font-size: 12px; }
.phase-chip small { font-size: 10px; color: var(--muted); border-left: 1px solid rgba(255,255,255,.14); padding-left: 7px; }
.top-actions { justify-self: end; display: flex; gap: 6px; pointer-events: auto; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(255,255,255,.11); background: rgba(255,255,255,.06); color: var(--ink); cursor: pointer; font-weight: 700; }

.players-hud { position: absolute; z-index: 7; left: 16px; top: 86px; display: grid; gap: 8px; width: 190px; pointer-events: none; }
.player-chip { padding: 9px 11px; border-radius: 13px; background: rgba(5,31,28,.66); border: 1px solid rgba(255,255,255,.09); backdrop-filter: blur(10px); transition: .2s ease; }
.player-chip.active { border-color: rgba(232,181,88,.62); box-shadow: 0 0 0 1px rgba(232,181,88,.16), 0 8px 24px rgba(0,0,0,.18); }
.player-chip .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.player-chip strong { font-size: 12px; }
.player-chip .score { color: var(--gold); font-weight: 700; }
.player-chip small { color: var(--muted); font-size: 10px; display: block; margin-top: 3px; }

.deck-hud { position: absolute; right: 16px; top: 86px; z-index: 7; border-radius: 14px; padding: 9px 12px; display: flex; gap: 10px; align-items: center; min-width: 128px; }
.deck-stack { width: 28px; height: 38px; border-radius: 5px; display: block; background: linear-gradient(135deg, #d7b273, #8c6c39); box-shadow: -3px 2px 0 rgba(255,255,255,.13), -6px 4px 0 rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.25); }
.deck-hud b, .deck-hud small { display: block; }
.deck-hud b { font-size: 14px; }
.deck-hud small { font-size: 9px; color: var(--muted); }

.turn-banner { position: absolute; z-index: 9; top: 82px; left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: 12px; font-size: 12px; font-weight: 700; opacity: 0; transition: opacity .2s; pointer-events: none; }
.turn-banner.show { opacity: 1; }
.toast { position: absolute; z-index: 20; left: 50%; bottom: 192px; transform: translate(-50%, 8px); max-width: min(560px, calc(100% - 36px)); padding: 10px 14px; border-radius: 12px; background: rgba(3,23,20,.9); border: 1px solid rgba(255,255,255,.12); color: var(--ink); font-size: 12px; opacity: 0; transition: .24s ease; pointer-events: none; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.hand-panel { position: absolute; z-index: 8; left: 16px; right: 16px; bottom: max(14px, env(safe-area-inset-bottom)); min-height: 158px; border-radius: 21px; padding: 12px 14px 14px; }
.hand-head { height: 37px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hand-head .eyebrow { margin: 0; font-size: 9px; }
.hand-head b { display: block; font-size: 11px; margin-top: 2px; font-weight: 500; color: var(--muted); }
.play-btn { padding: 8px 14px; min-width: 88px; color: #14362f; background: #e8b558; font-size: 11px; }
.play-btn:disabled { opacity: .35; cursor: not-allowed; }
.hand { height: 99px; display: flex; justify-content: center; align-items: flex-end; gap: 8px; }
.hand-card { position: relative; width: clamp(68px, 8.2vw, 88px); height: 96px; border: 0; padding: 0; border-radius: 11px; overflow: hidden; cursor: pointer; color: #fff; background: #1a3b34; box-shadow: 0 8px 18px rgba(0,0,0,.25); outline: 1px solid rgba(255,255,255,.16); transition: transform .16s ease, box-shadow .16s ease, outline-color .16s; flex: 0 0 auto; }
.hand-card:hover:not(:disabled) { transform: translateY(-5px); }
.hand-card.selected { transform: translateY(-10px); outline: 2px solid #f0c776; box-shadow: 0 13px 26px rgba(0,0,0,.32), 0 0 0 4px rgba(240,199,118,.12); }
.hand-card:disabled { cursor: default; }
.hand-card img { width: 100%; height: 62px; object-fit: cover; display: block; }
.hand-card .card-foot { height: 34px; display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 3px; padding: 3px 6px; background: linear-gradient(180deg, #143d34, #0a2823); }
.hand-card .num { font-family: 'Lexend', sans-serif; font-size: 19px; color: #f0c776; }
.hand-card .animal-name { font-size: 8.5px; font-weight: 700; line-height: 1.05; text-align: left; }
.hand-card.pulse { background: radial-gradient(circle at 50% 35%, #70c6bb, #176b63 55%, #0c3732); }
.hand-card.pulse .pulse-wave { font-family: 'Lexend', sans-serif; font-size: 48px; height: 62px; display: grid; place-items: center; color: #d6f5ef; }
.hand-card.pulse .card-foot { display: block; padding-top: 9px; text-align: center; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(1,15,13,.7); backdrop-filter: blur(8px); }
.modal-card { position: relative; width: min(540px, 100%); max-height: min(760px, 90dvh); overflow: auto; border-radius: 24px; padding: 30px; }
.modal-card h2 { margin: 2px 0 10px; font-size: 31px; }
.modal-card p { color: var(--muted); line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.pulse-card { text-align: center; width: min(470px, 100%); }
.pulse-symbol { margin: 0 auto 12px; width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; background: rgba(77,191,175,.15); border: 1px solid rgba(126,220,207,.3); font-family: 'Lexend', sans-serif; font-size: 58px; color: #82d7ca; }
.phase-transition { margin: 18px auto; padding: 11px; border-radius: 13px; background: rgba(255,255,255,.06); font-weight: 700; }
.result-score { display: grid; gap: 8px; margin-top: 20px; }
.result-row { display: flex; justify-content: space-between; padding: 11px 13px; border-radius: 12px; background: rgba(255,255,255,.06); }
.result-row.winner { border: 1px solid rgba(232,181,88,.55); background: rgba(232,181,88,.1); }
.modal-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 12px; border: 1px solid rgba(255,255,255,.11); background: rgba(255,255,255,.06); color: var(--ink); cursor: pointer; font-size: 20px; }
.info-card { width: min(760px, 100%); padding: 36px; }
.info-card h2 { margin-top: 0; }
.info-card h3 { margin-top: 24px; font-size: 15px; color: #f0c776; }
.info-card p, .info-card li { font-size: 13px; line-height: 1.62; color: rgba(246,240,223,.72); }
.info-card table { width: 100%; border-collapse: collapse; font-size: 12px; }
.info-card td, .info-card th { text-align: left; padding: 8px; border-bottom: 1px solid rgba(255,255,255,.09); }
.info-card a { color: #8ee0d3; }

@media (max-width: 760px) {
  .lobby-screen { align-items: start; padding: 12px; }
  .lobby-card { padding: 26px 20px; border-radius: 22px; margin: 8px 0; }
  .setup-grid { grid-template-columns: 1fr; gap: 22px; }
  h1 { font-size: 52px; }
  .lead { margin-bottom: 26px; }
  .topbar { left: 8px; right: 8px; top: 8px; height: 52px; padding: 0 8px 0 12px; }
  .brand-mini { display: none; }
  .topbar { grid-template-columns: 1fr auto; }
  .phase-chip { justify-self: start; }
  .phase-chip small { display: none; }
  .players-hud { left: 8px; top: 68px; width: 140px; gap: 5px; }
  .player-chip { padding: 6px 8px; }
  .player-chip small { display: none; }
  .deck-hud { right: 8px; top: 68px; padding: 6px 8px; min-width: auto; }
  .deck-stack { width: 22px; height: 30px; }
  .hand-panel { left: 7px; right: 7px; bottom: 7px; min-height: 146px; padding: 9px 8px 10px; border-radius: 17px; }
  .hand { height: 94px; gap: 4px; overflow-x: auto; justify-content: flex-start; padding: 0 4px; scrollbar-width: none; }
  .hand::-webkit-scrollbar { display: none; }
  .hand-card { width: 68px; height: 91px; }
  .hand-card img, .hand-card.pulse .pulse-wave { height: 58px; }
  .hand-card .card-foot { height: 33px; }
  .toast { bottom: 170px; }
  .turn-banner { top: 66px; }
}

@media (max-height: 650px) and (orientation: landscape) {
  .hand-panel { min-height: 112px; padding: 7px 10px; }
  .hand-head { height: 29px; }
  .hand { height: 70px; }
  .hand-card { width: 57px; height: 68px; border-radius: 8px; }
  .hand-card img, .hand-card.pulse .pulse-wave { height: 43px; }
  .hand-card .card-foot { height: 25px; }
  .hand-card .num { font-size: 14px; }
  .hand-card .animal-name { font-size: 7px; }
  .toast { bottom: 125px; }
  .players-hud { transform: scale(.88); transform-origin: top left; }
}

/* =========================================================
   BMQ visual system + gameplay readability pass (v2)
   ========================================================= */
:root {
  --paper: #ffeedd;
  --earth: #492a1b;
  --orange: #e26527;
  --yellow: #ef9e28;
  --forest: #034e42;
  --red: #b73326;
  --green-live: #119b49;
  --pink: #e66a94;
  --caramel: #9a5f26;
  --night: #31465d;
  --sky: #4f6da9;
  --purple: #4b438d;
  --blue-soft: #93adbc;
  --pink-soft: #dfa5bb;
  --sand-soft: #e4b695;
  --coral-soft: #ec8672;
  --yellow-soft: #f4daa4;
  --ink: #ffeedd;
  --muted: rgba(255, 238, 221, .72);
  --green: #034e42;
  --green2: #119b49;
  --deep: #2d1b14;
  --water: #4f6da9;
  --sand: #e4b695;
  --gold: #e26527;
  --danger: #b73326;
  font-family: 'Lexend', 'DM Sans', system-ui, sans-serif;
}

body { background: var(--earth); }
#app-bg { filter: saturate(.72) contrast(1.01) brightness(.82); }
#app-shade {
  background:
    radial-gradient(circle at 50% 42%, rgba(255,238,221,.06), rgba(73,42,27,.25) 48%, rgba(32,20,14,.78)),
    linear-gradient(180deg, rgba(49,70,93,.13), rgba(73,42,27,.58));
  backdrop-filter: blur(.45px);
}
#brand-grafismo {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    url('./assets/brand/botanica-cores-01-amarelo-vivo.svg'),
    url('./assets/brand/folha-01.svg'),
    url('./assets/brand/flor-silhueta-amarelo-claro.svg'),
    url('./assets/brand/folha-03.svg'),
    url('./assets/brand/botanica-cores-02-azul-claro.svg'),
    url('./assets/brand/folha-02.svg');
  background-repeat: no-repeat;
  background-position:
    -4vw 12vh,
    5vw 69vh,
    88vw 10vh,
    79vw 72vh,
    100% 88%,
    96% 36%;
  background-size:
    clamp(190px, 24vw, 390px) auto,
    clamp(42px, 5vw, 76px) auto,
    clamp(96px, 12vw, 170px) auto,
    clamp(120px, 15vw, 210px) auto,
    clamp(180px, 22vw, 320px) auto,
    clamp(70px, 8vw, 120px) auto;
  mix-blend-mode: normal;
  opacity: .58;
}

.glass {
  background: linear-gradient(145deg, rgba(73,42,27,.90), rgba(49,70,93,.76));
  border: 1px solid rgba(255,238,221,.24);
  box-shadow: 0 28px 80px rgba(35,20,13,.34), inset 0 1px rgba(255,238,221,.08);
}
.glass-soft {
  background: rgba(73,42,27,.72);
  border: 1px solid rgba(255,238,221,.18);
  box-shadow: 0 14px 34px rgba(35,20,13,.22);
}

h1 span { color: var(--coral-soft); }
.choice { border-color: rgba(255,238,221,.14); background: rgba(255,238,221,.03); }
.choice:hover { border-color: rgba(255,238,221,.3); }
.choice.selected { background: rgba(226,101,39,.18); border-color: rgba(226,101,39,.68); }
.segmented { background: rgba(35,20,13,.34); }
.segmented button.active { color: var(--earth); background: var(--paper); }
.primary-btn { background: var(--orange); color: var(--paper); box-shadow: 0 10px 28px rgba(226,101,39,.25); }
.secondary-btn { color: var(--paper); background: rgba(255,238,221,.10); border-color: rgba(255,238,221,.18); }
.link-btn { color: rgba(255,238,221,.7); }

.phase-chip { background: rgba(255,238,221,.11); }
.player-chip { background: rgba(73,42,27,.70); border-color: rgba(255,238,221,.14); }
.player-chip.active { border-color: rgba(226,101,39,.78); box-shadow: 0 0 0 1px rgba(226,101,39,.18), 0 8px 24px rgba(0,0,0,.18); }
.player-chip .score { color: var(--coral-soft); }
.deck-stack { background: linear-gradient(135deg, var(--paper), var(--sand-soft)); border-color: rgba(73,42,27,.28); }

/* Larger hand cards: imagery is now the dominant area. */
.hand-panel {
  min-height: 205px;
  padding: 13px 16px 16px;
  background: linear-gradient(145deg, rgba(73,42,27,.94), rgba(49,70,93,.84));
}
.hand-head { height: 43px; }
.hand { height: 142px; gap: 12px; }
.hand-card {
  width: clamp(92px, 8.8vw, 122px);
  height: 140px;
  border-radius: 14px;
  background: var(--paper);
  outline: 2px solid rgba(255,238,221,.22);
  box-shadow: 0 12px 28px rgba(35,20,13,.32);
  transform-origin: 50% 100%;
}
.hand-card:hover:not(:disabled) {
  transform: translateY(-10px) rotate(-.7deg) scale(1.025);
  box-shadow: 0 19px 34px rgba(35,20,13,.38);
}
.hand-card.selected {
  transform: translateY(-16px) scale(1.045);
  outline: 3px solid var(--orange);
  box-shadow: 0 20px 38px rgba(35,20,13,.40), 0 0 0 5px rgba(226,101,39,.14);
}
.hand-card img { width: 100%; height: 101px; object-fit: cover; display: block; }
.hand-card .card-foot {
  height: 39px;
  grid-template-columns: 27px 1fr;
  padding: 4px 8px;
  background: var(--earth);
}
.hand-card .num { font-size: 22px; color: var(--yellow-soft); }
.hand-card .animal-name { font-family: 'Lexend', sans-serif; font-size: 10px; color: var(--paper); }
.hand-card.pulse { background: var(--paper); }
.hand-card.pulse .pulse-art { height: 105px; object-fit: cover; object-position: center; }
.hand-card.pulse .card-foot { display: grid; grid-template-columns: 1fr; text-align: center; background: var(--night); }
.hand-card.pulse .animal-name { text-align: center; font-size: 8.8px; letter-spacing: .04em; }
.play-btn { background: var(--orange); color: var(--paper); font-size: 12px; padding: 9px 16px; }

.toast { bottom: 232px; background: rgba(73,42,27,.94); border-color: rgba(255,238,221,.20); }

/* The Water Window is deliberately NOT a modal.
   It is anchored around the center phase card and never shades or blocks the board. */
#pulse-modal.pulse-window {
  position: absolute;
  z-index: 90;
  width: min(390px, calc(100vw - 24px));
  height: 330px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: transparent;
  padding: 0;
}
#pulse-modal .pulse-card {
  position: relative;
  width: 100%; height: 100%;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: center;
  pointer-events: none;
}
#pulse-modal .pulse-eyebrow,
#pulse-modal #pulse-title,
#pulse-modal #pulse-copy {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  width: max-content;
  max-width: 94%;
  color: var(--paper);
  text-shadow: 0 2px 16px rgba(35,20,13,.65);
}
#pulse-modal .pulse-eyebrow {
  top: 0;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--orange);
  color: var(--paper);
  letter-spacing: .15em;
  box-shadow: 0 8px 20px rgba(35,20,13,.30);
}
#pulse-modal #pulse-title {
  top: 31px;
  font-family: 'Lexend', sans-serif;
  font-size: 17px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 11px;
  background: rgba(73,42,27,.88);
  border: 1px solid rgba(255,238,221,.20);
}
#pulse-modal #pulse-copy {
  top: 73px;
  font-size: 10px;
  color: rgba(255,238,221,.82);
  background: rgba(73,42,27,.64);
  padding: 4px 8px;
  border-radius: 8px;
}
#pulse-modal .phase-transition {
  position: absolute;
  left: 50%; bottom: 47px;
  transform: translateX(-50%);
  margin: 0;
  width: max-content;
  max-width: 96%;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255,238,221,.95);
  border: 1px solid rgba(73,42,27,.22);
  color: var(--earth);
  font-size: 11px;
  box-shadow: 0 10px 26px rgba(35,20,13,.28);
}
#pulse-modal .phase-transition b { color: var(--orange); font-size: 15px; }
#pulse-modal .pulse-actions {
  position: absolute;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  display: flex; gap: 10px;
  pointer-events: auto;
}
.pulse-action {
  min-width: 96px;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font-family: 'Lexend', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(35,20,13,.28);
  transition: transform .16s ease, filter .16s ease;
}
.pulse-action:hover { transform: translateY(-3px) scale(1.035); filter: brightness(1.04); }
.pulse-action.pass { background: var(--paper); color: var(--earth); border: 1px solid rgba(73,42,27,.16); }
.pulse-action.play { background: var(--orange); color: var(--paper); }
#pulse-modal.is-open .pulse-eyebrow { animation: waterWindowChip .55s cubic-bezier(.17,.84,.44,1) both; }
#pulse-modal.is-open #pulse-title { animation: waterWindowTitle .5s .06s cubic-bezier(.17,.84,.44,1) both; }
#pulse-modal.is-open #pulse-copy { animation: waterWindowTitle .5s .11s cubic-bezier(.17,.84,.44,1) both; }
#pulse-modal.is-open .phase-transition { animation: waterWindowBottom .55s .14s cubic-bezier(.17,.84,.44,1) both; }
#pulse-modal.is-open .pulse-actions { animation: waterWindowBottom .55s .19s cubic-bezier(.17,.84,.44,1) both; }
#pulse-modal.is-open::before,
#pulse-modal.is-open::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 180px; height: 180px;
  border-radius: 50%;
  border: 2px solid rgba(255,238,221,.38);
  transform: translate(-50%, -50%) scale(.75);
  animation: waterRing 1.7s ease-out infinite;
}
#pulse-modal.is-open::after { animation-delay: .55s; border-color: rgba(226,101,39,.34); }
@keyframes waterWindowChip { from { opacity:0; transform:translate(-50%,18px) scale(.84); } to { opacity:1; transform:translate(-50%,0) scale(1); } }
@keyframes waterWindowTitle { from { opacity:0; transform:translate(-50%,14px); } to { opacity:1; transform:translate(-50%,0); } }
@keyframes waterWindowBottom { from { opacity:0; transform:translate(-50%,-14px) scale(.94); } to { opacity:1; transform:translate(-50%,0) scale(1); } }
@keyframes waterRing { 0% { opacity:.72; transform:translate(-50%,-50%) scale(.72); } 80%,100% { opacity:0; transform:translate(-50%,-50%) scale(1.65); } }

/* Keep true blocking behavior only for result/rules dialogs. */
#result-modal.modal-backdrop,
#info-modal.modal-backdrop { background: rgba(35,20,13,.74); backdrop-filter: blur(8px); }
.info-card h3 { color: var(--coral-soft); }
.info-card a { color: var(--blue-soft); }

@media (max-width: 760px) {
  #brand-grafismo { opacity: .32; }
  .hand-panel { min-height: 174px; padding: 9px 8px 11px; }
  .hand { height: 120px; gap: 7px; overflow-x: auto; justify-content: flex-start; padding: 0 5px; }
  .hand-card { width: 82px; height: 116px; border-radius: 11px; }
  .hand-card img { height: 82px; }
  .hand-card.pulse .pulse-art { height: 84px; }
  .hand-card .card-foot { height: 34px; grid-template-columns: 22px 1fr; padding: 3px 6px; }
  .hand-card .num { font-size: 18px; }
  .hand-card .animal-name { font-size: 8.2px; }
  .toast { bottom: 194px; }
  #pulse-modal.pulse-window { height: 290px; width: min(340px, calc(100vw - 16px)); }
  #pulse-modal #pulse-title { font-size: 14px; }
  #pulse-modal #pulse-copy { display: none; }
  #pulse-modal .phase-transition { bottom: 43px; font-size: 10px; }
  .pulse-action { min-width: 84px; padding: 10px 14px; }
}

@media (max-height: 650px) and (orientation: landscape) {
  .hand-panel { min-height: 126px; padding: 7px 10px; }
  .hand-head { height: 31px; }
  .hand { height: 82px; }
  .hand-card { width: 68px; height: 80px; border-radius: 9px; }
  .hand-card img, .hand-card.pulse .pulse-art { height: 55px; }
  .hand-card .card-foot { height: 25px; }
  .hand-card .num { font-size: 14px; }
  .hand-card .animal-name { font-size: 7px; }
  .toast { bottom: 140px; }
  #pulse-modal.pulse-window { height: 250px; }
  #pulse-modal .pulse-eyebrow { top: 5px; }
  #pulse-modal #pulse-title { top: 36px; }
  #pulse-modal #pulse-copy { display:none; }
  #pulse-modal .phase-transition { bottom: 40px; }
}


/* BMQ typography + official graphic assets */
:root {
  --font-title: 'Caramel Sauce', 'Segoe Print', 'Bradley Hand', cursive;
  --font-body: 'Lexend', system-ui, sans-serif;
}
html, body, button, input { font-family: var(--font-body); }
h1, h2, .brand-mini, .result-card #result-title, .info-card h2 {
  font-family: var(--font-title);
  font-weight: 400;
  letter-spacing: -.025em;
}
h1 { line-height: .90; }
.lobby-card h1 { font-size: clamp(54px, 7.8vw, 92px); }
.brand-mini { font-size: 20px; line-height: 1; }
.modal-card h2 { font-size: clamp(34px, 4vw, 48px); line-height: 1; }
#pulse-modal #pulse-title {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: -.02em;
  padding-top: 5px;
  padding-bottom: 8px;
}
.eyebrow, legend, .choice, .segmented, .field-hint, .player-chip, .phase-chip,
.deck-hud, .hand-panel, .hand-card, .pulse-action, .toast, .turn-banner,
.info-card, .result-card { font-family: var(--font-body); }

/* Give the official marks breathing room; the game stays dominant. */
#brand-grafismo { filter: saturate(.96); }
.lobby-card { position: relative; isolation: isolate; }
.lobby-card::before {
  content: '';
  position: absolute;
  width: clamp(150px, 21vw, 260px);
  aspect-ratio: 360.33 / 149.42;
  right: clamp(10px, 3vw, 36px);
  top: -24px;
  background: url('./assets/brand/botanica-cores-01-amarelo-vivo.svg') center/contain no-repeat;
  opacity: .34;
  transform: rotate(-4deg);
  z-index: -1;
  pointer-events: none;
}
.lobby-card::after {
  content: '';
  position: absolute;
  width: clamp(68px, 8vw, 110px);
  aspect-ratio: 59.72 / 273.25;
  left: clamp(6px, 2vw, 24px);
  bottom: -42px;
  background: url('./assets/brand/folha-01.svg') center/contain no-repeat;
  opacity: .34;
  transform: rotate(8deg);
  z-index: -1;
  pointer-events: none;
}

@media (max-width: 760px) {
  #brand-grafismo {
    opacity: .40;
    background-position: -40px 12vh, 12px 72vh, calc(100% + 26px) 9vh, 88% 67vh, calc(100% + 60px) 88%, calc(100% + 12px) 40%;
    background-size: 190px auto, 48px auto, 94px auto, 120px auto, 180px auto, 70px auto;
  }
  .lobby-card h1 { font-size: clamp(50px, 15vw, 68px); }
  .brand-mini { font-size: 18px; }
  #pulse-modal #pulse-title { font-size: 20px; }
}

/* v1.3 — official BMQ graphic layer. Explicit <img> elements keep the
   supplied SVGs visible across browsers while remaining non-interactive. */
#brand-grafismo {
  z-index: 2;
  background: none !important;
  opacity: 1;
  overflow: hidden;
}
#app { z-index: 3; }
.brand-mark {
  position: absolute;
  display: block;
  pointer-events: none;
  user-select: none;
  transform-origin: center;
  filter: drop-shadow(0 10px 24px rgba(73,42,27,.10));
  animation: brandDrift 10s ease-in-out infinite alternate;
}
.mark-botanica-yellow {
  width: clamp(220px, 26vw, 430px);
  left: -5vw;
  top: 8vh;
  opacity: .72;
  transform: rotate(-6deg);
}
.mark-folha-01 {
  width: clamp(58px, 6vw, 94px);
  left: 4vw;
  bottom: 7vh;
  opacity: .70;
  transform: rotate(9deg);
  animation-delay: -2s;
}
.mark-flor {
  width: clamp(110px, 13vw, 190px);
  right: 3.5vw;
  top: 8vh;
  opacity: .70;
  transform: rotate(7deg);
  animation-delay: -4s;
}
.mark-folha-03 {
  width: clamp(135px, 15vw, 220px);
  right: 9vw;
  bottom: 4vh;
  opacity: .62;
  transform: rotate(-13deg);
  animation-delay: -6s;
}
.mark-botanica-blue {
  width: clamp(190px, 22vw, 350px);
  right: -5vw;
  bottom: 16vh;
  opacity: .58;
  transform: rotate(5deg);
  animation-delay: -3s;
}
.mark-folha-02 {
  width: clamp(76px, 8vw, 126px);
  right: 1.5vw;
  top: 40vh;
  opacity: .64;
  transform: rotate(13deg);
  animation-delay: -5s;
}
@keyframes brandDrift {
  0% { translate: 0 0; }
  100% { translate: 0 -8px; }
}

/* Cache-busted official graphic references used by the lobby composition. */
.lobby-card::before { background-image: url('./assets/brand-v2/botanica-cores-01-amarelo-vivo.svg'); }
.lobby-card::after { background-image: url('./assets/brand-v2/folha-01.svg'); }

@media (max-width: 760px) {
  #brand-grafismo { opacity: .78; }
  .mark-botanica-yellow { width: 210px; left: -90px; top: 12vh; opacity: .54; }
  .mark-folha-01 { width: 52px; left: 10px; bottom: 20vh; }
  .mark-flor { width: 92px; right: -28px; top: 12vh; }
  .mark-folha-03 { width: 112px; right: -30px; bottom: 22vh; }
  .mark-botanica-blue { width: 190px; right: -105px; bottom: 34vh; opacity: .45; }
  .mark-folha-02 { width: 64px; right: 5px; top: 47vh; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark { animation: none; }
}

/* v1.4 — center hierarchy, phase guide, grouped hand and quieter brand marks */

/* Brand graphics are now supporting ambience only: three official marks, no pattern-wall effect. */
.lobby-card::before,
.lobby-card::after { display: none !important; }
#brand-grafismo { opacity: 1; filter: none; }
.brand-mark { animation: none !important; filter: none; }
.mark-botanica-blue {
  width: clamp(210px, 22vw, 350px);
  right: -7vw;
  bottom: 12vh;
  opacity: .17;
  transform: rotate(5deg);
}
.mark-flor {
  width: clamp(90px, 10vw, 150px);
  right: 3vw;
  top: 11vh;
  opacity: .15;
  transform: rotate(6deg);
}
.mark-folha-03 {
  width: clamp(100px, 12vw, 180px);
  left: 1.5vw;
  bottom: 5vh;
  opacity: .13;
  transform: rotate(-12deg);
}

/* Side reference for the expansion: informative, compact and always secondary to the board. */
.phase-guide {
  position: absolute;
  z-index: 8;
  right: 16px;
  top: 148px;
  width: 215px;
  padding: 13px;
  border-radius: 17px;
  background: rgba(73,42,27,.73);
  border-color: rgba(255,238,221,.13);
  pointer-events: none;
}
.phase-guide-head { padding: 1px 3px 10px; border-bottom: 1px solid rgba(255,238,221,.10); }
.phase-guide-head .eyebrow { margin: 0 0 3px; font-size: 8px; }
.phase-guide-head strong { font-family: var(--font-title); font-weight: 400; font-size: 22px; line-height: 1; color: var(--paper); }
.phase-guide-list { display: grid; gap: 5px; padding-top: 8px; }
.phase-guide-item {
  display: grid;
  grid-template-columns: 27px 1fr;
  gap: 7px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 11px;
  border: 1px solid transparent;
  color: rgba(255,238,221,.62);
  transition: .24s ease;
}
.phase-guide-icon { font-size: 16px; text-align: center; filter: saturate(.78); }
.phase-guide-item b { display: block; font-size: 10px; color: rgba(255,238,221,.84); }
.phase-guide-item small { display: block; margin-top: 1px; font-size: 7.5px; line-height: 1.3; color: rgba(255,238,221,.52); }
.phase-guide-item.active {
  background: rgba(255,238,221,.93);
  border-color: rgba(255,238,221,.34);
  box-shadow: 0 8px 20px rgba(35,20,13,.18);
  color: var(--earth);
}
.phase-guide-item.active b { color: var(--earth); }
.phase-guide-item.active small { color: rgba(73,42,27,.68); }
.phase-guide-item.active .phase-guide-icon { transform: scale(1.07); filter: none; }

/* Equal cards behave as a visual family while remaining individually clickable. */
.hand {
  gap: 16px;
  align-items: flex-end;
  overflow-x: auto;
  justify-content: center;
  scrollbar-width: none;
  padding: 0 7px;
}
.hand::-webkit-scrollbar { display: none; }
.hand-group {
  position: relative;
  display: flex;
  align-items: flex-end;
  flex: 0 0 auto;
  padding-top: 15px;
}
.hand-group + .hand-group { margin-left: 1px; }
.hand-group .hand-card { z-index: 1; }
.hand-group .hand-card + .hand-card { margin-left: -16px; }
.hand-group .hand-card:hover,
.hand-group .hand-card.selected { z-index: 10; }
.hand-group[data-count="2"]::before,
.hand-group[data-count="3"]::before,
.hand-group[data-count="4"]::before,
.hand-group[data-count="5"]::before {
  content: '×' attr(data-count);
  position: absolute;
  right: -3px;
  top: 0;
  z-index: 20;
  min-width: 25px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 1px solid rgba(73,42,27,.20);
  color: var(--earth);
  font-size: 8px;
  font-weight: 800;
  box-shadow: 0 4px 11px rgba(35,20,13,.18);
}
.pulse-group { margin-left: 7px; }
.pulse-group::after {
  content: '';
  position: absolute;
  left: -11px;
  top: 22px;
  bottom: 7px;
  width: 1px;
  background: rgba(255,238,221,.16);
}

/* The larger central phase card gets more breathing room during the decision window. */
#pulse-modal.pulse-window { width: min(440px, calc(100vw - 24px)); height: 390px; }
#pulse-modal.is-open::before,
#pulse-modal.is-open::after { width: 235px; height: 235px; border-width: 1.5px; }
#pulse-modal .pulse-eyebrow { top: -4px; }
#pulse-modal #pulse-title { top: 28px; }
#pulse-modal #pulse-copy { top: 70px; }
#pulse-modal .phase-transition { bottom: 49px; }

/* Finale stays visible until the bouncing-card sequence is complete. */
#result-modal { transition: opacity .28s ease; }

@media (max-width: 1180px) {
  .phase-guide { width: 188px; right: 10px; top: 145px; padding: 10px; }
  .phase-guide-head strong { font-size: 19px; }
  .phase-guide-item { grid-template-columns: 23px 1fr; padding: 6px; gap: 5px; }
  .phase-guide-item small { font-size: 7px; }
}

@media (max-width: 900px) {
  .phase-guide {
    left: 50%; right: auto; top: 68px;
    transform: translateX(-50%);
    width: min(560px, calc(100vw - 300px));
    min-width: 390px;
    padding: 6px 8px;
    border-radius: 13px;
  }
  .phase-guide-head { display: none; }
  .phase-guide-list { grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 0; }
  .phase-guide-item { display: flex; gap: 4px; padding: 5px 6px; justify-content: center; }
  .phase-guide-item small { display: none; }
  .phase-guide-item b { font-size: 8px; }
  .phase-guide-icon { font-size: 12px; }
}

@media (max-width: 760px) {
  .mark-botanica-blue { width: 180px; right: -95px; bottom: 30vh; opacity: .11; }
  .mark-flor { width: 82px; right: -22px; top: 14vh; opacity: .12; }
  .mark-folha-03 { width: 92px; left: -28px; bottom: 24vh; opacity: .10; }
  .phase-guide {
    top: 62px;
    min-width: 0;
    width: calc(100vw - 16px);
    background: rgba(73,42,27,.55);
  }
  .phase-guide-list { gap: 2px; }
  .phase-guide-item { padding: 4px 3px; }
  .phase-guide-item b { font-size: 7px; }
  .phase-guide-icon { font-size: 11px; }
  .hand { justify-content: flex-start; gap: 12px; padding-left: 4px; }
  .hand-group { padding-top: 13px; }
  .hand-group .hand-card + .hand-card { margin-left: -11px; }
  .hand-group[data-count]::before { right: -2px; transform: scale(.9); transform-origin: top right; }
  #pulse-modal.pulse-window { height: 335px; width: min(360px, calc(100vw - 12px)); }
  #pulse-modal.is-open::before,
  #pulse-modal.is-open::after { width: 190px; height: 190px; }
}

@media (max-height: 650px) and (orientation: landscape) {
  .phase-guide { display: none !important; }
  .hand-group { padding-top: 8px; }
  .hand-group[data-count]::before { display: none; }
  .hand-group .hand-card + .hand-card { margin-left: -9px; }
  #pulse-modal.pulse-window { height: 280px; }
  #pulse-modal.is-open::before,
  #pulse-modal.is-open::after { width: 160px; height: 160px; }
}

/* v1.5 — phase guide imagery, hydrology popups and persistent hand counts */
.phase-guide { pointer-events: auto; }
.phase-guide-item {
  width: 100%;
  appearance: none;
  font: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
  outline: none;
}
.phase-guide-image {
  width: 31px;
  height: 31px;
  display: block;
  object-fit: contain;
  border-radius: 50%;
  filter: saturate(.82) contrast(.96);
  box-shadow: 0 2px 8px rgba(20,12,8,.16);
  transition: transform .2s ease, filter .2s ease;
}
.phase-guide-item:hover .phase-guide-image { transform: scale(1.08); filter: saturate(1) contrast(1); }
.phase-guide-item:focus-visible { border-color: rgba(255,238,221,.58); box-shadow: 0 0 0 2px rgba(255,238,221,.16); }
.phase-guide-item.active .phase-guide-image { transform: scale(1.10); filter: saturate(1.05) contrast(1.02); box-shadow: 0 3px 10px rgba(73,42,27,.22); }

.hand-heading { min-width: 0; }
.hand-label-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hand-count-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,238,221,.94);
  border: 1px solid rgba(73,42,27,.14);
  color: var(--earth);
  font-family: 'Lexend', sans-serif;
  font-size: 8px;
  line-height: 1;
  font-weight: 750;
  white-space: nowrap;
  box-shadow: 0 3px 9px rgba(35,20,13,.14);
}
.hand-head .eyebrow { flex: 0 0 auto; }

.phase-info-layout { display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: start; }
.phase-info-visual { position: sticky; top: 0; }
.phase-info-art { width: 145px; height: 145px; object-fit: contain; display: block; border-radius: 50%; }
.phase-info-period { margin: 10px 0 0; font-size: 10px; line-height: 1.35; color: rgba(255,238,221,.58); text-align: center; }
.phase-info-body h2 { margin-top: 0; }
.phase-info-body h3 { margin-top: 18px; }
.phase-info-game {
  margin-top: 18px;
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(226,101,39,.10);
  border: 1px solid rgba(226,101,39,.23);
}
.phase-info-game strong { color: var(--paper); }
.phase-info-sources { margin-top: 18px; padding-top: 12px; border-top: 1px solid rgba(255,238,221,.10); }
.phase-info-sources a { display: inline-block; margin: 4px 10px 0 0; }

@media (max-width: 900px) {
  .phase-guide-image { width: 24px; height: 24px; }
}
@media (max-width: 760px) {
  .phase-guide-image { width: 21px; height: 21px; }
  .phase-guide-item { min-height: 38px; }
  .player-chip small { display: block !important; font-size: 8px; margin-top: 2px; }
  .hand-count-badge { font-size: 7.5px; padding: 2px 7px; }
  .phase-info-layout { grid-template-columns: 1fr; gap: 10px; }
  .phase-info-visual { position: static; display: grid; place-items: center; }
  .phase-info-art { width: 118px; height: 118px; }
}
@media (max-height: 650px) and (orientation: landscape) {
  /* Keep strategic information visible; compress it instead of hiding it. */
  .phase-guide { display: block !important; top: 61px; right: 8px; width: 172px; padding: 6px; }
  .phase-guide-head { display: none; }
  .phase-guide-list { display: grid; grid-template-columns: repeat(2,1fr); gap: 3px; padding: 0; }
  .phase-guide-item { display: grid; grid-template-columns: 20px 1fr; min-height: 31px; padding: 3px 4px; gap: 3px; }
  .phase-guide-image { width: 19px; height: 19px; }
  .phase-guide-item b { font-size: 6.5px; }
  .phase-guide-item small { display: none; }
  .hand-label-row { gap: 5px; }
  .hand-count-badge { min-height: 16px; padding: 1px 5px; font-size: 6.5px; }
}
@media (max-height: 650px) and (orientation: landscape) {
  .hand-group[data-count="2"]::before,
  .hand-group[data-count="3"]::before,
  .hand-group[data-count="4"]::before,
  .hand-group[data-count="5"]::before { display: grid !important; transform: scale(.78); transform-origin: top right; }
}
.lobby-links .dossel-link{display:inline-flex;align-items:center;text-decoration:none;color:#ffeedd;border:1px solid rgba(255,238,221,.22);background:rgba(3,78,66,.64);padding:7px 11px;border-radius:999px;font-size:11px;font-weight:800}.lobby-links .dossel-link:hover{background:#034e42}
