/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --skipbo-blue:   #1a5fb4;
  --skipbo-red:    #c01c28;
  --skipbo-yellow: #f5c211;
  --skipbo-green:  #2ec27e;
  --bg-dark:       #0e1a2b;
  --bg-card:       #182841;
  --bg-card-2:     #1f3354;
  --text:          #f0f4fa;
  --text-muted:    #8295b0;
  --border:        rgba(255,255,255,0.08);
  --safe-top:      env(safe-area-inset-top, 0px);
  --safe-bottom:   env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* ── Login ──────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, #1a3a6b 0%, #0e1a2b 60%);
}

.login-container {
  width: 100%;
  max-width: 340px;
  padding: 24px;
  text-align: center;
}

/* ── Login ──────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, #1a3a6b 0%, #0e1a2b 60%);
}

.login-logo {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.logo-img {
  width: 100px;
  height: 100px;
  flex-shrink: 0; /* Verhindert, dass das Bild gequetscht wird */
  border-radius: 22px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.logo-card {
  display: inline-block;
  background: #fff;
  color: var(--skipbo-red);
  padding: 14px 28px;
  border-radius: 14px;
  font-weight: 900;
  font-size: 30px;
  letter-spacing: 3px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 4px var(--skipbo-blue), 0 0 0 8px rgba(26,95,180,0.3);
  transform: rotate(-4deg);
}

.login-title {
  margin-top: 28px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--skipbo-yellow);
}

.login-form {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form input {
  padding: 16px 18px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 17px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.login-form input:focus {
  border-color: var(--skipbo-yellow);
  background: rgba(255,255,255,0.1);
}

.login-form input::placeholder { color: var(--text-muted); }

.btn-primary {
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--skipbo-red), #9b1820);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(192,28,40,0.4);
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(192,28,40,0.3);
}

.btn-small {
  padding: 10px 20px;
  font-size: 15px;
  align-self: flex-end;
}

.error {
  color: #ff6b6b;
  font-size: 14px;
  min-height: 20px;
}

/* ── App-Layout ─────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 600px;
  margin: 0 auto;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  padding-top: calc(14px + var(--safe-top));
  background: linear-gradient(135deg, #1a3a6b, #0e2647);
  border-bottom: 3px solid var(--skipbo-yellow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-logo {
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 2px 2px 0 var(--skipbo-red);
}

.btn-icon {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-icon:active { background: rgba(255,255,255,0.2); }

.main {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Spieler-Karten ─────────────────────────────────────────── */
.players {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
}

.player-card {
  position: relative;
  background: linear-gradient(160deg, var(--bg-card), var(--bg-card-2));
  border-radius: 18px;
  padding: 20px 14px 16px;
  text-align: center;
  overflow: hidden;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.player-stripe {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
}

.player-siggi {
  border-color: rgba(26,95,180,0.5);
}
.player-siggi .player-stripe {
  background: linear-gradient(90deg, var(--skipbo-blue), #4a9fe0);
}
.player-siggi .player-avatar {
  background: var(--skipbo-blue);
}

.player-sabine {
  border-color: rgba(192,28,40,0.5);
}
.player-sabine .player-stripe {
  background: linear-gradient(90deg, var(--skipbo-red), #e85a64);
}
.player-sabine .player-avatar {
  background: var(--skipbo-red);
}

.player-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 3px solid rgba(255,255,255,0.15);
}

.player-name {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text);
}

.player-score {
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
  color: var(--skipbo-yellow);
  text-shadow: 0 2px 12px rgba(245,194,17,0.4);
  font-variant-numeric: tabular-nums;
  transition: transform 0.2s;
}

.player-score.bump {
  transform: scale(1.15);
}

.player-controls {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.btn-round {
  flex: 1;
  border: none;
  border-radius: 12px;
  font-size: 24px;
  font-weight: 900;
  height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s, opacity 0.15s;
  user-select: none;
}

.btn-plus {
  background: linear-gradient(135deg, var(--skipbo-green), #1ea968);
  color: #fff;
  box-shadow: 0 3px 10px rgba(46,194,126,0.35);
}

.btn-minus {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-plus:active, .btn-minus:active {
  transform: scale(0.92);
}

.btn-plus:disabled, .btn-minus:disabled {
  opacity: 0.5;
}

.vs-badge {
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vs-badge span {
  font-size: 13px;
  font-weight: 900;
  color: var(--skipbo-yellow);
  letter-spacing: 2px;
  background: rgba(245,194,17,0.1);
  padding: 6px 8px;
  border-radius: 8px;
}

/* ── Gesamt-Bar ─────────────────────────────────────────────── */
.total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.total-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

.total-number {
  font-size: 20px;
  font-weight: 900;
  color: var(--skipbo-yellow);
  font-variant-numeric: tabular-nums;
}

/* ── Panel (Verlauf & Bemerkungen) ──────────────────────────── */
.panel {
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.panel-toggle {
  width: 100%;
  padding: 16px 18px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.panel-arrow {
  color: var(--skipbo-yellow);
  font-size: 18px;
  transition: transform 0.3s ease;
  display: inline-block;
}

.panel.expanded .panel-arrow {
  transform: rotate(90deg);
}

.panel-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

/* Verlauf: standardmäßig die letzten 10 sichtbar */
#historySection .panel-list {
  max-height: 620px;
}

#historySection.expanded .panel-list {
  max-height: 4000px;
}

#notesSection .panel-list {
  max-height: 0;
}

#notesSection.expanded .panel-list {
  max-height: 3000px;
  overflow-y: auto;
}

/* ── Verlauf-Einträge ───────────────────────────────────────── */
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.history-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}

.history-badge.siggi { background: var(--skipbo-blue); }
.history-badge.sabine { background: var(--skipbo-red); }

.history-info {
  flex: 1;
  min-width: 0;
}

.history-winner {
  font-weight: 700;
  font-size: 15px;
}

.history-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.panel-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  border-top: 1px solid var(--border);
}

.history-hint {
  text-align: center;
  padding: 12px;
  font-size: 13px;
  color: var(--skipbo-yellow);
  font-weight: 600;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

/* ── Bemerkungen ────────────────────────────────────────────── */
.note-form {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border);
}

.note-form textarea {
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.note-form textarea:focus {
  border-color: var(--skipbo-yellow);
}

.note-form textarea::placeholder { color: var(--text-muted); }

.note-item {
  margin: 0 18px 10px;
  padding: 12px 14px;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  border-left: 3px solid var(--skipbo-yellow);
}

.note-text {
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.note-time {
  font-size: 12px;
  color: var(--text-muted);
}

.note-delete {
  background: none;
  border: none;
  color: #ff6b6b;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.note-delete:active { background: rgba(255,107,107,0.1); }

/* ── Scrollbar ──────────────────────────────────────────────── */
.panel-list::-webkit-scrollbar { width: 4px; }
.panel-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (min-width: 480px) {
  .player-score { font-size: 64px; }
  .player-avatar { width: 58px; height: 58px; font-size: 26px; }
}

@media (max-width: 360px) {
  .player-score { font-size: 48px; }
  .player-card { padding: 16px 10px 14px; }
  .player-name { font-size: 14px; }
  .btn-round { height: 44px; font-size: 22px; }
  .main { padding: 12px; gap: 12px; }
}

/* Dark mode ist Standard – keine Media Query nötig */
