/* Custom Fonts */
@font-face {
  font-family: 'Bubblegum';
  src: url('fonts/Bubblegum.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Lovely Rose';
  src: url('fonts/Lovely Rose.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

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

/* Full page layout */
html, body {
  width: 100%;
  height: 100%;
  font-family: 'Lovely Rose', 'Arial', sans-serif;
  background: linear-gradient(135deg, #e8e8e8 0%, #c8c8c8 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* ==================== DEBUG TOGGLE ==================== */

.debug-toggle-container {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.8);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: 'Lovely Rose', sans-serif;
  font-size: 12px;
  color: #fff;
}

.debug-toggle-container label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.debug-toggle-container input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

/* ==================== DICE JIGGLE ANIMATION ==================== */

@keyframes dice-jiggle {
  0%   { transform: rotate(0deg)   scale(1); }
  10%  { transform: rotate(-18deg) scale(1.15); }
  25%  { transform: rotate(16deg)  scale(1.18); }
  40%  { transform: rotate(-12deg) scale(1.12); }
  55%  { transform: rotate(10deg)  scale(1.08); }
  70%  { transform: rotate(-6deg)  scale(1.04); }
  85%  { transform: rotate(4deg)   scale(1.02); }
  100% { transform: rotate(0deg)   scale(1); }
}

.dice-jiggle {
  animation: dice-jiggle 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  transform-origin: center center;
}



#landing-page {
  width: 100%;
  max-width: 500px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 1;
}

.landing-card {
  background: linear-gradient(180deg, #f8f8f8 0%, #e0e0e0 100%);
  border-radius: 40px;
  padding: 40px 40px 50px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.15),
    inset 0 -2px 10px rgba(0, 0, 0, 0.05);
  border: 8px solid #d0d0d0;
  text-align: center;
  width: 100%;
  position: relative;
}

/* Menu Container - wrapper for auth button, icon and dropdown */
.menu-container {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
}

/* Menu Icon */
.menu-icon {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.menu-icon:hover {
  transform: scale(1.1);
}

.menu-icon img {
  width: 60px;
  height: auto;
}

/* Game Title */
.game-title {
  font-family: 'Bubblegum', sans-serif;
  font-size: 80px;
  font-weight: normal;
  line-height: 0.85;
  margin-bottom: 10px;
  letter-spacing: -2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 40px;
}

.title-jelly,
.title-belly {
  display: block;
  color: #000;
  text-transform: uppercase;
}

/* Subtitle */
.subtitle {
  font-family: 'Lovely Rose', sans-serif;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 3px;
  margin-bottom: 30px;
  color: #888;
  text-transform: uppercase;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 40px;
}

.game-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.game-btn:hover {
  transform: translateY(-5px);
  filter: brightness(1.1);
}

.game-btn:active {
  transform: translateY(-2px);
}

.game-btn img {
  width: 160px;
  height: auto;
  display: block;
}

/* High Score Section */
.high-score-section {
  margin-bottom: 30px;
}

.high-score-label {
  font-family: 'Bubblegum', sans-serif;
  font-size: 36px;
  color: #000;
  margin-bottom: 15px;
}

.high-score-container {
  position: relative;
  display: inline-block;
  margin-bottom: 10px;
}

.high-score-container img {
  width: 280px;
  height: auto;
  display: block;
}

.high-score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Bubblegum', sans-serif;
  font-size: 48px;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.team-name {
  font-family: 'Bubblegum', sans-serif;
  font-size: 24px;
  color: #000;
  margin-top: 5px;
}

/* Meta Info */
.meta-info {
  font-family: 'Lovely Rose', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #333;
  margin-bottom: 10px;
}

/* Subscribe strip on landing page */
.landing-subscribe-strip {
  margin-bottom: 12px;
  width: 100%;
  text-align: center;
}
.landing-subscribe-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.landing-subscribe-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: 'Lovely Rose', sans-serif;
  font-size: 13px;
  color: #555;
  user-select: none;
}
.landing-subscribe-checkbox {
  width: 15px;
  height: 15px;
  accent-color: #e75480;
  cursor: pointer;
}
.landing-subscribe-status {
  font-family: 'Lovely Rose', sans-serif;
  font-size: 12px;
  color: #e75480;
}
.landing-email-row {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.landing-email-input {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1.5px solid #ccc;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  width: 100%;
  max-width: 220px;
  box-sizing: border-box;
}
.landing-email-btn {
  padding: 7px 18px;
  border-radius: 8px;
  background: #e75480;
  color: white;
  border: none;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  font-weight: bold;
}

/* Status Message */
.status-message {
  margin-top: 20px;
  font-size: 14px;
  color: #e74c3c;
  font-weight: 600;
  min-height: 20px;
}

/* ==================== SCROLLING BACKGROUND ==================== */

.jb-bg-scroll {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  /* Halftone: small dots slightly darker than the grey background (#e8e8e8 / #c8c8c8) */
  background-image:
    radial-gradient(circle, #b2b2b2 2.2px, transparent 2.2px);
  background-size: 18px 18px;
  background-position: 0 0;
  animation: jb-halftone-scroll 12s linear infinite;
  will-change: background-position;
}

@keyframes jb-halftone-scroll {
  0%   { background-position: 0 0; }
  100% { background-position: 36px 36px; }
}

/* ==================== LANDSCAPE LANDING PAGE ==================== */
/*
 * On short landscape screens (phones rotated) the vertical card
 * becomes a two-column layout with a dramatic split design:
 *   LEFT  — dark accent panel with title + meta
 *   RIGHT — light panel with buttons + high score
 */
/* ==================== LANDSCAPE LANDING PAGE — Option B: Light Horizontal Bar ====================
 *
 * Layout: [ Title + Subtitle ] | [ Create · Join + Solo ] | [ Score + Team ]
 * with the menu-container (Tutorial btn + Auth btn + Menu icon) in the top-right of the card.
 *
 * Covers:
 *   - Rotated phones    (landscape, max-height ~520px)
 *   - Tablets landscape (landscape, height 520–900px)  via the min-width block below
 *   - PC / wide screens (min-width: 900px)             via the min-width block below
 * ========================================================================================== */

@media (orientation: landscape) and (max-height: 520px) {

  /* Body stays light grey — matches the card so there's no jarring background clash */
  html, body {
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #e8e8e8 0%, #c8c8c8 100%);
    /* Use small viewport height so the browser address bar never clips the card */
    min-height: 100svh;
    height: auto;
    overflow-y: auto;
  }

  #landing-page {
    max-width: 100%;
    width: 100%;
    align-items: center;
    justify-content: center;
    /* No fixed height — let the card breathe */
  }

  /* ── Card: 3-column grid (title | actions | score) with a top row for controls ── */
  .landing-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto 1fr auto auto;
    grid-template-areas:
      "topbar  topbar  topbar"
      "title   center  score "
      "sub     solo    meta  "
      "status  status  status";
    width: 100%;
    max-width: 1100px;           /* caps nicely on wide tablets / small PCs */
    padding: 0;
    border-radius: 20px;
    /* Keep the same light-grey look as portrait — no dark split panels */
    background: linear-gradient(180deg, #f8f8f8 0%, #e0e0e0 100%);
    border: 6px solid #d0d0d0;
    box-shadow: 0 16px 48px rgba(0,0,0,0.18), inset 0 -2px 8px rgba(0,0,0,0.05);
    /* overflow must stay visible so the dropdown menu can escape the card bounds */
    overflow: visible;
    position: relative;
  }

  /* Remove the dark split pseudo-panels from the old approach */
  .landing-card::before,
  .landing-card::after {
    display: none;
  }

  /* ── Top bar: menu-container (Tutorial + Auth + ☰) ── */
  .menu-container {
    grid-area: topbar;
    position: relative;          /* un-do the portrait absolute positioning */
    top: auto;
    right: auto;
    justify-self: end;           /* push to the right inside the grid row */
    align-self: center;
    padding: 7px 12px 0;
    gap: 6px;
    flex-wrap: nowrap;
    z-index: 200;
  }

  /* Compact the Tutorial button (JS injects inline styles — override them) */
  #tutorialBtn {
    height: 32px !important;
    font-size: 12px !important;
    padding: 0 12px !important;
    border-radius: 16px !important;
    margin-right: 0 !important;
  }

  /* Compact the auth / sign-in button */
  #authBtn {
    height: 32px !important;
    font-size: 12px !important;
    padding: 4px 10px 4px 8px !important;
  }

  /* Compact menu icon */
  .menu-icon img {
    width: 34px;
  }

  /* Ensure the dropdown itself can still overflow the card */
  .menu-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 9999;
  }

  /* ── Left column: title ── */
  .game-title {
    grid-area: title;
    font-size: 46px;
    margin: 0;
    align-items: flex-start;
    padding: 6px 18px 2px 20px;
    line-height: 0.82;
    letter-spacing: -1px;
    align-self: end;
    /* Visual divider — right border acts as separator */
    border-right: 2px solid rgba(0,0,0,0.08);
    z-index: 1;
  }

  /* Title text back to black (not purple/white from old split theme) */
  .title-jelly,
  .title-belly {
    color: #000;
    text-shadow: none;
  }

  /* Subtitle sits below the title in the same left column */
  .subtitle {
    grid-area: sub;
    font-size: 9px;
    letter-spacing: 3px;
    margin: 0;
    text-align: left;
    padding: 3px 18px 10px 22px;
    color: #888;
    align-self: start;
    border-right: 2px solid rgba(0,0,0,0.08);
    z-index: 1;
  }

  /* ── Center column: Create + Join buttons ── */
  .action-buttons {
    grid-area: center;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0;
    padding: 6px 16px 2px;
    align-self: end;
    z-index: 1;
  }

  .game-btn img {
    width: 108px;
    filter: none;
    transition: transform 0.2s ease;
  }

  .game-btn:hover img {
    filter: none;
    transform: translateY(-3px);
  }

  /* Solo Play pill — center column, below the main buttons */
  .solo-pill-row {
    grid-area: solo;
    margin: 0;                  /* reset the portrait negative-margin hack */
    justify-content: center;
    padding: 12px 16px 10px;
    align-self: start;
  }

  .solo-pill-btn {
    font-size: 12px;
    padding: 5px 18px;
  }

  /* ── Right column: score ── */
  .high-score-section {
    grid-area: score;
    margin: 0;
    padding: 6px 20px 2px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    border-left: 2px solid rgba(0,0,0,0.08);
    align-self: end;
    z-index: 1;
  }

  .high-score-label {
    font-size: 11px;
    margin-bottom: 0;
    color: #555;
    white-space: nowrap;
  }

  .high-score-container {
    margin-bottom: 0;
  }

  .high-score-container img {
    width: 108px;
  }

  .high-score-value {
    font-size: 22px;
  }

  /* Team name + meta info sit below the score in the right column */
  .meta-info {
    grid-area: meta;
    display: block;             /* was hidden in old layout */
    font-size: 8px;
    color: #aaa;
    text-align: center;
    padding: 2px 18px 10px 16px;
    align-self: start;
    border-left: 2px solid rgba(0,0,0,0.08);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .team-name {
    font-size: 11px;
    color: #666;
    margin-top: 0;
    white-space: nowrap;
  }

  /* Status / error message spans the full width at the bottom */
  #status {
    grid-area: status;
    font-size: 11px;
    padding: 3px 16px 7px;
    text-align: center;
    z-index: 10;
    min-height: 0;
  }
}

/* ── Extra-narrow landscape phones (height ≤ 380px, e.g. iPhone SE rotated) ── */
@media (orientation: landscape) and (max-height: 380px) {
  html, body {
    padding: 6px 10px;
  }

  .landing-card {
    border-radius: 14px;
    border-width: 4px;
    max-width: 100%;
  }

  .landing-card::before,
  .landing-card::after { display: none; }

  .game-title {
    font-size: 34px;
    padding: 5px 14px 2px 16px;
  }

  .subtitle {
    font-size: 8px;
    padding: 2px 14px 8px 18px;
  }

  .action-buttons {
    gap: 8px;
    padding: 5px 12px 2px;
  }

  .game-btn img {
    width: 86px;
  }

  .solo-pill-btn {
    font-size: 10px;
    padding: 4px 13px;
  }

  .solo-pill-row {
    padding: 10px 12px 8px;
  }

  .high-score-section {
    padding: 5px 14px 2px 12px;
  }

  .high-score-container img {
    width: 86px;
  }

  .high-score-value {
    font-size: 17px;
  }

  .high-score-label {
    font-size: 9px;
  }

  .meta-info {
    font-size: 7px;
    padding: 2px 12px 8px;
  }

  .team-name {
    font-size: 10px;
  }

  .menu-container {
    padding: 5px 10px 0;
    gap: 5px;
  }

  #tutorialBtn {
    height: 27px !important;
    font-size: 10px !important;
    padding: 0 8px !important;
  }

  #authBtn {
    height: 27px !important;
    font-size: 10px !important;
    padding: 2px 8px 2px 6px !important;
  }

  .menu-icon img {
    width: 28px;
  }
}

