/* ========== Γκρινιάρης ========== */
.gr-app{
  max-width: 1220px;
  margin-inline: auto;
  padding: 32px 32px 60px;
}

.gr-title{
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 52px);
  color: var(--paper);
  margin-bottom: 24px;
}
.gr-app.is-in-room .gr-title{
  font-size: clamp(22px, 3vw, 30px);
  margin-bottom: 14px;
}

.gr-layout{
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-areas:
    "image room"
    "desc  room";
  align-items: start;
  gap: 16px;
}
.gr-block-image{ grid-area: image; }
.gr-block-desc{ grid-area: desc; min-width: 0; }
.gr-block-room{ grid-area: room; min-width: 0; }

@media (max-width: 1100px){
  .gr-layout{
    grid-template-columns: 1fr;
    grid-template-areas: "image" "room" "desc";
  }
}

.gr-app.is-in-room .gr-block-image,
.gr-app.is-in-room .gr-block-desc{ display: none; }
.gr-app.is-in-room .gr-layout{
  grid-template-columns: 1fr;
  grid-template-areas: "room";
  justify-content: center;
}
.gr-app.is-in-room .gr-block-room{
  max-width: 980px;
  margin-inline: auto;
  width: 100%;
}

.gr-game-image{ margin-bottom: 24px; max-width: 640px; }
.gr-game-image img{ width: 100%; height: auto; border-radius: 12px; display: block; }
.gr-game-image.is-vertical{ max-width: 340px; }

.gr-desc-heading{
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--paper);
  margin: 0 0 14px;
}
.gr-subtitle{ color: var(--paper-dim); max-width: 60ch; }
.gr-game-description{ max-width: 70ch; line-height: 1.6; color: var(--paper-dim); }
.gr-game-description p{ margin: 0 0 14px; }

/* ---- Κάρτες lobby (αυτοτελές, ίδιο μοτίβο με τα άλλα παιχνίδια) ---- */
.tavli-card{
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: 10px;
  padding: 32px 36px;
  max-width: 640px;
}
.tavli-card h2{ font-family: var(--font-display); font-size: 26px; color: var(--paper); margin-bottom: 10px; }
.tavli-card p{ color: var(--paper-dim); font-size: 15px; margin-bottom: 18px; }
.tavli-card-icon{ display:flex; align-items:center; justify-content:center; width:56px; height:56px; border-radius:50%; background:rgba(255,182,39,0.14); margin-bottom:16px; }
.tavli-card-icon svg{ width:28px; height:28px; display:block; }
.tavli-card-inviter{ color: var(--amber); font-weight:600; }
.tavli-field{ display:flex; flex-direction:column; gap:6px; margin-bottom:18px; }
.tavli-field label{ font-size: 13px; font-weight:600; color: var(--paper-dim); }
.tavli-field input[type="text"],
.tavli-field select{
  background: var(--ink);
  border: 1px solid var(--ink-3);
  color: var(--paper);
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 15px;
  font-family: var(--font-body);
}
.btn-sm{
  padding: 8px 16px;
  font-size: 13px;
  flex-shrink: 0;
}

/* ---- Popup νικητή (ίδιο μοτίβο με τα άλλα παιχνίδια) ---- */
.tavli-winner{
  position: fixed; inset: 0; background: rgba(10,14,28,.88);
  display:flex; align-items:center; justify-content:center; z-index: 999; padding: 20px;
}
.tavli-winner-card{
  background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: 12px;
  padding: 40px; text-align: center; max-width: 380px; position: relative;
}
.tavli-winner-card p{ font-family: var(--font-display); font-size: 26px; color: var(--paper); margin-bottom: 22px; }
.tavli-winner-close{
  position: absolute; top: 12px; right: 14px; background: none; border: none;
  color: var(--paper-dim); font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px;
}
.tavli-winner-close:hover{ color: var(--paper); }
.tavli-winner-note{ font-family: var(--font-body); color: var(--paper-dim); font-size: 15px; margin: 0 0 18px; line-height: 1.5; }
.tavli-winner-actions{ display:flex; gap:12px; justify-content:center; flex-wrap:wrap; }

.gamehub-ad-slot{ margin-top: 32px; display:flex; justify-content:center; overflow:hidden; }

