/* ------------------------------------------------------------
   Grundlayout
------------------------------------------------------------ */
:root{
  --tile: 120px;
  --gap: 8px;
}


body {
  font-family: Arial, sans-serif;
  padding: 20px;
  margin: 0;
}

.game-container {
  max-width: 600px;        /* verhindert superbreite Darstellung */
  margin: 0 auto;          /* horizontal zentrieren */
  text-align: center;      /* Texte zentrieren */
}

/* Zusätzlich: Board selbst zentrieren */
.board {
  margin-left: auto;
  margin-right: auto;
}

/* ------------------------------------------------------------
   Typo & Status
------------------------------------------------------------ */

h1 {
  margin-bottom: 8px;
}

p {
  margin-bottom: 8px;
}

/* Versuchszähler */
#attempts-box {
  margin-bottom: 12px;
  font-size: 0.9rem;
  font-weight: 600;
}

.next-grid-info {
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: #666;
}

/* Logo in der Grid-Ecke oben links */
.board .corner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-logo {
  width: 80%;
  height: 80%;
  object-fit: contain;
  display: block;
}


/* ------------------------------------------------------------
   Board – Tabellenlayout mit Kacheloptik
------------------------------------------------------------ */

.board{
  border-collapse: separate;
  border-spacing: var(--gap);
  margin-top: 8px;
  table-layout: fixed;
}


.board th,
.board td {
  border: none;
  padding: 0;
  vertical-align: middle;
}

/* Grund-Box-Style für Header-„Kacheln“ */
.board .corner,
.board th.col-cond,
.board th.row-cond{
  width: var(--tile);
  height: var(--tile);
}


/* Ecke oben links */
.board .corner {
  background: transparent;
  box-shadow: none;
}

