/* =========================
   Base / reset-ish
========================= */
:root {
  --card-h: 120px;
  --card-w: 90px;
  --card-radius: 8px;
  --hand-overlap: 30px;
  --meld-gap: 26px;
  --meld-inner-gap: 12px;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 6px 12px rgba(0, 0, 0, 0.4);
}



* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  background: linear-gradient(135deg, #7b5cff, #5a7cff);
}

body {
  font-family: system-ui, sans-serif;
  width: 100vw;
  padding: 0;
  min-height: 100dvh;
  overflow: hidden;
}

h1,
h2,
h3,
p,
div {
  margin: 0;
}

/******** GLOBAL STYLES ********/
.screen {
   display: flex;
  padding: 10px;
  color: white;
  width: 100%;
  height: 100dvh;
  overflow: visible;
}

.hidden {
  display: none !important;
}

.title {
  text-align: center;
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: 700;
}

/* Button Styles */

/* =========================
   Shared action button base
========================= */

.primary-btn {
  width: 100%;
  max-width: 520px;
  max-height: 50px;
  padding: 12px 28px;
  font-weight: 700;
  background: linear-gradient(180deg, #7cff3a, #4cd137);
  color: #1b3a0f;
  border-radius: 999px;
  box-shadow: 0 6px 0 #2f8f1f, 0 12px 20px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  font-size: 18px;
  transition: transform 0.3s, box-shadow 0.3s;
  border: none;
  margin-bottom: 10px;
  margin-top: 10px;
}

.primary-btn:active {
  box-shadow: 0 3px 0 #2f8f1f, 0 10px 16px rgba(0, 0, 0, 0.3);
}

/* Secondary action (JOIN) */
.secondary-btn {
  background: linear-gradient(180deg, #7c55ff, #5b39d9);
  color: white;

  padding: 14px 32px;
  font-size: 18px;

  box-shadow: 0 6px 0 rgba(60, 40, 140, 0.8), 0 14px 22px rgba(0, 0, 0, 0.35);
}

.secondary-btn:active {
  box-shadow: 0 3px 0 rgba(60, 40, 140, 0.8), 0 10px 16px rgba(0, 0, 0, 0.3);
}


/* =========================
   GIN button (floating action)
========================= */

.gin-btn{
  margin-left: 10px;
  flex: 0 0 auto;

  padding: 10px 14px;
  border-radius: 999px;
  border: none;
  font-weight: 1000;
  font-size: 16px;
  cursor: pointer;

  background: linear-gradient(180deg, #7cff3a, #4cd137);
  color: #1b3a0f;
  box-shadow: 0 6px 0 #2f8f1f, 0 12px 20px rgba(0,0,0,0.25);
}

.gin-btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 #2f8f1f, 0 10px 16px rgba(0, 0, 0, 0.3);
}

.gin-btn.disabled{
  opacity: 0.5;
  pointer-events: none;
}

.gin-btn.is-hidden{
  display: none !important;
}

/* Optional: attention pulse when available */
.gin-btn.pulse {
  animation: ginPulse 0.9s ease-in-out infinite;
}

@keyframes ginPulse {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-1px) scale(1.04); }
  100% { transform: translateY(0) scale(1); }
}

/* =========================
   Points selection buttons
========================= */

.points-selection {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.points-btn {
  min-width: 72px;
  padding: 14px 0;
  border-radius: 14px;
  border: none;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  color: white;

  background: linear-gradient(180deg, #7c55ff, #5b39d9);
  box-shadow: 0 6px 0 rgba(60, 40, 140, 0.8), 0 14px 22px rgba(0, 0, 0, 0.35);

  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.points-btn:hover {
  filter: brightness(1.1);
}

.points-btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(60, 40, 140, 0.8), 0 10px 16px rgba(0, 0, 0, 0.3);
}

/* selected state */
.points-btn.active {
  background: linear-gradient(180deg, #7cff3a, #4cd137);
  color: #1b3a0f;
  box-shadow: 0 6px 0 #2f8f1f, 0 14px 22px rgba(0, 0, 0, 0.35);
}


/* Have a Code Button */
.small-btn {
  padding: 12px 14px;
  border-radius: 12px;
  border: none;
  background: rgba(0, 0, 0, 0.35);
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.3s ease;
}

.small-btn:hover {
  background: rgba(0, 0, 0, 0.45);
}

button.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Copy Button */
#screen-host .copy-btn {
  padding: 8px 16px;
  background: linear-gradient(180deg, #caa6ff, #9a7cff);
  border-radius: 8px;
  border: none;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.3s ease;
}

#screen-host .copy-btn:hover {
  background: linear-gradient(180deg, #8b63e3, #7f49a1);
}

/* Compact action button sizing (used by START / CREATE if desired) */



.start-game-btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 #2f8f1f, 0 8px 12px rgba(0, 0, 0, 0.25);
}

.start-game-btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* =========================
   SCREEN HOST STYLES
========================= */

/* Main screen styling */


#screen-host, #screen-create, #screen-join {
  width: 100%;
}

/* applies to create/join/host cards */
.room-code-container,
.lobby-stack,
.join-card {
  width: 100%;
  max-width: 520px;
  margin: auto;              /* center inside .screen */
  max-height: 100%;          /* never exceed screen */
  overflow: hidden;          /* ✅ no scroll */
  padding: 24px;
  gap: 16px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, 0.45);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}


