/* ============================================================
   Hawker Match - Styles
   Mobile-first, Malaysian tropical palette
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, #FFA726 0%, #FF7043 50%, #E91E63 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #1F2937;
  transition: background 1s ease;
  position: relative;
  overflow: hidden;
}

/* ====== Per-level background decoration layer ====== */
#decoration-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

/* All interactive content sits above decorations */
#header,
#goal-bar,
#grid-container {
  position: relative;
  z-index: 3;
}

.decoration {
  position: absolute;
  font-size: 80px;
  opacity: 0.28;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.25));
  pointer-events: none;
  animation: float-around 25s ease-in-out infinite;
}

.decoration.small  { font-size: 40px;  opacity: 0.25; }
.decoration.medium { font-size: 65px;  opacity: 0.28; }
.decoration.large  { font-size: 95px;  opacity: 0.30; }
.decoration.huge   { font-size: 130px; opacity: 0.20; }

@keyframes float-around {
  0%   { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(20px, -30px) rotate(8deg); }
  50%  { transform: translate(-15px, -20px) rotate(-5deg); }
  75%  { transform: translate(10px, 25px) rotate(6deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

/* Ensure game container sits above decorations */
#game {
  position: relative;
  z-index: 1;
}

/* ====== Game container ====== */
#game {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  max-height: 900px;
  background: linear-gradient(180deg, #FFF8E7 0%, #FFE4B5 100%);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* ====== Header ====== */
#header {
  background: linear-gradient(180deg, #EF4444 0%, #DC2626 100%);
  color: white;
  padding: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 2;
}

#top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

#menu-btn, #music-btn {
  background: rgba(255,255,255,0.25);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

#music-btn {
  padding: 6px 10px;
  font-size: 14px;
}

#music-btn.muted {
  opacity: 0.4;
}

#music-btn.muted::after {
  content: " ✕";
  font-size: 11px;
}

#level-title {
  font-size: 16px;
  font-weight: 800;
}

#coins {
  background: rgba(255,255,255,0.25);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}

#info-row {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}

.info-block {
  background: rgba(255,255,255,0.2);
  padding: 6px 10px;
  border-radius: 10px;
  flex: 1;
  text-align: center;
}

.info-block .label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
  display: block;
}

.info-block .value {
  font-size: 16px;
  font-weight: 800;
}

/* ====== Grid ====== */
#grid-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  position: relative;
}

