/* ===== CUS2 dashboard — Minecraft-themed, buildless ===== */
:root {
  color-scheme: dark;
  --bg: #0e1622;
  --bg-2: #0a1019;
  --panel: #16202e;
  --panel-2: #1b2838;
  --edge: #0a0f17;
  --line: #2a3a4f;
  --text: #e8eef5;
  --muted: #8aa0b6;
  --grass: #6ab04c;
  --grass-bright: #8fe05a;
  --dirt: #8a5a3b;
  --gold: #f6c344;
  --redstone: #e2533f;
  --diamond: #4fd6e0;
  --good: #58d36e;
  --warn: #f6c344;
  --bad: #e2533f;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "VT323", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px;
  color: var(--text);
  background: radial-gradient(1200px 700px at 50% -10%, #1a2740 0%, var(--bg) 45%, var(--bg-2) 100%);
  min-height: 100vh;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: .5;
  pointer-events: none;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---- headings / pixel font ---- */
h1, h2, h3, .kicker, .label, .ring-label, .status-badge, .tag, summary h2 {
  font-family: "Press Start 2P", "VT323", monospace;
}
h1 { font-size: 18px; margin: 0 0 6px; letter-spacing: .5px; }
h2 { font-size: 12px; margin: 0; color: var(--grass-bright); text-transform: uppercase; letter-spacing: 1px; }
h3 { font-size: 10px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; }
.tagline { margin: 0; color: var(--muted); font-size: 18px; }

/* ---- card base: blocky with hard pixel edge ---- */
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 2px 0 rgba(255, 255, 255, .04), inset 0 -4px 0 rgba(0, 0, 0, .35);
  padding: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }

/* ---- top bar ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }

/* bobbing grass-block cube */
.cube { position: relative; width: 38px; height: 38px; display: inline-block; animation: bob 3.2s ease-in-out infinite; }
.cube i { position: absolute; inset: 0; border-radius: 5px; }
.cube i:nth-child(1) { background: var(--grass); box-shadow: inset 0 -10px 0 rgba(0,0,0,.18); }
.cube i:nth-child(2) { background: repeating-linear-gradient(45deg, #5a9a3f, #5a9a3f 4px, #67ad49 4px, #67ad49 8px); opacity: 0; }
.cube i:nth-child(3) { background: linear-gradient(180deg, transparent 60%, var(--dirt) 60%); border-radius: 5px; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }

.status-badge {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 10px; padding: 9px 13px; border-radius: 999px;
  border: 2px solid var(--line); background: rgba(0, 0, 0, .25);
  text-transform: uppercase; letter-spacing: 1px;
}
.status-badge .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--muted); }
body[data-state="online"] .status-badge { border-color: rgba(88, 211, 110, .5); color: var(--good); }
body[data-state="online"] .status-badge .dot { background: var(--good); animation: pulse 1.8s infinite; }
body[data-state="offline"] .status-badge { border-color: rgba(226, 83, 63, .5); color: var(--bad); }
body[data-state="offline"] .status-badge .dot { background: var(--bad); }
body[data-state="attention"] .status-badge { border-color: rgba(246, 195, 68, .5); color: var(--warn); }
body[data-state="attention"] .status-badge .dot { background: var(--warn); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(88,211,110,.6); } 70% { box-shadow: 0 0 0 10px rgba(88,211,110,0); } 100% { box-shadow: 0 0 0 0 rgba(88,211,110,0); } }

/* ---- hero ---- */
.hero { display: grid; grid-template-columns: 1fr 220px; gap: 18px; }
.connect { display: flex; flex-direction: column; justify-content: center; gap: 12px; position: relative; overflow: hidden; }
.connect::before { content: ""; position: absolute; inset: 0; background: radial-gradient(400px 120px at 0% 0%, rgba(106,176,76,.16), transparent 70%); pointer-events: none; }
.kicker { font-size: 10px; color: var(--grass-bright); text-transform: uppercase; letter-spacing: 1.5px; }
.address {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  font-family: "VT323", monospace; font-size: 34px; line-height: 1;
  color: var(--text); background: var(--edge);
  border: 2px solid var(--line); border-radius: 10px;
  padding: 14px 16px; cursor: pointer; width: 100%; text-align: left;
  transition: border-color .15s, transform .05s;
}
.address:hover { border-color: var(--grass); }
.address:active { transform: translateY(1px); }
.address.copied { border-color: var(--grass-bright); }
.copy-hint {
  font-family: "Press Start 2P", monospace; font-size: 9px;
  color: var(--bg); background: var(--grass-bright); padding: 7px 9px; border-radius: 6px;
  text-transform: uppercase; white-space: nowrap;
}
.connect-note { margin: 0; color: var(--muted); font-size: 17px; }