/* =========================
   Room code inline layout
========================= */

.room-code-row{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap; /* allows graceful wrap on very small screens */
  justify-content: center;
  width: 100%;
  margin-bottom: 10px;
}

.room-code-text{
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

/* Make sure the pill stays nice */
.code-box{
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px 14px;
  border-radius: 14px;

  background: rgba(0,0,0,0.35);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.12),
    0 8px 18px rgba(0,0,0,0.3);
}

/* Code text styling (if not already defined) */
.room-code{
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 3px;
}



/* Player count text */
.player-count-text {
  font-size: 16px;
  color: white;
  font-weight: 600;
  text-align: center;
  margin-bottom: 15px;
}

/* Waiting status text */
.waiting-status {
  font-size: 18px;
  color: white;
  text-align: center;
  opacity: 0.85;
  margin-top: 0;
  margin-bottom: 10px;
}

/* =========================
   Toasts
========================= */
.toast-stack {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 99999;
  pointer-events: none;
}

.toast {
  pointer-events: none;
  min-width: min(520px, 92vw);
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/******** CREATE GAME SCREEN ********/

.screen--pattern {
  position: relative;
  overflow: hidden;
}

.screen--pattern::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill='%23000000' fill-opacity='0.55'%3E%3Cpath d='M80 22c10 0 18 8 18 18 0 12-12 22-18 26-6-4-18-14-18-26 0-10 8-18 18-18z'/%3E%3Cpath d='M56 88c0-12 10-22 24-22s24 10 24 22c0 18-24 34-24 34S56 106 56 88z'/%3E%3Cpath d='M76 120h8l-4 18z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 170px 170px;
  background-repeat: repeat;
  transform: rotate(-12deg) scale(1.08);
  pointer-events: none;
}


.lobby-title {
  font-weight: 700;
  margin-bottom: 15px;
  font-size: 22px;
  text-align: center;
}

.segmented {
  width: 100%;
  max-width: 520px;
  min-height: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
    margin-bottom: 10px;
}

.seg-btn {
  padding: 16px 0;
  border: 0;
  background: transparent;
  color: white;
  font-weight: 700;
  font-size: 20px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  min-height: 100%;
}

.seg-btn.active {
  background: linear-gradient(180deg, #7c55ff, #5b39d9);
}

.pill {
  width: 100%;
  max-width: 520px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

/* Pill that contains the points buttons */
.points-pill{
  gap: 10px;
}

.pill-points{
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex: 1;                /* takes the middle space */
  min-width: 0;
}

/* when inside the pill, keep buttons compact */
.points-pill .points-btn{
  min-width: 64px;
  padding: 12px 0;
  border-radius: 12px;
  font-size: 16px;
  margin: 0;
}

/* optional: stop the pill text from wrapping weird */
.points-pill .pill-text{
  white-space: nowrap;
}


/* Join screen */
.code-input {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 18px;
  text-align: center;
  letter-spacing: 4px;
}

.enter-code-box {
  display: flex;
  align-items: center;
  gap: 10px;

}

#screen-join .join-title {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
}

#screen-join .join-label {
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  opacity: 0.9;
}

#screen-join #joinCodeInput {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: none;
  outline: none;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 6px;

  background: rgba(0, 0, 0, 0.25);
  color: white;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

#screen-join #joinCodeInput::placeholder {
  color: rgba(255, 255, 255, 0.55);
}


/* =========================
   GAME SCREEN (clean layout)
========================= */
#screen-game {
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  position: relative;
}


#screen-game::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  height:80px;
  pointer-events:none;
  background: linear-gradient(to top, rgba(0,0,0,0.25), transparent);
}

#screen-game .game-shell{
  height: 100%;
  width: 100%;
  min-height: 0; /* allows children to shrink instead of overflow */
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom)); /* lifts hand above gesture bar */
}