/* Scene illustrations positioned in visible empty zones */
.scene-top,
.scene-bottom {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.scene-top {
  top: 0;
  height: 28%;
  /* Soft fade at the bottom so scene blends into the grid area */
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
}

.scene-bottom {
  bottom: 0;
  height: 22%;
  -webkit-mask-image: linear-gradient(to top, #000 70%, transparent 100%);
          mask-image: linear-gradient(to top, #000 70%, transparent 100%);
}

/* Grid sits on top of scene illustrations */
#grid {
  position: relative;
  z-index: 2;
  padding: 10px;
  /* Soft cream backdrop so tiles stay readable against any scene */
  background:
    linear-gradient(180deg,
      rgba(255, 248, 231, 0.92) 0%,
      rgba(255, 228, 181, 0.88) 100%);
  border: 2px solid rgba(139, 69, 19, 0.35);
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 7/8;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  /* Outer glow + drop shadow so the grid pops off the scene */
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.4),
    0 8px 24px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.tile {
  position: absolute;
  background: rgba(255,255,255,0.7);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: grab;
  transition: left 0.25s cubic-bezier(0.34, 1.2, 0.64, 1),
              top 0.28s cubic-bezier(0.5, 0.04, 0.36, 1),
              transform 0.15s,
              background 0.15s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  pointer-events: auto;
}

.tile:active,
.tile.dragging {
  cursor: grabbing;
  z-index: 10;
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.tile.dragging {
  transition: transform 0.05s;
}

.tile.selected {
  background: linear-gradient(135deg, #FCD34D, #F59E0B);
  transform: scale(1.15);
  box-shadow: 0 0 20px rgba(252, 211, 77, 0.9), 0 0 40px rgba(245, 158, 11, 0.5);
  z-index: 5;
  animation: selected-pulse 0.7s infinite;
}

@keyframes selected-pulse {
  0%, 100% { transform: scale(1.15); box-shadow: 0 0 20px rgba(252, 211, 77, 0.9); }
  50%      { transform: scale(1.25); box-shadow: 0 0 30px rgba(252, 211, 77, 1), 0 0 50px rgba(245, 158, 11, 0.7); }
}

.tile.clearing {
  animation: clear-burst 0.4s ease forwards;
}

@keyframes clear-burst {
  0%   { transform: scale(1) rotate(0); opacity: 1; filter: brightness(1); }
  30%  { transform: scale(1.5) rotate(15deg); opacity: 1; filter: brightness(1.8); }
  60%  { transform: scale(1.3) rotate(-10deg); opacity: 0.8; filter: brightness(2); }
  100% { transform: scale(0) rotate(360deg); opacity: 0; filter: brightness(3); }
}

/* New tile spawning — gets a little bounce on first appear */
.tile.spawning {
  animation: tile-spawn-bounce 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes tile-spawn-bounce {
  0%   { opacity: 0; transform: scale(0.4); }
  50%  { opacity: 1; transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Staggered entry on level start */
.tile.entering {
  animation: tile-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

@keyframes tile-enter {
  0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.tile.shake {
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.tile.special {
  background: linear-gradient(135deg, #FCD34D, #F59E0B);
  box-shadow: 0 0 10px rgba(252, 211, 77, 0.6);
  animation: special-pulse 1.5s infinite;
}

.tile.special-star {
  background: linear-gradient(135deg, #EC4899, #A855F7, #3B82F6);
  background-size: 200% 200%;
  animation: rainbow-pulse 2s infinite;
}

@keyframes special-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(252, 211, 77, 0.6); }
  50% { box-shadow: 0 0 20px rgba(252, 211, 77, 0.9); }
}

@keyframes rainbow-pulse {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ====== Goal display ====== */
#goal-bar {
  background: rgba(255,255,255,0.6);
  margin: 8px 12px;
  padding: 10px 14px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

#goal-label {
  font-weight: 700;
  font-size: 14px;
  color: #6B7280;
}

#goal-progress {
  font-weight: 800;
  font-size: 16px;
  color: #DC2626;
}

/* ====== Overlays ====== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.92);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  flex-direction: column;
  color: white;
  padding: 20px;
}

/* ====== Menu / Level Select ====== */
#menu-overlay h1 {
  font-size: 36px;
  margin-bottom: 8px;
  text-align: center;
  text-shadow: 0 4px 12px rgba(0,0,0,0.5);
  background: linear-gradient(90deg, #FCD34D, #F59E0B, #EF4444);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

#menu-overlay .subtitle {
  font-size: 14px;
  color: #FCD34D;
  margin-bottom: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#menu-coins {
  background: rgba(252, 211, 77, 0.2);
  padding: 6px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 700;
}

#resume-section {
  width: 100%;
  max-width: 420px;
  padding: 0 12px 8px;
}

#resume-btn {
  width: 100%;
  background: linear-gradient(135deg, #FCD34D, #F59E0B);
  color: #7C2D12;
  border: 2px solid #92400E;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
  margin: 0;
}

#level-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 420px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 12px;
}

.level-item {
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 12px;
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.1s;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.level-item:active {
  transform: scale(0.95);
}

.level-item.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.level-item.completed {
  border-color: #FCD34D;
  background: linear-gradient(135deg, rgba(252, 211, 77, 0.2), rgba(245, 158, 11, 0.2));
}

.lvl-num {
  font-size: 24px;
  font-weight: 800;
  color: white;
}

.lvl-name {
  font-size: 9px;
  color: #FCD34D;
  margin-top: 2px;
  font-weight: 600;
  line-height: 1.1;
}

.lvl-stars {
  font-size: 10px;
  margin-top: 4px;
  letter-spacing: 0.05em;
}

/* ====== Win / Lose screens ====== */
#win-overlay {
  background: rgba(15, 20, 25, 0.95);
}

#win-overlay h2,
#lose-overlay h2 {
  font-size: 40px;
  margin-bottom: 12px;
  font-weight: 800;
  animation: pop-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#win-overlay h2 {
  color: #FCD34D;
  text-shadow: 0 0 30px rgba(252, 211, 77, 0.7);
}

#lose-overlay h2 {
  color: #EF4444;
}

@keyframes pop-in {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

#win-stars {
  font-size: 48px;
  margin: 16px 0;
  letter-spacing: 0.1em;
}

#win-score, #win-coins {
  font-size: 24px;
  font-weight: 700;
  margin: 8px 0;
}

#win-coins {
  color: #FCD34D;
}

.overlay button {
  background: white;
  color: #DC2626;
  border: none;
  padding: 14px 28px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  margin: 12px 6px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.3);
  transition: transform 0.1s;
}

.overlay button:active {
  transform: scale(0.95);
}

#reset-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.5);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
  box-shadow: none;
  margin: 0;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* ====== Score popups (floating "+50" text) ====== */
.score-popup {
  position: fixed;
  font-size: 28px;
  font-weight: 900;
  color: #FCD34D;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8), 0 0 20px rgba(252, 211, 77, 0.7);
  pointer-events: none;
  z-index: 90;
  transform: translate(-50%, -50%);
  animation: score-float 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  white-space: nowrap;
}

.score-popup.big {
  font-size: 38px;
  color: #FB923C;
}

.score-popup.huge {
  font-size: 52px;
  color: #EC4899;
  text-shadow: 0 4px 12px rgba(0,0,0,0.8), 0 0 30px rgba(236, 72, 153, 0.9);
}

@keyframes score-float {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  20%  { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  100% { transform: translate(-50%, -180%) scale(1); opacity: 0; }
}

/* ====== Combo display (centered burst) ====== */
#combo-display {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  font-weight: 900;
  text-align: center;
  color: #FCD34D;
  text-shadow: 0 0 30px currentColor, 0 4px 20px rgba(0,0,0,0.7);
  pointer-events: none;
  z-index: 95;
  opacity: 0;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

#combo-display.show {
  animation: combo-flash 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#combo-display.x2 { color: #FCD34D; }
#combo-display.x3 { color: #FB923C; }
#combo-display.x4 { color: #EC4899; }
#combo-display.x5,
#combo-display.x6,
#combo-display.x7 {
  background: linear-gradient(90deg, #EC4899, #A855F7, #3B82F6, #10B981, #FCD34D);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes combo-flash {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0) rotate(-20deg); }
  25%  { opacity: 1; transform: translate(-50%, -50%) scale(1.4) rotate(10deg); }
  45%  { transform: translate(-50%, -50%) scale(0.9) rotate(-3deg); }
  60%  { transform: translate(-50%, -50%) scale(1.1) rotate(0); }
  80%  { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -150%) scale(0.7); }
}

/* ====== Confetti for win screen ====== */
.confetti {
  position: fixed;
  top: -20px;
  width: 12px;
  height: 12px;
  z-index: 102;
  animation: confetti-fall 3s linear forwards;
  pointer-events: none;
  border-radius: 2px;
}

@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(120vh) rotate(720deg); opacity: 0; }
}

