/* ============================================================
   EMOJI TYCOON — POKÉMON LEAFGREEN-STYLE THEME
   Light, cream/tan menu boxes with dark red-brown borders and
   rounded corners, in the spirit of the GBA Pokémon UI.
   ============================================================ */

:root {
  --world-bg: #bfe6a0;   /* light grass — page background outside menus */
  --panel: #f8ecd0;      /* cream menu-box surface */
  --panel-light: #fff8e8; /* lighter cream, secondary surface */
  --ink: #4a2f1c;        /* dark brown — main text & text-on-accent */
  --border: #7a3b1d;     /* dark red-brown trim, Pokémon box edge */
  --accent: #f4b23a;     /* warm gold — selected tab / highlight */
  --accent2: #3868b0;    /* Pokémon blue accent */
  --danger: #d0402a;     /* Pokémon red */
  --good: #3a9a4a;       /* Pokémon green */
  --shadow: 3px 3px 0 rgba(74,47,28,0.25);
  --grass: #8fd070;
  --grass-dark: #63b24a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--world-bg);
  color: var(--ink);
  font-family: 'Nunito', sans-serif;
  overflow: hidden;
}

h2 { font-family: 'Fredoka', sans-serif; font-weight: 700; }

.pixel-border {
  border: 4px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

button {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  background: linear-gradient(180deg, #fff8ea, #f2d68e);
  color: var(--ink);
  border: 3px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: 0.3px;
  transition: transform 0.05s ease;
}
button:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 rgba(74,47,28,0.3); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.secondary { background: linear-gradient(180deg, #ffffff, #ead9b0); }
button.danger { background: linear-gradient(180deg, #ec8672, var(--danger)); color: #fff; border-color: #8a2416; }

/* ---------- CHARACTER PICKER ---------- */
#emojiPicker {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
  margin-bottom: 14px; max-height: 320px; overflow-y: auto; padding: 6px;
}
.emoji-btn {
  font-size: 34px;
  width: 68px;
  height: 68px;
  padding: 0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease, transform 0.05s ease;
}
.emoji-btn.active {
  outline: 3px solid var(--good);
  box-shadow: 0 0 14px 3px var(--good);
}
#emojiPicker.has-selection .emoji-btn:not(.active) {
  opacity: 0.2;
}

/* Faint retro screen texture — kept very subtle so it doesn't muddy the
   lighter palette (previous version darkened everything noticeably). */
.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  background: repeating-linear-gradient(
    to bottom, rgba(0,0,0,0.035) 0px, rgba(0,0,0,0.035) 1px,
    transparent 1px, transparent 3px
  );
  mix-blend-mode: multiply;
}

/* ---------- MASTER BOARD ---------- */
.master-wrap {
  display: grid;
  grid-template-columns: 3fr 1fr;
  height: 100vh;
  gap: 8px;
  padding: 8px;
}

.board-stage {
  position: relative;
  background: var(--world-bg);
  border: 4px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Flat face-on board (top-down, no isometric tilt) — easier for students
   to read tile text off the projector than the old rotated/diamond view. */
.iso-board {
  display: grid;
  grid-template-columns: repeat(11, 64px);
  grid-template-rows: repeat(11, 64px);
  transform: scale(var(--board-scale, 0.85));
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.12) 0 2px, transparent 2px 7px),
    linear-gradient(135deg, var(--grass), var(--grass-dark));
  border: 4px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 0 0 2px #4d7a3a;
}

.tile {
  border: 2px solid var(--border);
  border-radius: 6px;
  background: linear-gradient(160deg, #fffaf0, #f0dcae 60%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.6), inset 0 -3px 4px rgba(122,59,29,0.25);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  text-align: center;
  color: var(--ink);
  padding: 2px;
  overflow: visible;
}
.tile .tile-name { position: absolute; top: 3px; left: 2px; right: 2px; line-height: 1.25; font-size: 9px; font-weight: 800; z-index: 1; }
/* Property tiles have a colour-strip band across the top — push the name
   below it so multi-line names (e.g. "Safety Goggles Street") don't run
   underneath/behind the band. */
.tile .tile-name.has-strip { top: 13px; }
.tile .tile-price { position: absolute; bottom: 2px; font-size: 7px; color: var(--accent2); font-weight: 800; }
.tile .color-strip {
  position: absolute; top: 0; left: 0; right: 0; height: 10px;
  border-radius: 4px 4px 0 0;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), inset 0 -2px 3px rgba(0,0,0,0.25);
  z-index: 2;
}

.tile.for-sale { animation: pulse-glow 1.4s ease-in-out infinite; border-color: var(--border); }
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.6), inset 0 -3px 4px rgba(122,59,29,0.25), 0 0 0px var(--accent);
    transform: scale(1);
  }
  50% {
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.6), inset 0 -3px 4px rgba(122,59,29,0.25), 0 0 14px 4px var(--accent);
    transform: scale(1.05);
  }
}
.tile .forsale-tag {
  position: absolute; bottom: 10px; font-size: 6px; font-weight: 800; color: #fff;
  background: var(--border); border-radius: 4px; padding: 1px 3px;
}
.tile .house-dots { position: absolute; bottom: 12px; display: flex; gap: 1px; }
.tile .house-dots span { width: 4px; height: 4px; background: var(--good); display: block; border-radius: 1px; }
.tile .house-dots span.hotel { background: var(--danger); }

