/* PatchPing: one stylesheet for every page. Light and dark (follows the system, or the toggle). */
:root {
  --bg: #f6f7fb; --bg-2: #eef0f7; --card: #ffffff; --line: #e2e5ef; --line-2: #d3d7e4;
  --text: #171a26; --muted: #5d6478; --faint: #8a90a3;
  --brand: #5865f2; --brand-2: #4752c4; --brand-soft: #e8eafe; --on-brand: #ffffff;
  --ok: #1f9d55; --ok-soft: #e3f6ea; --warn: #b7791f; --warn-soft: #fdf3e1; --bad: #d64545; --bad-soft: #fde8e8;
  --switch-off: #c9cddb; --knob: #ffffff;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 4px 16px rgba(20, 24, 40, .06);
  --radius: 14px; --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1117; --bg-2: #161923; --card: #1a1e2a; --line: #2a2f3e; --line-2: #363c4e;
    --text: #e9ebf3; --muted: #a3a9bc; --faint: #737a8f;
    --brand: #7983f5; --brand-2: #98a0ff; --brand-soft: #262b4d; --on-brand: #0d0f1a;
    --ok: #44c47a; --ok-soft: #173325; --warn: #e3a64a; --warn-soft: #3a2c14; --bad: #f07070; --bad-soft: #3d1b1f;
    --switch-off: #3b4153; --knob: #f4f5fa;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1117; --bg-2: #161923; --card: #1a1e2a; --line: #2a2f3e; --line-2: #363c4e;
  --text: #e9ebf3; --muted: #a3a9bc; --faint: #737a8f;
  --brand: #7983f5; --brand-2: #98a0ff; --brand-soft: #262b4d; --on-brand: #0d0f1a;
  --ok: #44c47a; --ok-soft: #173325; --warn: #e3a64a; --warn-soft: #3a2c14; --bad: #f07070; --bad-soft: #3d1b1f;
  --switch-off: #3b4153; --knob: #f4f5fa;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); overflow-x: hidden; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-2); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
code { font: .88em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: .1em .35em; white-space: nowrap; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---- top bar */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand svg { width: 30px; height: 30px; flex: none; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-weight: 500; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--bg-2); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { border-color: var(--line-2); }

/* ---- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; font: 600 .95rem/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-2); color: var(--on-brand); }
.btn-ghost { background: var(--card); color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--brand); color: var(--text); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: .85rem; border-radius: 9px; }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--line-2); }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---- landing */
.hero { padding: 56px 0 32px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); background: var(--brand-soft); padding: 4px 10px; border-radius: 999px; margin-bottom: 14px; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 10px; }
.preview { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.msg { display: flex; gap: 12px; }
.msg + .msg { margin-top: 14px; }
.msg .ava { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); flex: none; display: grid; place-items: center; }
.msg .ava svg { width: 24px; height: 24px; }
.msg .who { font-weight: 700; font-size: .95rem; }
.msg .who span { font-weight: 600; font-size: .7rem; background: var(--brand); color: var(--on-brand); border-radius: 4px; padding: 1px 4px; margin-left: 6px; vertical-align: 1px; }
.embed { margin-top: 6px; border-left: 4px solid var(--c, var(--brand)); background: var(--bg-2); border-radius: 6px; padding: 10px 12px; font-size: .9rem; }
.embed b { display: block; margin-bottom: 2px; }
.embed .f { display: flex; gap: 22px; margin-top: 8px; flex-wrap: wrap; }
.embed .f div { font-size: .82rem; color: var(--muted); }
.embed .f strong { display: block; color: var(--text); font-size: .85rem; }
section { padding: 36px 0; }
.section-head { max-width: 40em; margin-bottom: 20px; }
.section-head h2 { font-size: 1.6rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { font-size: 1.05rem; }
.card p { color: var(--muted); margin: 0; font-size: .95rem; }
.step-n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 5px; font-size: .9rem; font-weight: 500; }
.cmds { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cmds td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; font-size: .95rem; }
.cmds tr:first-child td { border-top: 0; }
.cmds td:first-child { width: 34%; }
.who-tag { font-size: .75rem; color: var(--muted); display: block; }
footer { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--faint); font-size: .875rem; margin-top: 24px; }

