/* ARK Cluster panel. Dark, calm, one accent per map (set in /theme.css). */

:root {
  --bg: #0a0c0f;
  --panel: #12161b;
  --panel-2: #181d23;
  --raise: #222932;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --text: #e8ebef;
  --muted: #9aa4b1;
  --faint: #66707c;
  --ok: #34d399;
  --warn: #fbbf24;
  --stop: #fb923c;
  --danger: #f43f5e;
  --accent: #64748b;
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "SF Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 0% -10%, rgba(255, 255, 255, .045), transparent 60%);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, white); outline-offset: 2px; }

/* ---------------------------------------------------------------- icons */

svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i-fill { fill: currentColor; stroke: none; }

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: 12px 28px;
  background: rgba(10, 12, 15, .75);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand small {
  font: 500 11.5px var(--mono); color: var(--faint);
  padding: 2px 8px; border: 1px solid var(--line-2); border-radius: 999px;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #34d399, #0ea5e9); color: #04110c;
  font-weight: 800; font-size: 15px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand-mark-lg { width: 52px; height: 52px; border-radius: 15px; font-size: 24px; margin: 0 auto 18px; }
.brand-mark-muted { background: linear-gradient(135deg, #475569, #1e293b); color: var(--text); }

.host { display: flex; align-items: center; gap: 24px; margin-left: auto; }
.host-online { white-space: nowrap; }
.host-online strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.host-online span { color: var(--muted); }
.meter { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.meter-label { font-weight: 600; letter-spacing: .04em; color: var(--faint); }
.meter .bar { width: 76px; height: 6px; border-radius: 99px; background: var(--raise); overflow: hidden; }
.meter .bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: #94a3b8; transition: width .8s var(--ease), background .3s; }
.meter .bar i.hot { background: var(--warn); }
.meter .bar i.crit { background: var(--danger); }

.user { display: flex; align-items: center; gap: 6px; }
.user form { margin: 0; display: contents; }
.user-name { color: var(--muted); font-weight: 500; margin-right: 2px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; background: var(--raise); }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  border-radius: 10px; border: 1px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
#notify-btn[aria-pressed="true"] { color: var(--ok); }

.conn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 16px; font-size: 13px; font-weight: 500;
  background: color-mix(in srgb, var(--warn) 14%, var(--bg)); color: var(--warn);
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
}
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite;
}

/* ---------------------------------------------------------------- layout */

.main {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px;
  max-width: 1480px; margin: 0 auto; padding: 24px 28px 56px;
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; align-content: start; }
.card-slot { display: grid; }

/* ---------------------------------------------------------------- cards */

.card {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; gap: 16px; min-height: 232px;
  padding: 18px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  transition: border-color .4s var(--ease), box-shadow .4s var(--ease);
  animation: fade-in .25s var(--ease);
}
.card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, .02), transparent 40%);
  transition: opacity .5s var(--ease);
}
.card-art {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-size: cover; background-position: center; opacity: .28;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
  transition: opacity .5s, filter .5s;
}
.card.is-ready { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); box-shadow: 0 10px 40px -18px color-mix(in srgb, var(--accent) 60%, transparent); }
.card.is-offline::before { opacity: .22; }
.card.is-offline .card-art { opacity: .1; filter: grayscale(1); }
.card.is-starting { border-color: color-mix(in srgb, var(--warn) 22%, var(--line)); }
.card.is-stopping { border-color: color-mix(in srgb, var(--stop) 22%, var(--line)); }

.card-head { display: flex; align-items: center; gap: 12px; }
.map-mark {
  width: var(--mark-w, 42px); height: 42px; /* --mark-w: a map logo (see /theme.css) is wider than the letter badge */ border-radius: 12px; flex: none; display: grid; place-items: center;
  font-weight: 750; font-size: 14px; letter-spacing: .03em; color: #fff;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 90%, white), color-mix(in srgb, var(--accent) 55%, black));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 4px 14px -6px var(--accent);
  transition: filter .4s;
}
.card.is-offline .map-mark { filter: grayscale(.85) brightness(.7); }
.card-title { flex: 1; min-width: 0; }
.card-title h3 { margin: 0 0 1px; font-size: 16.5px; font-weight: 650; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addr {
  display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none;
  font: 12px var(--mono); color: var(--faint); cursor: pointer; transition: color .15s;
}
.addr svg.i { width: 12px; height: 12px; opacity: 0; transition: opacity .15s; }
.addr:hover { color: var(--text); }
.addr:hover svg.i, .addr:focus-visible svg.i { opacity: 1; }
.addr-static { cursor: default; }
.addr-static:hover { color: var(--faint); }

.pill {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 4px 10px 4px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--raise); color: var(--muted);
}
.pill i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-ready { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.pill-ready i { box-shadow: 0 0 10px currentColor; }
.pill-starting { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); }
.pill-stopping { color: var(--stop); background: color-mix(in srgb, var(--stop) 13%, transparent); }
.pill-starting i, .pill-stopping i { animation: pulse 1.4s ease-in-out infinite; }
.pill-offline { color: var(--faint); background: rgba(255, 255, 255, .04); }
.pill-offline i { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }

.card-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat {
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line);
  min-width: 0;
}
.stat-value { display: block; font-size: 19px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-of { color: var(--faint); font-weight: 500; font-size: 13px; margin-left: 1px; }
.stat-label { display: block; font-size: 10.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.boot-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.boot-row .mono { color: var(--text); }
.progress { position: relative; height: 8px; border-radius: 99px; background: var(--raise); overflow: hidden; }
.progress i {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--warn) 55%, var(--accent)), var(--warn));
  transition: width 1s linear;
}
.progress i::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
  animation: shimmer 1.8s ease-in-out infinite;
}
.progress.is-indeterminate i { width: 32%; animation: indeterminate 1.6s var(--ease) infinite; }
.progress.is-stopping i { background: linear-gradient(90deg, color-mix(in srgb, var(--stop) 50%, transparent), var(--stop)); }
.progress.is-slow i { background: var(--stop); }
.hint { margin: 10px 0 0; font-size: 12.5px; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.hint svg.i { width: 14px; height: 14px; }
.hint-warn { color: var(--warn); }

.offline p { margin: 0; color: var(--muted); }
.offline .hint { margin-top: 6px; }

.confirm-note { margin: -6px 0 -4px; font-size: 12.5px; font-weight: 500; color: #fda4af; animation: fade-in .15s; }

/* ---------------------------------------------------------------- buttons */

.actions { display: flex; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 14px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--panel-2);
  font-weight: 600; font-size: 13.5px; text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s, filter .15s, transform .08s;
}
.btn:hover { background: var(--raise); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.grow { flex: 1; }
.btn svg.i { width: 16px; height: 16px; }
/* one Start style for every map: the green of the "Online" pill, so starting reads as "go online" */
.btn-primary {
  flex: 1; height: 46px; font-size: 14.5px;
  color: #a7f3d0;
  background: color-mix(in srgb, var(--ok) 11%, var(--panel-2));
  border-color: color-mix(in srgb, var(--ok) 28%, transparent);
}
.btn-primary svg.i { color: var(--ok); }
.btn-primary:hover {
  color: #ecfdf5;
  background: color-mix(in srgb, var(--ok) 20%, var(--panel-2));
  border-color: color-mix(in srgb, var(--ok) 50%, transparent);
  box-shadow: 0 8px 24px -14px var(--ok);
}
.btn-danger { color: #fda4af; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 16%, var(--panel-2)); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.is-armed, .btn.is-armed:hover {
  color: #fff; border-color: transparent; background: var(--danger);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 25%, transparent);
  animation: armed 1s ease-in-out infinite;
}
.btn.htmx-request { pointer-events: none; }
.btn.htmx-request svg.i { animation: spin .8s linear infinite; }
.btn-discord {
  width: 100%; height: 48px; margin-top: 8px; color: #fff; border-color: transparent; font-size: 15px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .12), transparent) #5865f2;
}
.btn-discord:hover { background-color: #4752c4; }
.btn-discord svg.i { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- activity */

.side {
  position: sticky; top: 82px; align-self: start;
  padding: 16px 8px 8px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
}
.side-title { margin: 0 10px 8px; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.feed { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 170px); overflow-y: auto; overscroll-behavior: contain; }
.feed-empty { padding: 8px 10px 12px; color: var(--faint); font-size: 13px; }
.ev { display: flex; gap: 10px; padding: 8px 10px; border-radius: 10px; transition: background .15s; }
.ev:first-child { animation: slide-in .3s var(--ease); }
.ev:hover { background: var(--panel-2); }
.ev .avatar { width: 24px; height: 24px; margin-top: 1px; }
.ev-dot { width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; flex: none; position: relative; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.ev-dot::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--accent); }
.ev-ready .ev-dot { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.ev-ready .ev-dot::after { background: var(--ok); }
.ev-down .ev-dot, .ev-error .ev-dot { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.ev-down .ev-dot::after, .ev-error .ev-dot::after { background: var(--danger); }
.ev-body { min-width: 0; }
.ev p { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.ev strong { color: var(--text); font-weight: 600; }
.ev-error p, .ev-down p { color: #fda4af; }
.ev time { font-size: 11.5px; color: var(--faint); }

/* ---------------------------------------------------------------- console */

.console-dialog {
  width: min(1040px, calc(100vw - 32px)); height: min(760px, calc(100vh - 48px));
  max-width: none; max-height: none; padding: 0;
  border: 1px solid var(--line-2); border-radius: 18px;
  background: #07090b; color: var(--text);
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .8);
}
.console-dialog[open] { animation: pop .2s var(--ease); }
.console-dialog::backdrop { background: rgba(3, 4, 6, .6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#console-slot { height: 100%; }
.console { position: relative; display: flex; flex-direction: column; height: 100%; }
.console-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.console .console-head .map-mark { width: calc(var(--mark-w, 42px) * .86); height: 36px; font-size: 12.5px; }
.console-title { flex: 1; min-width: 0; }
.console-title h2 { margin: 0; font-size: 15px; font-weight: 650; }
.console-title p { margin: 0; font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); animation: pulse 1.6s ease-in-out infinite; color: var(--danger); }
.console.is-paused .live-dot { background: var(--faint); animation: none; }
.console-body {
  flex: 1; overflow: auto; padding: 12px 18px 16px;
  font: 12.5px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
  overscroll-behavior: contain;
}
.console-empty { color: var(--faint); margin: 0; }
.ln { color: #b4bcc8; }
.ln-err { color: #fb7185; }
.ln-warn { color: #fcd34d; }
.ln-ok { color: var(--ok); font-weight: 650; }
.ln-join { color: #7dd3fc; }
.ln-dim { color: #4f5966; }
.jump {
  position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%);
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--raise); font-size: 12.5px; font-weight: 600; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); animation: fade-in .15s;
}
.console-input { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, .02); }
.console-input .prompt { font: 600 14px var(--mono); color: var(--accent); }
.console-input input { flex: 1; min-width: 0; height: 30px; border: 0; outline: 0; background: transparent; font: 13px var(--mono); }
.console-input input::placeholder { color: var(--faint); }
.console-input.htmx-request .prompt { animation: pulse-op 1s infinite; }
.rcon-out { max-height: 180px; overflow: auto; font: 12.5px/1.5 var(--mono); }
.rcon-out:empty { display: none; }
.rcon-entry { padding: 8px 18px; border-top: 1px solid var(--line); }
.rcon-cmd { color: var(--accent); filter: brightness(1.3); }
.rcon-entry pre { margin: 2px 0 0; white-space: pre-wrap; color: var(--text); font: inherit; }
.rcon-entry .rcon-err { color: #fb7185; }
.console-note { margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--faint); }
.console-note code { font-family: var(--mono); color: var(--muted); }

/* ---------------------------------------------------------------- toasts */

.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  max-width: min(420px, calc(100vw - 32px)); padding: 11px 16px 11px 14px; border-radius: 12px;
  background: var(--raise); border: 1px solid var(--line-2); border-left: 3px solid var(--muted);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .7);
  font-size: 13.5px; font-weight: 500; pointer-events: auto;
  opacity: 0; transform: translateY(8px) scale(.98); transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.in { opacity: 1; transform: none; }
.toast-ok { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--danger); }

/* ---------------------------------------------------------------- login */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(400px, 100%); padding: 36px 32px 32px; text-align: center;
  border-radius: 22px; background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .8);
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
.login-card p { margin: 0 0 18px; }
.login-card .btn:not(.btn-discord) { width: 100%; margin-top: 8px; }
.login-problem { padding: 10px 12px; border-radius: 10px; font-size: 13px; color: #fda4af; background: color-mix(in srgb, var(--danger) 12%, transparent); }
.id-chip {
  display: block; width: 100%; margin: 0 0 16px; padding: 10px; border-radius: 10px; cursor: pointer;
  font: 600 15px var(--mono); letter-spacing: .02em;
  background: var(--panel-2); border: 1px dashed var(--line-2);
}
.id-chip:hover { border-color: var(--muted); }

/* ---------------------------------------------------------------- motion */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes pulse-op { 50% { opacity: .3; } }
@keyframes armed { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--danger) 12%, transparent); } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes indeterminate { from { left: -32%; } to { left: 100%; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }

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

/* ---------------------------------------------------------------- small screens */

@media (max-width: 1120px) {
  .main { grid-template-columns: 1fr; }
  .side { position: static; }
  .feed { max-height: 420px; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px 16px; padding: 10px 16px; }
  .user { margin-left: auto; }
  .user-name { display: none; }
  .host { order: 3; width: 100%; margin: 0; gap: 14px; justify-content: space-between; }
  .meter .bar { width: 44px; }
  .main { padding: 16px 16px 40px; gap: 16px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .card { min-height: 0; }
  .btn { height: 44px; }
  .actions .btn:not(.grow):not(.btn-primary) .label { display: none; }
  .actions .btn.is-armed .label { display: inline; }
  .console-dialog { width: 100vw; height: 100dvh; margin: 0; border-radius: 0; border: 0; }
  .jump { bottom: 84px; }
  .toasts { left: 16px; right: 16px; bottom: 16px; align-items: stretch; }
  .toast { max-width: none; }
}