#screen-game .hud{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 12px 14px;
  border-radius: 16px;

  background: rgba(0,0,0,0.30);
  box-shadow: 0 10px 24px rgba(0,0,0,0.30),
    inset 0 0 0 1px rgba(255,255,255,0.12);
}


#player-title{
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
}

#scoreboard{
  margin-right: 10px;
  font-size: 16px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 76vw;
}

.hud-close{
  width: 45px;
  height: 45px;
  border-radius: 999px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: white;
  font-size: 25px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}

#turn-status{
  font-weight: 800;
  opacity: 0.95;
  font-size: 16px;
}



#screen-game .table{
  border-radius: 18px;

  background: rgba(0,0,0,0.20);
  box-shadow: 0 20px 40px rgba(0,0,0,0.35),
    inset 0 0 0 1px rgba(255,255,255,0.10);
  padding: 14px;
   min-height: 0;      /* important for flex children */
  flex: 1; 
  display: flex;
  justify-content: space-evenly;
  align-items: center;
}

.table-inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    gap: 40px;
    height: 100%;
    min-height: 0;
}

.center-pile {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 30px;
}



#screen-game #hand{
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  touch-action: none;
  overflow: visible;
}

#hand .card {
    position: relative;
    margin-right: calc(-1 * var(--hand-overlap));
  transform-origin: 50% 100%;

  --curve: 0deg;
  --lift: 0px;

  transform: translateY(var(--lift)) rotate(var(--curve));
    
  transition: transform 160ms ease;
  user-select: none;
   -webkit-user-select: none; 
}

/* ===== MELD VISUALS ===== */

/* Glow / highlight on cards that are part of a meld */
#hand .card.meld-glow {
  outline: none;
  box-shadow:
   inset 0 0 0 3px rgba(120, 255, 120, 0.95),
    inset 0 0 18px rgba(120, 255, 120, 0.25);
}

#hand .card.meld-glow-1 {
  outline: 3px solid rgba(120,255,120,0.95);
  box-shadow: 0 0 0.6rem rgba(120,255,120,0.55), 0 0 1.2rem rgba(120,255,120,0.35);
}

#hand .card.meld-glow-2 {
  outline: 3px solid rgba(255,210,90,0.95);
  box-shadow: 0 0 0.6rem rgba(255,210,90,0.55), 0 0 1.2rem rgba(255,210,90,0.35);
}

#hand .card.meld-glow-3 {
  outline: 3px solid rgba(90,220,255,0.95);
  box-shadow: 0 0 0.6rem rgba(90,220,255,0.55), 0 0 1.2rem rgba(90,220,255,0.35);
}

#hand .card.meld-glow-4 {
  outline: 3px solid rgba(255,120,220,0.95);
  box-shadow: 0 0 0.6rem rgba(255,120,220,0.55), 0 0 1.2rem rgba(255,120,220,0.35);
}



/* ===== Ideal curve: 10–11 cards ===== */

#hand.size-10 .card:nth-child(1),
#hand.size-11 .card:nth-child(1) { --curve: -7deg; --lift: -5px; }

#hand.size-10 .card:nth-child(2),
#hand.size-11 .card:nth-child(2) { --curve: -5deg; --lift: -13px; }

#hand.size-10 .card:nth-child(3),
#hand.size-11 .card:nth-child(3) { --curve: -3deg; --lift: -19px; }

#hand.size-10 .card:nth-child(4),
#hand.size-11 .card:nth-child(4) { --curve: -2deg; --lift: -23px; }

#hand.size-10 .card:nth-child(5),
#hand.size-11 .card:nth-child(5) { --curve: -1deg; --lift: -26px; }

#hand.size-10 .card:nth-child(6),
#hand.size-11 .card:nth-child(6) { --curve: 1deg; --lift: -26px; }

#hand.size-10 .card:nth-child(7),
#hand.size-11 .card:nth-child(7) { --curve: 2deg; --lift: -23px; }

#hand.size-10 .card:nth-child(8),
#hand.size-11 .card:nth-child(8) { --curve: 3deg; --lift: -19px; }

#hand.size-10 .card:nth-child(9),
#hand.size-11 .card:nth-child(9) { --curve: 5deg; --lift: -13px; }

#hand.size-10 .card:nth-child(10),
#hand.size-11 .card:nth-child(10) { --curve: 7deg; --lift: -5px; }

#hand.size-11 .card:nth-child(11) { --curve: 8deg; --lift: 1px; }

.card:hover {
  transform:
    translateY(calc(var(--lift) - 10px))
    rotate(var(--curve));
}
.card.selected {
  transform:
    translateY(calc(var(--lift) - 18px))
    rotate(var(--curve));
}

