/* ========== Chess ========== */
.ch-app{
  max-width: 1220px;
  margin-inline: auto;
  padding: 32px 32px 60px;
}

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

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

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

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

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

.ch-desc-heading{
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--paper);
  margin: 0 0 14px;
}
.ch-subtitle{ color: var(--paper-dim); max-width: 60ch; }
.ch-game-description{ max-width: 70ch; line-height: 1.6; color: var(--paper-dim); }
.ch-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"]{
  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);
}
.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; }
.ch-level-note{ font-size: 12px; color: var(--paper-dim); opacity: .8; margin: 6px 0 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; }

/* ---- Πάνω γραμμή "εγώ vs αντίπαλος" ---- */
.ch-player-dot{
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; display: inline-block;
  background: var(--gh-pcolor, #FFB627);
}
.ch-player-wins{ font-weight: 800; color: var(--amber); opacity: .95; }

.ch-vs-summary{ display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.ch-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 transparent;
}
.ch-vs-chip.is-me{ background: var(--ink-3); }
.ch-vs-chip.is-turn{ border-color: var(--gh-pcolor); }
.ch-vs-label{ color: var(--paper-dim); font-weight: 700; font-size: 14px; }

/* ---- Κοινοποίηση ---- */
.ch-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;
}
.ch-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;
}
.ch-share-social{ display: flex; gap: 8px; align-items: center; }
.ch-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;
}
.ch-share-icon:hover{ transform: translateY(-2px); border-color: currentColor; }
.ch-share-fb:hover{ color: #1877F2; }
.ch-share-x:hover{ color: var(--paper); }
.ch-share-viber:hover{ color: #7360F2; }
.ch-share-email:hover{ color: var(--amber); }

.ch-status-row{ display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.ch-status{ color: var(--paper-dim); font-size: 15px; margin-bottom: 0; min-height: 22px; }
/* Σε προβολή υπολογιστή, το κείμενο κατάστασης + το κουμπί παραίτησης
   μπαίνουν στην ΙΔΙΑ γραμμή με τα ονόματα παιχτών (μετά από αυτά), αντί
   για ξεχωριστή γραμμή από κάτω. Σε κινητό παραμένουν όπως ήταν. */
@media (min-width: 641px){
  .ch-top-row{
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
  }
  .ch-top-row .ch-vs-summary{ margin-bottom: 0; }
  .ch-top-row .ch-status-row{
    flex: 1 1 auto;
    margin: 0;
    min-width: 0;
  }
  .ch-top-row .ch-status{ margin-left: 24px; margin-top: -4px; }
}

.ch-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;
}
#ch-abandon-claim-btn{ margin-left: auto; }

/* ---- Το ταμπλό σκακιού ---- */
.ch-board-wrap{ display: flex; justify-content: center; }
.ch-board{
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(100%, 560px);
  aspect-ratio: 1;
  border: 10px solid #6b4226;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(0,0,0,.4);
}
.ch-square{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.ch-square.is-light{ background: #EDE0C8; }
.ch-square.is-dark{ background: #7A5C3E; }
.ch-square.is-selected{ box-shadow: inset 0 0 0 4px var(--amber); }
.ch-square.is-last-move{ box-shadow: inset 0 0 0 3px rgba(255,182,39,.5); }
.ch-square.is-in-check{ box-shadow: inset 0 0 0 4px var(--coral); background: rgba(255,93,115,.35); }
.ch-square.is-move-hint::after{
  content: '';
  position: absolute;
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: rgba(20,20,20,.28);
}
.ch-square.is-capture-hint{ box-shadow: inset 0 0 0 4px rgba(220,50,50,.55); cursor: pointer; }
.ch-square:has(.ch-piece){ cursor: pointer; }

.ch-piece{
  position: relative;
  font-size: clamp(30px, 6.4vw, 50px);
  line-height: 1;
  user-select: none;
  transition: transform .12s ease;
}
.ch-square:hover .ch-piece{ transform: translateY(-2px) scale(1.04); }

/* "Βάση" σκιάς κάτω από κάθε πιόνι, για αίσθηση βάθους πάνω στο τετράγωνο. */
.ch-square::before{
  content: '';
  position: absolute;
  bottom: 6%;
  width: 62%;
  height: 14%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.32) 0%, rgba(0,0,0,0) 72%);
  pointer-events: none;
  opacity: 0;
}
.ch-square:has(.ch-piece)::before{ opacity: 1; }

/* Λευκά πιόνια -- ελεφαντόδοντο με απαλή χρυσαφί λάμψη περιγράμματος. */
.ch-piece-w{
  background: linear-gradient(160deg, #ffffff 0%, #f2ecd8 45%, #ddd0a8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1.4px #6b5a2e;
  filter:
    drop-shadow(0 1px 0 #ffffff)
    drop-shadow(0 3px 3px rgba(0,0,0,.45));
}
/* Μαύρα πιόνια -- βαθύ γκρι/μαύρο με μεταλλική λάμψη. */
.ch-piece-b{
  background: linear-gradient(160deg, #4a4a52 0%, #1c1c22 55%, #050506 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1.4px #000000;
  filter:
    drop-shadow(0 1px 0 rgba(255,255,255,.15))
    drop-shadow(0 3px 4px rgba(0,0,0,.6));
}

/* ---- Popup προαγωγής πιονιού ---- */
.ch-promo-picker{
  position: fixed; inset: 0; background: rgba(10,14,28,.75);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 20px;
  z-index: 1000; animation: ch-modal-fade .18s ease;
}
@keyframes ch-modal-fade{ from{ opacity:0; } to{ opacity:1; } }
.ch-promo-picker p{ font-family: var(--font-display); font-size: 24px; color: var(--paper); }
.ch-promo-cancel{
  position: absolute; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right));
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.28);
  color: var(--paper); font-size: 24px; line-height: 1; cursor: pointer;
}
.ch-promo-cancel:hover{ background: rgba(255,255,255,.2); }
.ch-promo-options{ display: flex; gap: 14px; }
.ch-promo-btn{
  width: 74px; height: 74px; border-radius: 12px;
  background: #EDE0C8; border: 3px solid var(--ink-3);
  font-size: 40px; cursor: pointer; color: #1a1a1a;
  display: flex; align-items: center; justify-content: center;
}
.ch-promo-btn:hover{ border-color: var(--amber); }

/* ---- Popup επιβεβαίωσης παραίτησης ---- */
.ch-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: ch-modal-fade .18s ease;
}
.ch-resign-modal-card{
  background: var(--ink-2); border: 1px solid var(--coral);
  box-shadow: 0 0 0 1px rgba(255,93,115,.15), 0 20px 60px rgba(0,0,0,.5);
  border-radius: 16px; padding: 36px; text-align: center; max-width: 380px; width: 100%;
}
.ch-resign-modal-icon{ font-size: 40px; margin-bottom: 8px; }
.ch-resign-modal-card h3{ font-family: var(--font-display); color: var(--paper); font-size: 22px; margin: 0 0 12px; }
.ch-resign-modal-card p{ color: var(--paper-dim); font-size: 14px; line-height: 1.5; margin: 0 0 24px; }
.ch-resign-modal-actions{ display: flex; gap: 12px; justify-content: center; }
.ch-resign-modal-actions .btn{ flex: 1 1 0; }

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

/* ---- Κουμπί πλήρους οθόνης ---- */
#ch-view-game{ position: relative; }
.ch-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);
}
.ch-fullscreen-btn.is-active{ background: var(--amber); border-color: var(--amber); color: var(--ink); }
@media (max-width: 640px) and (orientation: portrait){
  .ch-fullscreen-btn{ display: flex; }
  .ch-share{ margin-bottom: 6px; padding: 6px; gap: 6px; }
  .ch-share input{ font-size: 11px; padding: 6px 8px; }
  .ch-vs-chip{ font-size: 11px; padding: 5px 10px; gap: 5px; }
  .ch-vs-label{ font-size: 11px; }
  .ch-status{ font-size: 12px; }
  #ch-resign-btn{ padding: 4px 10px !important; font-size: 11px !important; }
}

body.ch-landscape-mode{ overflow: hidden; position: fixed; width: 100%; height: 100%; }
body.ch-landscape-mode .site-header,
body.ch-landscape-mode .site-footer{ display: none !important; }
body.ch-landscape-mode .ch-app{ padding: 4px 10px; }
body.ch-landscape-mode .ch-title{ display: none; }

/* ---- Responsive ---- */
@media (max-width: 900px){
  .ch-app{ padding: 20px 16px 40px; }
}