.tile-emojis {
  position: absolute; inset: 0; display: flex; flex-wrap: wrap;
  align-items: flex-end; justify-content: center; gap: 1px; pointer-events: none;
}
.piece {
  font-size: 16px;
  transition: all 0.4s cubic-bezier(.2,.9,.3,1.3);
  filter: drop-shadow(1px 2px 1px rgba(0,0,0,0.35));
}
.piece.ghost { opacity: 0.5; filter: grayscale(1) drop-shadow(1px 2px 1px rgba(0,0,0,0.35)); }

/* Floating "+£X"/"-£X" text on rent/trade/tax events — anchored to the
   tile div itself (not #pieces-*, which renderBoardState() clears on every
   sync) so the animation always plays out in full before removal. */
.floating-cash {
  position: absolute;
  left: 50%;
  bottom: 45%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.6);
  animation: float-up 1.4s ease-out forwards;
  z-index: 30;
}
.floating-cash.positive { color: var(--good); }
.floating-cash.negative { color: var(--danger); }
@keyframes float-up {
  0%   { opacity: 0; bottom: 40%; }
  15%  { opacity: 1; bottom: 55%; }
  100% { opacity: 0; bottom: 95%; }
}

.sidebar {
  display: flex; flex-direction: column; gap: 8px; overflow: hidden;
}
.panel {
  background: linear-gradient(180deg, #fffaf0, var(--panel));
  border: 3px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px; overflow-y: auto;
}
.panel h3 { margin: 0 0 8px; font-size: 12px; color: var(--border); }
.jackpot-value { font-size: 22px; color: var(--good); text-shadow: 1px 1px 0 rgba(0,0,0,0.15); font-weight: 800; }
.ticker-item { font-size: 10px; margin-bottom: 6px; line-height: 1.4; border-bottom: 1px dashed #c9a876; padding-bottom: 4px; }
.round-banner {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, #fffaf0, var(--panel));
  border: 3px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  padding: 10px 20px; font-size: 13px; z-index: 50; text-align: center; font-weight: 800;
}
.phase-timer { font-size: 24px; color: var(--danger); font-weight: 800; }
.session-timer { font-size: 11px; color: var(--accent2); font-weight: 800; margin-top: 4px; }

.room-code-big {
  font-size: 72px;
  letter-spacing: 12px;
  color: var(--good);
  text-shadow: 3px 3px 0 rgba(74,47,28,0.25);
  margin: 14px 0;
  font-weight: 800;
}

/* ---------- ENTRY / LANDING SCREEN ---------- */
.entry-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--world-bg);
}
.entry-choices { display: flex; gap: 16px; justify-content: center; margin-top: 20px; }
.entry-choices button { flex: 1; padding: 18px 10px; font-size: 14px; }
.entry-error { color: var(--danger); font-size: 11px; min-height: 14px; margin-top: 10px; font-weight: 800; }
#boardCodeInput {
  font-family: inherit; padding: 10px; width: 100%; text-align: center;
  letter-spacing: 6px; font-size: 16px; margin: 14px 0 6px;
  border: 3px solid var(--border); border-radius: 8px; background: #fffaf0; color: var(--ink);
}

