/* Light Mode (Standard) */
table.sudoku {
  border-collapse: collapse;
  margin: auto;
}

td.cell {
  width: 40px;
  height: 40px;
  text-align: center;
  vertical-align: middle;
  font-size: 24px;
  user-select: none;
  border: 1px solid #999; /* Default dĆ¼nner Rahmen */
  cursor: pointer;
  background-color: #fff;
  color: #000;
}

td.border-top-outer {
  border-top: 3px solid black !important;
}

td.border-left-outer {
  border-left: 3px solid black !important;
}

td.border-right-outer {
  border-right: 3px solid black !important;
}

td.border-bottom-outer {
  border-bottom: 3px solid black !important;
}

td.border-right-block {
  border-right: 3px solid black !important;
}

td.border-bottom-block {
  border-bottom: 3px solid black !important;
}

/* Hervorhebung der selektierten Zelle */
td.cell.selected {
  outline: 3px solid #2196F3;
  background-color: #d0e7ff;
  cursor: pointer;
}
td.cell.correct {
  background-color: #ccffcc;
  border: 2px solid #00ff00;
  outline: none;
}

/* ===== Dark Mode ===== */

body.dark {
  background-color: #121212;
  color: #e0e0e0;
}

body.dark table.sudoku {
  /* Optional: leichter Kontrast */
  border-color: #666;
}

body.dark td.cell {
  background-color: #222;
  color: #eee;
  border: 1px solid #555;
  cursor: pointer;
}

body.dark td.border-top-outer,
body.dark td.border-left-outer,
body.dark td.border-right-outer,
body.dark td.border-bottom-outer,
body.dark td.border-right-block,
body.dark td.border-bottom-block {
  border-color: #888 !important; /* helleres Grau statt schwarz */
}

/* Hervorhebung der selektierten Zelle im Dark Mode */
body.dark td.cell.selected {
  outline: 3px solid #64b5f6;
  background-color: #335577;
  cursor: pointer;
}
#error-status {
  color: #ff0000;         /* kr¸«£ftiges Rot */
  font-weight: bold;
  font-size: 1.2em;
  transition: color 0.3s ease;
}

#error-status.error-flash {
  color: #ff5555;         /* etwas helleres Rot beim Aufblitzen */
  animation: flashRed 0.5s ease;
}

@keyframes flashRed {
  0%, 100% { color: #ff0000; }
  50% { color: #ffaaaa; }
}
td.cell.incorrect {
  background-color: #ffcccc;   /* heller Rot-Ton als Hintergrund */
  border: 2px solid #ff0000;   /* rote dickere Umrandung */
  transition: background-color 0.5s ease;
}
td.cell.correct {
  background-color: #ccffcc;   /* heller gr¸«än-Ton als Hintergrund */
  border: 2px solid #00ff00;   /* gr¸«äne dickere Umrandung */
  transition: background-color 0.5s ease;
}
#selection-pad {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
@media (max-width: 480px) {
  .pad-btn {
    font-size: 1.2rem;
    padding: 6px 10px;
  }
}
  body {
    font-family: Arial, sans-serif;
    text-align: center;
    margin: 20px;
  }
  .top-controls, .bottom-controls {
    margin: 10px auto;
    max-width: 400px;
  }
  form {
    margin-bottom: 10px;
  }
  label {
    margin-right: 8px;
    font-weight: bold;
  }
  button, select {
    font-size: 1rem;
    padding: 5px 10px;
    margin: 0 5px 10px 0;
  }
  #error-status {
    margin: 15px 0;
    font-weight: bold;
    color: red;
  }
  .dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.dialog.hidden { display:none; }
.dialog-box {
  background: #fff;
  padding: 1em;
  border-radius: 10px;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.pad-btn{
    font-size:40px;width:64px;height:64px;
    border-radius:10px;border:1px solid #888;
    cursor:pointer;margin:4px;
    display: flex;
  align-items: center;
  justify-content: center;
}
.pad-btn:active {
  transform: scale(0.95);
}
.top-controls button,
.bottom-controls button,
.top-controls select,
.bottom-controls select {
  font-size: 0.9rem;
  padding: 4px 8px;
}
@media (max-width: 480px) {

  .top-controls,
  .bottom-controls {
    max-width: 95%;
  }

  .top-controls form,
  .bottom-controls form {
    margin-bottom: 6px;
  }

  label {
    font-size: 0.85rem;
  }

  button, select {
    font-size: 0.85rem;
    padding: 3px 6px;
  }
}
.top-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
@media (max-width: 480px) {
  .top-controls {
    gap: 4px;
  }
}
.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 */
}