/* ── Wide landscape: tablets + PC (landscape orientation, viewport tall enough to not hit
      the phone-landscape rule, but we still want the horizontal bar layout) ── */
@media (orientation: landscape) and (min-height: 521px) and (min-width: 900px) {
  html, body {
    background: linear-gradient(135deg, #e8e8e8 0%, #c8c8c8 100%);
    align-items: center;
    padding: 20px;
  }

  #landing-page {
    max-width: 100%;
    width: 100%;
    align-items: center;
  }

  .landing-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto 1fr auto auto;
    grid-template-areas:
      "topbar  topbar  topbar"
      "title   center  score "
      "sub     solo    meta  "
      "status  status  status";
    width: 100%;
    max-width: 1100px;
    padding: 0;
    border-radius: 36px;
    overflow: visible;
    border: 8px solid #d0d0d0;
    background: linear-gradient(180deg, #f8f8f8 0%, #e0e0e0 100%);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15), inset 0 -2px 10px rgba(0,0,0,0.05);
  }

  .landing-card::before,
  .landing-card::after { display: none; }

  /* Menu controls */
  .menu-container {
    grid-area: topbar;
    position: relative;
    top: auto; right: auto;
    justify-self: end;
    align-self: center;
    padding: 14px 18px 0;
    gap: 8px;
    flex-wrap: nowrap;
    z-index: 200;
  }

  /* Full-size tutorial + auth buttons on tall screens */
  #tutorialBtn {
    height: 44px !important;
    font-size: 15px !important;
    padding: 0 16px !important;
    border-radius: 22px !important;
    margin-right: 0 !important;
  }

  #authBtn {
    height: 44px !important;
    font-size: 14px !important;
    padding: 6px 14px 6px 10px !important;
  }

  .menu-icon img {
    width: 52px;
  }

  .menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 9999;
  }

  /* Title */
  .game-title {
    grid-area: title;
    font-size: 72px;
    margin: 0;
    align-items: flex-start;
    padding: 14px 28px 4px 34px;
    line-height: 0.82;
    letter-spacing: -2px;
    align-self: end;
    border-right: 2px solid rgba(0,0,0,0.08);
    z-index: 1;
    margin-top: 30px;           /* room for the topbar row */
  }

  .title-jelly,
  .title-belly {
    color: #000;
    text-shadow: none;
  }

  .subtitle {
    grid-area: sub;
    font-size: 14px;
    letter-spacing: 4px;
    margin: 0;
    text-align: left;
    padding: 4px 28px 20px 36px;
    color: #888;
    align-self: start;
    border-right: 2px solid rgba(0,0,0,0.08);
  }

  /* Buttons */
  .action-buttons {
    grid-area: center;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 0;
    padding: 14px 24px 4px;
    align-self: end;
    margin-top: 30px;
  }

  .game-btn img {
    width: 160px;
    filter: none;
    transition: transform 0.2s ease;
  }

  .game-btn:hover img {
    transform: translateY(-5px);
    filter: none;
  }

  .solo-pill-row {
    grid-area: solo;
    margin: 0;
    justify-content: center;
    padding: 14px 24px 20px;
    align-self: start;
  }

  .solo-pill-btn {
    font-size: 16px;
    padding: 9px 28px;
  }

  /* Score */
  .high-score-section {
    grid-area: score;
    margin: 0;
    padding: 14px 30px 4px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    border-left: 2px solid rgba(0,0,0,0.08);
    align-self: end;
    margin-top: 30px;
  }

  .high-score-label {
    font-size: 22px;
    margin-bottom: 0;
    color: #000;
    white-space: nowrap;
  }

  .high-score-container {
    margin-bottom: 0;
  }

  .high-score-container img {
    width: 220px;
  }

  .high-score-value {
    font-size: 42px;
  }

  .meta-info {
    grid-area: meta;
    display: block;
    font-size: 12px;
    color: #888;
    text-align: center;
    padding: 4px 28px 20px 22px;
    align-self: start;
    border-left: 2px solid rgba(0,0,0,0.08);
  }

  .team-name {
    font-size: 18px;
    color: #000;
    margin-top: 0;
  }

  #status {
    grid-area: status;
    padding: 4px 20px 10px;
    text-align: center;
    font-size: 14px;
  }
}



/* ==================== MODAL ==================== */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: linear-gradient(180deg, #f8f8f8 0%, #e0e0e0 100%);
  border-radius: 30px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: 6px solid #d0d0d0;
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.modal-content h2 {
  font-family: 'Bubblegum', sans-serif;
  font-size: 28px;
  margin-bottom: 25px;
  color: #000;
}

.modal-content input {
  width: 100%;
  padding: 15px;
  font-size: 18px;
  font-family: 'Lovely Rose', sans-serif;
  border: 3px solid #999;
  border-radius: 15px;
  margin-bottom: 10px;
  text-align: center;
  outline: none;
}

.modal-content input:focus {
  border-color: #666;
}

.modal-room-code {
  margin: 20px 0;
  padding: 15px;
  background: rgba(26, 188, 156, 0.1);
  border-radius: 15px;
  border: 2px solid #1abc9c;
}

.modal-room-code p {
  margin: 5px 0;
  font-family: 'Lovely Rose', sans-serif;
}

.room-code-display-modal {
  font-family: 'Bubblegum', sans-serif;
  font-size: 32px;
  color: #1abc9c;
  font-weight: bold;
  letter-spacing: 3px;
}

.room-code-hint {
  font-size: 12px;
  color: #666;
  font-style: italic;
}

#roomCodeSection {
  margin-bottom: 15px;
}

#roomCodeInput {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: bold;
}

.confirm-btn,
.cancel-btn {
  font-family: 'Bubblegum', sans-serif;
  font-size: 20px;
  padding: 12px 30px;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  margin: 10px 10px 0;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.confirm-btn {
  background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%);
  color: #000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.cancel-btn {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.confirm-btn:hover,
.cancel-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.confirm-btn:active,
.cancel-btn:active {
  transform: translateY(0);
}

.confirm-btn:disabled {
  background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Code Selection Modal Styles */
.code-modal {
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
}

.code-modal-subtitle {
  font-size: 14px;
  color: #666;
  margin-bottom: 20px;
  line-height: 1.5;
}

.code-selection-container {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: nowrap; /* stay in one row but shrink */
}

.code-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0; /* allow shrinking */
  flex: 1;
  max-width: 160px;
}

.code-slot-label {
  font-family: 'Bubblegum', sans-serif;
  font-size: 15px;
  color: #333;
  font-weight: bold;
}

.dice-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: rgba(255, 255, 255, 0.5);
  padding: 10px;
  border-radius: 15px;
  border: 3px solid #ddd;
  width: 100%;
  box-sizing: border-box;
}

