/* ZUG Landing — boot + menu Kairosoft sobre o cenário real */

:root {
  --ks-pink: #ff8ab8;
  --ks-pink-dk: #e85898;
  --ks-pink-lt: #ffc0d8;
  --ks-brown: #5c4030;
  --ks-brown-dk: #3d2a20;
  --ks-shadow: rgba(74, 54, 40, 0.28);
  --font-ui: 'M PLUS Rounded 1c', system-ui, sans-serif;
  --font-pixel: 'Press Start 2P', monospace;
  --ease-bounce: cubic-bezier(0.34, 1.45, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Landing: sem HUD do jogo */
body.landing-idle .user-fab-wrap,
body.landing-idle .sims-panel,
body.landing-idle .day-cycle-widget,
body.landing-play .user-fab-wrap,
body.landing-play .sims-panel,
body.landing-play .day-cycle-widget {
  display: none !important;
}

body.landing-idle::after,
body.landing-play::after {
  display: none;
}

/* Cenário ocupa tela inteira */
.game-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.game-screen #scene {
  z-index: 1;
}

/* Esconder elementos até START */
body.landing-idle .pedestrians,
body.landing-idle .traffic,
body.landing-idle #dogWrap,
body.landing-idle #dogShadowRpg,
body.landing-idle .poop-layer,
body.landing-idle .map-click-layer,
body.landing-idle .bark-bubble,
.landing-scene .dog-sleep-spot,
.landing-scene .sleep-zzz {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.landing-idle .walker,
body.landing-idle .car {
  animation-play-state: paused !important;
}

/* Cachorro aparece ao dar START */
body.landing-play #dogWrap,
body.landing-play #dogShadowRpg {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

body.landing-play #dogWrap {
  animation: landingDogIn 0.75s var(--ease-bounce) both;
}

@keyframes landingDogIn {
  from {
    opacity: 0;
    transform: translate(-50%, 20px) scale(0.6);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

body.landing-play .landing-scene .dog-wrap,
body.landing-play #dogWrap {
  position: absolute !important;
  left: 38% !important;
  bottom: 30% !important;
  top: auto !important;
  right: auto !important;
  width: min(120px, 28vw) !important;
  height: auto !important;
  z-index: 20;
  transform: translateX(-50%);
}

body.landing-play #dogShadowRpg {
  left: 38% !important;
  bottom: 28% !important;
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* ── Boot ───────────────────────────────────────────────────── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0806;
  transition: opacity 0.7s var(--ease-out);
}

body.is-booting .game-screen {
  opacity: 0;
  pointer-events: none;
}

body.is-booting .splash {
  opacity: 1;
}

body.is-revealing .splash {
  opacity: 0;
  pointer-events: none;
}

body.is-revealing .game-screen,
body.landing-idle .game-screen,
body.landing-play .game-screen {
  opacity: 1;
  pointer-events: auto;
}

.boot-power {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  animation: bootFlash 0.4s ease-out 0.05s both;
}

@keyframes bootFlash {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

.boot-scanlines {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, #000 2px, #000 4px);
  pointer-events: none;
}

.boot-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px;
}

.boot-logo {
  width: min(180px, 48vw);
  filter: drop-shadow(0 4px 0 #8a4a10);
  animation: bootLogoIn 0.8s var(--ease-bounce) 0.2s both;
}

@keyframes bootLogoIn {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.boot-title {
  margin-top: 16px;
  font-family: var(--font-pixel);
  font-size: clamp(12px, 3vw, 16px);
  color: #ffe8b8;
  text-shadow: 0 2px 0 #6a3810;
}

.boot-loader {
  width: min(300px, 84vw);
  margin-top: 28px;
}

.boot-loader-track {
  height: 16px;
  padding: 2px;
  border-radius: 999px;
  background: #2a2018;
  border: 3px solid #5a4838;
}

.boot-loader-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(180deg, #7ee878, #3cb838);
  transition: width 0.1s linear;
}

.boot-loader-label {
  margin-top: 8px;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: rgba(255, 230, 200, 0.75);
}

.boot-copy {
  position: fixed;
  bottom: 14px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
}

/* ── Overlay título (Kairosoft) ─────────────────────────────── */
.landing-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vh, 28px) 16px 20px;
  pointer-events: none;
  font-family: var(--font-ui);
}

.landing-overlay > * {
  pointer-events: auto;
}

.landing-lang-fab {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 90;
  min-height: 42px;
  padding: 8px 14px;
  border: 3px solid #fff8d8;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff0a0, #ffc040);
  color: #4a2808;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 4px 0 #c87818, 0 8px 18px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

.landing-lang-fab:hover,
.landing-lang-fab:focus-visible {
  filter: brightness(1.04);
  outline: none;
}

.landing-title-block {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  animation: titleDrop 0.6s var(--ease-bounce) 0.15s both;
}

.landing-alpha-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 18px;
  border: 3px solid #fff;
  border-radius: 999px;
  background-color: #d92525;
  background: linear-gradient(180deg, #ff5c5c 0%, #e02828 100%);
  color: #fff;
  font-family: var(--font-ui);
  font-size: clamp(12px, 2vw, 14px);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.22);
  box-shadow: 0 4px 0 #9e1515, 0 8px 20px rgba(0, 0, 0, 0.22);
}

@keyframes titleDrop {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.landing-logo {
  width: min(560px, 96vw);
  max-height: min(240px, 32vh);
  object-fit: contain;
  filter:
    drop-shadow(0 4px 0 rgba(90, 50, 30, 0.45))
    drop-shadow(0 8px 20px rgba(0, 0, 0, 0.25));
}

.landing-tagline {
  margin-top: 8px;
  font-size: clamp(12px, 2.2vw, 15px);
  font-weight: 800;
  color: #fff;
  text-shadow:
    0 2px 0 var(--ks-brown-dk),
    0 0 12px rgba(0, 0, 0, 0.35);
  letter-spacing: 0.04em;
}

.landing-press {
  position: relative;
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border: none;
  border-radius: 999px;
  font-family: var(--font-pixel);
  font-size: clamp(8px, 2vw, 10px);
  color: #4a2808;
  background: linear-gradient(180deg, #fff0a0, #ffc040);
  border: 3px solid #fff8d8;
  box-shadow: 0 4px 0 #c87818, 0 8px 24px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  animation: pressPulse 1.4s ease-in-out infinite;
}

body.landing-play .landing-press {
  display: none;
}

@keyframes pressPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(0.98); }
}

.landing-press-icon {
  font-size: 12px;
}

/* Menu principal — botões rosas centralizados */
.ks-main-menu {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: min(320px, 92vw);
  margin-top: auto;
  margin-bottom: auto;
  padding: 8px 0;
}

.ks-main-menu[hidden] {
  display: none;
}

body.landing-idle .landing-overlay,
body.landing-play .landing-overlay {
  justify-content: center;
  gap: clamp(12px, 2vh, 22px);
}

body.landing-idle .landing-title-block,
body.landing-play .landing-title-block {
  margin-top: 0;
  margin-bottom: 0;
}

body.landing-idle .landing-logo {
  width: min(620px, 98vw);
  max-height: min(280px, 38vh);
}

body.landing-play .landing-logo {
  width: min(470px, 94vw);
  max-height: min(210px, 30vh);
}

body.landing-play .ks-main-menu {
  width: min(360px, 92vw);
  margin-top: 0;
  margin-bottom: 0;
}

body.landing-idle .ks-main-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  pointer-events: none;
}

