/* ==========================================
   TippArena Neon
   Design-only: bestehende IDs bleiben erhalten
   ========================================== */

:root {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;

  --bg: #080e1e;
  --card: rgba(19, 29, 55, .78);
  --ink: #f1f5ff;
  --muted: #a6b4d0;
  --line: rgba(164, 186, 255, .16);
  --accent: #9b79ff;
  --accent2: #22d3ee;
  --good: #34d399;
  --bad: #fb7185;
}

/* Helles Design */
body:not(.dark) {
  color-scheme: light;
  --bg: #edf2ff;
  --card: rgba(255, 255, 255, .82);
  --ink: #18233e;
  --muted: #62708e;
  --line: rgba(77, 99, 155, .17);
  --accent: #6948df;
  --accent2: #0891b2;
  --good: #087f5b;
  --bad: #d92d4c;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(
      ellipse at 15% 15%,
      rgba(124, 58, 237, .23),
      transparent 38%
    ),
    radial-gradient(
      ellipse at 85% 65%,
      rgba(6, 182, 212, .17),
      transparent 42%
    ),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Animierte Lichtflächen */
body::before,
body::after {
  content: "";
  position: fixed;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  filter: blur(95px);
  opacity: .35;
  pointer-events: none;
  z-index: -1;
  animation: floatGlow 15s ease-in-out infinite alternate;
}

body::before {
  top: 5%;
  left: -130px;
  background: #8b5cf6;
}

body::after {
  right: -130px;
  bottom: 5%;
  background: #06b6d4;
  animation-delay: -7s;
}

@keyframes floatGlow {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(65px, 45px) scale(1.25);
  }
}

/* Layout */
header,
main,
footer {
  max-width: 1100px;
  margin: auto;
  padding: 24px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 36px;
  padding-bottom: 30px;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 900;
  letter-spacing: -.05em;
  background: linear-gradient(110deg, #a78bfa, #22d3ee);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

h2 {
  margin: 0 0 25px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -.035em;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

/* Hauptkarten */
.card {
  position: relative;
  padding: clamp(24px, 5vw, 48px);
  margin-bottom: 25px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 25px 70px rgba(0, 0, 0, .16),
    inset 0 1px rgba(255, 255, 255, .12);
  animation: cardEnter .45s ease both;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hidden {
  display: none !important;
}

/* Eingabefelder */
label {
  display: block;
  margin: 18px 0;
  font-weight: 650;
}

input:not([type="checkbox"]),
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 9px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(127, 147, 190, .08);
  color: var(--ink);
  font: inherit;
  transition:
    border-color .2s,
    box-shadow .2s,
    background .2s;
}

select option {
  background: var(--bg);
  color: var(--ink);
}

input:not([type="checkbox"]):hover,
select:hover,
textarea:hover {
  border-color: var(--accent);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .12);
}

input[type="checkbox"] {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  vertical-align: middle;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  padding: 14px 0;
}

.options label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 5px 0;
}

/* Buttons */
button {
  cursor: pointer;
  padding: 13px 22px;
  margin: 6px 8px 6px 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(127, 147, 190, .10);
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  transition:
    transform .2s,
    box-shadow .2s,
    border-color .2s,
    background .2s;
}

button:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 10px 25px rgba(0, 0, 0, .14);
}

button:active {
  transform: scale(.97);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent2);
  outline-offset: 3px;
}

.primary {
  border: none;
  color: #fff;
  background: linear-gradient(120deg, #7952ed, #7c3aed, #0891b2);
  box-shadow: 0 8px 28px rgba(124, 58, 237, .28);
}

.primary:hover {
  box-shadow: 0 12px 35px rgba(124, 58, 237, .45);
}

/* Statistik-Karten */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.stats > div {
  padding: 22px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(
    145deg,
    rgba(139, 92, 246, .12),
    rgba(34, 211, 238, .04)
  );
  color: var(--muted);
  text-align: center;
  font-size: .9rem;
}

.stats strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

/* Tippbereich */
#target {
  margin: 24px 0;
  padding: 28px;
  min-height: 170px;
  max-height: 330px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(5, 12, 28, .12);
  font:
    clamp(1.1rem, 2.3vw, 1.5rem)/2
    ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: none;
  letter-spacing: .015em;
}

#target .correct {
  color: var(--good);
  background: rgba(52, 211, 153, .12);
  border-radius: 3px;
}

#target .wrong {
  color: var(--bad);
  background: rgba(251, 113, 133, .2);
  text-decoration: underline wavy;
  border-radius: 3px;
}

#target .cursor {
  border-left: 3px solid var(--accent2);
  background: rgba(34, 211, 238, .13);
  animation: cursorPulse .85s infinite;
}

@keyframes cursorPulse {
  50% {
    border-left-color: transparent;
  }
}

#typing {
  min-height: 105px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.1rem;
  resize: vertical;
}

#typing:focus {
  outline: none;
}

/* Countdown */
#countdown {
  min-height: 45px;
  text-align: center;
  color: var(--accent2);
  font-size: 2.3rem;
  font-weight: 900;
  text-shadow: 0 0 25px rgba(34, 211, 238, .3);
}

/* Ergebnis */
#summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

#summary p {
  margin: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(127, 147, 190, .07);
  color: var(--ink);
}

#record {
  padding: 18px;
  border: 1px solid rgba(52, 211, 153, .3);
  border-radius: 14px;
  background: rgba(52, 211, 153, .08);
  color: var(--good);
  font-weight: 750;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* Bestenliste */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 25px;
}

.tabs button {
  margin: 0;
}

.tabs button.active {
  border-color: transparent;
  color: white;
  background: linear-gradient(120deg, #7952ed, #0891b2);
}

.tableWrap {
  margin: 20px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 17px 15px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  background: rgba(139, 92, 246, .12);
  color: var(--muted);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

tbody tr {
  transition: background .2s;
}

tbody tr:hover {
  background: rgba(139, 92, 246, .10);
}

tbody tr:nth-child(1) {
  background: rgba(245, 158, 11, .12);
}

tbody tr:nth-child(2) {
  background: rgba(148, 163, 184, .10);
}

tbody tr:nth-child(3) {
  background: rgba(180, 116, 62, .10);
}

tbody tr:nth-child(1) td:first-child {
  color: #e9a514;
  font-weight: 900;
}

tbody tr:nth-child(2) td:first-child {
  color: #94a3b8;
  font-weight: 900;
}

tbody tr:nth-child(3) td:first-child {
  color: #c88b5a;
  font-weight: 900;
}

/* Persönlicher Rekord */
#best {
  margin-top: 20px;
  color: var(--accent2);
  font-weight: 750;
}

/* Footer */
footer {
  padding-bottom: 35px;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}

/* Responsive */
@media (max-width: 650px) {
  header,
  main,
  footer {
    padding: 14px;
  }

  header {
    padding-top: 25px;
    padding-bottom: 20px;
  }

  .card {
    padding: 20px;
    border-radius: 20px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  #summary {
    grid-template-columns: 1fr;
  }

  #target {
    padding: 17px;
  }

  button {
    padding: 12px 15px;
  }
}

/* Animationen bei reduzierter Bewegung deaktivieren */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