.dice-option {
  width: 100%;
  aspect-ratio: 1;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  border: 3px solid transparent;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.dice-option:hover {
  transform: scale(1.1);
  border-color: #3498db;
  background-color: rgba(52, 152, 219, 0.1);
}

.dice-option.selected {
  border-color: #1abc9c;
  background-color: rgba(26, 188, 156, 0.2);
  transform: scale(1.05);
}

/* Mobile: stack slots vertically if very narrow, and make modal scrollable */
@media (max-width: 480px) {
  .modal {
    align-items: flex-start;
    padding: 12px 0;
    overflow-y: auto;
  }

  .modal-content {
    margin: auto;
    max-height: none;
    overflow-y: visible;
  }

  .code-modal {
    max-height: none;
    overflow-y: visible;
    width: 94%;
    padding: 24px 16px 28px;
  }

  .code-selection-container {
    gap: 8px;
  }

  .dice-options {
    gap: 4px;
    padding: 8px;
  }

  .code-slot-label {
    font-size: 13px;
  }
}

.selected-value {
  width: 60px;
  height: 60px;
  border: 3px solid #1abc9c;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bubblegum', sans-serif;
  font-size: 32px;
  color: #1abc9c;
  background: white;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.selected-value.empty {
  color: #ccc;
}

.code-modal-info {
  background: rgba(52, 152, 219, 0.1);
  border: 2px solid #3498db;
  border-radius: 15px;
  padding: 15px;
  margin-bottom: 20px;
}

.code-modal-info p {
  font-size: 14px;
  color: #333;
  margin: 0;
  line-height: 1.6;
}

/* ==================== GAME SCREEN ==================== */

#game {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #e4e2dc;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

/* Game container - main layout wrapper */
.game-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Board container - properly centers the hex grid */
#boardContainer {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #f5f5f5;
  border-radius: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Board wrapper - adds controlled padding */
.board-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 20px;
}

/* Actions container */
#actionsContainer {
  position: relative;
  z-index: 1000;
  background-color: #ffffff;
  border-radius: 8px;
  padding: 15px;
  border: 2px solid #333;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* HUD */
#hud {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 16px;
  position: relative;
  z-index: 100;
}

#hud div {
  background-color: #fff4c2;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #e0d8b0;
}

/* Inventory */
.inventory {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.perk {
  padding: 6px 10px;
  background-color: #d9f0ff;
  border-radius: 6px;
  border: 1px solid #a6d0ff;
  cursor: pointer;
  position: relative;
}

.perk:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 14px;
  z-index: 10;
}

/* Dice */
.dice {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.die {
  width: 40px;
  height: 40px;
  background-color: #fff;
  border: 2px solid #000;
  border-radius: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 20px;
  cursor: pointer;
}

.die.locked {
  background-color: #ccc;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  /* Allow the page to scroll on small phones so nothing is clipped */
  html, body {
    height: auto;
    min-height: 100%;
    align-items: flex-start;
    padding: max(28px, env(safe-area-inset-top, 28px)) 12px 24px;
    overflow-y: auto;
  }

  #landing-page {
    width: 100%;
    max-width: 100%;
    align-items: stretch;
    min-height: unset;
  }

  .landing-card {
    padding: 30px 20px 36px;
    width: 100%;
    border-radius: 28px;
  }
  
  .game-title {
    font-size: 64px;
    margin-top: 56px; /* room for the absolute menu-container */
  }
  
  .menu-container {
    top: 20px;
    right: 18px;
  }
  
  .menu-icon img {
    width: 46px;
  }
  
  .action-buttons {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }
  
  .game-btn img {
    width: 140px;
  }
  
  .high-score-container img {
    width: 240px;
  }
  
  .high-score-value {
    font-size: 40px;
  }
  
  .high-score-label {
    font-size: 30px;
  }
  
  .team-name {
    font-size: 20px;
  }
  
  #hud {
    flex-direction: column;
    gap: 6px;
  }

  .die {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
}

/* ==================== COMPREHENSIVE GAME BOARD STYLES ==================== */

.game-container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #f0f0f0 0%, #d8d8d8 100%);
  overflow: hidden;
  position: relative;
}

/* HUD Bar - Improved for mobile */
.hud-bar {
  background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
  color: white;
  padding: 10px 15px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: center;
  gap: 8px 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  border-bottom: 3px solid #1abc9c;
  flex-shrink: 0;
  min-height: 60px;
  z-index: 1000;
}

.hud-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 70px;
}

.hud-label {
  font-family: 'Lovely Rose', sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  color: #95a5a6;
  letter-spacing: 0.5px;
}

.hud-value {
  font-family: 'Bubblegum', sans-serif;
  font-size: 18px;
  color: #1abc9c;
  font-weight: bold;
}

.room-code-hud {
  font-size: 14px;
  letter-spacing: 2px;
  color: #95a5a6;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  transition: color 0.2s;
}

.room-code-hud:hover {
  color: #1abc9c;
}

/* Main Game Layout - Redesigned for mobile-first */
.game-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow: hidden;
  min-height: 0;
}

/* Player Areas - Mobile-optimized and COMPACT */
.player-area {
  background: linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
  border-radius: 10px;
  padding: 6px 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 2px solid #ddd;
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  max-height: 70px;
}

.player-1-area {
  border-color: #27ae60;
  order: 1;
}

.player-2-area {
  border-color: #3498db;
  order: 3;
}

.player-header {
  font-family: 'Bubblegum', sans-serif;
  font-size: 13px;
  text-align: center;
  color: #2c3e50;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  min-width: 55px;
  flex-shrink: 0;
}

