/* styles.css — Forager co-op. Lobby uses the purple diamond-checkerboard
   language from the evidence (menu-language.png); game is one big canvas. */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  background: #1a0f1e;
  overflow: hidden;
  font-family: "Courier New", monospace;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}

#app { width: 100%; height: 100%; position: relative; }

/* ── Lobby ─────────────────────────────────────────────────────────────── */
#lobby-screen {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background:
    repeating-conic-gradient(from 45deg, #6b2d6b 0% 25%, #7e3a7e 25% 50%) 0 0 / 72px 72px;
  z-index: 10;
}
#lobby-card {
  background: #2c1631;
  border: 4px solid #000;
  box-shadow: 0 0 0 4px #953c7f, 0 12px 40px rgba(0,0,0,.55);
  padding: 26px 34px;
  width: min(480px, 92vw);
  text-align: center;
  color: #fff;
}
#lobby-logo {
  font-size: 44px; font-weight: bold; letter-spacing: 6px;
  color: #ffc93e;
  text-shadow: 3px 3px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
}
#lobby-sub { font-size: 12px; letter-spacing: 4px; color: #93ff49; margin: 4px 0 14px; text-shadow: 1px 1px 0 #000; }
#lobby-lcd {
  background: #10081455; border: 2px solid #000; padding: 8px; margin-bottom: 12px;
}
#lobby-room-line { font-size: 18px; letter-spacing: 2px; }
#room-code-display { color: #ffc93e; font-weight: bold; }
#connection-status { font-size: 11px; margin-top: 2px; letter-spacing: 1px; }
#connection-status.connected { color: #93ff49; }
#connection-status.disconnected { color: #ff6b6b; }

.player-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.player-slot {
  display: flex; align-items: center; gap: 7px;
  background: #00000038; border: 2px solid #00000066;
  padding: 7px 9px; font-size: 12px; min-height: 34px;
  opacity: .45;
}
.player-slot.filled { opacity: 1; border-color: #000; background: #00000060; }
.slot-dot { width: 12px; height: 12px; border: 2px solid #000; flex-shrink: 0; }
.slot-dot.c1 { background: #4aa3ff; } .slot-dot.c2 { background: #ff9f43; }
.slot-dot.c3 { background: #5cd65c; } .slot-dot.c4 { background: #e056fd; }
.slot-name { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-status { font-size: 10px; color: #aaa; }
.slot-status.ready { color: #93ff49; font-weight: bold; }

#btn-ready, #btn-copy-link {
  display: block; width: 100%; margin-bottom: 8px;
  padding: 12px; font-family: inherit; font-size: 16px; font-weight: bold;
  letter-spacing: 2px; cursor: pointer;
  border: 3px solid #000; color: #000;
  background: linear-gradient(#ffe28a, #ffc93e);
  box-shadow: 0 4px 0 #c88a1e;
}
#btn-ready:active, #btn-copy-link:active { transform: translateY(3px); box-shadow: 0 1px 0 #c88a1e; }
#btn-ready:disabled { opacity: .5; cursor: default; }
#btn-ready.is-ready { background: linear-gradient(#b8ff8a, #93ff49); box-shadow: 0 4px 0 #4d9a1e; }
#btn-copy-link { font-size: 12px; padding: 9px; background: linear-gradient(#9ad2ff, #46a2ff); box-shadow: 0 4px 0 #1a467f; color: #fff; text-shadow: 1px 1px 0 #000; }
#lobby-hint { font-size: 11px; line-height: 1.6; color: #d9b8d9; margin-top: 4px; }
#lobby-hint b { color: #ffc93e; }
#lobby-error { color: #ff6b6b; font-size: 12px; min-height: 16px; margin-top: 6px; }

/* ── Game canvas ───────────────────────────────────────────────────────── */
#game-wrapper {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: #46a2ff;
}
#game-wrapper.active { display: flex; }
#game-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #46a2ff;
  max-width: 100vw; max-height: 100vh;
}

#countdown-overlay {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center;
  pointer-events: none;
}
#countdown-overlay.active { display: flex; }
#countdown-number {
  font-size: 110px; font-weight: bold; color: #ffc93e;
  text-shadow: 5px 5px 0 #000;
}

#reconnect-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: #a32622; color: #fff; border: 2px solid #000;
  padding: 6px 18px; font-size: 13px; letter-spacing: 2px;
  display: none; z-index: 20;
}
#reconnect-banner.active { display: block; }

#btn-fullscreen {
  position: absolute; top: 10px; right: 10px; z-index: 15;
  width: 38px; height: 38px;
  background: #00000055; color: #fff; border: 2px solid #00000088;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: .6;
}
#btn-fullscreen:hover { opacity: 1; }

/* ── Touch UI (coarse pointers only) ───────────────────────────────────── */
#touch-ui { display: none; }
@media (pointer: coarse) {
  #touch-ui { display: block; }
}
#joy-zone {
  position: absolute; left: 0; bottom: 0;
  width: 42vw; height: 62vh; z-index: 14;
  touch-action: none;
}
#joy-base {
  position: fixed; width: 110px; height: 110px;
  border-radius: 50%; border: 3px solid #ffffff55;
  background: #ffffff18;
  display: none; align-items: center; justify-content: center;
  pointer-events: none;
}
#joy-base.active { display: flex; }
#joy-knob {
  width: 46px; height: 46px; border-radius: 50%;
  background: #ffffff66; border: 2px solid #00000044;
}
.touch-btn {
  position: absolute; z-index: 15;
  width: 62px; height: 62px; border-radius: 50%;
  border: 3px solid #00000088; background: #ffffff2e; color: #fff;
  font-family: inherit; font-size: 13px; font-weight: bold;
  text-shadow: 1px 1px 0 #000;
}
.touch-btn:active { background: #ffffff55; }
.touch-btn.big { width: 84px; height: 84px; right: 24px; bottom: 68px; font-size: 15px; }
#btn-interact { right: 122px; bottom: 40px; }
#btn-build { right: 30px; bottom: 170px; }
#btn-eat { right: 132px; bottom: 122px; }

/* ── rotate overlay (portrait phones) ──────────────────────────────────── */
#rotate-overlay {
  position: absolute; inset: 0; z-index: 50;
  background: #2c1631;
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-align: center;
}
@media (pointer: coarse) and (orientation: portrait) {
  #rotate-overlay { display: flex; }
}
#rotate-phone {
  width: 46px; height: 76px; border: 4px solid #ffc93e; border-radius: 8px;
  margin-bottom: 22px;
  animation: rotatePhone 1.6s ease-in-out infinite;
}
@keyframes rotatePhone {
  0%, 25% { transform: rotate(0); }
  60%, 100% { transform: rotate(90deg); }
}
#rotate-text { font-size: 22px; font-weight: bold; letter-spacing: 1px; }
#rotate-sub { font-size: 13px; color: #d9b8d9; margin-top: 8px; }