/* Spalten-Bedingungen oben */
.board th.col-cond {
  background: #f0f2ff;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Zeilen-Bedingungen links */
.board th.row-cond {
  background: #f5f5f5;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: normal;
}

/* --------------------------------------
----------------------
   Antwortkacheln – Quadrat liegt auf .cell-label, nicht auf <td>
------------------------------------------------------------ */

/* <td> selbst ist nur Container, ohne eigene Karte */
.board td.cell .cell-label{
  width: var(--tile);
}


/* Die sichtbare Kachel */
.board td.cell .cell-label {
  width: var(--tile);
  aspect-ratio: 1 / 1;          /* macht die Kachel quadratisch */
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  background: #ffffff;
  box-sizing: border-box;

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

  font-size: 0.9rem;
  font-weight: 500;
  overflow: hidden;             /* Inhalt beschneiden, nicht Kachel verziehen */
  margin: 0 auto;               /* in der Zelle zentrieren */
}

/* Hover-Effekt auf der Karte */
.board td.cell:hover .cell-label {
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* Validierungsfarben (Kachel-Hintergrund einfärben) */
.board td.ok .cell-label {
  background: #c8e6c9 !important;
}

.board td.error .cell-label {
  background: #ffcdd2 !important;
}

/* Gesperrte (korrekte oder Spielende-)Kacheln */
.board td.locked {
  cursor: default !important;
}

.board td.locked .cell-label {
  box-shadow: none !important;
}

/* Container für Inhalt (Logo + Flagge) */
.cell-content {
  width: 80%;
  height: 80%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Logo selbst: passt sich an Container an, Seitenverhältnis bleibt */
.club-logo {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* Fallback: reiner Name statt Logo */
.club-name {
  display: block;
  text-align: center;
  padding: 4px;
  font-size: 0.8rem;
}

/* Flaggen-Emoji in der Ecke */
.club-flag-emoji {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 22px;
  line-height: 1;
  pointer-events: none;
}

/* ------------------------------------------------------------
   Modal
------------------------------------------------------------ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.hidden {
  display: none;
}

.modal {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  width: 320px;
  max-width: 90vw;
  padding: 12px 16px 14px;
  box-sizing: border-box;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  margin-bottom: 10px;
}

#team-input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.modal-hint {
  font-size: 0.75rem;
  color: #666;
  margin-top: 4px;
}

/* Vorschlagsliste */
.suggestions-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  max-height: 180px;
  overflow-y: auto;
  border-radius: 6px;
  border: 1px solid #ddd;
}

.suggestions-list li {
  padding: 6px 8px;
  font-size: 0.9rem;
  cursor: pointer;
  background: #ffffff;
}

.suggestions-list li:nth-child(odd) {
  background: #fafafa;
}

.suggestions-list li:hover {
  background: #e3f2fd;
}

/* Modal-Footer */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-btn {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #1e88e5;
  font-size: 0.85rem;
  cursor: pointer;
}

.modal-btn.secondary {
  border-color: #999;
  background: #f5f5f5;
}

.modal-btn.secondary:hover {
  background: #e0e0e0;
}

/* ------------------------------------------------------------
   Summary-Grid im Auswertungs-Modal
------------------------------------------------------------ */

.summary-grid {
  display: inline-block;
  margin: 8px 0 12px;
}

.summary-row {
  display: flex;
}

.summary-cell {
  width: 70px;
  height: 70px;
  margin: 2px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
  cursor: pointer;
}

.summary-cell .club-logo {
  max-width: 80%;
  max-height: 80%;
  display: block;
}

.summary-cell.ok {
  background: #c8e6c9;     /* wie im Board */
}

.summary-cell.error {
  background: #ffcdd2;     /* wie im Board */
}

.summary-cell:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* Box für die Lösungsliste */
.solutions-box {
  margin-top: 8px;
  font-size: 0.85rem;
  text-align: left;
  max-height: 160px;
  overflow-y: auto;
}

.solutions-box ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

/* ------------------------------------------------------------
   Hard Mode – iOS-Style Toggle
------------------------------------------------------------ */

.toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  margin: 6px auto 14px;
}

.toggle input {
  display: none;
}

/* Schalter-Hintergrund */
.slider {
  width: 46px;
  height: 24px;
  background: #ccc;
  border-radius: 24px;
  position: relative;
  transition: background 0.25s ease;
}

/* Kreiselement */
.slider::before {
  content: "";
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.25s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

/* Aktiv: Grün */
.toggle input:checked + .slider {
  background: #4caf50;
}

/* Kreis fährt nach rechts */
.toggle input:checked + .slider::before {
  transform: translateX(22px);
}

.toggle-label {
  font-size: 0.95rem;
  user-select: none;
}

/* ------------------------------------------------------------
   Summary-Modal (Auswertung)
------------------------------------------------------------ */

#summary-content {
  max-height: 75vh;
  overflow-y: auto;
  padding-right: 10px;
  box-sizing: border-box;
}

#summary-content p {
  margin: 6px 0;
  font-size: 0.95rem;
  line-height: 1.35;
}

#summary-content ul {
  text-align: left;
  padding-left: 20px;
  margin: 6px 0 10px;
  font-size: 0.9rem;
}

#summary-content li {
  margin-bottom: 4px;
}

#summary-content .global-stats {
  border-top: 1px solid #ddd;
  margin-top: 12px;
  padding-top: 10px;
}

/* Container hält das Logo am oberen linken Rand */
.logo-container {
  position: fixed;     /* bleibt auch beim Scrollen oben links */
  top: 10px;           /* Abstand nach oben */
  left: 10px;          /* Abstand nach links */
  z-index: 1000;       /* immer über dem Rest der Seite */
}

/* Logo selbst */
.logo {
  width: 130px;        /* feste Größe */
  height: 130px;
  object-fit: contain; /* verhindert Verzerren */
  display: block;
}


.bmc-container {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 2500;  /* über dem Rest */
  transform: scale(0.85);  /* optional: etwas kleiner */
}