.hearts-container {
  display: flex;
  justify-content: center;
  gap: 3px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.heart {
  width: 22px;
  height: 22px;
  background: url('assets/tiles/DotedRedEmptyHeart.svg') center/contain no-repeat;
  filter: grayscale(100%) brightness(0.5);
  flex-shrink: 0;
}

.heart.filled {
  filter: none;
}

.player-code {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  background: rgba(236, 240, 241, 0.5);
  border-radius: 6px;
  flex-shrink: 0;
}

.code-die {
  width: 28px;
  height: 28px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

.inventory-area {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: 4px;
  min-width: 0;
  align-items: center;
}

.inventory-label {
  font-family: 'Lovely Rose', sans-serif;
  font-size: 10px;
  text-align: center;
  color: #7f8c8d;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  flex-shrink: 0;
}

.inventory-slots {
  display: flex;
  flex-direction: row;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
  flex: 1;
}

.inventory-slot {
  background: rgba(241, 196, 15, 0.1);
  border: 2px dashed #f39c12;
  border-radius: 6px;
  min-width: 40px;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.inventory-slot:hover {
  background: rgba(241, 196, 15, 0.2);
  border-color: #e67e22;
}

.inventory-slot.filled {
  background: rgba(241, 196, 15, 0.3);
  border-style: solid;
}

.perk-card {
  width: 100%;
  height: 100%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.perk-card:hover {
  transform: scale(1.05);
}

.bag-info {
  text-align: center;
  font-family: 'Lovely Rose', sans-serif;
  font-size: 10px;
  color: #7f8c8d;
  padding: 4px 6px;
  background: rgba(236, 240, 241, 0.5);
  border-radius: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Board Wrapper - Now properly responsive and fills space */
.board-wrapper {
  background: linear-gradient(135deg, #ecf0f1 0%, #bdc3c7 100%);
  border-radius: 12px;
  padding: 10px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border: 3px solid #95a5a6;
  position: relative;
  flex: 1;
  min-height: 0;
  order: 2;
}

/* Hex Board - Responsive sizing */
.hex-board {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

.hex-grid-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: min(90vw, 450px);
  max-height: min(90vw, 450px);
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hex-tile {
  position: absolute;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
  width: 40px;
  height: 46px;
}

.hex-tile:hover {
  transform: scale(1.15);
  filter: brightness(1.2);
  z-index: 500 !important;
  position: relative;
}

/* Reachable tile highlights */
.reachable-highlight {
  pointer-events: none;
  z-index: 2;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.hex-tile.occupied {
  border: 3px solid gold;
  border-radius: 50%;
  box-shadow: 0 0 20px gold;
}

.hex-tile.player-1-position {
  border-color: #27ae60;
  box-shadow: 0 0 20px #27ae60;
}

.hex-tile.player-2-position {
  border-color: #3498db;
  box-shadow: 0 0 20px #3498db;
}

/* Player Tokens */
.player-token {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Bubblegum', sans-serif;
  font-size: 20px;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 100;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Slide and land animation for moving token overlay */
@keyframes token-land {
  0%   { transform: translate(-50%, -50%) scale(1.3); }
  50%  { transform: translate(-50%, -50%) scale(0.88); }
  75%  { transform: translate(-50%, -50%) scale(1.1); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.player-token.land-bounce {
  animation: token-land 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

.player-token.p1 {
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.player-token.p2 {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

/* Player Markers (alternative style for boardRenderer.js) */
.player-marker {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Bubblegum', sans-serif;
  font-size: 20px;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 100;
  pointer-events: none;
}

/* Controls Area - Redesigned for mobile */
/* ── Boss tile subtle pulse ──────────────────────────────────────────────── */
@keyframes bossTilePulse {
  0%, 100% {
    filter: brightness(1) drop-shadow(0 0 3px rgba(180, 180, 180, 0.25));
  }
  50% {
    filter: brightness(1.22) drop-shadow(0 0 10px rgba(220, 220, 220, 0.6));
  }
}

.boss-tile-pulse {
  animation: bossTilePulse 2.8s ease-in-out infinite;
  z-index: 2 !important;
}

/* ── Controls area + action/dice panel responsive layout ─────────────────── */
.controls-area {
  background: linear-gradient(180deg, #34495e 0%, #2c3e50 100%);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  border-top: 3px solid #1abc9c;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 200;
  flex-shrink: 0;
  /* Large screens: auto-size so all buttons are visible */
  max-height: none;
  overflow-y: visible;
  overflow-x: hidden;
}

/* Actions Panel */
.actions-panel {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 150;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

.action-header {
  font-family: 'Bubblegum', sans-serif;
  font-size: 18px;
  color: #2c3e50;
  margin-bottom: 10px;
  text-align: center;
  flex-shrink: 0;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  flex: 1;
}

.action-btn {
  font-family: 'Lovely Rose', sans-serif;
  font-size: 13px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
  position: relative;
  z-index: 100;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 100px;
  min-height: 40px;
  font-weight: 500;
}

.action-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.3);
  filter: brightness(1.1);
}

.action-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, #16a085 0%, #148f77 100%);
}

.action-btn:disabled {
  background: #95a5a6;
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

/* Dice Panel */
.dice-panel {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  z-index: 150;
  pointer-events: auto;
}

.dice-header {
  font-family: 'Bubblegum', sans-serif;
  font-size: 18px;
  color: #2c3e50;
  margin-bottom: 10px;
  text-align: center;
  flex-shrink: 0;
}

.dice-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.dice-die {
  width: 45px;
  height: 45px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  transition: all 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  flex-shrink: 0;
}

.dice-die:hover {
  transform: scale(1.1);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)) brightness(1.1);
}

.dice-die.locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.dice-btn {
  font-family: 'Bubblegum', sans-serif;
  font-size: 14px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
  width: 100%;
}

.dice-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.3);
  filter: brightness(1.1);
}

.dice-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.dice-btn:disabled {
  background: #95a5a6;
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

/* Phase Indicator */
.phase-indicator {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  grid-column: span 2;
}

.phase-text {
  font-family: 'Bubblegum', sans-serif;
  font-size: 20px;
  color: #2c3e50;
  text-align: center;
  line-height: 1.3;
}
  pointer-events: auto;
  height: 100%;
}

.dice-header {
  font-family: 'Bubblegum', sans-serif;
  font-size: 24px;
  color: #2c3e50;
  margin-bottom: 15px;
  text-align: center;
  flex-shrink: 0;
}

.dice-display {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.dice-die {
  width: 60px;
  height: 60px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  transition: all 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  flex-shrink: 0;
}

.dice-die:hover {
  transform: scale(1.15);
}

.dice-die.locked {
  filter: grayscale(100%) brightness(0.7);
  border: 3px solid #f39c12;
  border-radius: 10px;
}

.dice-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.dice-btn {
  font-family: 'Lovely Rose', sans-serif;
  font-size: 16px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
  position: relative;
  z-index: 100;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 140px;
  min-height: 50px;
  font-weight: 500;
}

.dice-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
  filter: brightness(1.15);
}

.dice-btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
  transition: all 0.1s ease;
}

.dice-btn:disabled {
  background: #95a5a6;
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

/* Phase Indicator */
.phase-indicator {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 25px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  height: 100%;
}

.phase-text {
  font-family: 'Bubblegum', sans-serif;
  font-size: 28px;
  color: #2c3e50;
  text-align: center;
  line-height: 1.3;
}

/* Responsive Design for Game Board */

/* Landscape orientation - switch to side-by-side IMMEDIATELY */
@media (orientation: landscape) {
  .game-layout {
    flex-direction: row;
    gap: 8px;
    padding: 8px;
  }
  
  .player-area {
    flex-direction: column;
    max-height: none;
    width: 140px;
    max-width: 140px;
    overflow-y: auto;
    overflow-x: hidden;
  }
  
  .player-1-area {
    order: 1;
  }
  
  .board-wrapper {
    order: 2;
    flex: 1;
  }
  
  .player-2-area {
    order: 3;
  }
  
  .player-header {
    font-size: 14px;
    padding: 5px 8px;
    min-width: auto;
  }
  
  .inventory-area {
    flex-direction: column;
    align-items: stretch; /* Fix: stretch children to full width instead of centering */
  }
  
  .inventory-label {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    font-size: 11px;
  }
  
  .inventory-slots {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%; /* Fix: ensure slots container fills available width */
  }
  
  .inventory-slot {
    width: 100%;
    min-width: auto;
    height: 50px;
    min-height: 50px; /* Fix: prevent slots from collapsing */
  }
  
  .controls-area {
    grid-template-columns: 1fr 1fr 1fr;
    max-height: 30vh;
  }
  
  .phase-indicator {
    grid-column: 3;
  }
  
  .hex-grid-container {
    max-width: min(80vh, 500px);
    max-height: min(80vh, 500px);
  }
}

/* Tablet and larger - enhanced spacing */
@media (min-width: 768px) {
  .game-layout {
    gap: 12px;
    padding: 12px;
  }
  
  .player-area {
    width: 180px;
    max-width: 180px;
    padding: 10px;
  }
  
  .player-header {
    font-size: 16px;
    padding: 8px 10px;
  }
  
  .heart {
    width: 28px;
    height: 28px;
  }
  
  .code-die {
    width: 35px;
    height: 35px;
  }
  
  .inventory-label {
    font-size: 12px;
  }
  
  .inventory-slot {
    height: 60px;
    min-height: 60px;
  }
  
  .bag-info {
    font-size: 11px;
    padding: 5px 8px;
  }
  
  .controls-area {
    padding: 15px;
    gap: 15px;
  }
  
  .hex-grid-container {
    max-width: min(70vh, 550px);
    max-height: min(70vh, 550px);
  }
  
  .hud-bar {
    padding: 12px 20px;
  }
  
  .hud-section {
    min-width: 85px;
  }
  
  .hud-label {
    font-size: 13px;
  }
  
  .hud-value {
    font-size: 22px;
  }
}

/* Desktop and larger */
@media (min-width: 1024px) {
  .game-layout {
    gap: 15px;
    padding: 15px;
  }
  
  .player-area {
    width: 220px;
    max-width: 220px;
    padding: 12px;
  }
  
  .player-header {
    font-size: 18px;
    padding: 10px;
  }
  
  .heart {
    width: 32px;
    height: 32px;
  }
  
  .code-die {
    width: 42px;
    height: 42px;
  }
  
  .inventory-label {
    font-size: 13px;
  }
  
  .inventory-slot {
    height: 70px;
    min-height: 70px;
  }
  
  .bag-info {
    font-size: 12px;
    padding: 6px 10px;
  }
  
  .controls-area {
    padding: 18px;
    gap: 18px;
    max-height: 28vh;
  }
  
  .actions-panel,
  .dice-panel,
  .phase-indicator {
    padding: 16px;
  }
  
  .action-header,
  .dice-header {
    font-size: 20px;
    margin-bottom: 12px;
  }
  
  .action-btn {
    font-size: 14px;
    padding: 11px 16px;
    min-width: 110px;
    min-height: 42px;
  }
  
  .dice-die {
    width: 48px;
    height: 48px;
  }
  
  .dice-btn {
    font-size: 15px;
    padding: 11px 18px;
  }
  
  .phase-text {
    font-size: 22px;
  }
  
  .hex-grid-container {
    max-width: min(65vh, 650px);
    max-height: min(65vh, 650px);
  }
  
  .hex-tile {
    width: 48px;
    height: 55px;
  }
  
  .hud-bar {
    min-height: 70px;
  }
  
  .hud-section {
    min-width: 90px;
    gap: 5px;
  }
  
  .hud-label {
    font-size: 14px;
  }
  
  .hud-value {
    font-size: 24px;
  }
}

/* Small mobile devices */
@media (max-width: 400px) {
  .hud-bar {
    padding: 8px 10px;
    gap: 6px 8px;
    min-height: 50px;
  }
  
  .hud-section {
    min-width: 60px;
    gap: 2px;
  }
  
  .hud-label {
    font-size: 9px;
  }
  
  .hud-value {
    font-size: 14px;
  }
  
  .game-layout {
    padding: 6px;
    gap: 6px;
  }
  
  .player-area {
    padding: 5px 6px;
    gap: 5px;
    max-height: 65px;
  }
  
  .player-header {
    font-size: 12px;
    padding: 3px 6px;
    min-width: 50px;
  }
  
  .heart {
    width: 20px;
    height: 20px;
  }
  
  .code-die {
    width: 25px;
    height: 25px;
  }
  
  .inventory-label {
    font-size: 9px;
  }
  
  .inventory-slot {
    min-width: 35px;
    width: 35px;
    height: 35px;
  }
  
  .bag-info {
    font-size: 9px;
    padding: 3px 5px;
  }
  
  .board-wrapper {
    padding: 8px;
  }
  
  .hex-grid-container {
    padding: 6px;
    max-width: min(92vw, 400px);
    max-height: min(92vw, 400px);
  }
  
  .hex-tile {
    width: 32px;
    height: 37px;
  }
  
  .controls-area {
    padding: 10px;
    gap: 8px;
  }
  
  .actions-panel,
  .dice-panel {
    padding: 10px;
  }
  
  .action-header,
  .dice-header {
    font-size: 15px;
    margin-bottom: 8px;
  }
  
  .action-btn {
    font-size: 11px;
    padding: 8px 10px;
    min-width: 85px;
    min-height: 36px;
  }
  
  .dice-die {
    width: 38px;
    height: 38px;
  }
  
  .dice-btn {
    font-size: 12px;
    padding: 8px 12px;
  }
  
  .phase-text {
    font-size: 16px;
  }
}

/* ============================================
   BOARD ZOOM CONTROLS
   ============================================ */

#boardZoomControls {
  position: absolute;
  bottom: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  z-index: 600;
  pointer-events: auto;
}

.bzc-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(26, 32, 44, 0.82);
  color: #ecf0f1;
  font-size: 22px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s, transform 0.1s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.bzc-btn:hover {
  background: rgba(26, 188, 156, 0.75);
  border-color: rgba(26, 188, 156, 0.6);
}

.bzc-btn:active {
  transform: scale(0.93);
}

.bzc-reset {
  font-size: 17px;
  color: #95a5a6;
}

.bzc-reset:hover {
  color: #ecf0f1;
}

.bzc-scale {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.5px;
  text-align: center;
  user-select: none;
  line-height: 1;
  margin: 1px 0;
}

/* Make sure the board-wrapper can contain the absolutely-positioned controls */
.board-wrapper {
  position: relative;
}

/* ─── Mobile: slightly larger touch targets ─────────────────────────────── */
@media (max-width: 768px) {
  .bzc-btn {
    width: 42px;
    height: 42px;
  }

  #boardZoomControls {
    bottom: 10px;
    right: 10px;
    gap: 6px;
  }
}



.leaderboard-content {
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid #333;
}

.leaderboard-header h2 {
  margin: 0;
  font-size: 24px;
  color: #ffd700;
}

.close-btn {
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.close-btn:hover {
  background: #cc0000;
}

.leaderboard-info {
  text-align: center;
  font-size: 14px;
  color: #888;
  margin-bottom: 15px;
}

.leaderboard-list {
  overflow-y: auto;
  max-height: 60vh;
  padding-right: 10px;
}

.leaderboard-list::-webkit-scrollbar {
  width: 8px;
}

.leaderboard-list::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 4px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
  background: #666;
}

.loading-scores {
  text-align: center;
  padding: 40px;
  color: #888;
  font-size: 16px;
}

.score-entry {
  display: flex;
  align-items: center;
  padding: 12px;
  margin-bottom: 8px;
  background: #2a2a2a;
  border-radius: 8px;
  transition: background 0.2s;
}

.score-entry:hover {
  background: #333;
}

.score-entry.top-3 {
  background: linear-gradient(135deg, #2a2a2a 0%, #3a3a2a 100%);
  border: 1px solid #ffd700;
}

.score-rank {
  font-size: 18px;
  font-weight: bold;
  width: 50px;
  text-align: center;
  color: #888;
}

.score-entry.top-3 .score-rank {
  color: #ffd700;
  font-size: 24px;
}

.score-details {
  flex: 1;
  margin: 0 15px;
}

.score-team {
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 4px;
}

.score-meta {
  font-size: 12px;
  color: #888;
}

.score-value {
  font-size: 24px;
  font-weight: bold;
  color: #4CAF50;
  min-width: 60px;
  text-align: right;
}

.score-entry.top-3 .score-value {
  color: #ffd700;
  font-size: 28px;
}

/* Make high score clickable */
.high-score-section {
  cursor: pointer;
  transition: transform 0.2s;
}

.high-score-section:hover {
  transform: scale(1.05);
}

/* Make menu icon clickable */
.menu-icon {
  cursor: pointer;
  transition: transform 0.2s;
}

.menu-icon:hover {
  transform: scale(1.1);
}

@media (max-width: 768px) {
  .leaderboard-content {
    max-width: 95vw;
    padding: 15px;
  }
  
  .score-entry {
    padding: 10px;
  }
  
  .score-rank {
    width: 40px;
    font-size: 16px;
  }
  
  .score-entry.top-3 .score-rank {
    font-size: 20px;
  }
  
  .score-team {
    font-size: 14px;
  }
  
  .score-value {
    font-size: 20px;
  }
  
  .score-entry.top-3 .score-value {
    font-size: 24px;
  }
}



/* ===== MENU DROPDOWN ===== */
/* (menu-container base styles are defined near the top of the landing page section) */

.menu-icon {
  cursor: pointer;
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #1a1a2e;
  border: 2px solid #444;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  min-width: 200px;
  z-index: 200;
  animation: menuFadeIn 0.15s ease;
}

@keyframes menuFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.menu-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 15px 22px;
  background: none;
  border: none;
  color: #f0f0f0;
  font-family: 'Bubblegum', sans-serif;
  font-size: 18px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.5px;
}

.menu-dropdown-item:hover {
  background: rgba(255,255,255,0.09);
  color: #ffffff;
}

.menu-item-icon {
  font-size: 20px;
  width: 26px;
  text-align: center;
}

.menu-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 0 12px;
}

/* ===== NEWSROOM MODAL ===== */
.newsroom-content {
  max-width: 540px;
  width: 92%;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  text-align: left;
}

.newsroom-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.newsroom-coming-soon {
  text-align: center;
  padding: 40px 20px;
}

.newsroom-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.newsroom-title {
  font-family: 'Bubblegum', sans-serif;
  font-size: 26px;
  color: #ffd700;
  margin: 0 0 10px;
}

.newsroom-subtitle {
  font-size: 15px;
  color: #888;
  margin: 0;
}

/* ==================== GAME MODAL SYSTEM ==================== */

.game-modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: modalFadeIn 0.15s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.game-modal-box {
  background: linear-gradient(180deg, #fff 0%, #f0f0f0 100%);
  border-radius: 24px;
  padding: 32px 36px 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  border: 4px solid #d0d0d0;
  text-align: center;
  animation: modalSlideUp 0.2s ease;
}

@keyframes modalSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.game-modal-message {
  font-family: 'Lovely Rose', 'Arial', sans-serif;
  font-size: 17px;
  color: #333;
  line-height: 1.6;
  margin-bottom: 24px;
  white-space: pre-wrap;
}

.game-modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.game-modal-btn {
  font-family: 'Bubblegum', sans-serif;
  font-size: 18px;
  padding: 11px 32px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-width: 90px;
}

.game-modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

.game-modal-btn:active {
  transform: scale(0.97);
}

.game-modal-ok {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

.game-modal-confirm {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

.game-modal-cancel {
  background: #e0e0e0;
  color: #555;
}

/* ==================== HOW TO PLAY MODAL ==================== */

.how-to-play-content {
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

.how-to-play-body {
  padding: 0 4px;
  text-align: left;
}

.htp-section {
  margin-bottom: 22px;
}

.htp-section h3 {
  font-family: 'Bubblegum', sans-serif;
  font-size: 20px;
  color: #667eea;
  margin-bottom: 8px;
  border-bottom: 2px solid #e0e0f0;
  padding-bottom: 4px;
}

.htp-section p, .htp-section li {
  font-family: 'Lovely Rose', 'Arial', sans-serif;
  font-size: 15px;
  color: #444;
  line-height: 1.6;
  margin-bottom: 5px;
}

.htp-section ul {
  padding-left: 20px;
}

.htp-section li {
  margin-bottom: 4px;
}

.htp-tip {
  background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
  border-left: 4px solid #667eea;
  padding: 10px 14px;
  border-radius: 0 12px 12px 0;
  font-family: 'Lovely Rose', 'Arial', sans-serif;
  font-size: 14px;
  color: #555;
  margin-top: 8px;
}

/* Tile guide grid inside How to Play */
.htp-tile-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 12px 0;
}

.htp-tile-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(102, 126, 234, 0.06);
  border-radius: 14px;
  padding: 10px 14px;
}

.htp-tile-img {
  width: 52px;
  height: 60px;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.htp-tile-info {
  flex: 1;
}

.htp-tile-info strong {
  font-family: 'Bubblegum', sans-serif;
  font-size: 16px;
  color: #555;
  display: block;
  margin-bottom: 3px;
}

.htp-tile-info p {
  font-family: 'Lovely Rose', 'Arial', sans-serif;
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  margin: 0;
}

/* ==================== TUTORIAL STYLES ==================== */

/* Tutorial pulse animation for menu icon and tiles */
@keyframes tutorial-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 15px rgba(102, 126, 234, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
  }
}

.tutorial-pulse {
  animation: tutorial-pulse 2s infinite;
  z-index: 100 !important;
}

/* Tutorial achievement popup */
.tutorial-achievement-popup {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  animation: slideInRight 0.5s ease-out;
  transition: opacity 0.5s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.tutorial-achievement-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  min-width: 280px;
  color: white;
  font-family: 'Bubblegum', sans-serif;
}

.tutorial-achievement-icon {
  font-size: 48px;
  text-align: center;
  margin-bottom: 8px;
}

.tutorial-achievement-title {
  font-size: 20px;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.tutorial-achievement-text {
  font-family: 'Lovely Rose', 'Arial', sans-serif;
  font-size: 16px;
  text-align: center;
  line-height: 1.4;
  opacity: 0.95;
}

/* Tutorial button */
.tutorial-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
}

.tutorial-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5) !important;
}

/* Additional styling for locked buttons during tutorial */
button:disabled.tutorial-locked {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  filter: grayscale(50%);
}

/* ── Settings Modal ─────────────────────────────────────────────────────────── */
.settings-modal-content {
  max-width: 420px;
  width: 90%;
  padding: 28px 24px 20px;
}

.settings-title {
  font-family: 'Bubblegum', sans-serif;
  font-size: 22px;
  color: #2c3e50;
  margin: 0 0 20px;
  text-align: center;
}

.settings-section {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.settings-section-title {
  font-family: 'Bubblegum', sans-serif;
  font-size: 14px;
  color: #7f8c8d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
}

.settings-row-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.settings-label {
  font-family: 'Bubblegum', sans-serif;
  font-size: 16px;
  color: #2c3e50;
}

.settings-desc {
  font-family: 'Lovely Rose', sans-serif;
  font-size: 11px;
  color: #95a5a6;
  line-height: 1.4;
}

/* Toggle switch */
.settings-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.settings-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ccc;
  border-radius: 26px;
  transition: background 0.25s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.settings-toggle input:checked + .toggle-slider {
  background: #1abc9c;
}

.settings-toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* In-game HUD settings button */
.hud-settings-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.7;
  padding: 4px 6px;
  border-radius: 6px;
  transition: opacity 0.2s, background 0.2s;
  line-height: 1;
  flex-shrink: 0;
}

.hud-settings-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,0.15);
}

/* ── Speech Bubbles ─────────────────────────────────────────────── */


/* ============================================================
   RESPONSIVE AUDIT FIXES — all screen sizes
   ============================================================ */

/* ── 1. Safe-area / notch support (iPhone Dynamic Island etc.) ── */
#game {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.hud-bar {
  padding-left: max(15px, env(safe-area-inset-left));
  padding-right: max(15px, env(safe-area-inset-right));
}

.controls-area {
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

/* ── 2. iOS momentum scrolling on all scroll containers ── */
.inventory-slots,
.controls-area,
.actions-panel,
.dice-panel,
.player-area,
.newsroom-body,
.leaderboard-list,
.how-to-play-content {
  -webkit-overflow-scrolling: touch;
}

/* ── 3. Controls area — cap width on ultra-wide / TV ── */
.controls-area {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

/* ── 4. TV / large screen breakpoint (≥ 1440px) ── */
@media (min-width: 1440px) {
  .game-layout {
    gap: 20px;
    padding: 20px;
  }

  .player-area {
    width: 280px;
    max-width: 280px;
    padding: 16px;
  }

  .player-header {
    font-size: 22px;
    padding: 12px 14px;
  }

  .heart {
    width: 38px;
    height: 38px;
  }

  .code-die {
    width: 52px;
    height: 52px;
  }

  .inventory-slot {
    height: 84px;
    min-height: 84px;
    min-width: 84px;
    width: 84px;
  }

  .bag-info {
    font-size: 14px;
    padding: 8px 12px;
  }

  .hex-grid-container {
    max-width: min(70vh, 820px);
    max-height: min(70vh, 820px);
  }

  .hex-tile {
    width: 60px;
    height: 69px;
  }

  .hud-bar {
    min-height: 80px;
    padding: 16px 28px;
  }

  .hud-section {
    min-width: 110px;
    gap: 6px;
  }

  .hud-label {
    font-size: 15px;
  }

  .hud-value {
    font-size: 30px;
  }

  .controls-area {
    padding: 20px 24px;
    gap: 20px;
    max-height: 25vh;
  }

  .action-header,
  .dice-header {
    font-size: 22px;
    margin-bottom: 14px;
  }

  .action-btn {
    font-size: 16px;
    padding: 14px 20px;
    min-width: 130px;
    min-height: 48px;
  }

  .dice-die {
    width: 60px;
    height: 60px;
    font-size: 28px;
  }

  .dice-btn {
    font-size: 17px;
    padding: 13px 22px;
  }

  .phase-text {
    font-size: 26px;
  }
}

/* ── 5. Even larger screens / 4K TV (≥ 1920px) ── */
@media (min-width: 1920px) {
  .player-area {
    width: 340px;
    max-width: 340px;
  }

  .hex-grid-container {
    max-width: min(72vh, 1050px);
    max-height: min(72vh, 1050px);
  }

  .hex-tile {
    width: 72px;
    height: 83px;
  }

  .hud-bar {
    min-height: 90px;
  }

  .hud-label {
    font-size: 17px;
  }

  .hud-value {
    font-size: 36px;
  }

  .action-btn {
    font-size: 18px;
    min-height: 52px;
    min-width: 150px;
  }
}

/* ── 6. Landscape small phones — fix tiny controls area ── */
@media (orientation: landscape) and (max-height: 420px) {
  .controls-area {
    max-height: 42vh;
    grid-template-columns: 1fr 1fr;
    overflow-y: auto;
  }

  .phase-indicator {
    grid-column: auto;
  }

  .hud-bar {
    min-height: 44px;
    padding: 6px 12px;
  }

  .hud-label {
    font-size: 9px;
  }

  .hud-value {
    font-size: 13px;
  }

  .hud-section {
    min-width: 55px;
    gap: 2px;
  }

  .player-area {
    width: 110px;
    max-width: 110px;
    padding: 6px;
    gap: 4px;
  }

  .player-header {
    font-size: 11px;
    padding: 3px 5px;
  }

  .heart {
    width: 18px;
    height: 18px;
  }

  .inventory-slot {
    height: 38px;
    min-height: 38px;
  }

  .action-btn {
    font-size: 11px;
    padding: 7px 9px;
    min-width: 80px;
    min-height: 34px;
  }

  .dice-die {
    width: 34px;
    height: 34px;
  }
}

/* ── 7. Portrait phones — ensure game screen doesn't overflow ── */
@media (max-width: 480px) and (orientation: portrait) {
  #game {
    height: 100dvh; /* dynamic viewport height accounts for browser chrome */
  }

  .game-container {
    height: 100dvh;
  }

  .player-area {
    max-height: 65px;
  }

  .controls-area {
    max-height: 38vh;
  }
}

/* ── 8. Newsroom modal responsive ── */
@media (max-width: 600px) {
  .newsroom-content {
    width: 95vw !important;
    max-width: 95vw !important;
    padding: 0;
  }

  .newsroom-content .leaderboard-header {
    padding: 14px 16px 10px;
  }

  .newsroom-content .leaderboard-header h2 {
    font-size: 20px;
  }
}

/* ── 9. Newsroom notify row — stack on tiny screens ── */
@media (max-width: 380px) {
  .newsroom-notify-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .newsroom-notify-status {
    text-align: left;
    min-width: auto;
  }
}

/* ── 10. Touch target minimum 44px for all interactive elements ── */
@media (pointer: coarse) {
  .close-btn {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .hud-settings-btn {
    min-width: 44px;
    min-height: 44px;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .bzc-btn {
    width: 48px;
    height: 48px;
  }

  .inventory-slot {
    min-width: 44px;
    min-height: 44px;
  }

  .menu-dropdown-item {
    padding: 18px 22px;
    min-height: 52px;
  }

  .settings-toggle {
    width: 54px;
    height: 30px;
  }

  .action-btn {
    min-height: 44px;
  }

  .dice-btn {
    min-height: 44px;
  }
}

/* ── 11. Tablet portrait (768px, no orientation override) ── */
@media (min-width: 601px) and (max-width: 1023px) and (orientation: portrait) {
  .game-layout {
    flex-direction: column;
    gap: 10px;
    padding: 10px;
  }

  .player-area {
    flex-direction: row;
    max-height: 80px;
    width: 100%;
    max-width: 100%;
  }

  .board-wrapper {
    order: 2;
    flex: 1;
  }
}

/* ── 12. Tablet landscape (768px+) — player areas visible and roomy ── */
@media (min-width: 768px) and (orientation: landscape) {
  .player-area {
    min-width: 160px;
  }
}

/* ── 13. Prevent modal overflow on very short screens ── */
@media (max-height: 600px) {
  .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .leaderboard-content {
    max-height: 90vh;
  }

  .how-to-play-content {
    max-height: 88vh;
  }
}


/* ============================================================
   GAME ELEMENTS RESPONSIVE AUDIT — v2
   Covers: inventory, combat dice, all game modals, perk selector,
   message modals, transfer heart, omega device, spectator view,
   game over/tie screens, close buttons, touch targets
   ============================================================ */

/* ──────────────────────────────────────────────────────────
   INVENTORY SLOTS — ensure they never disappear on small screens
   ────────────────────────────────────────────────────────── */

/* Player bar scrollability hint — show shadow when content overflows */
.player-area {
  scrollbar-width: none; /* Hide scrollbar on Firefox */
}
.player-area::-webkit-scrollbar {
  display: none; /* Hide scrollbar on WebKit */
}

/* Portrait: player bar must accommodate 40px slots comfortably */
@media (max-width: 767px) and (orientation: portrait) {
  .player-area {
    max-height: 75px;
    padding: 6px 8px;
  }
  .inventory-slot {
    min-width: 44px;
    width: 44px;
    height: 44px;
    min-height: 44px;
  }
  .heart {
    width: 20px;
    height: 20px;
  }
  /* Give inventory area more room */
  .inventory-area {
    flex: 1;
    min-width: 0;
    overflow: visible;
  }
}

/* Tiny portrait phones — pack even tighter */
@media (max-width: 360px) and (orientation: portrait) {
  .player-area {
    gap: 4px;
    padding: 4px 6px;
  }
  .inventory-slot {
    min-width: 38px;
    width: 38px;
    height: 38px;
    min-height: 38px;
  }
  .player-header {
    font-size: 11px;
    min-width: 44px;
    padding: 3px 4px;
  }
  .code-die {
    width: 22px;
    height: 22px;
  }
  .bag-info {
    font-size: 8px;
    padding: 2px 4px;
  }
}

/* ──────────────────────────────────────────────────────────
   COMBAT DICE — override the JS inline 60px with CSS class
   .dice-die is already the class; JS also sets inline width/height
   We use !important to override those inline styles on small screens
   ────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .dice-die {
    width: 44px !important;
    height: 44px !important;
  }
}
@media (max-width: 380px) {
  .dice-die {
    width: 38px !important;
    height: 38px !important;
  }
}
/* Landscape small phones — dice compete with controls */
@media (orientation: landscape) and (max-height: 420px) {
  .dice-die {
    width: 36px !important;
    height: 36px !important;
  }
}
/* TV / large — bigger dice */
@media (min-width: 1440px) {
  .dice-die {
    width: 60px !important;
    height: 60px !important;
  }
}

/* ──────────────────────────────────────────────────────────
   CONTROLS AREA — small screens: constrain height and enable scroll within cards
   ────────────────────────────────────────────────────────── */
@media (max-height: 700px) {
  .controls-area {
    max-height: 38vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .actions-panel,
  .dice-panel {
    max-height: 34vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .action-buttons {
    overflow-y: auto;
    max-height: 26vh;
  }
}

/* ──────────────────────────────────────────────────────────
   CONTROLS AREA — fix 35vh being too short on landscape phones
   ────────────────────────────────────────────────────────── */

@media (orientation: landscape) and (max-height: 500px) {
  .controls-area {
    max-height: 45vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    grid-template-columns: 1fr 1fr;
  }
  .phase-indicator {
    grid-column: span 2;
    padding: 8px;
  }
  .phase-text {
    font-size: 14px;
  }
  .action-header,
  .dice-header {
    font-size: 14px;
    margin-bottom: 6px;
  }
  .dice-display {
    margin-bottom: 8px;
  }
}

/* ──────────────────────────────────────────────────────────
   ALL GAME MODAL CLOSE BUTTONS — minimum 44×44px touch target
   .th-close, .wc-close, .od-close are all 30×30px in JS inline styles
   ────────────────────────────────────────────────────────── */

.th-close, .wc-close, .od-close {
  min-width: 44px !important;
  min-height: 44px !important;
  width: 44px !important;
  height: 44px !important;
  font-size: 18px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

/* ──────────────────────────────────────────────────────────
   PERK DETAIL MODAL (inventoryUI.js) — responsive rewrite
   The container has hardcoded padding:40px and 120px image
   ────────────────────────────────────────────────────────── */

/* Target the dynamically created perk modal content */
#perkModalStyle ~ div [style*="padding: 40px"],
.perk-modal-content {
  padding: clamp(16px, 5vw, 40px) !important;
  max-height: 90vh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  box-sizing: border-box !important;
  width: min(92vw, 450px) !important;
}

/* Override hardcoded 120px perk image on small screens */
@media (max-width: 480px) {
  /* Target the perk image container div via its known inline style signature */
  [style*="width: 120px"][style*="height: 120px"][style*="background-image"] {
    width: 80px !important;
    height: 80px !important;
    margin-bottom: 12px !important;
  }
  /* Shrink the h2 in the perk modal */
  [style*="font-family: 'Bubblegum'"][style*="font-size: 28px"] {
    font-size: 22px !important;
  }
}
@media (max-height: 600px) {
  [style*="width: 120px"][style*="height: 120px"][style*="background-image"] {
    width: 64px !important;
    height: 64px !important;
    margin-bottom: 8px !important;
  }
}

/* ──────────────────────────────────────────────────────────
   CHAT / MESSAGE MODAL — responsive tweaks
   .chatModal and .incomingChatModal are built entirely inline
   ────────────────────────────────────────────────────────── */

/* When keyboard is open on mobile, modals should scroll */
#chatModal, #incomingChatModal {
  align-items: flex-start !important;
  padding-top: max(40px, env(safe-area-inset-top)) !important;
  overflow-y: auto !important;
}

@media (max-width: 480px) {
  /* Make chat inner panel full readable width */
  #chatModal > div,
  #incomingChatModal > div {
    padding: 20px 16px !important;
  }
  /* Slightly smaller title on tiny phones */
  #chatModal [style*="font-size:22px"],
  #incomingChatModal [style*="font-size:18px"] {
    font-size: 18px !important;
  }
  /* Make incoming message text readable but not huge */
  #incomingChatModal [style*="font-size:20px"] {
    font-size: 16px !important;
  }
}

/* ──────────────────────────────────────────────────────────
   TRANSFER HEART MODAL (.th-panel)
   ────────────────────────────────────────────────────────── */

/* Main panel should scroll on short screens */
.th-panel {
  max-height: 90vh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  /* Already has width:90vw; max-width:420px — good */
}

/* Option buttons — already 14px padding, but ensure 44px min height */
.th-option-btn {
  min-height: 44px !important;
}

/* Cancel button — bring up to comfortable touch target */
.th-cancel {
  min-height: 44px !important;
  padding: 12px !important;
}

@media (max-width: 380px) {
  .th-title {
    font-size: 18px !important;
  }
  .th-hearts .th-hp {
    font-size: 18px !important;
  }
  .th-option-btn {
    font-size: 13px !important;
    padding: 11px 12px !important;
  }
}

/* ──────────────────────────────────────────────────────────
   WILDCARD PERK SELECTOR (.wc-panel) & OMEGA DEVICE (.od-panel)
   ────────────────────────────────────────────────────────── */

/* Perk cards — 130px fixed is too wide on tiny phones, allow wrap */
.wc-cards, .od-cards {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  justify-content: flex-start !important;
}

/* Card description text — 10px is too small everywhere */
.wc-card-desc, .od-card-desc {
  font-size: 11px !important;
  line-height: 1.35 !important;
}

/* Card image — already 40px, fine but ensure it doesn't collapse */
.wc-card-img, .od-card-img {
  width: 40px !important;
  height: 40px !important;
  flex-shrink: 0 !important;
}

@media (max-width: 380px) {
  /* On tiny phones cards go to 2-per-row minimum */
  .wc-card, .od-card {
    width: calc(50% - 4px) !important;
    min-width: 0 !important;
    padding: 8px 6px !important;
  }
  .wc-card-img, .od-card-img {
    width: 32px !important;
    height: 32px !important;
  }
  .wc-card-name, .od-card-name {
    font-size: 11px !important;
  }
}

/* Confirm buttons — ensure touch target */
.wc-confirm, .od-confirm {
  min-height: 48px !important;
  margin: 8px 12px 12px !important;
}

/* Panel scroll area — smooth iOS scrolling */
.wc-scroll, .od-scroll {
  -webkit-overflow-scrolling: touch !important;
}

/* Ensure panels don't overflow on very short landscape screens */
@media (max-height: 500px) {
  .wc-panel, .od-panel {
    max-height: 92vh !important;
  }
  .wc-panel .wc-header,
  .od-panel .od-header {
    padding: 10px 14px 8px !important;
  }
}

/* ──────────────────────────────────────────────────────────
   COMBAT RESULT MODAL (.cr-card)
   ────────────────────────────────────────────────────────── */

.cr-card {
  max-height: 88vh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  box-sizing: border-box !important;
}

@media (max-width: 380px) {
  .cr-card {
    padding: 16px 14px !important;
  }
  .cr-title {
    font-size: 18px !important;
    margin-bottom: 12px !important;
  }
  .cr-section {
    font-size: 13px !important;
    padding: 8px 10px !important;
  }
  .cr-ok-btn {
    padding: 11px !important;
    font-size: 16px !important;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .cr-card {
    padding: 14px 16px !important;
    max-height: 92vh !important;
  }
  .cr-title {
    font-size: 16px !important;
    margin-bottom: 8px !important;
  }
  .cr-ok-btn {
    margin-top: 10px !important;
    padding: 10px !important;
  }
}

/* ──────────────────────────────────────────────────────────
   GAME OVER / TIE SCREENS
   The inline font-sizes (80px emoji, 48px title, 22px body)
   are too large on tiny or landscape phones
   ────────────────────────────────────────────────────────── */

#gameOverOverlay > div,
#tieOverlay > div {
  padding: clamp(16px, 5vw, 30px) !important;
  max-height: 100vh !important;
  overflow-y: auto !important;
}

/* Scale down oversized text on small screens */
@media (max-width: 400px) {
  #gameOverOverlay [style*="font-size:80px"],
  #tieOverlay [style*="font-size:80px"] {
    font-size: 52px !important;
    margin-bottom: 10px !important;
  }
  #gameOverOverlay [style*="font-size:48px"],
  #tieOverlay [style*="font-size:48px"] {
    font-size: 32px !important;
    margin-bottom: 8px !important;
  }
  #gameOverOverlay [style*="font-size:22px"],
  #tieOverlay [style*="font-size:22px"],
  #tieOverlay [style*="font-size:18px"] {
    font-size: 15px !important;
    margin-bottom: 20px !important;
  }
  #gameOverOverlay button,
  #tieOverlay button {
    padding: 13px 28px !important;
    font-size: 17px !important;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  #gameOverOverlay [style*="font-size:80px"],
  #tieOverlay [style*="font-size:80px"] {
    font-size: 40px !important;
    margin-bottom: 6px !important;
  }
  #gameOverOverlay [style*="font-size:48px"],
  #tieOverlay [style*="font-size:48px"] {
    font-size: 28px !important;
    margin-bottom: 6px !important;
  }
  #gameOverOverlay [style*="font-size:22px"],
  #tieOverlay [style*="font-size:18px"],
  #tieOverlay [style*="font-size:22px"] {
    font-size: 13px !important;
    margin-bottom: 14px !important;
  }
  #gameOverOverlay button,
  #tieOverlay button {
    padding: 10px 24px !important;
    font-size: 15px !important;
  }
}

