:root {
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #16161d;
  color: #e6e6f0;
  padding-bottom: 24px;
}

h1:focus { outline: none; }

.sticky-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #1c1c26;
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #1c1c26;
  border-bottom: 1px solid #2c2c3a;
}

header.topbar h1 { font-size: 17px; margin: 0; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip { color: #9a9ab0; font-size: 13px; }
.logout-btn {
  padding: 6px 10px;
  border-radius: 8px;
  background: #2c2c3a;
  color: #e6e6f0;
  font-size: 13px;
  text-decoration: none;
}

nav.tab-bar {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: #1c1c26;
  border-bottom: 1px solid #2c2c3a;
  overflow-x: auto;
}

nav.tab-bar a {
  color: #9a9ab0;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
}

nav.tab-bar a.active { color: #fff; background: #6c5ce7; }

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card { background: #1c1c26; border-radius: 14px; padding: 16px; }
.card h2 { margin: 0 0 12px; font-size: 16px; }

.unit-note { color: #888899; font-size: 13px; }
.error-text { color: #e07f7f; font-size: 14px; min-height: 1.2em; }

input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #2c2c3a;
  background: #12121a;
  color: inherit;
  /* iOS Safari zoomt beim Fokussieren, wenn ein Feld unter 16px Schrift hat. */
  font-size: 16px;
  margin-bottom: 10px;
}

.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

button {
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  background: #6c5ce7;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

button.secondary { background: #2c2c3a; }
button.small { padding: 8px 12px; font-size: 13px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 15px; }
.checkbox-row input[type="checkbox"] { width: auto; margin-bottom: 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid #2c2c3a; }
th { color: #888899; font-weight: 500; font-size: 12px; }
.table-scroll { overflow-x: auto; }

.vocab-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid #2c2c3a; }
.vocab-row .words { display: flex; justify-content: space-between; gap: 12px; }
.vocab-row .row-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.due-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.due-count { font-size: 28px; font-weight: 700; margin: 0; }

/* Login */
.auth-card { max-width: 360px; margin: 40px auto 0; }
.auth-card button { width: 100%; }
.auth-mode-switch { margin-bottom: 12px; }
.guest-btn { margin-top: 8px; }

/* Start: Schwierigkeitsauswahl */
.difficulty-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.difficulty-btn { padding: 16px 8px; }

/* Spiel */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  color: #9a9ab0;
}
.game-timer { font-variant-numeric: tabular-nums; color: #e6e6f0; font-weight: 600; }

.pause-overlay { text-align: center; padding: 48px 16px; }

.sudoku-board {
  display: flex;
  flex-direction: column;
  width: min(92vw, 460px);
  aspect-ratio: 1;
  margin: 0 auto;
  background: #2c2c3a;
  border: 2px solid #4a4a5e;
  border-radius: 8px;
  overflow: hidden;
}

.sudoku-row { display: flex; flex: 1; }

.sudoku-cell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1c1c26;
  color: #e6e6f0;
  border: 1px solid #2c2c3a;
  border-radius: 0;
  font-size: clamp(14px, 4.2vw, 20px);
  font-weight: 600;
  padding: 0;
  margin: 0;
}

.sudoku-cell.given { color: #9a9ab0; background: #22222e; }
.sudoku-cell.selected { background: #3a2f6e; }
.sudoku-cell.wrong { color: #e07f7f; }
.sudoku-cell.solved:not(.given) { color: #7fe0a0; }

.sudoku-cell.box-left { border-left: 2px solid #4a4a5e; }
.sudoku-cell.box-right { border-right: 2px solid #4a4a5e; }
.sudoku-cell.box-top { border-top: 2px solid #4a4a5e; }
.sudoku-cell.box-bottom { border-bottom: 2px solid #4a4a5e; }

.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  font-size: clamp(7px, 2vw, 10px);
  font-weight: 400;
  color: #888899;
}
.notes-grid span { display: flex; align-items: center; justify-content: center; }

.number-pad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  width: min(92vw, 460px);
  margin: 12px auto 0;
}
.number-pad button { padding: 14px 0; font-size: 17px; }

.game-actions { width: min(92vw, 460px); margin: 10px auto 0; }

.result-card { text-align: center; }
.final-score { font-size: 32px; font-weight: 700; color: #7fe0a0; margin: 12px 0; }

.hidden { display: none !important; }

/* Blazor-Standardelemente, dunkel eingefärbt statt der hellen Default-Styles */
#blazor-error-ui {
  color-scheme: light only;
  background: lightyellow;
  color: #12121a;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  display: none;
  left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}

.blazor-error-boundary {
  background: #b32121;
  padding: 1rem;
  color: white;
  border-radius: 8px;
}
.blazor-error-boundary::after { content: "Es ist ein Fehler aufgetreten."; }

.loading-progress {
  position: relative;
  display: block;
  width: 8rem;
  height: 8rem;
  margin: 20vh auto 1rem;
}

.loading-progress circle {
  fill: none;
  stroke: #2c2c3a;
  stroke-width: 0.6rem;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}

.loading-progress circle:last-child {
  stroke: #6c5ce7;
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
  text-align: center;
  color: #9a9ab0;
}

.loading-progress-text::after { content: var(--blazor-load-percentage-text, "Lädt…"); }
