/* ============================================================
   Spielkiste – gemeinsames Design
   Mobile-first, CSS Custom Properties, Dark/Light via data-theme
   ============================================================ */

:root {
  --bg: #f4f2ec;
  --bg-elev: #ffffff;
  --text: #2a2723;
  --text-dim: #6f6a61;
  --accent: #2f7d5c;
  --accent-contrast: #ffffff;
  --border: #e0dcd2;
  --shadow: 0 2px 10px rgba(40, 35, 25, 0.08);
  --shadow-lift: 0 6px 24px rgba(40, 35, 25, 0.14);
  --radius: 14px;
  --tap-min: 44px;
}

:root[data-theme="dark"] {
  --bg: #1c1b19;
  --bg-elev: #26241f;
  --text: #ece8df;
  --text-dim: #a49e91;
  --accent: #4fae85;
  --accent-contrast: #10201a;
  --border: #38352e;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 6px 24px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  transition: background 0.25s ease, color 0.25s ease;
}

/* ---------- Kopfzeile ---------- */

.sk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  max-width: 960px;
  margin: 0 auto;
}

.sk-header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.sk-header .sk-untertitel {
  margin: 0.15rem 0 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.sk-header a {
  color: inherit;
  text-decoration: none;
}

/* ---------- Buttons ---------- */

.sk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease, background 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.sk-btn:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.sk-btn:active { transform: scale(0.94); }

.sk-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.sk-btn--primary:hover {
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 45%, transparent);
}

/* Theme-Umschalter dreht sich beim Antippen */
[data-theme-toggle] { transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease; }
[data-theme-toggle]:active { transform: rotate(40deg) scale(0.9); }

.sk-btn--icon {
  padding: 0.5rem;
  font-size: 1.25rem;
  line-height: 1;
}

/* ---------- Hauptbereich & Kacheln ---------- */

.sk-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 3rem;
}

.sk-kacheln {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 560px) {
  .sk-kacheln { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 860px) {
  .sk-kacheln { grid-template-columns: repeat(3, 1fr); }
}

.sk-kachel {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.5rem 1.25rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease;
  -webkit-tap-highlight-color: transparent;
  animation: sk-kachel-auf 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

/* gestaffeltes Einblenden der Kacheln */
.sk-kachel:nth-child(1) { animation-delay: 0.05s; }
.sk-kachel:nth-child(2) { animation-delay: 0.13s; }
.sk-kachel:nth-child(3) { animation-delay: 0.21s; }
.sk-kachel:nth-child(4) { animation-delay: 0.29s; }
.sk-kachel:nth-child(5) { animation-delay: 0.37s; }
.sk-kachel:nth-child(6) { animation-delay: 0.45s; }

@keyframes sk-kachel-auf {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.sk-kachel:hover,
.sk-kachel:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

.sk-kachel:hover .sk-kachel-icon {
  transform: scale(1.12) rotate(-4deg);
}

.sk-kachel .sk-kachel-icon {
  font-size: 2.4rem;
  line-height: 1;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sk-kachel h2 {
  margin: 0.4rem 0 0;
  font-size: 1.2rem;
}

.sk-kachel p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.sk-kachel[hidden] { display: none; }

/* ---------- Hinweisbox / Platzhalter ---------- */

.sk-hinweis {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-elev);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  text-align: center;
}

/* ---------- Fusszeile ---------- */

.sk-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
}

/* Admin-Link in der Fusszeile – dezent, aber klar als Button erkennbar */
.sk-footer p { margin: 0 0 0.75rem; }
.sk-admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0.4rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  background: var(--bg-elev);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.sk-admin-link:hover,
.sk-admin-link:focus-visible {
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: var(--accent);
}
.sk-admin-link:active { transform: scale(0.96); }

/* ---------- Gewinn-Animation: Konfetti (gemeinsam) ---------- */

.sk-konfetti {
  position: fixed;
  top: -20px;
  width: 10px;
  height: 14px;
  z-index: 1400;
  pointer-events: none;
  will-change: transform;
  animation: sk-fall cubic-bezier(0.3, 0.2, 0.6, 1) forwards;
}

@keyframes sk-fall {
  0%   { transform: translateY(-5vh) translateX(0) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) translateX(var(--drift, 0)) rotate(var(--spin, 720deg)); opacity: 0.85; }
}

/* ---------- Reduzierte Bewegung respektieren ---------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .sk-konfetti { display: none; }
}