/* ──────────────────────────────────────────────────────────
   SPECTATOR VIEW — dice images hardcoded at 52px / 64px inline
   ────────────────────────────────────────────────────────── */

/* Spectator dice inside controls area — ensure they're not oversized */
@media (max-width: 480px) {
  /* Combat dice images in spectator view */
  .dice-panel img[style*="width:52px"],
  .dice-panel img[style*="width:64px"],
  .actions-panel img[style*="width:52px"],
  .actions-panel img[style*="width:64px"] {
    width: 40px !important;
    height: 40px !important;
  }
  /* Movement roll dice image */
  .dice-panel img[style*="width:64px;height:64px"] {
    width: 44px !important;
    height: 44px !important;
  }
}
@media (max-width: 380px) {
  .dice-panel img[style*="width"],
  .actions-panel img[style*="width"] {
    max-width: 36px !important;
    max-height: 36px !important;
  }
}

/* ──────────────────────────────────────────────────────────
   PERK SLOT (inventoryUI.js legacy renderer, 50×50 hardcoded)
   These appear if inventoryUI.js is ever invoked
   ────────────────────────────────────────────────────────── */

.perk-slot {
  width: clamp(36px, 10vw, 60px) !important;
  height: clamp(36px, 10vw, 60px) !important;
  min-width: 36px !important;
  min-height: 36px !important;
  box-sizing: border-box !important;
}