body.landing-play .ks-main-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.4s ease, transform 0.45s var(--ease-bounce);
  animation: menuIn 0.5s var(--ease-bounce) both;
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.ks-menu-btn {
  position: relative;
  min-height: 56px;
  padding: 12px 20px;
  border: 4px solid #fff;
  border-radius: 14px;
  font-family: var(--font-ui);
  font-size: clamp(17px, 4vw, 22px);
  font-weight: 900;
  color: #fff;
  text-align: center;
  cursor: pointer;
  background: linear-gradient(180deg, var(--ks-pink-lt) 0%, var(--ks-pink) 45%, var(--ks-pink-dk) 100%);
  box-shadow:
    0 5px 0 #b84078,
    0 8px 20px rgba(0, 0, 0, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.12s, filter 0.12s;
}

.ks-menu-btn:hover {
  filter: brightness(1.05);
}

.ks-menu-btn.is-selected {
  transform: scale(1.03);
  box-shadow:
    0 6px 0 #903060,
    0 0 0 3px rgba(255, 255, 255, 0.9),
    0 12px 28px rgba(0, 0, 0, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.55);
}

.ks-menu-hand {
  position: absolute;
  left: -16px;
  font-size: 26px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
  transition: top 0.22s var(--ease-out);
  pointer-events: none;
  z-index: 2;
  transform: rotate(-8deg);
  animation: pawBob 0.6s ease-in-out infinite;
}

@keyframes pawBob {
  0%, 100% { transform: rotate(-8deg) translateY(0); }
  50% { transform: rotate(-4deg) translateY(-4px); }
}

.landing-footer {
  position: fixed;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 16px;
  font-family: var(--font-pixel);
  font-size: 7px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.auth-error {
  position: fixed;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  max-width: 90vw;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: #e85068;
  border: 3px solid #b83048;
  border-radius: 12px;
  box-shadow: 0 4px 0 #902838;
}

.auth-error[hidden] {
  display: none;
}

.auth-form-error {
  margin: 8px 0 14px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: #e85068;
  border: 3px solid #b83048;
  border-radius: 12px;
  box-shadow: 0 4px 0 #902838;
}

.auth-form-error[hidden] {
  display: none;
}

/* ── Modal de formulário ────────────────────────────────────── */
.ks-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ks-modal[hidden] {
  display: none;
}

.ks-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 30, 50, 0.55);
  backdrop-filter: blur(4px);
}

