:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #f0ece4;
  --text: #1f1b16;
  --muted: #6d655a;
  --border: #e2dbcf;
  --accent: #c7791a;
  --accent-text: #ffffff;
  --link: #9a5a0c;
  --ok: #2f8a4a;
  --warn: #b7791f;
  --err: #c0392b;
  --info: #2c6fb3;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 16px rgb(0 0 0 / .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15130f;
    --surface: #1e1b16;
    --surface-2: #27231c;
    --text: #efe9df;
    --muted: #a39a8c;
    --border: #36302686;
    --accent: #e3963a;
    --accent-text: #1a1206;
    --link: #f0ab55;
    --ok: #5cc27a;
    --warn: #e0a84a;
    --err: #ef6b5b;
    --info: #6aa7e6;
    --shadow: none;
    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 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: .92em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: .1em .4em; border-radius: 6px; }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 .5rem; }
.card > h1:first-child, .card > h2:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.right { margin-left: auto; }

/* ---------- układ */
header.top {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); }
.brand img { border-radius: 6px; image-rendering: pixelated; }
header nav { display: flex; gap: .25rem; flex-wrap: wrap; }
header nav a, .me a { padding: .35rem .65rem; border-radius: 8px; color: var(--muted); }
header nav a.active, header nav a:hover, .me a:hover, .me a.active { background: var(--surface-2); color: var(--text); text-decoration: none; }
.me { margin-left: auto; display: flex; align-items: center; gap: .25rem; }
.me a { display: inline-flex; align-items: center; gap: .4rem; }
.me a.btn, .me a.btn:hover { color: var(--accent-text); background: var(--accent); }
.me form { margin: 0; }
main { width: 100%; max-width: 960px; margin: 0 auto; padding: 1.5rem 16px 2rem; flex: 1; display: flex; flex-direction: column; gap: 1rem; }
main.wide { max-width: none; padding: 0; }
footer { text-align: center; padding: 1rem; color: var(--muted); font-size: .85rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card.narrow { max-width: 560px; width: 100%; margin: 0 auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.tile { color: var(--text); }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile h2 { margin: 0 0 .25rem; }

/* ---------- elementy */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--accent); color: var(--accent-text); border: 1px solid transparent;
  padding: .55rem 1rem; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn.small { padding: .3rem .65rem; font-size: .85rem; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
button.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: .35rem .5rem; }
button.link:hover { color: var(--text); }

.form { display: flex; flex-direction: column; gap: .85rem; margin: 1rem 0; }
.form.inline { flex-direction: row; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--muted); }
input {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 9px; padding: .6rem .75rem; min-width: 0;
}
input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 0; border-color: var(--accent); }
input.code { font: 600 1.25rem ui-monospace, monospace; letter-spacing: .3em; text-transform: uppercase; width: 11rem; text-align: center; }

.notice { padding: .7rem .9rem; border-radius: 9px; border: 1px solid; font-size: .95rem; }
.notice.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.notice.err { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, transparent); background: color-mix(in srgb, var(--err) 8%, transparent); }
.notice.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, transparent); }

.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.approved { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.pill.pending { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.pill.rejected, .pill.banned { color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }
.pill.admin { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); }

.head { border-radius: 4px; image-rendering: pixelated; vertical-align: middle; flex: none; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0 0 1rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
details summary { cursor: pointer; color: var(--muted); margin-top: 1rem; }

.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: .82rem; padding: .4rem .5rem; border-bottom: 1px solid var(--border); }
.table td { padding: .55rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table td a { display: inline-flex; align-items: center; gap: .45rem; }
.card:has(.table) { overflow-x: auto; }
.actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.actions form { margin: 0; }

/* ---------- start */
.hero { text-align: center; padding: 1.5rem 0 .5rem; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin-bottom: .4rem; }
.lead { color: var(--muted); max-width: 36rem; margin: 0 auto 1rem; }
.address { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.address code { font-size: 1.1rem; padding: .35rem .7rem; }

.status-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.dot.off { background: var(--err); }
.players { list-style: none; padding: 0; margin: .9rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.players:empty { display: none; }
.players a { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .6rem .3rem .3rem; background: var(--surface-2); border-radius: 8px; color: var(--text); }

.steps ol { padding-left: 1.3rem; margin: .5rem 0 0; display: grid; gap: .55rem; }
.steps li.done { color: var(--muted); }
.steps li.done::marker { content: "✔  "; color: var(--ok); }

/* ---------- czat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 11rem); min-height: 420px; padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: .75rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.chat-head h1 { margin: 0; font-size: 1.2rem; }
.chat-head label { flex-direction: row; align-items: center; gap: .35rem; }
.messages { list-style: none; margin: 0; padding: .75rem 1.1rem; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: .15rem; }
.msg { display: grid; grid-template-columns: 24px 1fr auto; gap: .6rem; align-items: start; padding: .3rem .4rem; border-radius: 8px; }
.msg:hover { background: var(--surface-2); }
.msg .body { min-width: 0; overflow-wrap: anywhere; }
.msg .who { font-weight: 600; margin-right: .35rem; }
.msg .src { font-size: .7rem; font-weight: 700; padding: 0 .35rem; border-radius: 4px; margin-right: .35rem; vertical-align: 1px; }
.msg .src.web { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); }
.msg .src.mc { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.msg time { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.msg .del { visibility: hidden; background: none; border: 0; color: var(--err); cursor: pointer; font-size: .75rem; }
.msg:hover .del { visibility: visible; }
.msg.event { color: var(--muted); font-size: .88rem; }
.msg.event .body { font-style: italic; }
.messages.hide-events .msg.event { display: none; }
.day { text-align: center; color: var(--muted); font-size: .78rem; margin: .6rem 0 .3rem; }
.chat-form { display: flex; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--border); }
.chat-form input { flex: 1; }

/* ---------- mapa */
iframe.map { border: 0; width: 100%; height: calc(100vh - 7.5rem); display: block; }

/* ---------- gracz */
.profile-head { display: flex; gap: 1.25rem; align-items: center; margin-bottom: 1rem; }
.profile-head img { image-rendering: pixelated; }
.profile-head h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; }
.stats div { background: var(--surface-2); border-radius: 10px; padding: .75rem; display: flex; flex-direction: column; }
.stats b { font-size: 1.25rem; }
.stats span { color: var(--muted); font-size: .82rem; }

/* ---------- admin */
ul.pending { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
ul.pending li { display: flex; align-items: center; gap: .8rem; padding: .6rem; background: var(--surface-2); border-radius: 10px; flex-wrap: wrap; }
ul.pending .actions { margin-left: auto; }
ul.audit { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }

@media (max-width: 640px) {
  header.top { gap: .5rem; }
  .me { margin-left: 0; width: 100%; justify-content: flex-end; }
  .chat { height: calc(100vh - 13rem); }
  .msg time { display: none; }
  .msg { grid-template-columns: 24px 1fr; }
}
