/* Pisk Console. Printed on paper: one flat cream, a faint grain, the odd oxblood fleck, and thin hand-drawn
   oxblood lines (no shadows, no cards, no rounded corners). Magilio for display, Clash Grotesk for text.
   The line strips and flecks come from tools/paper.js. */
@font-face { font-family: "Clash Grotesk"; src: url(fonts/clash-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Clash Grotesk"; src: url(fonts/clash-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Clash Grotesk"; src: url(fonts/clash-600.woff2) format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Magilio"; src: url(fonts/magilio.woff2) format("woff2"); font-display: swap; }

:root {
  --paper: #fef4e2;
  --tint: rgba(36, 4, 3, 0.035);  /* hover: a breath of ink on the paper */
  --tint-2: rgba(36, 4, 3, 0.07);
  --ink: #240403;                 /* oxblood */
  --ink-soft: rgba(36, 4, 3, 0.7);
  --ink-faint: rgba(36, 4, 3, 0.48);
  --line: rgba(36, 4, 3, 0.14);   /* straight hairlines inside things */
  --green: #212e2c;
  --rust: #b6361e;
  --orange: #f8a04a;
  --text: "Clash Grotesk", system-ui, sans-serif;
  --display: "Magilio", Georgia, serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Hand-drawn outlines: four repeating pen strips (top, bottom, left, right). */
  --lines: url(paper/line-ink-h.svg), url(paper/line-ink-h.svg), url(paper/line-ink-v.svg), url(paper/line-ink-v.svg);
  --lines-rust: url(paper/line-rust-h.svg), url(paper/line-rust-h.svg), url(paper/line-rust-v.svg), url(paper/line-rust-v.svg);
  --lines-faint: url(paper/line-faint-h.svg), url(paper/line-faint-h.svg), url(paper/line-faint-v.svg), url(paper/line-faint-v.svg);
  --rule: url(paper/line-ink-h.svg);
  --rule-v: url(paper/line-ink-v.svg);
}
*, *::before, *::after { box-sizing: border-box; border-radius: 0 !important; box-shadow: none !important; }
html { background: var(--paper); color: var(--ink); font: 500 15px/1.45 var(--text); -webkit-font-smoothing: antialiased; }
body { margin: 0; min-height: 100vh; background: url(paper/flecks.svg) 0 0 / 620px 620px repeat; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--ink); color: var(--paper); }
[hidden] { display: none !important; }
:focus-visible { outline: 1px dashed var(--rust); outline-offset: 3px; }

/* The paper's grain, over everything (very faint) */
.grain { position: fixed; inset: 0; z-index: 100; pointer-events: none; mix-blend-mode: multiply; opacity: 0.32;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .3 0 0 0 0 .2 0 0 0 .13 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* Everything with an outline gets the pen lines. Each side has its own strip length and offset so the
   wobble never lines up. (Never use the `background` shorthand on these: it would wipe the lines.) */
:where(.panel, .tile, .btn, .top nav, .tabs, .icon, .big-stats, table.list, .choices, .mod, .modal, .login form,
  .cmdline, .person, .check input, .bar, .empty, .key, select, textarea,
  input[type="text"], input[type="password"], input[type="number"], input[type="search"]) {
  border: 0;
  background-color: transparent;
  background-image: var(--lines);
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  background-position: 0 0, 83px 100%, 0 37px, 100% 151px;
  background-size: 240px 3px, 257px 3px, 3px 240px, 3px 229px;
}

/* Top bar: just the name, the nav, and a ruled line under it */
.top { display: flex; align-items: center; gap: 28px; padding: 16px 28px 15px; position: sticky; top: 0; z-index: 10;
  background: var(--paper) var(--rule) repeat-x 0 100% / 240px 3px; }
.top .brand { font: 400 27px/1 var(--display); color: var(--ink); text-decoration: none; padding-top: 4px; letter-spacing: 0.005em; }
.top nav { display: flex; margin-left: auto; }
.top nav a { padding: 8px 16px; text-decoration: none; color: var(--ink-soft); }
.top nav a + a { background: var(--rule-v) repeat-y 0 11px / 3px 240px; }
.top nav a:hover { color: var(--ink); background-color: var(--tint); }
.top nav a.on { color: var(--paper); background-color: var(--ink); }

main { max-width: 1240px; margin: 0 auto; padding: 36px 28px 80px; }
h1, h2 { font-family: var(--display); font-weight: 400; margin: 0; letter-spacing: 0.005em; }
h1 { font-size: 54px; line-height: 1.05; }
h2 { font-size: 30px; line-height: 1.1; margin-bottom: 14px; }
h3 { font-size: 12px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 10px; }
.lede { color: var(--ink-soft); margin: 8px 0 0; max-width: 62ch; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 18px; }
.center { text-align: center; margin-left: auto; margin-right: auto; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.mono { font-family: var(--mono); font-size: 13px; }

/* Buttons: pen outline; the main action is solid ink; danger is rust */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background-color: var(--ink); color: var(--paper); }
.btn.go { background-color: var(--ink); color: var(--paper); }
.btn.go:hover { background-color: var(--rust); }
.btn.stop { background-image: var(--lines-rust); color: var(--rust); }
.btn.stop:hover { background-color: var(--rust); color: var(--paper); }
.btn.stop.solid { background-color: var(--rust); color: var(--paper); }
.btn.stop.solid:hover { background-color: var(--ink); }
.btn.quiet { background-image: var(--lines-faint); color: var(--ink-soft); }
.btn.quiet:hover { background-color: var(--tint); background-image: var(--lines); color: var(--ink); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn:disabled { opacity: 0.4; cursor: default; pointer-events: none; }

/* Status chip */
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid currentColor; }
.chip::before { content: ""; width: 7px; height: 7px; background: currentColor; }
.chip.online { color: var(--paper); background: var(--green); border-color: var(--green); }
.chip.online::before { background: var(--orange); }
.chip.starting, .chip.checking { color: var(--ink); background: var(--orange); border-color: var(--orange); }
.chip.starting::before { animation: blink 1s steps(2) infinite; }
.chip.offline, .chip.missing { color: var(--ink-faint); }
.chip.unwell, .chip.error { color: var(--paper); background: var(--rust); border-color: var(--rust); }
@keyframes blink { 50% { opacity: 0.2; } }

/* Server tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 30px; }
.tile { display: flex; flex-direction: column; text-decoration: none; color: inherit; min-height: 300px; }
.tile:hover { background-color: var(--tint); }
.tile .head { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 18px 0; }
.icon { width: 72px; height: 72px; display: grid; place-items: center; overflow: hidden; flex: none; padding: 3px; }
.icon img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.icon .letter { font: 400 40px/1 var(--display); color: var(--rust); padding-top: 6px; }
.tile .name { font: 400 36px/1.05 var(--display); padding: 16px 18px 4px; }
.tile .addr { padding: 0 18px; font-family: var(--mono); font-size: 13px; color: var(--ink-soft); }
.tile .kind { padding: 6px 18px 0; color: var(--ink-faint); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: auto; background: var(--rule) repeat-x 41px 0 / 240px 3px; }
.stats > div { padding: 12px 12px 11px; }
.stats > div + div { border-left: 1px solid var(--line); }
.stats b { display: block; font-size: 19px; font-weight: 600; }
.stats small { color: var(--ink-faint); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.tile.new { align-items: center; justify-content: center; background-image: var(--lines-faint); color: var(--ink-soft); gap: 10px; }
.tile.new:hover { color: var(--ink); background-image: var(--lines); }
.tile.new .plus { font: 400 90px/0.8 var(--display); color: var(--rust); }

/* Panels: a ruled box on the same paper */
.panel { padding: 22px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }

/* Server page */
.server-head { display: flex; gap: 22px; align-items: flex-end; flex-wrap: wrap; }
.server-head .icon { width: 108px; height: 108px; cursor: pointer; position: relative; }
.server-head .icon:hover::after { content: "Change picture"; position: absolute; inset: 3px; display: grid; place-items: center; background: rgba(36, 4, 3, 0.82); color: var(--paper); font-size: 12px; font-weight: 600; text-align: center; }
.server-head .icon .letter { font-size: 64px; }
.server-head .who { flex: 1; min-width: 260px; }
.server-head .who .addr { font-family: var(--mono); color: var(--ink-soft); margin-top: 6px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tabs { display: flex; flex-wrap: wrap; margin: 30px 0 24px; width: fit-content; max-width: 100%; }
.tabs a { padding: 9px 16px; text-decoration: none; color: var(--ink-soft); }
.tabs a + a { background: var(--rule-v) repeat-y 0 17px / 3px 240px; }
.tabs a:hover { color: var(--ink); background-color: var(--tint); }
.tabs a.on { background-color: var(--ink); color: var(--paper); }

.big-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.big-stats > div { padding: 18px; }
.big-stats > div + div { border-left: 1px solid var(--line); }
.big-stats b { display: block; font-family: var(--display); font-weight: 400; font-size: 42px; line-height: 1.1; }
.big-stats small { color: var(--ink-faint); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.bar { height: 10px; margin-top: 10px; padding: 3px; }
.bar i { display: block; height: 100%; background: var(--orange); }
.bar.hot i { background: var(--rust); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
dl.facts dt { color: var(--ink-faint); }
dl.facts dd { margin: 0; }

/* Terminal: a block of ink on the paper */
.console { background: var(--ink); height: 58vh; overflow: auto; padding: 14px 16px; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; color: #f6e6cd; }
.console .warn { color: #f8c77d; }
.console .err { color: #ff9b84; }
.console .join { color: var(--orange); }
.cmdline { display: flex; }
.cmdline span { padding: 10px 12px; color: var(--rust); font-family: var(--mono); font-weight: 600; }
.cmdline input[type="text"], .cmdline input[type="text"]:focus { flex: 1; background-image: none; background-color: transparent; padding: 10px 4px; outline: 0; font-family: var(--mono); }
.cmdline:focus-within { background-image: var(--lines-rust); }

/* Forms: ruled boxes; the focused one turns rust */
label.field { display: block; }
label.field > span { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea { width: 100%; padding: 10px 12px; outline: 0; }
input:focus, select:focus, textarea:focus { background-image: var(--lines-rust); background-color: rgba(255, 255, 255, 0.35); }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: var(--lines), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23240403' stroke-width='1.2'/%3E%3C/svg%3E");
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y, no-repeat;
  background-position: 0 0, 83px 100%, 0 37px, 100% 151px, right 13px center;
  background-size: 240px 3px, 257px 3px, 3px 240px, 3px 229px, 10px 6px; }
select:focus { background-image: var(--lines-rust), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23b6361e' stroke-width='1.2'/%3E%3C/svg%3E"); }
textarea { min-height: 50vh; font: 13px/1.5 var(--mono); resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--rust); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 0; }
.check input { appearance: none; width: 19px; height: 19px; margin: 0; display: grid; place-items: center; flex: none; cursor: pointer; }
.check input:checked::after { content: ""; width: 9px; height: 9px; background: var(--rust); }
.hint { color: var(--ink-faint); font-size: 13px; margin-top: 6px; }
.err-text { color: var(--rust); font-weight: 600; }

/* Choices (server type) */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); padding: 2px; }
.choices label { cursor: pointer; padding: 16px; box-shadow: none; outline: 1px solid var(--line); outline-offset: -0.5px; }
.choices input { display: none; }
.choices b { display: block; font: 400 27px/1.1 var(--display); }
.choices small { color: var(--ink-soft); }
.choices label:hover { background: var(--tint); }
.choices label:has(input:checked) { background: var(--ink); color: var(--paper); }
.choices label:has(input:checked) small { color: rgba(254, 244, 226, 0.75); }

/* Mods */
.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mod { display: flex; gap: 12px; padding: 12px; align-items: flex-start; background-image: var(--lines-faint); }
.mod img, .mod .noimg { width: 44px; height: 44px; flex: none; background: var(--tint-2); }
.mod .t { font-weight: 600; }
.mod .d { color: var(--ink-soft); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mod .x { margin-left: auto; }
.mod.on { background-image: var(--lines); background-color: var(--tint); }

/* Lists */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 10px 13px; }
table.list tbody tr + tr td { border-top: 1px solid var(--line); }
table.list th { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; background: var(--rule) repeat-x 17px 100% / 240px 3px; }
table.list tbody tr:hover td { background-color: var(--tint); }
table.list a { text-decoration: none; }
table.list .dir { color: var(--rust); font-weight: 600; }
table.list td.acts { text-align: right; white-space: nowrap; }
table.list td.acts .btn + .btn { margin-left: 4px; }
.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 11px; font-weight: 600; }
.person button { border: 0; background: none; color: var(--ink-soft); cursor: pointer; padding: 3px 7px; font-size: 13px; }
.person button:hover { color: var(--paper); background: var(--rust); }
ol.qs { margin: 0; padding-left: 22px; }
ol.qs li + li { margin-top: 4px; }

/* Sign in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: min(420px, 100%); padding: 34px; }
.login img.mark { height: 110px; display: block; margin: 0 auto 16px; }
.login h1 { text-align: center; font-size: 46px; margin-bottom: 22px; }
.login .lede { margin-top: -10px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 18px; font-weight: 600; z-index: 400; max-width: 90vw; }
.toast.bad { background: var(--rust); }

.danger { padding: 22px; background-image: var(--lines-rust); background-color: rgba(182, 54, 30, 0.05); }
.danger h2 { color: var(--rust); }
.key { font-family: var(--mono); font-size: 18px; letter-spacing: 0.12em; padding: 12px 14px; word-break: break-all; }
.qr-box { width: min(240px, 100%); }
.qr-box svg { display: block; width: 100%; height: auto; }
details.hint summary { cursor: pointer; width: max-content; }
details.hint[open] summary { margin-bottom: 8px; }
.empty { padding: 30px; text-align: center; color: var(--ink-faint); background-image: var(--lines-faint); }
.panel.working { background-image: var(--lines-faint); }

/* "Are you sure" screens: a ruled sheet on dimmed paper; risky ones are ruled in rust */
.modal-back { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px; background: rgba(36, 4, 3, 0.3); animation: fade-in 0.12s ease-out; }
.modal { width: min(470px, 100%); display: grid; gap: 16px; padding: 26px; background-color: var(--paper); animation: drop-in 0.14s ease-out; }
.modal.is-danger { background-image: var(--lines-rust); }
.modal h2 { margin: 0; overflow-wrap: anywhere; }
.modal .lede { margin: 0; }
.modal .row.end { justify-content: flex-end; margin-top: 4px; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes drop-in { from { transform: translateY(6px); opacity: 0; } }

@media (max-width: 720px) {
  .top { padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
  .top nav { margin-left: 0; width: 100%; }
  .top nav a { flex: 1; text-align: center; padding: 8px 6px; }
  main { padding: 24px 16px 60px; }
  h1 { font-size: 42px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:nth-child(3) { border-left: 0; }
  .stats div:nth-child(n+3) { border-top: 1px solid var(--line); }
  table.list td.acts { white-space: normal; }
}
label.field.q > span { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--ink); }