.ks-modal-sheet {
  position: relative;
  width: min(400px, 100%);
  max-height: 90dvh;
  overflow-y: auto;
  padding: 24px 20px;
  background: #fffdf8;
  border: 4px solid var(--ks-brown);
  border-radius: 20px;
  box-shadow:
    inset 0 0 0 3px #fff,
    0 10px 0 var(--ks-shadow, rgba(60, 40, 30, 0.25)),
    0 20px 50px rgba(0, 0, 0, 0.25);
  font-family: var(--font-ui);
}

.ks-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 3px solid var(--ks-brown);
  border-radius: 10px;
  background: #ffe8d8;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  color: var(--ks-brown-dk);
}

.ks-modal .content-panel {
  display: none;
}

.ks-modal .content-panel.is-active {
  display: block;
  animation: panelPop 0.28s var(--ease-out) both;
}

.ks-modal--takeover {
  z-index: 95;
}

.ks-modal-sheet--takeover {
  width: min(360px, calc(100% - 20px));
  text-align: center;
  padding: 24px 18px 18px;
}

.takeover-copy {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: #6b4f41;
}

.takeover-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.takeover-actions .gbtn {
  min-width: 130px;
}

@keyframes panelPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.panel-title {
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 900;
  color: var(--ks-brown-dk);
  margin-bottom: 18px;
}

.panel-hint {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 700;
  color: #8a7260;
}

.game-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: #8a7260;
  text-transform: uppercase;
}

.game-form .auth-remember-row {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #7b6758;
  text-transform: none;
}

.game-form .auth-remember-row input[type="checkbox"] {
  min-height: auto;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--ks-pink);
}

.game-form .auth-remember-row span {
  font-weight: 800;
}

.game-form input,
.game-form select {
  min-height: 46px;
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  border: 3px solid #d8c0b0;
  border-radius: 12px;
  background: #fff;
  color: var(--ks-brown-dk);
}

.game-form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ks-brown) 50%),
    linear-gradient(135deg, var(--ks-brown) 50%, transparent 50%),
    linear-gradient(180deg, #fff, #fff);
  background-position:
    calc(100% - 22px) calc(50% - 2px),
    calc(100% - 16px) calc(50% - 2px),
    0 0;
  background-size:
    6px 6px,
    6px 6px,
    100% 100%;
  background-repeat: no-repeat;
  cursor: pointer;
}

