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

html, body {
  height: 100%;
  overflow: hidden;
  background: #0b0b12;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  color: #f0e6d2;
}

#app, #app canvas {
  position: fixed; inset: 0; display: block;
  touch-action: none; /* drags are camera look, never page scroll/zoom */
}

.hidden { display: none !important; }

/* ---------- Character select ---------- */

#select-screen {
  position: fixed; inset: 0; z-index: 30; overflow-y: auto;
  display: flex; align-items: flex-start; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #2a2438 0%, #0b0b12 75%);
}

/* margin:auto keeps a short roster vertically centred; a long one scrolls. */
.select-inner { text-align: center; max-width: 1080px; padding: 24px; margin: auto; }

.select-inner h1 {
  font-size: 34px; letter-spacing: 5px; color: #e8c968;
  text-shadow: 0 0 24px rgba(232, 201, 104, 0.35);
}

.location { margin: 10px 0 4px; color: #f0e6d2; font-size: 17px; letter-spacing: 2px; }
.subtitle { margin: 4px 0 18px; color: #b8ac93; letter-spacing: 2px; }

#select-cards { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.player-card {
  width: 170px; padding: 14px 12px; cursor: pointer;
  background: rgba(240, 230, 210, 0.06);
  border: 1px solid rgba(232, 201, 104, 0.4); border-radius: 10px;
  color: inherit; font: inherit; transition: transform 0.12s, background 0.12s;
}
.player-card:hover:not(:disabled) {
  transform: translateY(-3px);
  background: rgba(232, 201, 104, 0.14);
}
.player-card:disabled { opacity: 0.35; cursor: not-allowed; }
.player-card .card-face {
  width: 72px; height: 72px; margin: 0 auto 6px; display: block;
  border-radius: 10px; background: rgba(240, 230, 210, 0.07);
}
.player-card .card-name {
  font-size: 19px; color: #e8c968; letter-spacing: 1px; overflow-wrap: anywhere;
}
.player-card .card-name.long { font-size: 13px; letter-spacing: 0; line-height: 1.25; }
.player-card .card-desc {
  margin-top: 6px; font-size: 12.5px; font-style: italic; color: #f0e6d2; line-height: 1.3;
}
.player-card .card-taken { margin-top: 8px; font-size: 12px; color: #d96a6a; }

#select-error { margin-top: 16px; min-height: 20px; color: #d96a6a; }
.select-hint { margin-top: 20px; font-size: 12px; color: #7d7466; }

/* ---------- HUD ---------- */

#hud > * { position: fixed; z-index: 20; }

#top-bar {
  top: 14px; left: 16px; display: flex; align-items: center; gap: 10px;
}
#self-name {
  padding: 6px 12px; background: rgba(10, 10, 16, 0.55);
  border: 1px solid rgba(232, 201, 104, 0.35); border-radius: 6px;
  color: #e8c968; letter-spacing: 1px;
}
#mic-btn {
  width: 34px; height: 34px; border-radius: 6px; cursor: pointer; font-size: 16px;
  background: rgba(10, 10, 16, 0.55); border: 1px solid rgba(232, 201, 104, 0.35);
}
#mic-btn.muted { background: rgba(120, 30, 30, 0.7); }
#compass {
  padding: 6px 12px; background: rgba(10, 10, 16, 0.55);
  border: 1px solid rgba(232, 201, 104, 0.35); border-radius: 6px;
  color: #f0e6d2; letter-spacing: 1px; min-width: 74px; text-align: center;
}
#debug-ceremony, #debug-boss, #debug-reset {
  padding: 6px 10px; cursor: pointer; font-size: 12px; letter-spacing: 1px;
  background: rgba(60, 30, 70, 0.6); color: #e8c968;
  border: 1px dashed rgba(232, 201, 104, 0.5); border-radius: 6px;
}
#debug-ceremony:hover, #debug-boss:hover, #debug-reset:hover { background: rgba(90, 45, 105, 0.75); }

#help {
  right: 16px; bottom: 12px; font-size: 12px; color: #b8ac93;
  background: rgba(10, 10, 16, 0.45); padding: 6px 10px; border-radius: 6px;
}

/* ---------- Chat ---------- */

#chat { left: 16px; bottom: 16px; width: 340px; }
#chat-log {
  max-height: 220px; overflow-y: auto; margin-bottom: 6px;
  display: flex; flex-direction: column; gap: 3px;
  mask-image: linear-gradient(to bottom, transparent, black 12%);
}
#chat-log .msg {
  font-size: 13px; line-height: 1.35; padding: 3px 8px; border-radius: 4px;
  background: rgba(10, 10, 16, 0.55); word-wrap: break-word;
}
#chat-log .msg .who { color: #e8c968; font-weight: bold; }
#chat-log .msg.system { color: #e8c968; font-style: italic; background: rgba(60, 48, 16, 0.55); }
#chat-input {
  width: 100%; padding: 7px 10px; font: inherit; font-size: 13px; color: #f0e6d2;
  background: rgba(10, 10, 16, 0.65); border: 1px solid rgba(240, 230, 210, 0.25);
  border-radius: 6px; outline: none; opacity: 0.5;
}
#chat-input:focus { opacity: 1; border-color: rgba(232, 201, 104, 0.6); }