@media (max-width: 500px) {
  .bmc-container {
    top: 5px;
    right: 5px;
    transform: scale(0.75);
  }
}

/* ===============================
   GRID – Desktop & Mobile
=================================*/


/* ===============================
   MODALS – Desktop & Mobile
=================================*/

/* Hintergrund des Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;                /* .hidden -> display: none; solltest du schon haben */
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* Falls du .hidden mit visibility/opacity machst, kannst du hier stattdessen flex erzwingen */
.modal-backdrop:not(.hidden) {
  display: flex;
}

/* Box des Modals */
.modal {
  background: #f8f8f8;
  border-radius: 12px;
  padding: 16px;
  width: 90%;
  max-width: 420px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Header/Footer etwas ordnen */
.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
}

/* Body und Suggestion-Liste */
.modal-body {
  margin-top: 8px;
}

/* Input im Modal */
#team-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #92a9ec;
  color: #f5f5f5;
}

/* Vorschlagsliste scrollbar machen */
.suggestions-list {
  list-style: none;
  padding-left: 0;
  margin-top: 8px;
  max-height: 40vh;
  overflow-y: auto;
}

/* ===============================
   MODALS – Mobile Fine-Tuning
=================================*/

@media (max-width: 600px) {
  .modal {
    width: 96%;
    margin: 0 2%;
    padding: 12px;
    border-radius: 10px;
    max-height: 90vh;
  }

  .modal-header h2 {
    font-size: 1rem;
  }

  #team-input {
    font-size: 16px; /* verhindert iOS-Zoom beim Fokussieren */
  }

  .modal-body {
    max-height: 60vh;
    overflow-y: auto;
  }

  .suggestions-list {
    max-height: 40vh;
  }
}


/* ===============================
   RESPONSIVE HEADER
=================================*/

.bd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 0 10px;
  flex-wrap: wrap; /* erlaubt umbrechen auf kleinen Geräten */
}

.header-left {
  flex: 0 0 auto;
}

.header-title {
  flex: 1 1 auto;
  text-align: center;
  font-size: 1.4rem;
  margin: 0;
}

.header-right {
  flex: 0 0 auto;
  transform: scale(0.85);
}

/* Logo kleiner auf Mobile */
.logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

/* ===============================
   MOBILE BREAKPOINT
=================================*/

@media (max-width: 600px) {

  .bd-header {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding-top: 6px;
  }

  .header-right {
    transform: scale(0.75);
  }

  .header-title {
    font-size: 1.2rem;
    margin-top: 4px;
    text-align: center;
  }

  .logo {
    width: 70px;
    height: 70px;
  }
}


/* Container für die beiden Buttons */
#grid-controls{
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 600px;
  margin: 20px auto 0;
}

/* 🔹 Einheitlicher Button-Style */
.grid-btn{
  flex: 1 1 0;              /* alle gleich breit */
  height: 48px;             /* gleiche Höhe */
  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 1rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}

/* Give-Up Button links */
#btn-giveup {
  background: #ff4d4d;
  color: #fff;
  border: none;
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
}

#btn-giveup:hover {
  background: #ff2f2f;
  transform: translateY(-2px);
}

#report-issue-btn {
  background: #ff4d4d;
  color: #fff;
  border: none;
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
  margin-left: 10px; /* kleiner Abstand zu Give up */
}

#report-issue-btn:hover {
  background: #ff2f2f;
  transform: translateY(-2px);
}



/* Support Button rechts */
#support-btn {
  background: #ffd000;
  color: #000;
  text-decoration: none;
  padding: 10px 20px;
  font-weight: 700;
  border-radius: 8px;
  border: 2px solid #000;
  transition: 0.25s;
}

#support-btn:hover {
  background: #ffea4d;
  transform: translateY(-2px);
}

/* Mobile Optimierung */
@media (max-width: 480px) {
  #grid-controls {
    flex-direction: column;
    gap: 12px;
  }

  #btn-giveup,
  #support-btn {
    width: 100%;
    text-align: center;
  }
}