/* ====== Move counter warning when low ====== */
.info-block.warning {
  animation: warn-shake 0.5s ease infinite;
}

.info-block.warning .value {
  color: #FEF2F2;
  animation: warn-pulse 0.5s infinite;
}

@keyframes warn-pulse {
  0%, 100% { color: #FCD34D; transform: scale(1); }
  50%      { color: #EF4444; transform: scale(1.25); }
}

@keyframes warn-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-2px); }
  75%      { transform: translateX(2px); }
}

/* ====== Goal completion burst ====== */
#goal-bar.completed {
  animation: goal-complete 0.7s ease;
}

@keyframes goal-complete {
  0%, 100% { transform: scale(1); background: rgba(255,255,255,0.6); box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
  30%      { transform: scale(1.08); background: rgba(252, 211, 77, 0.9); box-shadow: 0 0 40px rgba(252, 211, 77, 0.8); }
  60%      { transform: scale(0.97); }
}

/* ====== Grid border glow during cascades ====== */
#grid.cascading {
  animation: grid-glow 0.5s ease;
}

@keyframes grid-glow {
  0%, 100% { box-shadow: none; }
  50%      { box-shadow: 0 0 60px rgba(252, 211, 77, 0.6), inset 0 0 30px rgba(252, 211, 77, 0.3); }
}

/* ====== Win screen star burst ====== */
#win-stars {
  animation: star-burst 1s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