/* ---------- Prompts / crosshair / putt power ---------- */

#prompt {
  left: 50%; bottom: 22%; transform: translateX(-50%);
  padding: 8px 18px; background: rgba(10, 10, 16, 0.65);
  border: 1px solid rgba(232, 201, 104, 0.5); border-radius: 8px;
  font-size: 15px; letter-spacing: 1px; white-space: nowrap;
}
#prompt b { color: #e8c968; }

#crosshair {
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 26px; color: rgba(255, 235, 200, 0.9); text-shadow: 0 0 6px #000;
}

/* ---------- Statue modal ---------- */

#statue-modal {
  inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 5, 10, 0.35);
}
.modal-box {
  position: relative; min-width: 320px; max-width: 440px; padding: 28px 34px;
  text-align: center; border-radius: 12px;
  background: rgba(14, 13, 22, 0.92);
  border: 1px solid rgba(232, 201, 104, 0.65);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}
#statue-close {
  position: absolute; top: 8px; right: 12px; width: 28px; height: 28px;
  background: none; border: none; color: #b8ac93; font-size: 22px; cursor: pointer;
}
#statue-close:hover { color: #e8c968; }
#statue-name { font-size: 30px; letter-spacing: 5px; color: #e8c968; }
#statue-desc { margin-top: 12px; font-size: 16px; font-style: italic; color: #f0e6d2; }
#statue-partner {
  margin-top: 16px; padding-top: 14px; font-size: 15px; letter-spacing: 1px; color: #c9bda2;
  border-top: 1px solid rgba(232, 201, 104, 0.25);
}
#statue-partner b { color: #e8c968; }

/* ---------- Reveal cinematic ---------- */

#reveal-title {
  left: 50%; top: 18%; transform: translateX(-50%);
  text-align: center; pointer-events: none;
}
#reveal-name {
  font-size: 72px; font-weight: bold; letter-spacing: 14px; color: #e8c968;
  text-shadow: 0 0 30px rgba(232, 201, 104, 0.8), 0 4px 12px #000;
  animation: revealPunch 0.6s ease-out;
}
#reveal-sub {
  margin-top: 8px; font-size: 20px; letter-spacing: 6px; color: #f0e6d2;
  text-shadow: 0 2px 8px #000;
}
@keyframes revealPunch {
  0% { transform: scale(2.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

#flash {
  position: fixed; inset: 0; z-index: 25; pointer-events: none;
  background: #ffffff; opacity: 0; transition: opacity 0.09s;
}

/* ---------- Touch controls (phones / tablets) ---------- */

/* The layer itself must not eat taps meant for the world — only its children do. */
.touch-layer { position: fixed; inset: 0; z-index: 22; pointer-events: none; }

.touch-stick {
  position: absolute; left: 22px; bottom: 26px;
  width: 132px; height: 132px; border-radius: 50%;
  background: rgba(10, 10, 16, 0.34);
  border: 2px solid rgba(232, 201, 104, 0.45);
  pointer-events: auto; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.touch-knob {
  width: 58px; height: 58px; border-radius: 50%;
  background: rgba(232, 201, 104, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.5);
  transition: transform 0.05s linear;
}

.touch-buttons {
  position: absolute; right: 20px; bottom: 26px;
  display: grid; grid-template-columns: repeat(2, auto); gap: 12px;
  pointer-events: auto;
}
.touch-btn {
  width: 74px; height: 74px; border-radius: 50%;
  font: bold 15px 'Trebuchet MS', sans-serif; letter-spacing: 1px;
  color: #f0e6d2; background: rgba(10, 10, 16, 0.5);
  border: 2px solid rgba(232, 201, 104, 0.5);
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.touch-btn.down { background: rgba(232, 201, 104, 0.4); transform: scale(0.94); }
.touch-btn.active { background: rgba(232, 201, 104, 0.32); border-color: #e8c968; }
.touch-btn.fire {
  color: #ffd9d0; border-color: rgba(224, 73, 60, 0.4);
  background: rgba(90, 20, 16, 0.32); opacity: 0.5;
}
/* Lights up only when you're actually holding the 6 iron or fighting the boss. */
.touch-btn.fire.armed {
  opacity: 1; border-color: rgba(224, 73, 60, 0.9);
  background: rgba(150, 30, 22, 0.62);
  box-shadow: 0 0 14px rgba(224, 73, 60, 0.45);
}

/* Make room for the controls and keep the desktop key hints out of the way. */
body.touch #help { display: none; }
body.touch #chat { width: min(46vw, 300px); bottom: 178px; }
body.touch #chat-log { max-height: 116px; }
body.touch #prompt { bottom: 30%; font-size: 14px; }
body.touch .select-inner { padding: 18px 12px; }

/* Landscape phones are short — shrink the controls so they still fit. */
@media (orientation: landscape) and (max-height: 480px) {
  .touch-stick { width: 104px; height: 104px; bottom: 14px; }
  .touch-knob { width: 46px; height: 46px; }
  .touch-btn { width: 60px; height: 60px; font-size: 13px; }
  body.touch #chat { bottom: 140px; }
  body.touch #chat-log { max-height: 84px; }
}