/* player ring */
.ring-wrap { position: relative; display: grid; place-items: center; padding: 14px; }
.ring { width: 170px; height: 170px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--edge); stroke-width: 10; }
.ring-fg { fill: none; stroke: var(--grass); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 327; transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1), stroke .3s; filter: drop-shadow(0 0 6px rgba(106,176,76,.5)); }
.ring-center { position: absolute; display: grid; place-items: center; text-align: center; }
.ring-center strong { font-size: 44px; line-height: .9; }
.ring-center span { color: var(--muted); font-size: 18px; }
.ring-label { font-size: 9px !important; text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }

/* ---- player heads ---- */
.players-card .head-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.head { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 64px; animation: popin .35s ease both; }
.head img {
  width: 52px; height: 52px; image-rendering: pixelated;
  border: 2px solid var(--line); border-radius: 8px; background: var(--edge);
  box-shadow: 0 4px 0 rgba(0,0,0,.3); transition: transform .12s;
}
.head:hover img { transform: translateY(-4px) scale(1.05); border-color: var(--grass); }
.head span { font-size: 15px; color: var(--muted); max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes popin { from { opacity: 0; transform: translateY(8px) scale(.8); } to { opacity: 1; transform: none; } }

/* ---- stat tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.tile { display: flex; flex-direction: column; gap: 4px; transition: transform .12s, border-color .12s; }
.tile:hover { transform: translateY(-3px); border-color: var(--line); }
.label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.big { font-size: 38px; line-height: 1; }
.sub { color: var(--muted); font-size: 16px; }

/* progress bars */
.bar { margin-top: 8px; height: 12px; background: var(--edge); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.bar-fill { display: block; height: 100%; width: 0%; border-radius: 6px; background: linear-gradient(90deg, var(--grass), var(--grass-bright)); transition: width .8s cubic-bezier(.2,.8,.2,1), background .3s; }

/* ---- columns: graph + feed ---- */
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
/* Let grid cells shrink to their track instead of their content, so a wide card
   header (e.g. the zoom controls) can't blow out the equal-width columns. */
.columns > * { min-width: 0; }
/* graph-card is a flex column so the timeline can grow into the card's spare
   vertical space (the heads stack into more rows when there's room). */
.graph-card { display: flex; flex-direction: column; }
.graph-card canvas { width: 100%; display: block; flex: 0 0 auto; }

/* ---- timeline strip under the graph (8h window) ---- */
.timeline { position: relative; flex: 1 1 auto; min-height: 88px; margin-top: 10px; }
.tl-track { position: absolute; top: 4px; left: 0; right: 0; height: 6px; border-radius: 3px; background: rgba(143, 224, 90, .30); }
.tl-down { position: absolute; top: 0; height: 6px; background: var(--bad); border-radius: 3px; }
.tl-head { position: absolute; width: 20px; height: 20px; margin-left: -10px; image-rendering: pixelated; border-radius: 4px; border: 2px solid var(--line); background: var(--edge); }
.tl-head.tl-joined { border-color: var(--good); }
.tl-head.tl-left { border-color: var(--bad); opacity: .65; }
.tl-axis { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; max-height: 220px; overflow: auto; }
.feed li { display: flex; align-items: center; gap: 9px; font-size: 17px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed img { width: 24px; height: 24px; image-rendering: pixelated; border-radius: 5px; }
.feed .verb-join { color: var(--good); }
.feed .verb-leave { color: var(--muted); }
.feed .verb-adv { color: var(--gold); flex-shrink: 0; }
.feed .srv-tag { flex-shrink: 0; color: var(--gold); font-family: "Press Start 2P", monospace; font-size: 9px; }
.feed .msg { flex: 1; min-width: 0; color: #cdd9e5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .msg::before { content: "“"; color: var(--muted); }
.feed .msg::after { content: "”"; color: var(--muted); }
.feed .when { margin-left: auto; color: var(--muted); font-size: 14px; white-space: nowrap; }

/* ---- services ---- */
.service-row { display: flex; flex-wrap: wrap; gap: 10px; }
.svc { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 9px; background: var(--edge); border: 2px solid var(--line); font-size: 16px; }
.svc .led { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 6px currentColor; }
.svc.up .led { background: var(--good); color: var(--good); }
.svc.down .led { background: var(--bad); color: var(--bad); }
.svc b { text-transform: capitalize; }
.svc small { color: var(--muted); }

/* ---- tags / misc ---- */
.tag { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.head-right { display: flex; align-items: center; gap: 10px; }
.zoom { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.zoom button { font-family: "VT323", monospace; font-size: 15px; line-height: 1; padding: 4px 9px; border: 0; border-left: 1px solid var(--line); background: var(--panel-2); color: var(--muted); cursor: pointer; }
.zoom button:first-child { border-left: 0; }
.zoom button.on { background: var(--grass); color: #07210a; }
.muted { color: var(--muted); }

/* ---- say box ---- */
.say-form { display: flex; gap: 10px; margin-top: 4px; }
.say-form input { flex: 1; min-width: 0; font-family: "VT323", monospace; font-size: 19px; color: var(--text); background: var(--edge); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.say-form input:focus { outline: none; border-color: var(--grass); }
.say-form button { white-space: nowrap; }
.say-hint { margin: 9px 0 0; color: var(--muted); font-size: 14px; }

/* ---- logs ---- */
.logs summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
.logs summary::-webkit-details-marker { display: none; }
.logs .chev { transition: transform .2s; color: var(--muted); }
.logs[open] .chev { transform: rotate(180deg); }
pre { background: var(--edge); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; max-height: 220px; font-size: 15px; color: #cdd9e5; white-space: pre-wrap; word-break: break-word; }
/* Manager status and the watchdog tail are short; show them in full so the
   bottom lines are visible without scrolling, and keep the two boxes matched. */
#manager-status, #watchdog-log { max-height: none; }
.logs[open] .columns { margin-top: 12px; }

/* ---- footer / buttons ---- */
.footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 16px; }
.foot-actions { display: flex; gap: 10px; }
button { font-family: "Press Start 2P", monospace; font-size: 9px; cursor: pointer; border-radius: 8px; padding: 11px 14px; border: 2px solid var(--line); color: var(--text); background: var(--panel-2); text-transform: uppercase; letter-spacing: .5px; transition: transform .05s, border-color .12s, background .12s; }
button:hover { border-color: var(--grass); }
button:active { transform: translateY(2px); }
button.ghost { background: transparent; }
button.danger { background: #3a1d1a; border-color: #6a2f28; color: #ffb4a8; }
button.danger:hover { border-color: var(--redstone); }
button:disabled { opacity: .4; cursor: not-allowed; }

/* ---- dialog ---- */
dialog { border: 2px solid var(--line); border-radius: var(--radius); color: var(--text); max-width: 420px; width: calc(100% - 32px); background: linear-gradient(180deg, var(--panel-2), var(--panel)); }
dialog::backdrop { background: rgba(4, 8, 14, .7); backdrop-filter: blur(2px); }
.field { display: flex; flex-direction: column; gap: 7px; font-size: 16px; margin: 14px 0; }
.field input { font-family: "VT323", monospace; font-size: 22px; padding: 9px 11px; background: var(--edge); border: 2px solid var(--line); border-radius: 8px; color: var(--text); }
.field input:focus { outline: none; border-color: var(--grass); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.message { min-height: 22px; color: var(--gold); font-size: 16px; }

/* ---- responsive ---- */
@media (max-width: 860px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .columns { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 18px; }
  .hero { grid-template-columns: 1fr; }
  .ring-wrap { order: -1; }
  .address { font-size: 26px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
