/* Statusseite im Minecraft-Stil: Erd-Hintergrund wie im Optionsmenü, graue Inventar-Fenster, Pixel-Schrift */
@font-face {
  font-family: "Pixelify Sans";
  src: url("fonts/pixelify-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Pixelify Sans";
  src: url("fonts/pixelify-sans-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --gui: #c6c6c6;          /* Inventar-Grau */
  --gui-hi: #ffffff;       /* helle Kante oben/links */
  --gui-lo: #555555;       /* dunkle Kante unten/rechts */
  --gui-edge: #000000;
  --slot: #8b8b8b;
  --slot-hi: #ffffff;
  --slot-lo: #373737;
  --text: #3f3f3f;
  --muted: #5e5e5e;
  --field: #000000;
  --field-text: #e0e0e0;
  --line: rgba(0, 0, 0, .18);
  --ok: #55c837;           /* Smaragd/Gras */
  --quiet: #8e6bff;        /* Nacht/Enderperle */
  --off: #e0281e;          /* Redstone */
  --nodata: #8b8b8b;
  --gold: #ffff55;         /* Chat-Gelb */
  --page: #2b1f15;
  --px: 3px;               /* ein "Pixel" der Oberfläche */
  --shadow-text: 2px 2px 0 #3f3f3f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --gui: #313136;
    --gui-hi: #5a5a63;
    --gui-lo: #18181b;
    --slot: #232327;
    --slot-hi: #45454c;
    --slot-lo: #101012;
    --text: #ececec;
    --muted: #a8a8b0;
    --line: rgba(255, 255, 255, .1);
    --page: #120d09;
  }
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); }
body {
  margin: 0;
  min-height: 100vh;
  padding: 16px;
  font-family: "Pixelify Sans", ui-monospace, monospace;
  font-size: 19px;
  color: var(--text);
  /* Erde, abgedunkelt wie im Optionsmenü */
  background:
    linear-gradient(rgba(0, 0, 0, .55), rgba(0, 0, 0, .55)),
    url("img/dirt.svg") 0 0 / 64px 64px repeat;
  image-rendering: pixelated;
}
@media (prefers-color-scheme: dark) {
  body { background: linear-gradient(rgba(0, 0, 0, .7), rgba(0, 0, 0, .7)), url("img/dirt.svg") 0 0 / 64px 64px repeat; }
}
a { color: #2a52be; }
@media (prefers-color-scheme: dark) { a { color: #7fb2ff; } }
.wrap { width: min(1180px, 100%); margin: 0 auto; display: grid; gap: 18px; }
.narrow { width: min(440px, 100%); min-height: calc(100vh - 32px); align-content: center; }

/* Fenster mit Pixel-Kanten (wie das Inventar) */
.card, .panel, .msg {
  background: var(--gui);
  border: var(--px) solid var(--gui-edge);
  box-shadow: inset var(--px) var(--px) 0 var(--gui-hi), inset calc(-1 * var(--px)) calc(-1 * var(--px)) 0 var(--gui-lo);
  border-radius: 0;
}
.card { padding: 26px 26px 22px; text-align: center; }
.panel { padding: 18px 20px 20px; min-width: 0; }
h1 { margin: 0 0 8px; font-size: 1.6rem; font-weight: 700; letter-spacing: .02em; }
h2 { margin: 0 0 14px; font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
p { margin: 0 0 16px; line-height: 1.45; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Titelbildschirm */
.title { position: relative; text-align: center; margin: 0 0 6px; padding: 10px 0 18px; }
.title-text {
  display: inline-block;
  font-size: clamp(2.4rem, 11vw, 3.6rem);
  font-weight: 700;
  letter-spacing: .04em;
  color: #b8b8b8;
  background: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, .1)), url("img/stone.svg") 0 0 / 48px 48px;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 2px #1f1f1f;
  filter: drop-shadow(0 4px 0 #1f1f1f) drop-shadow(0 6px 0 rgba(0, 0, 0, .45));
}
.splash {
  position: absolute;
  right: 4%;
  bottom: 6px;
  color: var(--gold);
  font-weight: 700;
  font-size: 1rem;
  text-shadow: 2px 2px 0 #3f3f00;
  transform: rotate(-16deg);
  animation: splash .55s ease-in-out infinite alternate;
  white-space: nowrap;
}
@keyframes splash { to { transform: rotate(-16deg) scale(1.1); } }

.logo { width: 40px; height: 40px; flex: none; }
.logo .block {
  display: block; width: 100%; height: 100%;
  background: url("img/grass_side.svg") 0 0 / 100% 100%;
  border: 2px solid #000;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18);
}

/* Formulare */
.form { display: grid; gap: 12px; text-align: left; margin-top: 18px; }
label { display: grid; gap: 6px; font-size: .95rem; color: var(--text); }
input {
  font: inherit; font-size: 1rem;
  color: var(--field-text);
  padding: 9px 10px;
  background: var(--field);
  border: 2px solid #a0a0a0;
  border-radius: 0;
  min-width: 0;
  caret-color: #fff;
}
input:focus { outline: none; border-color: #ffffff; }
input::placeholder { color: #7a7a7a; }

/* Buttons wie im Spielmenü */
.btn {
  font: inherit; font-size: 1.05rem; cursor: pointer;
  padding: 10px 18px;
  color: #ffffff;
  text-shadow: var(--shadow-text);
  background: #727272 url("img/stone.svg") 0 0 / 48px 48px;
  border: 2px solid #000;
  border-radius: 0;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .45), inset -2px -3px 0 rgba(0, 0, 0, .4);
  background-blend-mode: multiply;
}
.btn:hover, .btn:focus-visible { outline: none; border-color: #fff; color: #ffffa0; }
.btn:active { box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .4); }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.btn.ghost { background-color: #8b8b8b; }
.btn.ok { background-color: #4f9e2f; }
.btn.danger { background-color: #b0302a; }
.link-btn { font: inherit; color: #e0e0e0; text-shadow: var(--shadow-text); background: none; border: 0; cursor: pointer; padding: 6px 4px; }
.link-btn:hover { color: var(--gold); }
.switch { margin: 18px 0 0; font-size: .95rem; color: var(--muted); }
.inline { display: inline; margin: 0; }
.msg { padding: 12px 16px; }
.msg-ok { background: #d6f5c4; color: #1d4a10; }
.msg-error { background: #ffd2cc; color: #6b0f0a; }
.msg-info { background: #e3dcff; color: #2f1f73; }
@media (prefers-color-scheme: dark) {
  .msg-ok { background: #1f3a16; color: #c9f5b3; }
  .msg-error { background: #4a1714; color: #ffc9c2; }
  .msg-info { background: #2a2350; color: #dcd3ff; }
}

/* Kopfzeile */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { white-space: nowrap; display: flex; align-items: center; gap: 12px; color: #fff; text-shadow: var(--shadow-text); text-decoration: none; font-weight: 700; font-size: 1.3rem; }
.top nav { display: flex; align-items: center; gap: 4px; }
.top nav a { padding: 6px 10px; color: #e0e0e0; text-shadow: var(--shadow-text); text-decoration: none; border: 2px solid transparent; }
.top nav a.on { border-color: #fff; }
.top nav a:hover { color: var(--gold); }

/* Statusfeld: kleine Szene mit Himmel, Sonne/Mond und Grasblöcken */
.hero {
  --c: var(--nodata);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 190px;
  padding: 26px 26px 66px;
  border: var(--px) solid #000;
  color: #fff;
  background: linear-gradient(#5f9bff, #a9cbff);
}
.hero::after {   /* Boden */
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 40px;
  background: url("img/grass_side.svg") 0 0 / 40px 40px repeat-x;
  border-top: 2px solid rgba(0, 0, 0, .35);
}
.hero > div:not(.sky) { position: relative; z-index: 1; }
.hero h1 { color: #fff; font-size: 2.4rem; margin: 2px 0 6px; text-shadow: 3px 3px 0 rgba(0, 0, 0, .55); }
.hero p { margin: 0; color: #fff; text-shadow: var(--shadow-text); font-size: 1.15rem; }
.hero .muted { color: rgba(255, 255, 255, .85); text-shadow: var(--shadow-text); }
.hero .badge {
  display: inline-block; margin-bottom: 4px; padding: 2px 8px;
  font-size: .85rem; background: var(--c); color: #fff; text-shadow: var(--shadow-text);
  border: 2px solid #000;
}
.sky { position: absolute; inset: 0; pointer-events: none; }
.celestial {
  position: absolute; right: 9%; top: 22px;
  width: 64px; height: 64px;
  background: url("img/sun.svg") 0 0 / 100% 100%;
  filter: drop-shadow(0 0 18px rgba(255, 240, 120, .8));
}
.state-running { --c: #3f9b22; }
.state-quiet {
  --c: var(--quiet);
  background:
    radial-gradient(2px 2px at 12% 22%, #fff 99%, transparent),
    radial-gradient(2px 2px at 28% 58%, #fff 99%, transparent),
    radial-gradient(2px 2px at 47% 18%, #fff 99%, transparent),
    radial-gradient(2px 2px at 63% 46%, #dfe6ff 99%, transparent),
    radial-gradient(2px 2px at 71% 12%, #fff 99%, transparent),
    radial-gradient(2px 2px at 92% 60%, #fff 99%, transparent),
    radial-gradient(2px 2px at 38% 36%, #cfd8ff 99%, transparent),
    linear-gradient(#0b1030, #26306a);
}
.state-quiet .celestial { background-image: url("img/moon.svg"); filter: drop-shadow(0 0 14px rgba(200, 210, 255, .6)); }
.state-quiet::after { filter: brightness(.45) saturate(.7); }
.state-offline { --c: var(--off); background: linear-gradient(rgba(0, 0, 0, .35), rgba(0, 0, 0, .35)), url("img/stone.svg") 0 0 / 48px 48px; }
.state-offline::after { background-image: url("img/deepslate.svg"); }
.state-offline .celestial { background-image: url("img/barrier.svg"); filter: none; animation: blink 1.6s steps(1) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.state-running .celestial { animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .celestial, .splash { animation: none !important; } }
.refresh {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 12px;
  margin-top: -8px;
  font-size: 1.05rem; color: #fff; text-shadow: var(--shadow-text);
}
.refresh #updated { font-weight: 700; }
.refresh .sep { color: #aaa; }
.refresh #countdown { color: #e0e0e0; font-variant-numeric: tabular-nums; min-width: 12.5em; }
.refresh .btn { font-size: .95rem; padding: 5px 12px; }
.refresh .btn:disabled { opacity: .6; cursor: progress; }

.grid { display: grid; gap: 18px; grid-template-columns: 1fr 2fr; }
.count {
  margin-left: auto; font-size: .95rem; font-weight: 700;
  color: #fff; text-shadow: var(--shadow-text);
  padding: 2px 10px; background: var(--slot);
  box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--slot-hi);
}

/* Spieler als Inventar-Slots */
.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.players li {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 8px 5px 5px;
  font-weight: 700; overflow-wrap: anywhere;
  background: var(--slot);
  color: #fff; text-shadow: var(--shadow-text);
  box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--slot-hi);
}
.head { width: 32px; height: 32px; flex: none; display: block; border: 2px solid rgba(0, 0, 0, .55); }
.head svg { display: block; width: 100%; height: 100%; }
.who .head { width: 36px; height: 36px; }
.empty { margin: 0; }
.note-quiet, .note-offline {
  padding: 12px 14px; line-height: 1.4; font-weight: 700;
  color: #fff; text-shadow: var(--shadow-text);
  border: 2px solid #000;
}
.note-quiet { background: #3b2f80; }
.note-offline { background: #8a2420; }

/* Diagramm im Slot-Rahmen */
.chart {
  width: 100%; overflow: hidden;
  background: var(--slot);
  box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--slot-hi);
  padding: 4px;
}
.chart svg { display: block; width: 100%; height: auto; font-family: "Pixelify Sans", monospace; }
.band { opacity: .35; }
.band.running { fill: var(--ok); }
.band.quiet { fill: var(--quiet); }
.band.offline { fill: var(--off); opacity: .45; }
.band.nodata { fill: #000; opacity: .15; }
.gridline { stroke: rgba(255, 255, 255, .18); }
.ax { fill: #fff; font-size: 15px; paint-order: stroke; stroke: rgba(0, 0, 0, .55); stroke-width: 3px; }
.area { fill: rgba(255, 255, 85, .45); stroke: var(--gold); stroke-width: 2; stroke-linejoin: miter; shape-rendering: crispEdges; }
.tipline { stroke: #fff; stroke-dasharray: 3 3; }
.tiptext { fill: #fff; font-size: 15px; font-weight: 700; paint-order: stroke; stroke: #1f1f1f; stroke-width: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 1rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; display: inline-block; border: 2px solid #000; }
.sw.running { background: var(--ok); }
.sw.quiet { background: var(--quiet); }
.sw.offline { background: var(--off); }
.sw.nodata { background: var(--nodata); }

/* Verlauf wie der Spiel-Chat */
.events {
  list-style: none; margin: 0; padding: 8px 10px;
  max-height: 420px; overflow-y: auto;
  background: rgba(0, 0, 0, .72);
  border: 2px solid #000;
}
.events li { display: flex; gap: 12px; padding: 3px 0; align-items: baseline; color: #fff; text-shadow: 2px 2px 0 #3f3f3f; }
.events time { font-variant-numeric: tabular-nums; color: #aaaaaa; flex: none; width: 3.4em; }
.ev-join span, .ev-leave span { color: var(--gold); text-shadow: 2px 2px 0 #3f3f15; }
.ev-running span { color: #55ff55; text-shadow: 2px 2px 0 #153f15; }
.ev-quiet span { color: #d0a4ff; text-shadow: 2px 2px 0 #2c1a40; }
.ev-offline span { color: #ff5555; text-shadow: 2px 2px 0 #3f1515; }
.ev-gap span { color: #aaaaaa; }
.events[hidden] { display: none; }
.panel > .events + .empty { margin-top: 8px; }

/* Admin */
.table { display: grid; gap: 8px; }
.row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--slot) 35%, var(--gui));
  box-shadow: inset 2px 2px 0 var(--gui-lo), inset -2px -2px 0 var(--gui-hi);
}
.who { display: flex; align-items: center; gap: 12px; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pw { display: inline-flex; gap: 6px; }
.pw input { width: 160px; padding: 6px 8px; font-size: .9rem; }
.tag { font-size: .78rem; font-weight: 700; padding: 1px 6px; margin-left: 6px; color: #fff; text-shadow: 1px 1px 0 #000; border: 2px solid #000; }
.tag-admin { background: #d9a400; }
.tag-wait { background: var(--quiet); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0 0 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }
code { font-family: ui-monospace, monospace; font-size: .85rem; overflow-wrap: anywhere; padding: 2px 6px; color: var(--field-text); background: var(--field); }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .grid { grid-template-columns: 1fr; }
  .hero { flex-wrap: wrap; padding: 22px 18px 76px; min-height: 0; }
  .hero h1 { font-size: 1.9rem; }
  .refresh { justify-content: flex-start; margin-top: -6px; font-size: 1rem; }
  .refresh #countdown { min-width: 0; }
  .brand span { display: none; }
  .top nav a, .link-btn { padding: 6px; }
  .celestial { width: 48px; height: 48px; top: 14px; right: 18px; }
  .kv { grid-template-columns: 1fr; }
  .splash { right: 0; font-size: .9rem; }
}