/* ──────────────────────────────────────────────────────────
   SOLO MODE INDICATOR (dynamically added to HUD)
   ────────────────────────────────────────────────────────── */

#soloModeIndicator {
  font-size: clamp(10px, 2vw, 13px) !important;
  padding: clamp(3px, 0.5vh, 4px) clamp(8px, 2vw, 12px) !important;
  white-space: nowrap !important;
  flex-shrink: 1 !important;
  min-width: 0 !important;
}

/* ──────────────────────────────────────────────────────────
   MOVEMENT ROLL DISPLAY (100px × 100px hardcoded in renderMoveRoll)
   ────────────────────────────────────────────────────────── */

#movementDieImg {
  width: clamp(60px, 15vmin, 100px) !important;
  height: clamp(60px, 15vmin, 100px) !important;
}

/* ──────────────────────────────────────────────────────────
   DICE LOCK INDICATOR (rendered inline in combat dice)
   Make sure the lock label text scales on tiny screens
   ────────────────────────────────────────────────────────── */

@media (max-width: 380px) {
  /* Lock label text under each die */
  .dice-display [style*="font-size: 12px"],
  .dice-panel [style*="fontSize: '12px'"] {
    font-size: 10px !important;
  }
}

/* ──────────────────────────────────────────────────────────
   GENERAL GAME MODAL OVERLAY — prevent all modals from
   going off screen when virtual keyboard is open
   ────────────────────────────────────────────────────────── */

