@font-face { font-family: "Grenze Gotisch"; src: url("/fonts/grenze-gotisch-bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

/* Imperial cogitator (default) */
:root, [data-theme="imperial"] {
  --bg: #0c0a07; --bg2: #14110c; --panel: #1a160f; --panel2: #221c13; --line: #3a2f1e; --line2: #5a4a2c;
  --text: #e9dfc8; --muted: #a8977a; --dim: #6f624c;
  --accent: #d6b66e; --accent2: #f0d48e; --accentInk: #1a1408;
  --good: #8fd68a; --warn: #e6b955; --bad: #e0624e; --info: #86c3d6;
  --feed: #0a0f0b; --feedText: #9be3a6; --feedDim: #5d9a68;
  --head: "Grenze Gotisch", Georgia, serif; --body: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
  --radius: 6px; --glow: 0 0 0 1px rgba(214,182,110,.08), 0 10px 30px rgba(0,0,0,.45);
  --texture: radial-gradient(ellipse at top, rgba(214,182,110,.06), transparent 60%);
}
[data-theme="modern"] {
  --bg: #0d1117; --bg2: #11161e; --panel: #161b24; --panel2: #1c2230; --line: #263043; --line2: #344158;
  --text: #e6edf3; --muted: #9aa7b8; --dim: #65748a;
  --accent: #8b7cf6; --accent2: #a89bff; --accentInk: #0d0a24;
  --good: #3fb950; --warn: #d29922; --bad: #f85149; --info: #58a6ff;
  --feed: #0b0f15; --feedText: #c9d4e3; --feedDim: #6e7d93;
  --head: var(--body); --radius: 10px; --glow: 0 1px 0 rgba(255,255,255,.03), 0 8px 24px rgba(0,0,0,.35);
  --texture: radial-gradient(ellipse at top left, rgba(139,124,246,.08), transparent 55%);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 var(--body); }
body { background-image: var(--texture); background-attachment: fixed; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent2); }
.boot { display: grid; place-items: center; height: 100vh; font-family: var(--head); color: var(--accent); letter-spacing: .1em; }

/* Sign-in */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.gate-card { width: min(420px, 100%); background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line2);
  border-radius: var(--radius); padding: 28px 26px; box-shadow: var(--glow); position: relative; overflow: hidden; }
[data-theme="imperial"] .gate-card::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(214,182,110,.035) 0 1px, transparent 1px 3px); }
.gate-mark { font-family: var(--head); font-size: 34px; color: var(--accent); text-align: center; line-height: 1.1; }
.gate-sub { text-align: center; color: var(--muted); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; margin: 6px 0 22px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
input[type=text], input[type=password], input[type=number], input[type=time], select, textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: calc(var(--radius) - 2px); padding: 9px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); margin: 4px 0 16px; }
.code { font-family: var(--mono); font-size: 22px; letter-spacing: .4em; text-align: center; }
.secret { font-family: var(--mono); background: var(--bg2); border: 1px dashed var(--line2); padding: 10px; border-radius: var(--radius);
  word-break: break-all; text-align: center; letter-spacing: .12em; color: var(--accent2); user-select: all; }
.note { color: var(--muted); font-size: 13px; }
.error { color: var(--bad); min-height: 20px; font-size: 13px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line2); background: var(--panel2);
  padding: 8px 14px; border-radius: calc(var(--radius) - 2px); cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent2); }
.btn.primary { background: var(--accent); color: var(--accentInk); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent2); color: var(--accentInk); }
.btn.danger { border-color: color-mix(in srgb, var(--bad) 60%, transparent); color: var(--bad); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 15%, transparent); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

/* Shell */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-family: var(--head); font-size: 26px; color: var(--accent); padding: 0 8px 2px; }
.brand-sub { color: var(--dim); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; padding: 0 8px 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.nav-title { color: var(--dim); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; padding: 12px 8px 4px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: calc(var(--radius) - 2px); color: var(--muted); cursor: pointer; border: 1px solid transparent; }
.nav:hover { color: var(--text); background: var(--panel); }
.nav.on { color: var(--accent2); background: var(--panel2); border-color: var(--line2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.on { background: var(--good); box-shadow: 0 0 8px var(--good); }
.nav .count { margin-left: auto; font-size: 11px; color: var(--dim); }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.who { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line2); color: var(--accent); font-weight: 700; }
.who small { display: block; color: var(--dim); text-transform: capitalize; }
.main { padding: 22px 26px 40px; min-width: 0; }
.menu-toggle { display: none; }

/* Page */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-family: var(--head); font-weight: 700; font-size: 30px; margin: 0; color: var(--accent); line-height: 1.1; }
[data-theme="modern"] .page-head h1 { color: var(--text); font-size: 24px; }
.crumbs { color: var(--dim); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 9px 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent2); border-color: var(--accent); }

.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--glow); min-width: 0; }
.card h2, .card h3 { margin: 0 0 10px; font-family: var(--head); color: var(--accent); font-weight: 700; }
[data-theme="modern"] .card h2, [data-theme="modern"] .card h3 { color: var(--text); font-size: 16px; }
.card h2 { font-size: 22px; } .card h3 { font-size: 18px; }
.server-card { cursor: pointer; transition: .15s; }
.server-card:hover { border-color: var(--line2); transform: translateY(-1px); }
.stat-row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.stat b { display: block; font-size: 22px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat span { color: var(--dim); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; border: 1px solid var(--line2); color: var(--muted); }
.pill.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 160px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }

/* Live feed */
.feed-wrap { display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 420px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line2); color: var(--muted); cursor: pointer; font-size: 12px; user-select: none; }
.chip.on { background: var(--panel2); color: var(--accent2); border-color: var(--accent); }
.feed { flex: 1; overflow-y: auto; background: var(--feed); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 0; font-family: var(--mono); font-size: 13px; }
[data-theme="imperial"] .feed { background-image: repeating-linear-gradient(0deg, rgba(155,227,166,.025) 0 1px, transparent 1px 3px); }
.line { display: grid; grid-template-columns: 62px 74px minmax(0, 1fr); gap: 8px; padding: 2px 12px; color: var(--feedText); }
.line:hover { background: rgba(255,255,255,.03); }
.line .t { color: var(--feedDim); font-variant-numeric: tabular-nums; }
.line .k { text-transform: uppercase; font-size: 11px; letter-spacing: .06em; color: var(--feedDim); padding-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.line .who { display: inline; padding: 0; color: var(--accent2); }
.line .steam { color: var(--feedDim); font-size: 11px; }
.line .msg { word-break: break-word; }
.k-whisper .k, .k-whisper .msg { color: #b9a2e8; }
.k-yell .k, .k-yell .msg { color: #f0a96a; }
.k-me .msg, .k-it .msg { font-style: italic; }
.k-ooc .k, .k-looc .k { color: var(--info); }
.k-pm .k, .k-pm .msg { color: #e889c4; }
.k-log .msg { color: var(--muted); }
.k-death .k, .k-death .msg { color: var(--bad); }
.k-join .msg, .k-leave .msg { color: var(--feedDim); }
.k-portal .msg { color: var(--warn); }
.feed-send { display: flex; gap: 8px; margin-top: 10px; }
.feed-send select { width: 160px; }
.paused { color: var(--warn); font-size: 12px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--dim); font-weight: 600; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: 9px 12px; background: var(--bg2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255,255,255,.02); }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { padding: 26px; text-align: center; color: var(--dim); }

/* Countdown */
.countdown { font-family: var(--head); font-size: 54px; color: var(--warn); text-align: center; font-variant-numeric: tabular-nums; }
[data-theme="modern"] .countdown { font-family: var(--mono); font-size: 42px; }

/* Dialogs and toasts */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; z-index: 50; backdrop-filter: blur(3px); }
.dialog { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); padding: 20px; box-shadow: var(--glow); }
.dialog h3 { margin: 0 0 12px; font-family: var(--head); color: var(--accent); font-size: 22px; }
.dialog .row { justify-content: flex-end; margin-top: 14px; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: var(--radius); box-shadow: var(--glow); max-width: 360px; animation: in .2s ease-out; }
.toast.bad { border-left-color: var(--bad); } .toast.good { border-left-color: var(--good); }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 40; transform: translateX(-105%); transition: .2s; }
  .side.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .main { padding: 16px; }
  .split { grid-template-columns: 1fr; }
  .line { grid-template-columns: 52px 1fr; } .line .k { display: none; }
  .feed-wrap { height: 70vh; }
}

/* Prayers */
.prayer-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.prayer { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-left: 4px solid var(--faith);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--glow); display: grid; gap: 10px; min-width: 0; }
.prayer.open { box-shadow: var(--glow), 0 0 0 1px color-mix(in srgb, var(--faith) 35%, transparent); }
.prayer.answered { opacity: .82; }
.prayer header { display: flex; gap: 10px; align-items: flex-start; }
.pname { font-family: var(--head); font-size: 22px; color: var(--faith); line-height: 1.1; }
[data-theme="modern"] .pname { font-size: 17px; font-weight: 700; }
.faith-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.faith { color: var(--faith); font-weight: 600; }
.prayer-text { margin: 0; padding: 10px 14px; border-left: 2px solid var(--faith); background: rgba(0,0,0,.18); font-family: Georgia, serif;
  font-style: italic; font-size: 16px; line-height: 1.5; color: var(--text); word-break: break-word; }
.meters { display: grid; gap: 4px; }
.meter { display: grid; grid-template-columns: 78px 1fr 34px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.meter b { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.meter-track { height: 6px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 99px; }
.small { font-size: 12px; }
.responses { display: grid; gap: 6px; }
.response { font-size: 13px; padding: 7px 10px; border-radius: calc(var(--radius) - 2px); background: var(--bg2); border: 1px solid var(--line); word-break: break-word; }
.response.prayerreply { border-color: color-mix(in srgb, var(--faith) 50%, transparent); font-weight: 600; letter-spacing: .03em; }
[data-theme="modern"] .response.prayerreply { font-family: var(--body); font-weight: 600; }
.response .by { color: var(--accent2); font-family: var(--body); font-weight: 600; letter-spacing: 0; }
.answer { display: grid; gap: 8px; }
.answer .amount { width: 74px; }
@media (max-width: 900px) { .prayer-list { grid-template-columns: 1fr; } }

/* Update notice */
.update-bar { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 70; display: flex; gap: 12px; align-items: center;
  background: var(--panel2); border: 1px solid var(--accent); border-radius: var(--radius); padding: 8px 10px 8px 16px; box-shadow: var(--glow); }

/* Live console */
.console-feed { height: calc(100vh - 330px); min-height: 380px; padding: 6px 0; }
.cline { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; padding: 1px 12px; color: var(--feedText); white-space: pre-wrap; word-break: break-word; }
.cline .t { color: var(--feedDim); font-variant-numeric: tabular-nums; }
.c-error { color: var(--bad); }
.c-warn { color: var(--warn); }
.c-command { color: var(--accent2); font-weight: 600; }
.c-reply { color: var(--info); }
.c-portal { color: var(--warn); font-style: italic; }

/* Usergroups */
.perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-top: 12px; }
.perm { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: calc(var(--radius) - 2px); background: var(--bg2); cursor: pointer; }
.perm small { display: block; font-size: 11px; line-height: 1.35; }
.perm input { margin-top: 3px; }