/* ---- game avatar (letters, the game's colour: no outside images) */
.ava-game { width: 40px; height: 40px; border-radius: 11px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: .92rem; color: #fff; background: var(--c, var(--brand)); text-shadow: 0 1px 1px rgba(0, 0, 0, .25); letter-spacing: -.02em; }
.chip .ava-game { width: 28px; height: 28px; border-radius: 50%; font-size: .7rem; }

/* ---- catalogue page */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.game-card { display: flex; gap: 12px; align-items: flex-start; }
.game-card h3 { font-size: 1rem; margin: 0 0 2px; }
.game-card p { font-size: .85rem; }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); margin-left: 6px; vertical-align: 2px; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }

/* ---- dashboard */
.app { padding-top: 24px; padding-bottom: 48px; }
.app-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.app-head h1 { font-size: 1.5rem; margin: 0; }
.server-ava { width: 52px; height: 52px; border-radius: 16px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; flex: none; }
.expires { margin-left: auto; font-size: .85rem; color: var(--muted); background: var(--card); border: 1px solid var(--line); padding: 6px 10px; border-radius: 999px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2 { font-size: 1.05rem; margin: 0; }
.panel-head .muted { font-size: .85rem; }
.panel-body { padding: 14px 16px; }
.field { display: grid; gap: 6px; }
.field label, .lbl { font-size: .8rem; font-weight: 600; color: var(--muted); }
select, input[type="text"], input[type="url"], input[type="search"] {
  width: 100%; min-height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font: inherit; font-size: .95rem;
}
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%238a90a3'%3E%3Cpath d='M5.3 7.3a1 1 0 0 1 1.4 0L10 10.6l3.3-3.3a1 1 0 1 1 1.4 1.4l-4 4a1 1 0 0 1-1.4 0l-4-4a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
select:focus, input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input[type="search"] { flex: 1 1 200px; width: auto; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 600 .85rem/1 var(--font); padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

.game-list { list-style: none; margin: 0; padding: 0; }
.game-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.game-row:first-child { border-top: 0; }
.game-row .name { font-weight: 600; overflow-wrap: anywhere; }
.game-row .about { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.game-row .opts { grid-column: 2 / 4; display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.game-row.off .opts { display: none; }
.game-row .warn-line { grid-column: 2 / 4; font-size: .8rem; color: var(--warn); }
.group-title { padding: 10px 16px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); background: var(--bg-2); border-top: 1px solid var(--line); }
.group-title:first-child { border-top: 0; border-radius: var(--radius) var(--radius) 0 0; }
.empty { padding: 18px 16px; color: var(--muted); font-size: .9rem; }

/* the switch: a real toggle, not a checkbox */
.switch { position: relative; width: 48px; height: 28px; flex: none; border-radius: 999px; border: 0; padding: 0; cursor: pointer; background: var(--switch-off); transition: background .18s ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--knob); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .18s ease; }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch[aria-busy="true"] { opacity: .6; }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }

.results { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.results li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.results li .n { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .92rem; }
.results li .n small { display: block; color: var(--faint); }
.feed-form { display: grid; gap: 10px; }
.feed-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 16px; border-top: 1px solid var(--line); font-size: .88rem; }
.list li:first-child { border-top: 0; }
.list .when { color: var(--faint); font-size: .78rem; display: block; }
.list .g { font-weight: 600; }
.list li.bad { color: var(--bad); }
.notice { border-radius: var(--radius-sm); padding: 12px 14px; font-size: .92rem; margin-bottom: 14px; border: 1px solid; }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.notice.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.center-card { max-width: 520px; margin: 48px auto; text-align: center; }
.center-card .card { padding: 28px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--brand); animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: .9rem; box-shadow: var(--shadow); z-index: 50; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); color: #fff; }

/* ---- phones */
@media (max-width: 860px) {
  .hero-grid, .layout { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .hero { padding-top: 32px; }
}
@media (max-width: 560px) {
  .nav a.hide-sm { display: none; }
  .brand .brand-name { font-size: .95rem; }
  .game-row .opts { grid-template-columns: 1fr; }
  .game-row .opts .btn { width: 100%; }
  .feed-form .row2 { grid-template-columns: 1fr; }
  .cmds td { display: block; width: 100% !important; }
  .cmds td + td { border-top: 0; padding-top: 0; }
  .expires { margin-left: 0; }
  .cta .btn { flex: 1 1 100%; }
}
