/* ============================================================
   Sloptropica — global styles
   The game renders to <canvas>; the DOM overlay is used for
   crisp text menus, buttons, dialogue and HUD chrome.
   ============================================================ */

:root {
  --slop-green: #7ec850;
  --slop-green-dark: #4f8a2e;
  --slop-ink: #2b2118;
  --slop-cream: #fff7e6;
  --slop-sky: #8ed0ff;
  --slop-purple: #7c5cbf;
  --slop-gold: #ffce4a;
  --ui-font: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #11151c;
  overflow: hidden;
  font-family: var(--ui-font);
  color: var(--slop-ink);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#game-frame {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 120% at 50% -10%, #1c2738 0%, #0c0f15 70%);
}

#game {
  display: block;
  image-rendering: auto;
  background: #000;
  box-shadow: 0 18px 60px rgba(0,0,0,0.6), 0 0 0 4px #1b232f;
  border-radius: 6px;
  max-width: 100%;
  max-height: 100%;
}

/* DOM overlay sits exactly over the canvas (sized by JS) */
#overlay {
  position: absolute;
  pointer-events: none;
  overflow: hidden;
  border-radius: 6px;
}
#overlay * { pointer-events: auto; }

/* ---------- generic UI widgets used across menus ---------- */
.slop-btn {
  font-family: var(--ui-font);
  font-weight: 700;
  font-size: 18px;
  color: var(--slop-ink);
  background: linear-gradient(#fff, #ffe9b8);
  border: 3px solid var(--slop-ink);
  border-radius: 14px;
  padding: 10px 22px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--slop-ink);
  transition: transform .06s ease, box-shadow .06s ease, background .1s;
}
.slop-btn:hover { background: linear-gradient(#fff, #ffd877); }
.slop-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--slop-ink); }
.slop-btn.secondary { background: linear-gradient(#fff, #dfe7ee); }
.slop-btn.green { background: linear-gradient(#bdf08a, #7ec850); }
.slop-btn:disabled { opacity: .5; cursor: default; box-shadow: 0 4px 0 var(--slop-ink); }

.slop-panel {
  background: var(--slop-cream);
  border: 4px solid var(--slop-ink);
  border-radius: 18px;
  box-shadow: 0 10px 0 rgba(0,0,0,.25), inset 0 0 0 3px #fff;
}

/* ---------- loading ---------- */
#loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(120% 120% at 50% 30%, #2a3a22, #0c0f15);
  z-index: 50;
  transition: opacity .5s ease;
}
#loading.hidden { opacity: 0; pointer-events: none; }
.logo-mini {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--slop-green);
  text-shadow: 0 3px 0 #2c4a18, 0 6px 14px rgba(0,0,0,.5);
}
#loading .bar {
  width: 240px; height: 16px;
  background: #1c2738; border: 3px solid #0c0f15; border-radius: 10px; overflow: hidden;
}
#loading .bar .fill {
  width: 0%; height: 100%;
  background: linear-gradient(90deg, var(--slop-green), var(--slop-gold));
  transition: width .2s ease;
}
#loading .hint { color: #9fb98a; font-style: italic; }

/* ---------- rotate hint (portrait mobile) ---------- */
#rotate-hint {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2em;
  background: #0c0f15;
  color: #fff;
  font-size: 20px;
  z-index: 60;
}
@media (max-aspect-ratio: 1/1) and (max-width: 760px) {
  #rotate-hint { display: flex; }
}

/* Focusable buttons: keyboard outline */
.slop-btn:focus-visible { outline: 3px solid var(--slop-purple); outline-offset: 2px; }