.popup-overlay {
  position: fixed; inset: 0; background: rgba(40,28,16,0.55); z-index: 900;
  display: flex; align-items: center; justify-content: center;
}
.popup-card {
  background: linear-gradient(180deg, #fffaf0, var(--panel));
  border: 4px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px; max-width: 400px; text-align: center; font-size: 13px; line-height: 1.7;
  color: var(--ink);
}

/* ---------- PLAYER CLIENT ---------- */
/* Landscape: HUD + action console side by side on top, nearby-strip as a
   short full-width bar along the bottom (not a tall side column). */
.player-wrap {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "hud center"
    "nearby nearby";
  height: 100vh;
  gap: 6px;
  padding: 6px;
}
.hud-panel { grid-area: hud; }
.center-panel { grid-area: center; }
.nearby-panel { grid-area: nearby; max-height: 130px; }
.hud-panel {
  background: linear-gradient(180deg, #fffaf0, var(--panel));
  border: 3px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  padding: 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto;
}
.hud-emoji { font-size: 40px; text-align: center; }
.hud-cash { font-size: 20px; color: var(--good); text-shadow: 1px 1px 0 rgba(0,0,0,0.15); text-align: center; font-weight: 800; }
.hud-label { font-size: 10px; color: #9a7a5a; font-weight: 800; letter-spacing: 0.3px; }

.center-panel {
  background: linear-gradient(180deg, #fffaf0, var(--panel));
  border: 3px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}
.tabs { display: flex; border-bottom: 3px solid var(--border); }
.tab-btn {
  flex: 1; background: var(--panel-light); color: var(--ink); border: none; box-shadow: none;
  border-right: 2px solid var(--border); font-size: 11px; padding: 10px 4px;
  border-radius: 0;
}
.tab-btn.active { background: var(--accent); color: var(--ink); }
.tab-content { flex: 1; overflow-y: auto; padding: 12px; font-size: 11px; min-height: 0; -webkit-overflow-scrolling: touch; }

.deck-item, .market-item {
  border: 2px solid var(--border); border-radius: 8px;
  padding: 10px; margin-bottom: 10px;
  background: linear-gradient(160deg, #fffaf0, #f0dcae 60%);
  color: var(--ink);
}
.deck-item .name, .market-item .name { color: var(--border); margin-bottom: 4px; font-weight: 800; }
.typing { border-right: 2px solid var(--border); white-space: pre-wrap; overflow: hidden; }

/* ---------- PROPERTY CARDS (MY DECK — face-up Monopoly-style deed cards) ---------- */
.card-hand {
  display: flex; flex-wrap: wrap; gap: 18px; justify-content: center;
}
.prop-card {
  width: 260px;
  background: #fffaf0;
  color: var(--ink);
  border: 3px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.prop-card-header {
  padding: 14px 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.35);
  border-bottom: 3px solid var(--border);
}
.prop-card-body { padding: 12px; font-size: 11px; line-height: 1.8; }
.prop-card-price { margin-bottom: 6px; }
.prop-card-houses { font-size: 16px; margin-bottom: 8px; }
.rent-table { border-top: 2px dashed #c9a876; padding-top: 8px; margin-bottom: 8px; }
.rent-row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.rent-row.current { background: var(--accent); border-radius: 6px; margin: 0 -5px; padding: 3px 5px; }
.card-set { border-top: 2px dashed #c9a876; padding-top: 8px; margin-bottom: 8px; }
.card-set-label { color: var(--border); margin-bottom: 6px; font-weight: 800; }
.set-chip {
  display: inline-block; font-size: 10px; padding: 3px 7px; margin: 0 4px 4px 0;
  border: 1px solid var(--border); border-radius: 6px; font-weight: 700;
}
.set-chip.owned { background: var(--good); color: #fff; border-color: #2a7238; }
.set-chip.missing { background: #ead9b0; color: #8a7358; }
.prop-card input, .prop-card button { font-size: 11px; width: 100%; margin-top: 8px; }
.prop-card input { border: 2px solid var(--border); border-radius: 8px; padding: 6px; background: #fff; color: var(--ink); }

/* ---------- NEARBY STRIP (behind / current / ahead) ----------
   Replaces the old full isometric mini-map — a player only needs to see
   what's immediately around them; the big presentation screen already
   shows everyone's position on the full board. */
.nearby-panel {
  background: linear-gradient(180deg, #fffaf0, var(--panel));
  border: 3px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px 8px; overflow: hidden; display: flex; flex-direction: column;
}
.nearby-panel h3 { margin: 0 0 4px; font-size: 10px; color: var(--border); text-align: center; }
.nearby-strip {
  display: flex; align-items: stretch; justify-content: center; gap: 6px; flex: 1;
  flex-wrap: nowrap; overflow-x: auto;
}
.nearby-tile {
  position: relative;
  flex: 1; min-width: 54px;
  border: 2px solid var(--border); border-radius: 8px; overflow: hidden;
  background: linear-gradient(160deg, #fffaf0, #f0dcae 60%);
  padding: 6px 4px 5px; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 7px;
}
.nearby-tile.prev, .nearby-tile.next { opacity: 0.7; }
.nearby-tile.current {
  flex: 1.3; border-width: 3px; border-color: var(--accent);
  box-shadow: 0 0 10px 2px rgba(244,178,58,0.55);
  font-size: 8px;
}
.nearby-color { position: absolute; top: 0; left: 0; right: 0; height: 5px; }
.nearby-label { font-size: 6px; font-weight: 800; color: var(--accent2); letter-spacing: 0.3px; margin-top: 2px; }
.nearby-name { font-weight: 800; line-height: 1.2; }
.nearby-sub { font-size: 6px; color: #8a7358; }

@media (max-width: 900px) {
  .player-wrap {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "hud"
      "center"
      "nearby";
    /* minmax(0, 1fr) on the center row — not "1fr" alone — lets it shrink
       below its content's natural size, which is what actually activates
       .tab-content's overflow-y:auto instead of pushing the page taller
       than the viewport (body has overflow:hidden, so that used to leave
       the deck cards completely unreachable on mobile). */
    height: 100vh;
    height: 100dvh;
  }
  /* Cap the nearby-strip on mobile so it doesn't eat the space the
     deck/market/build tab needs — it's just 3 small cards, not a scrollable
     board, so a fixed height is all it needs. */
  .nearby-panel { max-height: 100px; }
}
