/* =========================
   Samurai – Core (funktional)
   Niemals anfassen
   ========================= */

/* Container-Grundlage */
.samurai-container {
  display: grid;
  position: relative;
}

/* Grundzustand der Grids */
.samurai-container > div {
  position: relative;
  z-index: 1;
}

/* Grid-Zuweisungen (funktional, keine Optik) */
.grid-A { grid-column: 1; grid-row: 1; }
.grid-B { grid-column: 3; grid-row: 1; }
.grid-C { grid-column: 1; grid-row: 3; }
.grid-D { grid-column: 3; grid-row: 3; }
.grid-E { grid-column: 2; grid-row: 2; position: relative; }

/* Tabellen-Grundlage */
table.grid-table {
  border-collapse: collapse;
}

/* Tabellen-Beschriftung */
table.grid-table caption {
  user-select: none;
}

/* Zellen – funktional */
td {
  text-align: center;
  vertical-align: middle;
  user-select: none;
  cursor: pointer;
}

/* Fixierte Zellen */
td.fixed,
td.cell.fixed {
  cursor: default;
}

/* Leere Zellen */
td.empty,
td.cell.empty {
  cursor: pointer;
}

/* Auswahl */
td.selected {
  outline-style: solid;
}

/* Korrekt / Falsch – Funktion (nicht Optik) */
td.correct,
td.cell.correct {
  cursor: default !important;
}

td.incorrect,
td.cell.incorrect {
  cursor: pointer !important;
}

/* Input-Pad Funktion */
#input-pad {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

/* Sichtbarkeit */
.hidden {
  display: none;
}

/* Dialog – funktional (Overlay) */
#dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
}
/* Grid E – funktionaler Stapelwechsel */
.grid-E {
  z-index: 1;
}

.grid-E.top {
  z-index: 10;
}

#newgame-btn {
  position: relative !important;
  z-index: 10000 !important;
  background-color: #fff !important;
  border: 2px solid #444 !important;
  padding: 10px 20px !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  display: inline-block !important;
}

@media (max-width: 600px) {
  #newgame-btn {
    position: relative !important;
    z-index: 10000 !important;
    display: inline-block !important;
  }
}
.control-with-help {
  position: relative;  /* Positionierungs-Kontext für help-box */
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.help-btn {
  font-size: 0.9rem;
  padding: 2px 6px;
  border-radius: 50%;
  border: 1px solid #888;
  background: transparent;
  cursor: pointer;
  user-select: none;
}

.help-box {
  position: absolute;          /* Popup schwebt über anderen Inhalten */
  bottom: 120%;               /* Klappt nach oben */
  right: 0;                   /* Rechtsbündig zum Button */
  background: rgba(255,255,255,0.95);
  color: #000;
  border: 1px solid #aaa;
  border-radius: 8px;
  padding: 10px;
  max-width: 260px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  font-size: 0.9rem;
  text-align: left;
  z-index: 1000;
  display: none;              /* Standard versteckt */
  white-space: normal;
}

/* Sichtbarkeit wird über JS-Klasse gesteuert */
.help-box.visible {
  display: block;
}

/* Pfeil nach unten (unten an der Box) */
.help-box::after {
  content: "";
  position: absolute;
  top: 100%;              /* Direkt unterhalb der Box */
  right: 12px;            /* 12px vom rechten Rand der Box */
  border-width: 8px;
  border-style: solid;
  border-color: rgba(255,255,255,0.95) transparent transparent transparent;
}

/* Dunkles Design */
body.dark .help-box {
  background: rgba(40,40,40,0.95);
  color: #eee;
  border-color: #666;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

body.dark .help-box::after {
  border-color: rgba(40,40,40,0.95) transparent transparent transparent;
}
.control-with-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.help-btn {
  font-size: 0.9rem;
  padding: 2px 6px;
  border-radius: 50%;
  border: 1px solid #888;
  background: transparent;
  cursor: pointer;
  user-select: none;
}

.help-box {
  position: relative;
  bottom: 120%; /* Box öffnet nach oben */
  right: 0;
  background: #fff;
  color: #000;
  border: 1px solid #aaa;
  border-radius: 8px;
  padding: 10px;
  max-width: 260px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  font-size: 0.9rem;
  text-align: left;
  z-index: 1000;
  display: none;
}

.help-box.visible {
  display: block;
}

/* Optional: dunkles Design */
body.dark .help-box {
  background: #222;
  color: #eee;
  border-color: #666;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}
.help-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
  padding: 0;
  user-select: none;
}

.help-close:hover {
  color: #000;
}

body.dark .help-close {
  color: #ccc;
}

body.dark .help-close:hover {
  color: #fff;
}
.help-box .warning {
  color: #b33939;           /* dunkles Rot */
  background-color: #f8d7da; /* helles Rosa-Rot, dezenter Hintergrund */
  border: 1px solid #f5c6cb;
  padding: 6px 10px;
  border-radius: 5px;
  margin: 10px 0;
  font-weight: bold;
  font-size: 0.9rem;
}
#wakeToggle {
  background-color: #f0f0f0; /* Hellgrau normal */
  transition: background-color 0.3s ease;
}

#wakeToggle:hover,
#wakeToggle:focus {
  background-color: #a8d0a8; /* Hellgrün bei Hover und Focus */
  outline: none; /* Optional, um den blauen Rahmen bei Fokus zu entfernen */
}