/* Harvest Moon co-op — styles. Lobby mimics the SNES wooden title sign. */

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

html, body {
  width: 100%; height: 100%;
  background: #1a2410;
  font-family: "Courier New", monospace;
  overflow: hidden;
  color: #fff;
}

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

/* ── Lobby ────────────────────────────────────────────────────────────── */
#lobby-screen {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.08) 0 3px, transparent 3px 6px),
    linear-gradient(180deg, #79b8e8 0%, #a8d4f0 55%, #58a838 55.2%, #3d7d28 100%);
  z-index: 20;
}

#lobby-console {
  width: 430px;
  background: #b0793f;
  border: 4px solid #6b421f;
  border-radius: 12px;
  box-shadow: inset 2px 2px 0 #d19a5c, inset -2px -2px 0 #7c4a24, 0 10px 30px rgba(0,0,0,0.55);
  padding: 22px 26px;
  text-align: center;
}

#lobby-logo { margin-bottom: 12px; font-weight: bold; letter-spacing: 1px; }
.logo-harvest { color: #f8e8c0; font-size: 38px; text-shadow: 2px 2px 0 #6b421f, 3px 3px 0 #2a1a10; font-style: italic; }
.logo-moon    { color: #f0c840; font-size: 38px; text-shadow: 2px 2px 0 #6b421f, 3px 3px 0 #2a1a10; font-style: italic; margin-left: 8px; }
.logo-sub     { display: block; color: #f4e4c4; font-size: 11px; letter-spacing: 5px; margin-top: 4px; }

#lobby-lcd {
  background: #23180c;
  border: 3px solid #6b421f;
  border-radius: 4px;
  color: #8ad858;
  font-size: 14px;
  padding: 8px 10px;
  margin-bottom: 12px;
  text-align: left;
  letter-spacing: 1px;
}
#lobby-room-line { font-size: 17px; }
#room-code-display { color: #d2ff90; font-weight: bold; }
#connection-status { font-size: 11px; margin-top: 3px; }
#connection-status.connected { color: #8ad858; }
#connection-status.disconnected { color: #e8b050; }

.player-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.player-slot {
  background: #97662f;
  border: 2px solid #6b421f;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 12px;
  display: flex; align-items: center; gap: 6px;
  color: #f4e4c4;
  min-height: 30px;
}
.player-slot.filled { background: #c99553; color: #33220f; }
.slot-dot { width: 10px; height: 10px; border-radius: 2px; background: #7c5a34; flex: none; }
.slot-dot.c1 { background: #3868c8; } .slot-dot.c2 { background: #e08830; }
.slot-dot.c3 { background: #48a848; } .slot-dot.c4 { background: #c858b8; }
.slot-name { font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-status { margin-left: auto; font-size: 10px; color: #6b4a26; }
.slot-status.ready { color: #1c5c1c; font-weight: bold; }

#btn-ready, #btn-copy-link {
  display: block; width: 100%;
  margin-bottom: 8px;
  padding: 10px;
  font-family: inherit; font-weight: bold; font-size: 15px; letter-spacing: 2px;
  color: #fff;
  background: #2f7a2f;
  border: 0; border-radius: 4px;
  box-shadow: inset 2px 2px 0 #58aa58, inset -2px -2px 0 #1c4c1c, 0 3px 0 #143814;
  cursor: pointer;
}
#btn-ready:disabled { background: #8a7458; box-shadow: none; cursor: default; color: #c9b593; }
#btn-ready.is-ready { background: #b08018; box-shadow: inset 2px 2px 0 #d8a840, inset -2px -2px 0 #705010; }
#btn-copy-link {
  background: #3858b8; font-size: 11px; padding: 7px;
  box-shadow: inset 2px 2px 0 #6888d8, inset -2px -2px 0 #203878, 0 3px 0 #182858;
}
#btn-copy-link:active, #btn-ready:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }

#lobby-hint { font-size: 10px; color: #f4e4c4; line-height: 1.6; }
#lobby-hint b { color: #ffe080; }
#lobby-error { color: #701818; font-size: 12px; min-height: 16px; margin-top: 6px; font-weight: bold; }

/* ── Game ─────────────────────────────────────────────────────────────── */
#game-wrapper {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: #100c08;
}
#game-wrapper.active { display: flex; }

#game-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  touch-action: none;
}

/* fullscreen toggle (mobile QoL; harmless on desktop) */
#btn-fullscreen {
  position: absolute; top: 8px; right: 8px;
  width: 40px; height: 40px;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(32, 28, 20, 0.55);
  color: #e8e2d4;
  border: 2px solid rgba(232, 226, 212, 0.5);
  border-radius: 6px;
  cursor: pointer;
  z-index: 35;
  -webkit-tap-highlight-color: transparent;
}
#btn-fullscreen:active { background: rgba(32, 28, 20, 0.85); }
@media (pointer: coarse) {
  #game-wrapper.active #btn-fullscreen { display: flex; }
}

/* touch action buttons (phones only) */
#touch-ui { display: none; }
@media (pointer: coarse) {
  #game-wrapper.active #touch-ui { display: block; }
}
.touch-btn {
  position: absolute;
  width: 58px; height: 44px;
  background: rgba(32, 28, 20, 0.55);
  color: #f4e4c4;
  border: 2px solid rgba(232, 226, 212, 0.5);
  border-radius: 8px;
  font-family: inherit; font-weight: bold; font-size: 11px; letter-spacing: 1px;
  z-index: 34;
  -webkit-tap-highlight-color: transparent;
}
.touch-btn:active { background: rgba(80, 60, 30, 0.8); }
#btn-tool { right: 12px; bottom: 118px; }
#btn-act  { right: 12px; bottom: 64px; }
#btn-bag  { right: 12px; bottom: 10px; }

#countdown-overlay {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  pointer-events: none;
  z-index: 30;
}
#countdown-overlay.active { display: flex; }
#countdown-number {
  font-size: 110px; font-weight: bold; color: #ffe080;
  text-shadow: 4px 4px 0 #402808, 0 0 40px rgba(0,0,0,0.8);
}

/* ── portrait rotate prompt (mobile) ─────────────────────────────────── */
#rotate-overlay {
  position: fixed; inset: 0;
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  background: #14100a;
  z-index: 60;
  text-align: center;
}
#rotate-phone {
  width: 42px; height: 72px;
  border: 4px solid #e8e2d4;
  border-radius: 8px;
  animation: rotate-hint 1.8s ease-in-out infinite;
}
@keyframes rotate-hint {
  0%, 25%  { transform: rotate(0deg); }
  60%, 90% { transform: rotate(-90deg); }
  100%     { transform: rotate(-90deg); }
}
#rotate-text { font-size: 20px; font-weight: bold; letter-spacing: 2px; color: #e8e2d4; }
#rotate-sub  { font-size: 12px; color: #8a8478; }
@media (orientation: portrait) and (pointer: coarse) {
  #rotate-overlay { display: flex; }
}

#reconnect-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: none;
  background: #a02818; color: #fff;
  font-size: 13px; font-weight: bold; letter-spacing: 2px;
  padding: 8px 20px; border-radius: 4px;
  z-index: 40;
}
#reconnect-banner.active { display: block; }