/* while dragging, we hide the real card (it becomes a ghost) */
#hand .card.dragging{
  opacity: 0.15;
}

/* placeholder keeps spacing in the hand */
#hand .drag-placeholder{
  width: var(--card-w);            
  height: var(--card-h);           
  border-radius: 14px;
   margin-right: calc(-1 * var(--hand-overlap));       
  background: rgba(255,255,255,0.08);
  border: 2px dashed rgba(255,255,255,0.28);
    transform: translateY(-6px);
  box-shadow: none;
}

/* ghost follows your finger */
.drag-ghost{
  position: fixed;
  left: 0;
  top: 0;
  z-index: 99999;
  pointer-events: none;
  margin: 0 !important;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 18px 28px rgba(0,0,0,0.45));
  user-select: none; -webkit-user-select: none;
}


/* ========================
CARDS#
==========================*/

.card {
 position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border: 1px solid #333;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.39);
  border-radius: 8px;
   background: linear-gradient(#fff, #f4f4f4);
  color: black;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}


.card.red{
  color: #c62828;
}

.card.black{
  color: #111;
}

.card .corner {
  position: absolute;
  font-weight: 700;
  font-size: 18px;
}

.card .top-left {
  top: 4px;
  left: 4px;
}
.card .bottom-right {
  bottom: 4px;
  right: 4px;
  transform: rotate(180deg);
}

.card .center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 30px;
}

.card .corner,
.card .center{
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}


/* =========================
   Card back (deck)
========================= */

.card.back{
  background: linear-gradient(135deg, #6a4bff, #4b2fd6);
  border: 1px solid rgba(0,0,0,0.6);
  border-radius: 8px;
  box-shadow:
    0 8px 20px rgba(0,0,0,0.45),
    inset 0 0 0 2px rgba(255,255,255,0.18);

  position: relative;
  overflow: hidden;
}

/* Subtle pattern */
.card.back::before{
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(255,255,255,0.18) 1px, transparent 1px);
  background-size: 8px 8px;
  opacity: 0.25;
}

/* Inner border for depth */
.card.back::after{
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}

#deck, #discard, .discard-slot, .card.back {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* =========================
   Discard pile
========================= */
#deck, #discard, .discard-slot {
  touch-action: manipulation; /* tells the browser: treat taps as taps, not zoom */
}

#discard{
  position: relative;
   width: var(--card-w); 
  height: var(--card-h);
  transition: transform 120ms ease, filter 120ms ease;
}

/* Fake stacked shadow under top card */
#discard::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  transform: translate(3px, 3px);
  background: rgba(0,0,0,0.25);
  filter: blur(2px);
  z-index: 0;
}

#discard.drop-ready::after{
  content: "DROP TO DISCARD";
  position: absolute;
  left: 50%;
  top: -34px;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 1px;
  background: rgba(0,0,0,0.55);
  box-shadow: 0 10px 22px rgba(0,0,0,0.35),
    inset 0 0 0 1px rgba(255,255,255,0.18);
  color: white;
  pointer-events: none;
  opacity: 1;
}

#discard.drop-ready{
  transform: translateY(-2px) scale(1.03);
  filter: drop-shadow(0 0 18px rgba(124,255,58,0.45));
}

#discard .card{
  position: relative;
  z-index: 1;
}

.deck-count{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 20px;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 2px 6px rgba(0,0,0,0.45);
}

.card.back.clickable{
  cursor: pointer;
  animation: deckPulse 1.4s ease-in-out infinite;
}

@keyframes deckPulse{
  0%{ box-shadow: 0 8px 20px rgba(0,0,0,0.45); }
  50%{ box-shadow: 0 12px 30px rgba(124,255,58,0.55); }
  100%{ box-shadow: 0 8px 20px rgba(0,0,0,0.45); }
}





/* ---------- OVERLAY ---------- */
.overlay{
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  z-index: 10000;
}

.overlay-card{
  width: min(520px, 92vw);
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.10);
  box-shadow: 0 18px 40px rgba(0,0,0,0.45),
    inset 0 0 0 1px rgba(255,255,255,0.14);
  text-align: center;
}


/* =========================
   START button pulse (when enabled)
========================= */
@keyframes pulseGlow {
  0% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-1px) scale(1.03);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

.start-game-btn.pulse {
  animation: pulseGlow 0.9s ease-in-out infinite;
}

/* Optional: little glow */
.start-game-btn.pulse {
  box-shadow: 0 6px 0 #2f8f1f, 0 12px 20px rgba(0, 0, 0, 0.25),
    0 0 18px rgba(124, 255, 58, 0.35);
}

