:root {
  --rough: #1d4a2c;
  --rough-deep: #153a22;
  --fairway: #4e9a3e;
  --fairway-mown: #58a647;
  --rail: #6e4a28;
  --rail-light: #9a6c3e;
  --sand: #ecdcae;
  --sand-edge: #d6c08a;
  --ink: #2a2214;
  --flag: #c8302a;
  --flag-light: #e45a4f;
  --flag-dark: #8c1d18;
  --ball: #fbfbf4;
  --text: #eef3e6;
  --text-muted: #bcd2b2;

  --font: Verdana, "DejaVu Sans", Geneva, Tahoma, sans-serif;
  --font-code: Consolas, "Lucida Console", "DejaVu Sans Mono", monospace;

  /* Typografische Skala: Quarte (1.333) ab 1rem */
  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.333rem;
  --step-2: 1.777rem;
  --step-4: clamp(3.2rem, 11vw, 5.6rem);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--rough);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
}

.wrap {
  width: 100%;
  max-width: 46rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

a { color: var(--ball); text-underline-offset: 0.18em; }
a:hover { color: var(--sand); }

:focus-visible {
  outline: 3px solid var(--sand);
  outline-offset: 3px;
}

code {
  font-family: var(--font-code);
  font-size: 0.95em;
}

/* ---------- Kopf und Übungsgrün ---------- */

.hero { padding-block: 2.5rem 1rem; }

h1 {
  margin: 0;
  font-size: var(--step-4);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.045em;
  color: var(--ball);
}

.lede {
  margin: 0.9rem 0 0;
  max-width: 34rem;
  font-size: var(--step-1);
  line-height: 1.45;
  color: var(--text-muted);
}

.course { margin-block: 2rem 0; }

#green {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 7;
  border: 10px solid var(--rail);
  border-top-color: var(--rail-light);
  border-left-color: var(--rail-light);
  border-radius: 14px;
  background: var(--fairway);
  cursor: crosshair;
  touch-action: none;
}

@media (max-width: 34rem) {
  #green { aspect-ratio: 4 / 3; border-width: 8px; }
}

.course figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-top: 0.6rem;
  font-size: var(--step--1);
  color: var(--text-muted);
}

#score { color: var(--ball); font-weight: 700; }

/* ---------- Inhalt ---------- */

main { padding-bottom: 1rem; }

section { margin-top: 3rem; }

h2 {
  margin: 0 0 0.75rem;
  font-size: var(--step-2);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ball);
}

p { margin: 0 0 1rem; max-width: 40rem; }

/* Serveradresse als Sandplatte */
.plate {
  display: grid;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  background: var(--sand);
  color: var(--ink);
  border: 2px solid var(--sand-edge);
  border-radius: 22px 30px 26px 18px;
}

.plate-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
}

.plate-label {
  width: 3.5rem;
  font-size: var(--step--1);
  color: #6b5a36;
}

.plate code {
  font-size: clamp(1rem, 4.4vw, 1.333rem);
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* Knöpfe im Stil der alten Java-Applets: hell oben links, dunkel unten rechts */
.bevel {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 3px solid;
  border-radius: 4px;
}

.bevel-flag {
  display: block;
  max-width: 26rem;
  padding: 0.85rem 1.2rem;
  font-size: var(--step-1);
  line-height: 1.3;
  color: var(--ball);
  background: var(--flag);
  border-color: var(--flag-light) var(--flag-dark) var(--flag-dark) var(--flag-light);
}

.bevel-flag small {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--step--1);
  font-weight: 400;
  color: #ffe2dc;
}

.bevel-flag:hover { color: var(--ball); background: #d63a33; }

.bevel:active {
  border-color: var(--flag-dark) var(--flag-light) var(--flag-light) var(--flag-dark);
}

.bevel-small {
  margin-left: auto;
  padding: 0.3rem 0.8rem;
  font-size: var(--step--1);
  color: var(--ink);
  background: #f6ead0;
  border-color: #fffaf0 #b39c66 #b39c66 #fffaf0;
}

.bevel-small:active { border-color: #b39c66 #fffaf0 #fffaf0 #b39c66; }

.others {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.1rem;
}

.others li { padding-left: 1rem; border-left: 3px solid var(--fairway); }
.others li > a { font-weight: 700; }
.others p { margin: 0.2rem 0 0; font-size: var(--step--1); color: var(--text-muted); }
.others [data-size] { font-size: var(--step--1); color: var(--text-muted); margin-left: 0.4rem; }

/* Echte Reihenfolge: nummeriert, mit Bällen als Marken */
.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.75rem;
  max-width: 40rem;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ball);
  color: var(--ink);
  font-weight: 700;
  font-size: var(--step--1);
  box-shadow: inset -3px -3px 0 rgba(42, 34, 20, 0.18);
}

.pairs { margin: 0; }
.pairs dt { font-weight: 700; color: var(--ball); }
.pairs dd { margin: 0.15rem 0 1rem; max-width: 40rem; color: var(--text-muted); }

/* ---------- Server offen/zu ---------- */

.gate-status {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-weight: 700;
  color: var(--ball);
}

.gate-status::before {
  content: "";
  flex: none;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--flag-light);
  box-shadow: 0 0 0 3px rgba(228, 90, 79, 0.25);
}

.gate-status.is-open::before {
  background: #8fe07a;
  box-shadow: 0 0 0 3px rgba(143, 224, 122, 0.25);
}

/* ---------- Adminseite ---------- */

.hero-small { padding-bottom: 0; }
.hero-small h1 { font-size: var(--step-2); letter-spacing: -0.02em; }
.back { margin-bottom: 1rem; font-size: var(--step--1); }

h3 { margin: 1.5rem 0 0.6rem; font-size: var(--step-0); color: var(--ball); }

.admin-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
  max-width: 30rem;
}

.admin-form .plate-label { width: auto; }

.admin-form input {
  flex: 1 1 12rem;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  font: inherit;
  color: var(--ink);
  background: #fffaf0;
  border: 2px solid var(--sand-edge);
  border-radius: 4px;
}

.admin-form .bevel-small { margin-left: 0; }

.admin-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.admin-buttons .bevel-small { margin-left: 0; font-size: var(--step-0); padding: 0.45rem 1rem; }

.admin-hint { margin-top: 0.6rem; font-size: var(--step--1); color: var(--text-muted); }
.admin-error { min-height: 1.6em; margin-top: 0.6rem; color: #ffb4ab; font-weight: 700; }

.bevel-close { margin-top: 1.5rem; font-size: var(--step-0); }
.bevel:disabled { opacity: 0.45; cursor: not-allowed; }

.linkish {
  padding: 0;
  font: inherit;
  color: var(--ball);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

/* ---------- Fuß ---------- */

footer {
  margin-top: 3.5rem;
  padding-block: 0 2.5rem;
  font-size: var(--step--1);
  color: var(--text-muted);
}

footer::before {
  content: "";
  display: block;
  height: 2px;
  margin-bottom: 1.5rem;
  background: var(--rough-deep);
}

footer p { margin-bottom: 0.4rem; }

[hidden] { display: none !important; }