/* ---- Πάνω γραμμή παιχνιδιού ---- */
.gr-player-dot{
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; display: inline-block;
  background: var(--gh-pcolor, #FFB627);
  vertical-align: middle;
}
.gr-player-wins{ font-weight: 800; color: var(--amber); opacity: .9; }
.gr-share{
  display:flex; gap: 10px; margin-bottom: 22px;
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: 8px; padding: 14px; flex-wrap: wrap;
}
.gr-share input{
  flex: 1 1 220px; background: var(--ink); border: 1px solid var(--ink-3);
  color: var(--paper-dim); padding: 10px 12px; border-radius: 6px; font-size: 13px;
}
.gr-share-social{ display: flex; gap: 8px; align-items: center; }
.gr-share-icon{
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  border: 1px solid var(--ink-3);
  color: var(--paper-dim);
  flex-shrink: 0;
  transition: transform .12s ease, color .12s ease, border-color .12s ease;
}
.gr-share-icon:hover{ transform: translateY(-2px); border-color: currentColor; }
.gr-share-fb:hover{ color: #1877F2; }
.gr-share-x:hover{ color: var(--paper); }
.gr-share-viber:hover{ color: #7360F2; }
.gr-share-email:hover{ color: var(--amber); }

.gr-status-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  margin-top: -6px;
}
.gr-status{ color: var(--paper-dim); font-size: 12px; line-height: 1.4; min-height: 34px; margin-bottom: 0; overflow-wrap: anywhere; }
/* Σε προβολή υπολογιστή, το κείμενο κατάστασης + το κουμπί παραίτησης
   μπαίνουν στην ΙΔΙΑ γραμμή με τα ονόματα παιχτών (μετά από αυτά), αντί
   για ξεχωριστή γραμμή από κάτω -- ίδια αλλαγή με το Chess. Σε κινητό
   παραμένουν όπως ήταν. */
@media (min-width: 641px){
  .gr-top-row{
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 40px;
  }
  .gr-top-row .gr-vs-summary{ margin-bottom: 0; flex-shrink: 0; }
  .gr-top-row .gr-status-row{
    flex: 1 1 auto;
    margin: 0;
    min-width: 0;
  }
  .gr-top-row .gr-status{ margin-top: -4px; min-height: auto; font-size: 12px; white-space: normal; min-width: 0; flex: 1 1 auto; }
  /* 3-4 παίχτες: τα ονόματα + η «Παραίτηση» μένουν στην πάνω γραμμή και το
     κείμενο κινήσεων πηγαίνει από κάτω, ολόκληρο, σε δική του γραμμή. */
  .gr-top-row:not(.gr-few-players){ flex-wrap: wrap; row-gap: 6px; }
  .gr-top-row:not(.gr-few-players) .gr-status-row{ display: contents; }
  .gr-top-row:not(.gr-few-players) .gr-vs-summary{ order: 1; }
  .gr-top-row:not(.gr-few-players) #gr-resign-btn{ order: 2; margin-left: auto; }
  .gr-top-row:not(.gr-few-players) .gr-status{ order: 3; flex: 0 0 100%; margin-top: 0; margin-bottom: 10px; }
  .gr-top-row #gr-resign-btn{ flex-shrink: 0; }
  /* Με λιγότερους παίχτες (2), υπάρχει άπλετος χώρος -- επαναφέρουμε τη
     θέση που είχαμε ορίσει πριν, στην ίδια μεγάλη απόσταση. */
  .gr-top-row.gr-few-players .gr-status{ margin-left: 272px; }
}

.gr-abandon-banner{
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ink-2);
  border: 1px solid var(--coral);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
  color: var(--paper-dim);
  font-size: 14px;
  flex-wrap: wrap;
}

.gr-vs-summary{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.gr-vs-chip{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  color: var(--paper);
  background: var(--ink-2);
  border: 2px solid var(--gh-pcolor, transparent);
}
.gr-vs-chip.is-me{ background: var(--ink-3); }
.gr-vs-label{ color: var(--paper-dim); font-weight: 700; font-size: 14px; }
/* ---- Popup επιβεβαίωσης παραίτησης (ίδιο μοτίβο με τα άλλα παιχνίδια) ---- */
.gr-resign-modal{
  position: fixed;
  inset: 0;
  background: rgba(10,14,28,.75);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: gr-modal-fade .18s ease;
}
@keyframes gr-modal-fade{
  from{ opacity: 0; }
  to{ opacity: 1; }
}
.gr-resign-modal-card{
  background: var(--ink-2);
  border: 1px solid var(--coral);
  box-shadow: 0 0 0 1px rgba(255,93,115,0.15), 0 20px 60px rgba(0,0,0,0.5);
  border-radius: 16px;
  padding: 36px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  animation: gr-modal-pop .22s cubic-bezier(.25,1.6,.5,1);
}
@keyframes gr-modal-pop{
  from{ transform: scale(.9); opacity: 0; }
  to{ transform: scale(1); opacity: 1; }
}
.gr-resign-modal-icon{
  font-size: 40px;
  margin-bottom: 8px;
}
.gr-resign-modal-card h3{
  font-family: var(--font-display);
  color: var(--paper);
  font-size: 22px;
  margin: 0 0 12px;
}
.gr-resign-modal-card p{
  color: var(--paper-dim);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 24px;
}
.gr-resign-modal-actions{
  display: flex;
  gap: 12px;
  justify-content: center;
}
.gr-resign-modal-actions .btn{
  flex: 1 1 0;
}

.gr-rematch-buttons{ display:flex; gap:12px; justify-content:center; flex-wrap:wrap; }
#gr-countdown-num{ color: var(--amber); font-weight: 800; font-size: 20px; }
#gr-start-countdown-num{ color: var(--amber); font-weight: 800; font-size: 20px; }

/* ---- Κουμπί πλήρους οθόνης / οριζόντιας προβολής (μόνο σε κάθετη προβολή κινητού) ---- */
#gr-view-game{
  position: relative;
}
.gr-fullscreen-btn{
  display: none;
  position: absolute;
  top: -40px;
  right: 10px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 8px;
  color: var(--paper);
  cursor: pointer;
  z-index: 40;
  backdrop-filter: blur(2px);
}
.gr-fullscreen-btn.is-active{
  background: var(--amber);
  border-color: var(--amber);
  color: var(--ink);
}
@media (max-width: 640px) and (orientation: portrait){
  .gr-fullscreen-btn{ display: flex; }
  .gr-share{ margin-bottom: 6px; padding: 6px; gap: 6px; }
  .gr-share input{ font-size: 11px; padding: 6px 8px; }
  .gr-vs-chip{ font-size: 11px; padding: 5px 10px; gap: 5px; }
  .gr-vs-label{ font-size: 11px; }
  .gr-player-name{ font-size: 11px; }
  .gr-status{ font-size: 12px; }
  #gr-resign-btn{ padding: 4px 10px !important; font-size: 11px !important; }
  .gr-discard-pile{ margin-top: 28px; margin-left: -12px; }
  .gr-draw-pile{ margin-top: 32px; margin-left: 12px; }
}

body.gr-landscape-mode{
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}
body.gr-landscape-mode .site-header,
body.gr-landscape-mode .site-footer{
  display: none !important;
}
body.gr-landscape-mode .gr-app{
  padding: 10px;
}
/* ---- Ειδοποίηση αποβολής παίχτη λόγω αδράνειας (toast, 3 δευτ.) ---- */
.gr-elim-toast{
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-2);
  border: 1px solid var(--coral);
  color: var(--paper);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 500;
  animation: gr-elim-toast-fade .25s ease;
}
@keyframes gr-elim-toast-fade{ from{ opacity: 0; transform: translate(-50%, -10px); } to{ opacity: 1; transform: translate(-50%, 0); } }