/* =========================
   Mobile landscape tweaks
========================= */


@media (max-height: 720px) {
  
  #screen-create.screen {
    padding: 8px;
    overflow: hidden;
  }
  #screen-create,
  #screen-host,
  #screen-join {
    align-items: stretch; /* let the card use full height if needed */
  }
  .room-code-container,
  .lobby-stack,
  .join-card {
     justify-content: flex-start;      /* ✅ top align instead of center */
    padding-top: 14px;
    padding-bottom: 5px;
  }

  #screen-create .lobby-stack{
    justify-content: flex-start;
    gap: 10px;
    padding: 14px 16px;
  }

  .lobby-title,
  .title {
    font-size: 18px;
    margin-bottom: 6px;  
  }

  .seg-btn {
    padding: 12px 0;
    font-size: 16px;
  }


  .points-btn {
    padding: 10px 0;
    font-size: 16px;
    min-width: 64px;
    margin-bottom: -5px;
  }


  .primary-btn {
    margin-top: 6px;
    margin-bottom: 6px;
    padding: 10px 22px;
    font-size: 16px;
  }

  .small-btn {
    padding: 10px 12px;
    font-size: 14px;
    margin-top: 4px;
  }

  .primary-btn,
.points-btn,
.seg-btn,
.small-btn {
  line-height: 1.1;
}

}


@media (orientation: landscape) and (min-height: 750px) {
  :root{
    --card-w: 150px;
    --card-h: 200px;
    --hand-overlap: 50px;
    --meld-gap: 22px;
    --meld-inner-gap: 10px;
  }

   #screen-game .table {
        min-height: 600px;
    }

    .table-inner {
        gap: 200px;
    }
 
   #scoreboard, #player-title{
     font-size: 25px;

   }

   #discard{
    width: 120px; 
    height: 150px;
   }

   
#hand.size-10 .card:nth-child(1),
#hand.size-11 .card:nth-child(1) { --curve: -6deg; --lift: -5px; }

#hand.size-10 .card:nth-child(2),
#hand.size-11 .card:nth-child(2) { --curve: -5deg; --lift: -16px; }

#hand.size-10 .card:nth-child(3),
#hand.size-11 .card:nth-child(3) { --curve: -3deg; --lift: -23px; }

#hand.size-10 .card:nth-child(4),
#hand.size-11 .card:nth-child(4) { --curve: -2deg; --lift: -28px; }

#hand.size-10 .card:nth-child(5),
#hand.size-11 .card:nth-child(5) { --curve: -1deg; --lift: -30px; }

#hand.size-10 .card:nth-child(6),
#hand.size-11 .card:nth-child(6) { --curve: 1deg; --lift: -30px; }

#hand.size-10 .card:nth-child(7),
#hand.size-11 .card:nth-child(7) { --curve: 2deg; --lift: -28px; }

#hand.size-10 .card:nth-child(8),
#hand.size-11 .card:nth-child(8) { --curve: 3deg; --lift: -23px; }

#hand.size-10 .card:nth-child(9),
#hand.size-11 .card:nth-child(9) { --curve: 5deg; --lift: -16px; }

#hand.size-10 .card:nth-child(10),
#hand.size-11 .card:nth-child(10) { --curve: 7deg; --lift: -5px; }

#hand.size-11 .card:nth-child(11) { --curve: 8deg; --lift: 1px; }
}

/* =========================
   LANDSCAPE MEDIA QUERIES
========================= */
@media (orientation: landscape) {
  #screen-host {
    width: 100%;
    height: 100%;
  }

  #screen-host .room-code-container {
    width: 100%; /* Full width for content */
    max-width: 600px; /* Set a maximum width to avoid stretching too much */
    padding: 20px;
    gap: 16px;
    height: 100%;
  }

  .room-code-text {
    font-size: 28px; /* Larger text in landscape */
  }

  /* Adjust the spacing for mobile devices */
  .waiting-status {
    font-size: 20px;
  }
}



/* =========================
   Mobile tweaks
========================= */
@media (max-width: 420px) {
 

  #screen-host {
    width: 100%; /* Ensure full width */
    padding: 20px;
  }

  /* Adjust room code container padding and width for small screens */
  #screen-host .room-code-container {
    width: 100%;
    padding: 16px;
    gap: 14px;
  }

  /* Make buttons a bit smaller */
  .start-game-btn {
    padding: 12px 28px;
    font-size: 16px;
  }

  /* Adjust the waiting status text size */
  .waiting-status {
    font-size: 18px;
  }
}