@keyframes star-burst {
  0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
  60%  { transform: scale(1.4) rotate(15deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ====== Score number rolling animation ====== */
.value.rolling {
  animation: number-pop 0.3s ease;
}

@keyframes number-pop {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.3); color: #FCD34D; }
}

/* ====== Hint wobble (when player idle) ====== */
.tile.hint {
  animation: hint-wobble 0.5s ease infinite;
  z-index: 4;
}

@keyframes hint-wobble {
  0%, 100% { transform: rotate(0) scale(1.05); }
  25%      { transform: rotate(-10deg) scale(1.1); }
  75%      { transform: rotate(10deg) scale(1.1); }
}

/* ====== Responsive ====== */
@media (max-height: 700px) {
  .tile { font-size: 22px; }
  #grid { max-width: 320px; }
  #level-title { font-size: 14px; }
}

@media (max-width: 380px) {
  .tile { font-size: 22px; }
  .info-block .value { font-size: 14px; }
}

/* ============================================================
   Auth pages (signup / login)
   ============================================================ */
body.auth-body {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
  background: linear-gradient(135deg, #FFA726 0%, #FF7043 50%, #E91E63 100%);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, #FFF8E7 0%, #FFE4B5 100%);
  border-radius: 20px;
  padding: 28px 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  position: relative;
  z-index: 5;
}

.auth-logo {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: #B71C1C;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.auth-subtitle {
  text-align: center;
  color: #6B4423;
  margin-bottom: 22px;
  font-size: 14px;
}

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

.field {
  position: relative;
  display: flex;
  flex-direction: column;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: #6B4423;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;             /* 16px prevents iOS zoom-on-focus */
  border: 2px solid #E8C496;
  border-radius: 12px;
  background: #FFFDF7;
  color: #1F2937;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

.field input:focus {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.toggle-password {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: transparent;
  border: none;
  font-size: 18px;
  padding: 6px 10px;
  cursor: pointer;
  opacity: 0.65;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: #4A2E1A;
  line-height: 1.45;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: #DC2626;
  flex-shrink: 0;
}

.checkbox-row a {
  color: #DC2626;
  font-weight: 600;
  text-decoration: underline;
}

.auth-error {
  min-height: 18px;
  color: #B71C1C;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.auth-error:empty { display: none; }

.auth-submit {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  color: white;
  background: linear-gradient(180deg, #EF4444 0%, #DC2626 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 0 #991B1B, 0 6px 14px rgba(0,0,0,0.2);
  transition: transform 0.08s, box-shadow 0.08s;
  margin-top: 4px;
}

.auth-submit:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #991B1B, 0 3px 8px rgba(0,0,0,0.2);
}

.auth-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.auth-alt {
  text-align: center;
  font-size: 13px;
  color: #6B4423;
  margin-top: 6px;
}

.auth-alt a {
  color: #DC2626;
  font-weight: 600;
  text-decoration: none;
}

.auth-alt a:hover { text-decoration: underline; }

/* ============================================================
   Privacy / legal page
   ============================================================ */
html:has(body.legal-body),
body.legal-body {
  height: auto !important;
  overflow: auto !important;
}

body.legal-body {
  display: block;
  background: #FFF8E7;
  min-height: 100vh;
  align-items: flex-start;
  justify-content: flex-start;
  -webkit-overflow-scrolling: touch;
}

/* Re-enable text selection on the legal page (overrides the global
   user-select: none rule from the top of the file) */
body.legal-body,
body.legal-body * {
  user-select: text;
  -webkit-user-select: text;
}

.legal-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 22px 80px;
  color: #1F2937;
  line-height: 1.6;
  font-size: 15px;
}

.legal-back {
  display: inline-block;
  margin-bottom: 18px;
  color: #DC2626;
  font-weight: 600;
  text-decoration: none;
}

.legal-container h1 {
  font-size: 26px;
  margin-bottom: 4px;
  color: #B71C1C;
}

.legal-container h2 {
  font-size: 17px;
  margin-top: 26px;
  margin-bottom: 8px;
  color: #6B2E1A;
}

.legal-container ul {
  padding-left: 22px;
  margin: 8px 0;
}

.legal-container li { margin-bottom: 4px; }

.legal-container a {
  color: #DC2626;
  word-break: break-word;
}

.legal-meta {
  color: #6B4423;
  font-size: 13px;
  margin-bottom: 14px;
}

.legal-note {
  margin-top: 30px;
  padding: 14px;
  background: #FFE4B5;
  border-left: 4px solid #DC2626;
  border-radius: 6px;
  font-size: 13px;
  color: #4A2E1A;
}

/* ============================================================
   Logout pill + email inside in-game menu (sits on dark overlay)
   ============================================================ */
#user-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 16px auto 8px;
  font-size: 13px;
}

#user-email {
  display: inline-block;
  max-width: 320px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: #FCD34D;
  font-weight: 600;
  text-align: center;
  word-break: break-all;
  letter-spacing: 0.02em;
}

#logout-btn {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  background: transparent;
  border: 1.5px solid #FCD34D;
  color: #FCD34D;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

#logout-btn:active,
#logout-btn:hover {
  background: #FCD34D;
  color: #1F2937;
}

/* ============================================================
   SHARED CHARACTER ANIMATIONS (used by all scene characters)
   ============================================================ */
@keyframes char-bob        { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-1.4px); } }
@keyframes char-bob-fast   { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes char-arm-swing  { 0%,100% { transform: rotate(-10deg); } 50% { transform: rotate(22deg); } }
@keyframes char-arm-wave   { 0%,100% { transform: rotate(-18deg); } 50% { transform: rotate(18deg); } }
@keyframes char-arm-pour   { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(8deg); } }
@keyframes char-arm-fan    { 0%,100% { transform: rotate(-25deg); } 50% { transform: rotate(25deg); } }
@keyframes char-toss-high  { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-26px) rotate(180deg); } }
@keyframes char-puff       { 0% { transform: translateY(0) scale(1); opacity: 0.78; } 100% { transform: translateY(-15px) scale(2.4); opacity: 0; } }
@keyframes char-twinkle    { 0%,100% { opacity: 0; transform: scale(0.3); } 50% { opacity: 1; transform: scale(1.2); } }
@keyframes char-spin-full  { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes char-flame      { 0%,100% { transform: scaleY(1)    scaleX(1);   opacity: 0.92; } 25% { transform: scaleY(1.18) scaleX(0.9); opacity: 1; } 75% { transform: scaleY(0.82) scaleX(1.12); opacity: 0.7; } }
@keyframes char-pour       { 0%,100% { transform: scaleY(0.7); opacity: 0.65; } 50% { transform: scaleY(1.1); opacity: 1; } }
@keyframes char-confetti   { 0% { transform: translateY(-10px) rotate(0deg);   opacity: 1; } 100% { transform: translateY(60px) rotate(720deg); opacity: 0; } }
@keyframes char-pulse      { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes char-wobble     { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes char-blink-neon { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.char-bob        { animation: char-bob 0.55s ease-in-out infinite;       transform-box: fill-box; }
.char-bob-fast   { animation: char-bob-fast 0.4s ease-in-out infinite;   transform-box: fill-box; }
.char-arm-swing  { animation: char-arm-swing 0.65s ease-in-out infinite; transform-box: fill-box; }
.char-arm-wave   { animation: char-arm-wave 0.7s ease-in-out infinite;   transform-box: fill-box; }
.char-arm-pour   { animation: char-arm-pour 1.3s ease-in-out infinite;   transform-box: fill-box; }
.char-arm-fan    { animation: char-arm-fan 0.4s ease-in-out infinite;    transform-box: fill-box; }
.char-toss-high  { animation: char-toss-high 1.2s ease-in-out infinite;  transform-box: fill-box; }
.char-puff-1     { animation: char-puff 2.2s ease-out infinite;          transform-box: fill-box; }
.char-puff-2     { animation: char-puff 2.2s ease-out infinite 0.55s;    transform-box: fill-box; }
.char-puff-3     { animation: char-puff 2.2s ease-out infinite 1.1s;     transform-box: fill-box; }
.char-twinkle-1  { animation: char-twinkle 1.4s ease-in-out infinite;        transform-box: fill-box; }
.char-twinkle-2  { animation: char-twinkle 1.4s ease-in-out infinite 0.35s;  transform-box: fill-box; }
.char-twinkle-3  { animation: char-twinkle 1.4s ease-in-out infinite 0.7s;   transform-box: fill-box; }
.char-twinkle-4  { animation: char-twinkle 1.8s ease-in-out infinite 1s;     transform-box: fill-box; }
.char-spin       { animation: char-spin-full 1.2s linear infinite;       transform-box: fill-box; }
.char-spin-slow  { animation: char-spin-full 2.5s linear infinite;       transform-box: fill-box; }
.char-flame-1    { animation: char-flame 0.30s ease-in-out infinite;        transform-box: fill-box; }
.char-flame-2    { animation: char-flame 0.35s ease-in-out infinite 0.1s;   transform-box: fill-box; }
.char-flame-3    { animation: char-flame 0.28s ease-in-out infinite 0.05s;  transform-box: fill-box; }
.char-pour       { animation: char-pour 1.5s ease-in-out infinite;       transform-box: fill-box; }
.char-confetti-1 { animation: char-confetti 2.5s linear infinite;        transform-box: fill-box; }
.char-confetti-2 { animation: char-confetti 2.5s linear infinite 0.5s;   transform-box: fill-box; }
.char-confetti-3 { animation: char-confetti 2.5s linear infinite 1.0s;   transform-box: fill-box; }
.char-confetti-4 { animation: char-confetti 2.5s linear infinite 1.5s;   transform-box: fill-box; }
.char-pulse      { animation: char-pulse 0.8s ease-in-out infinite;      transform-box: fill-box; }
.char-wobble     { animation: char-wobble 0.6s ease-in-out infinite;     transform-box: fill-box; }
.char-neon       { animation: char-blink-neon 0.5s ease-in-out infinite; transform-box: fill-box; }