[id$="Modal"][style*="position:fixed"],
[id$="Overlay"][style*="position: fixed"],
.wc-overlay,
.od-overlay {
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ──────────────────────────────────────────────────────────
   PHASE INDICATOR — ensure it spans correctly on all grid sizes
   ────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .controls-area {
    /* Force 1-column on narrow portrait phones */
    grid-template-columns: 1fr 1fr !important;
  }
  .phase-indicator {
    grid-column: 1 / -1 !important;
    padding: 8px 12px !important;
  }
  .phase-text {
    font-size: 14px !important;
  }
}

/* ──────────────────────────────────────────────────────────
   DICE DISPLAY CONTAINER — ensure it wraps properly
   at all sizes so dice never clip outside the panel
   ────────────────────────────────────────────────────────── */

.dice-display {
  flex-wrap: wrap !important;
  gap: 8px !important;
  align-items: center !important;
  justify-content: center !important;
}

/* ──────────────────────────────────────────────────────────
   GAME MODAL BOX (.game-modal-box) — responsive padding
   ────────────────────────────────────────────────────────── */

@media (max-width: 400px) {
  .game-modal-box {
    padding: 20px 16px 18px !important;
    border-radius: 18px !important;
  }
  .game-modal-message {
    font-size: 15px !important;
    margin-bottom: 18px !important;
  }
  .game-modal-btn {
    font-size: 16px !important;
    padding: 10px 22px !important;
  }
}