.available-clubs-bar {
  margin: 8px 0 10px;
  text-align: center;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
}

.clubs-list {
  margin-top: 10px;
  max-height: 52vh;
  overflow: auto;
  text-align: left;
}

.country-block {
  margin: 10px 0 14px;
  border-top: 1px solid rgba(0,0,0,0.12);
  padding-top: 10px;
}

.country-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.club-items {
  margin: 0;
  padding-left: 18px;
}

.club-items li {
  margin: 2px 0;
}


@media (max-width: 600px){
  :root{
    --tile: clamp(70px, 20vw, 105px);
    --gap: 6px;
  }
}


.board-wrap{
  width: 100%;
  display: flex;
  justify-content: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.board{
  width: max-content; /* nimmt nur so viel Platz wie nötig */
  margin: 0;
}


/* ===============================
   GAME STATUS BAR (polished)
================================= */

:root{
  --status-h: 44px;
  --status-radius: 14px;
  --pill-radius: 999px;
}

.game-status{
  width: 100%;
  max-width: 600px;
  margin: 10px auto 10px;
  padding: 12px 12px;
  box-sizing: border-box;
  border-radius: var(--status-radius);
  background: #f7f7f7;
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

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

.status-row-2{
  margin-top: 10px;
}

.status-left{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* rechte Seite = gleiche Höhe wie die Pills */
.status-right{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: var(--status-h);
  min-width: 170px;
}

.status-pill{
  height: var(--status-h);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;

  border-radius: var(--pill-radius);
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);

  font-size: 0.92rem;
  line-height: 1;
  box-sizing: border-box;
  white-space: nowrap;
}

/* Attempts darf etwas „wichtiger“ wirken */
.status-attempts{
  font-weight: 800;
}

/* Dice etwas buttoniger + nicer hover */
.status-dice{
  cursor: pointer;
  border-color: rgba(0,0,0,0.14);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.status-dice:hover{
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.14);
}

.status-dice:disabled{
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.status-muted{
  font-size: 0.88rem;
  color: #666;
  line-height: 1.2;
  text-align: right;
}

/* Locked countries */
.status-locks{
  font-size: 0.95rem;
  font-weight: 800;
}

/* Hard mode kompakt */
.toggle-compact{
  cursor: pointer;
  user-select: none;
  /* sorgt dafür, dass Label/Slider exakt mittig in der Pill sitzen */
  padding-left: 12px;
  padding-right: 14px;
}

/* echtes Checkbox-Feld ausblenden */
.toggle-compact input[type="checkbox"]{
  display: none;
  appearance: none;
}

/* Slider minimal kleiner und perfekt zentriert */
.toggle-compact .slider{
  width: 42px;
  height: 24px;
  border-radius: 999px;
  position: relative;
  transition: background 0.25s ease;
}

.toggle-compact .slider::before{
  content: "";
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.25s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

.toggle-compact input:checked + .slider{
  background: #4caf50;
}

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

.toggle-compact .toggle-label{
  font-weight: 800;
}

/* Mobile: rechts nicht zu breit, Text bricht sauber */
@media (max-width: 520px){
  .status-right{
    min-width: 0;
    flex: 1 1 auto;
    justify-content: flex-start;
  }
  .status-muted{
    text-align: left;
  }
}

.info-icon{
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.18);
  background: #fff;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.info-icon:hover{
  background: rgba(0,0,0,0.04);
}

.status-pill{
  position: relative; /* safe */
}

.status-dice .pill-action{
  border: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

/* Popover (floating, kein Layoutsprung) */
.help-popover{
  position: fixed;
  z-index: 5000;
  max-width: min(320px, 92vw);
  background: #111;
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}

.help-popover.hidden{ display:none; }

.help-popover-title{
  font-weight: 800;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.help-popover-text{
  font-size: 0.9rem;
  line-height: 1.25;
  opacity: 0.95;
}