/* =====================================================================
   Γκρινιάρης — ταμπλό, πιόνια, ζάρι
   ===================================================================== */
.gr-play{
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 570px) 260px;
  justify-content: center;
  gap: 22px;
  align-items: start;
}
.gr-board-wrap{
  position: relative;
  width: 100%;
  max-width: 570px;
  margin-inline: auto;
  padding: 10px;
  border-radius: 22px;
  background:
    radial-gradient(120% 120% at 20% 10%, #9c6a3a 0%, #6f4624 55%, #4a2d15 100%);
  box-shadow: 0 18px 40px rgba(90,50,20,.3), inset 0 2px 0 rgba(255,255,255,.18), inset 0 -3px 0 rgba(0,0,0,.35);
}
.gr-board{ width: 100%; aspect-ratio: 1 / 1; display: block; }
.gr-board svg{ width: 100%; height: 100%; display: block; border-radius: 12px; touch-action: manipulation; }

.gr-cell{ stroke: #e0c58f; stroke-width: 1.4; }
.gr-cell-start{ stroke-width: 2.4; }
.gr-star{ pointer-events: none; }
.gr-base-plate{ stroke: rgba(0,0,0,.35); stroke-width: 2; }
.gr-slot{ fill: rgba(0,0,0,.22); stroke: rgba(255,255,255,.55); stroke-width: 1.5; }
.gr-center-tri{ stroke: rgba(0,0,0,.25); stroke-width: 1; }
.gr-base-glow{ opacity: 0; transition: opacity .3s ease; pointer-events: none; }
.gr-base-glow.is-turn{ opacity: 1; animation: gr-glow 1.4s ease-in-out infinite; }
@keyframes gr-glow{ 0%,100%{ opacity: .35; } 50%{ opacity: .95; } }

.gr-pawn{
  transition: transform .14s cubic-bezier(.3,.7,.4,1);
  will-change: transform;
}
.gr-pawn-inner{ transform-box: fill-box; transform-origin: 50% 90%; }
.gr-pawn.is-movable{ cursor: pointer; }
.gr-pawn.is-movable .gr-pawn-inner{ animation: gr-hop .7s ease-in-out infinite; }
.gr-pawn.is-hop .gr-pawn-inner{ animation: gr-hop-once .14s ease-out; }
@keyframes gr-hop{ 0%,100%{ transform: translateY(0) scale(1); } 50%{ transform: translateY(-4px) scale(1.08); } }
@keyframes gr-hop-once{ 0%{ transform: translateY(0); } 50%{ transform: translateY(-6px) scale(1.1); } 100%{ transform: translateY(0); } }
.gr-pawn-ring{ fill: none; stroke: #fff; stroke-width: 2.2; stroke-dasharray: 4 3; opacity: 0; }
.gr-pawn.is-movable .gr-pawn-ring{ opacity: 1; animation: gr-spin 3s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes gr-spin{ to{ transform: rotate(360deg); } }
.gr-pawn.is-captured .gr-pawn-inner{ animation: gr-shake .35s linear; }
@keyframes gr-shake{ 0%,100%{ transform: translateX(0); } 25%{ transform: translateX(-3px) rotate(-8deg); } 75%{ transform: translateX(3px) rotate(8deg); } }

.gr-target{ fill: rgba(255,255,255,.35); stroke: #fff; stroke-width: 2; stroke-dasharray: 3 3; pointer-events: none; animation: gr-pulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes gr-pulse{ 0%,100%{ transform: scale(.85); opacity: .7; } 50%{ transform: scale(1.08); opacity: 1; } }

/* ---- Πλαϊνό πάνελ ---- */
.gr-side{ display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.gr-dice-panel{
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 18px 14px;
  border-radius: 16px;
  background: var(--ink-2);
  border: 1px solid rgba(255,255,255,.1);
}
.gr-dice{
  --gr-die: 76px;
  width: var(--gr-die); height: var(--gr-die);
  border-radius: 16px;
  background: linear-gradient(145deg, #ffffff 0%, #ece6d8 100%);
  box-shadow: 0 6px 0 #bdb29a, 0 12px 22px rgba(0,0,0,.4), inset 0 0 0 2px rgba(255,255,255,.7);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 11px;
  gap: 2px;
  transition: opacity .2s ease, filter .2s ease;
}
.gr-dice.is-idle{ opacity: .55; filter: saturate(.6); }
.gr-dice.is-rolling{ animation: gr-roll .6s cubic-bezier(.3,.6,.4,1); }
@keyframes gr-roll{
  0%{ transform: translateY(0) rotate(0); }
  20%{ transform: translateY(-26px) rotate(140deg); }
  45%{ transform: translateY(0) rotate(300deg); }
  65%{ transform: translateY(-12px) rotate(430deg); }
  85%{ transform: translateY(0) rotate(690deg); }
  100%{ transform: translateY(0) rotate(720deg); }
}
.gr-pip{ border-radius: 50%; background: transparent; width: 100%; height: 100%; max-width: 15px; max-height: 15px; margin: auto; }
.gr-pip.on{ background: radial-gradient(circle at 35% 30%, #4a4a4a, #111); box-shadow: inset 0 -1px 1px rgba(255,255,255,.3); }
.gr-dice[data-value="6"] .gr-pip.on{ background: radial-gradient(circle at 35% 30%, #ff6b5f, #b3140a); }
.gr-roll-btn{ width: 100%; font-weight: 800; }
.gr-roll-btn:not(:disabled){ animation: gr-btn-pulse 1.3s ease-in-out infinite; }
@keyframes gr-btn-pulse{ 0%,100%{ box-shadow: 0 0 0 0 rgba(255,182,39,.55); } 50%{ box-shadow: 0 0 0 9px rgba(255,182,39,0); } }
.gr-hint{ margin: 0; font-size: 13px; line-height: 1.4; color: var(--paper-dim); text-align: center; min-height: 36px; }

.gr-players{ display: flex; flex-direction: column; gap: 8px; }
.gr-player{
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--ink-2);
  border: 2px solid transparent;
  transition: border-color .2s ease, transform .2s ease;
}
.gr-player.is-turn{ border-color: var(--gh-pcolor); transform: translateX(-3px); box-shadow: 0 0 14px -2px var(--gh-pcolor); }
.gr-player.is-out{ opacity: .45; text-decoration: line-through; }
.gr-player-name{ flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-player-name small{ color: var(--paper-dim); font-weight: 600; margin-left: 4px; font-size: inherit; }
.gr-player-home{ display: flex; gap: 3px; }
.gr-home-dot{ width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); }
.gr-home-dot.on{ background: var(--gh-pcolor); border-color: var(--gh-pcolor); }

.gr-status-row{ align-items: center; }

/* ---- Responsive ---- */
@media (max-width: 820px){
  .gr-play{ grid-template-columns: 1fr; }
  .gr-side{ flex-direction: column; }
  .gr-dice-panel{ flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .gr-roll-btn{ width: auto; flex: 1 1 140px; }
  .gr-hint{ flex-basis: 100%; min-height: 0; }
  .gr-dice{ --gr-die: 64px; padding: 9px; }
  .gr-board-wrap{ padding: 7px; border-radius: 16px; }
}
body.gr-landscape-mode .gr-play{ grid-template-columns: minmax(0, 1fr) 210px; gap: 12px; }
body.gr-landscape-mode .gr-board-wrap{ max-width: min(100%, calc(100vh - 70px)); }
body.gr-landscape-mode .gr-dice-panel{ flex-direction: column; padding: 10px; }
body.gr-landscape-mode .gr-dice{ --gr-die: 54px; padding: 8px; }
body.gr-landscape-mode .gr-hint{ min-height: 0; font-size: 12px; }
body.gr-landscape-mode .gr-player{ padding: 5px 9px; }
@media (prefers-reduced-motion: reduce){
  .gr-pawn, .gr-pawn-inner, .gr-roll-btn, .gr-target, .gr-base-glow{ animation: none !important; transition: none !important; }
}

/* Πλήρης οθόνη κινητού: τα ονόματα στο ίδιο μέγεθος με τα άλλα παιχνίδια */
body.gr-landscape-mode .gr-vs-summary{ gap: 6px; }
body.gr-landscape-mode .gr-vs-chip{ font-size: 11px; padding: 5px 10px; gap: 5px; }
body.gr-landscape-mode .gr-vs-label{ font-size: 11px; }
body.gr-landscape-mode .gr-player-name{ font-size: 11px; }

/* Ζάρι στη γραμμή πάνω-πάνω (κάθετο κινητό), δίπλα στην Παραίτηση */
.gr-dice.is-mini{
  --gr-die: 38px;
  padding: 6px; gap: 1px; border-radius: 9px; flex: 0 0 auto;
  box-shadow: 0 3px 0 #bdb29a, 0 6px 10px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.7);
}
.gr-dice.is-mini .gr-pip{ max-width: 7px; max-height: 7px; }
.gr-dice-panel:not(:has(.gr-dice)){ gap: 8px; }

@media (max-width: 640px) and (orientation: portrait){
  .gr-player-name{ font-size: 11px; }
}