.game-form input:focus,
.game-form select:focus {
  outline: none;
  border-color: var(--ks-pink);
  box-shadow: 0 0 0 3px rgba(255, 138, 184, 0.25);
}

.dog-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.gbtn-inline {
  min-height: 46px;
  margin-top: 0;
  padding: 0 14px;
  font-size: 14px;
  white-space: nowrap;
}

.dog-name-feedback {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.dog-name-feedback[hidden] {
  display: none;
}

.dog-name-status {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
  color: #8a7260;
}

.dog-name-status.is-ok {
  color: #23814b;
}

.dog-name-status.is-bad {
  color: #c13d54;
}

.dog-name-status.is-loading {
  color: #8a7260;
}

.dog-name-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dog-name-tag {
  min-height: 34px;
  padding: 6px 12px;
  border: 2px solid #f0c8d8;
  border-radius: 999px;
  background: #fff4fa;
  color: #8a3555;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.dog-name-tag:hover,
.dog-name-tag:focus-visible {
  border-color: var(--ks-pink);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 138, 184, 0.18);
}

.server-picker-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.server-flag-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.server-flag-option {
  min-height: 78px;
  padding: 10px 8px;
  border: 3px solid #d8c0b0;
  border-radius: 14px;
  background: #fff;
  color: var(--ks-brown-dk);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(92, 64, 48, 0.14);
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.server-flag-option:hover,
.server-flag-option:focus-visible {
  border-color: var(--ks-pink);
  box-shadow: 0 4px 0 rgba(184, 64, 120, 0.25);
  outline: none;
}

.server-flag-option.is-active {
  border-color: var(--ks-pink);
  background: linear-gradient(180deg, #fff4fb, #ffe7f2);
  box-shadow: 0 4px 0 rgba(184, 64, 120, 0.28), 0 0 0 3px rgba(255, 138, 184, 0.18);
  transform: translateY(-1px);
}

.server-flag-emoji {
  font-size: 26px;
  line-height: 1;
}

.server-flag-label {
  font-size: 12px;
  font-weight: 900;
  color: #8a7260;
  text-transform: none;
  text-align: center;
}

@media (max-width: 560px) {
  .dog-name-row {
    grid-template-columns: 1fr;
  }

  .gbtn-inline {
    width: 100%;
  }

  .server-flag-picker {
    grid-template-columns: 1fr;
  }
}

.gbtn {
  min-height: 48px;
  border: none;
  border-radius: 14px;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.gbtn-primary {
  color: #4a2808;
  background: linear-gradient(180deg, #ffe878, #ffb83c);
  border: 3px solid #fff8d0;
  box-shadow: 0 4px 0 #c87818;
}

.gbtn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #c87818;
}

.gbtn-outline {
  margin-top: 8px;
  background: #fff;
  border: 3px solid #d8c0b0;
  color: var(--ks-brown-dk);
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 2px dashed #e8d8cc;
  cursor: pointer;
}

.setting-label {
  font-weight: 800;
}

body.modal-open .landing-overlay {
  pointer-events: none;
}

body.modal-open .ks-modal {
  pointer-events: auto;
}

@media (max-width: 600px) {
  .landing-lang-fab {
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    min-height: 38px;
    padding: 7px 12px;
    font-size: 12px;
  }

  .landing-logo {
    width: min(420px, 96vw);
    max-height: 24vh;
  }

  .landing-alpha-badge {
    font-size: 11px;
    letter-spacing: 0.08em;
    padding: 6px 14px;
  }

  body.landing-idle .landing-logo {
    width: min(460px, 98vw);
    max-height: 28vh;
  }

  body.landing-play .landing-logo {
    width: min(400px, 96vw);
    max-height: 24vh;
  }

  .ks-menu-btn {
    min-height: 50px;
    font-size: 17px;
  }

  .ks-menu-hand {
    font-size: 24px;
    left: -8px;
  }
}