/* ──────────────────────────────────────────────────────────
   ACHIEVEMENT POPUP (.tutorial-achievement-card)
   Slides in from right — ensure it fits on small screens
   ────────────────────────────────────────────────────────── */

.tutorial-achievement-popup {
  right: 8px !important;
  top: max(70px, env(safe-area-inset-top) + 60px) !important;
  max-width: calc(100vw - 16px) !important;
}

.tutorial-achievement-card {
  min-width: min(280px, calc(100vw - 16px)) !important;
  padding: 16px 18px !important;
}

@media (max-width: 380px) {
  .tutorial-achievement-card {
    padding: 12px 14px !important;
  }
  .tutorial-achievement-icon {
    font-size: 36px !important;
    margin-bottom: 6px !important;
  }
  .tutorial-achievement-title {
    font-size: 16px !important;
  }
  .tutorial-achievement-text {
    font-size: 13px !important;
  }
}


/* ── Class Selection Modal ───────────────────────────────────────────────── */
.class-modal {
  max-width: 640px;
  width: 95vw;
  padding: 28px 24px;
}

.class-modal-subtitle {
  color: #7f8c8d;
  font-size: 14px;
  text-align: center;
  margin-bottom: 20px;
  font-family: 'Bubblegum', sans-serif;
}

.class-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.class-card {
  border: 3px solid #dfe6e9;
  border-radius: 16px;
  padding: 16px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fafafa;
  text-align: left;
}

.class-card:hover {
  border-color: #8e44ad;
  background: #f8f0ff;
  transform: translateY(-1px);
}

.class-card.selected {
  border-color: #8e44ad;
  background: linear-gradient(135deg, #f3e9ff, #e8d5ff);
  box-shadow: 0 4px 16px rgba(142, 68, 173, 0.25);
}

.class-card[data-class="attacker"].selected {
  border-color: #e74c3c;
  background: linear-gradient(135deg, #fff0ef, #ffd5d2);
  box-shadow: 0 4px 16px rgba(231, 76, 60, 0.25);
}

.class-card[data-class="defender"].selected {
  border-color: #2980b9;
  background: linear-gradient(135deg, #eaf4ff, #d0eaff);
  box-shadow: 0 4px 16px rgba(41, 128, 185, 0.25);
}

.class-card[data-class="support"].selected {
  border-color: #27ae60;
  background: linear-gradient(135deg, #eafff3, #d0ffe5);
  box-shadow: 0 4px 16px rgba(39, 174, 96, 0.25);
}

.class-icon {
  font-size: 28px;
  margin-bottom: 4px;
}

.class-name {
  font-family: 'Bubblegum', sans-serif;
  font-size: 20px;
  font-weight: bold;
  color: #2d3436;
  margin-bottom: 4px;
}

.class-desc {
  font-family: 'Bubblegum', sans-serif;
  font-size: 13px;
  color: #636e72;
  margin-bottom: 8px;
  line-height: 1.4;
}

.class-perks-preview {
  font-family: 'Bubblegum', sans-serif;
  font-size: 11px;
  color: #8e44ad;
  background: rgba(142, 68, 173, 0.08);
  border-radius: 8px;
  padding: 4px 10px;
  display: inline-block;
}

.class-card[data-class="attacker"] .class-perks-preview {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.08);
}

.class-card[data-class="defender"] .class-perks-preview {
  color: #2980b9;
  background: rgba(41, 128, 185, 0.08);
}

.class-card[data-class="support"] .class-perks-preview {
  color: #27ae60;
  background: rgba(39, 174, 96, 0.08);
}

.class-modal-info {
  font-family: 'Bubblegum', sans-serif;
  font-size: 12px;
  color: #7f8c8d;
  background: #f8f9fa;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  text-align: center;
}

@media (max-width: 480px) {
  .class-modal { padding: 18px 14px; }
  .class-name { font-size: 17px; }
  .class-desc { font-size: 12px; }
}

/* ==================== LEADERBOARD TABS & FILTERS ==================== */

.lb-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.lb-tab {
  flex: 1;
  padding: 10px 6px;
  font-family: 'Bubblegum', sans-serif;
  font-size: 15px;
  background: rgba(255,255,255,0.06);
  color: #95a5a6;
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  min-height: 44px;
}

.lb-tab.active {
  background: rgba(230,126,34,0.18);
  border-color: #e67e22;
  color: #e67e22;
}

.lb-tab:hover:not(.active) {
  background: rgba(255,255,255,0.1);
  color: #ecf0f1;
}

.lb-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.lb-boss-filter {
  padding: 8px 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  color: #ecf0f1;
  font-family: 'Lovely Rose', Arial, sans-serif;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  min-height: 40px;
}

.lb-boss-filter:focus {
  border-color: #e67e22;
}

.lb-boss-filter option {
  background: #1a2634;
}

.lb-season-info {
  flex: 1;
  font-size: 13px;
  color: #95a5a6;
  line-height: 1.4;
}

.lb-season-info strong {
  color: #e67e22;
}

.score-token-badge {
  font-size: 11px;
  color: #f39c12;
  font-family: 'Bubblegum', sans-serif;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   TILE TOOLTIP (double-tap or double-click to inspect)
   ═══════════════════════════════════════════════════════════ */

.tile-tooltip {
  position: fixed;
  z-index: 9500;
  background: linear-gradient(160deg, #1a2634, #2c3e50);
  border: 2px solid #1abc9c;
  border-radius: 14px;
  padding: 12px 16px;
  min-width: 180px;
  max-width: 240px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.6);
  pointer-events: none;
  animation: tooltipPop 0.18s ease;
}
@keyframes tooltipPop {
  from { opacity: 0; transform: scale(0.88) translateY(6px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}
.tile-tooltip-name {
  font-family: 'Bubblegum', sans-serif;
  font-size: 16px;
  color: #1abc9c;
  margin-bottom: 6px;
}
.tile-tooltip-desc {
  font-size: 13px;
  color: #bdc3c7;
  line-height: 1.5;
}
.tile-tooltip-hint {
  font-size: 10px;
  color: #636e72;
  margin-top: 6px;
  font-style: italic;
}
/* Hint text is set dynamically in JS: "Tap anywhere to dismiss" */

/* ── In-Game HUD Action Buttons (Quit / Restart) ─────────────────────────── */
.hud-game-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.hud-action-btn {
  font-family: 'Bubblegum', sans-serif;
  font-size: 12px;
  padding: 5px 10px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: transform 0.1s, opacity 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  line-height: 1.2;
}

.hud-action-btn:active {
  transform: scale(0.95);
}

.hud-restart-btn {
  background: linear-gradient(135deg, #1abc9c, #16a085);
  color: #fff;
  box-shadow: 0 2px 8px rgba(26,188,156,0.35);
}

.hud-restart-btn:hover {
  box-shadow: 0 3px 12px rgba(26,188,156,0.55);
  opacity: 0.92;
}

.hud-quit-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  box-shadow: 0 2px 8px rgba(231,76,60,0.35);
}

.hud-quit-btn:hover {
  box-shadow: 0 3px 12px rgba(231,76,60,0.55);
  opacity: 0.92;
}

/* Keep buttons readable at small screen sizes */
@media (max-width: 480px) {
  .hud-action-btn {
    font-size: 10px;
    padding: 4px 7px;
  }
}
