@font-face { font-family: 'Inter'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/inter-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/inter-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/inter-700.woff2') format('woff2'); }
@font-face { font-family: 'Anton'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/anton-400.woff2') format('woff2'); }

:root {
  --ink: #13261c;
  --ink-2: #34463b;
  --muted: #6c7a70;
  --paper: #f4f0e5;
  --card: #fffdf7;
  --line: #e2d9c6;
  --line-2: #d4c9b1;
  --green: #1d4a33;
  --green-2: #2b6647;
  --green-soft: #e4efe5;
  --teal: #2e6b6f;
  --gold: #f2b416;
  --gold-soft: #fff0c4;
  --gold-ink: #6e4600;
  --red: #a63e2a;
  --red-soft: #f8e3dc;
  --radius: 16px;
  --display: 'Anton', 'Arial Narrow', Impact, sans-serif;
  --ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--green-2); }

/* ---------- Header ---------- */
.hero {
  position: relative;
  color: #fff;
  background: #10281d url('/img/bg-river-sm.jpg') center 38% / cover no-repeat;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(10, 30, 21, 0.92) 0%, rgba(10, 30, 21, 0.72) 55%, rgba(10, 30, 21, 0.45) 100%);
}
.hero-inner {
  position: relative;
  max-width: 980px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo-pubgm { width: 46px; height: auto; opacity: 0.95; flex: none; }
.brand-text { min-width: 0; }
.brand-title { height: 26px; width: auto; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35)); }
.brand-sub { display: block; font-size: 12px; letter-spacing: 0.04em; opacity: 0.85; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-right { display: flex; align-items: center; gap: 10px; flex: none; }
.clock { font-family: var(--display); font-size: 26px; letter-spacing: 0.02em; line-height: 1; }
.sync {
  border: 0; border-radius: 999px; padding: 6px 10px 6px 22px; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, 0.14); color: #fff; position: relative; white-space: nowrap;
}
.sync::before { content: ''; position: absolute; left: 9px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #9ca3a0; }
.sync.ok::before { background: #5fd38a; box-shadow: 0 0 0 3px rgba(95, 211, 138, 0.25); }
.sync.busy::before { background: #f2b416; }
.sync.warn::before { background: #ff9e5e; }
.sync.bad::before { background: #ff6b5b; }
.krs-mini { height: 30px; width: auto; opacity: 0.9; }

/* ---------- Tabs ---------- */
.tabs {
  position: sticky; top: 0; z-index: 20;
  background: var(--green);
  box-shadow: 0 2px 10px rgba(16, 40, 29, 0.18);
}
.tabs-inner {
  max-width: 980px; margin: 0 auto;
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 0 8px;
}
.tabs-inner::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; color: rgba(255, 255, 255, 0.78); text-decoration: none; font-weight: 600; font-size: 15px;
  padding: 13px 14px 11px; border-bottom: 3px solid transparent;
}
.tabs a[aria-current='page'] { color: #fff; border-bottom-color: var(--gold); }

.phase {
  max-width: 980px; margin: 10px auto 0; padding: 0 16px;
  display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2);
  overflow-x: auto; scrollbar-width: none; white-space: nowrap;
}
.phase::-webkit-scrollbar { display: none; }
.phase > * { flex: none; }
.phase b { color: var(--ink); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: #ebe3d1; color: var(--ink-2); white-space: nowrap; }
.chip.on { background: var(--green-soft); color: #1d5a35; }
.chip.off { background: #efe9dc; color: var(--muted); }

/* ---------- Layout ---------- */
main { max-width: 980px; margin: 0 auto; padding: 4px 4px 0; }
.grid2 { display: grid; gap: 0; }
@media (min-width: 900px) {
  .grid2 { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); align-items: start; }
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px;
}
.card > h2, .card-head h2 {
  margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head .meta { font-size: 13px; color: var(--muted); }
.hint { font-size: 13.5px; color: var(--muted); margin: 10px 0 0; }
.muted { color: var(--muted); }
.empty { padding: 18px 6px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Segmented ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: #ebe3d1; border-radius: 13px; margin-bottom: 14px; }
.seg button {
  border: 0; background: transparent; border-radius: 10px; padding: 10px 6px; font-weight: 600; font-size: 14.5px; color: var(--ink-2);
  line-height: 1.2;
}
.seg button small { display: block; font-weight: 500; font-size: 12px; opacity: 0.8; margin-top: 2px; }
.seg button[aria-pressed='true'] { background: var(--green); color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 12px; }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label.f > input, label.f > select, label.f > textarea { margin-top: 6px; display: block; }
label.f span.opt { font-weight: 500; color: var(--muted); }
input[type='text'], input[type='tel'], input[type='search'], input[type='number'], input[type='password'], input:not([type]), select, textarea {
  width: 100%; font-size: 17px; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
textarea { min-height: 140px; font-size: 15px; line-height: 1.4; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(43, 102, 71, 0.18); }
input.weight-in { font-family: var(--display); font-size: 34px; letter-spacing: 0.02em; padding: 8px 14px; text-align: left; }
.field-msg { font-size: 13.5px; font-weight: 600; color: var(--red); min-height: 0; }
.field-msg:empty { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--line-2); background: #fff; color: var(--ink); border-radius: 12px;
  padding: 10px 14px; font-weight: 600; font-size: 15px; text-decoration: none; line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #18402c; }
.btn.gold { background: var(--gold); border-color: #e0a40c; color: #2b1c00; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; padding: 16px; font-size: 17px; border-radius: 14px; }
.btn.sm { padding: 7px 10px; font-size: 13.5px; border-radius: 10px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Quota ---------- */
.quota { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: center; padding: 4px 2px 16px; }
.quota-num { font-family: var(--display); font-size: 64px; line-height: 0.95; color: var(--green); }
.quota-num .of { font-size: 30px; color: var(--muted); margin-left: 4px; }
.quota-side { display: grid; gap: 8px; }
.quota-label { font-size: 13px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-2); }
.bar { height: 10px; border-radius: 999px; background: #e9e1cf; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green-2), #3f8a5f); border-radius: 999px; transition: width 0.3s ease; }
.quota.full .bar i { background: linear-gradient(90deg, #d99a06, var(--gold)); }
.quota-msg { font-size: 15px; font-weight: 600; }
.quota.full .quota-msg { color: var(--gold-ink); }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 2px; border-top: 1px solid #eee6d6;
}
.list li:first-child { border-top: 0; }
.list li.dim { opacity: 0.55; }
.no { font-family: var(--display); font-size: 24px; color: var(--green); text-align: center; line-height: 1; }
.no.gold { color: #c88a00; }
.who { min-width: 0; }
.who b { display: block; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small .note { font-style: normal; font-weight: 700; color: var(--gold-ink); }
.acts { display: flex; align-items: center; gap: 6px; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.badge.ok { background: var(--green-soft); color: #1d5a35; }
.badge.gold { background: var(--gold-soft); color: var(--gold-ink); }
.badge.mute { background: #eee7d8; color: var(--muted); }
.badge.red { background: var(--red-soft); color: var(--red); }
.kg { font-family: var(--display); font-size: 24px; line-height: 1; white-space: nowrap; }
.kg small { font-family: var(--ui); font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.more { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 10px; font-size: 20px; line-height: 1; color: var(--muted); }
.more:hover { background: #efe8d8; }
.toggle { border: 1.5px solid var(--line-2); background: #fff; border-radius: 10px; padding: 7px 10px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.toggle[aria-pressed='true'] { background: var(--green); border-color: var(--green); color: #fff; }
.toggle.warn[aria-pressed='true'] { background: var(--red); border-color: var(--red); }

/* ranking rows */
.rank li { grid-template-columns: 40px minmax(0, 1fr) auto auto; }
.rank li.top .no { color: #c88a00; }
.rank li.top { background: linear-gradient(90deg, rgba(242, 180, 22, 0.10), transparent 70%); border-radius: 10px; }

/* winners */
.win-grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .win-grid { grid-template-columns: 1fr 1fr; } }
.win-col h3 { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.win { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: #f6f0e1; margin-bottom: 6px; }
.win:first-of-type { background: var(--gold-soft); }
.win .no { font-size: 26px; color: #b77c00; }
.win b { font-size: 17px; }

/* in-game slots */
.slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.slot { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 10px; min-height: 88px; display: grid; gap: 6px; align-content: start; background: #fffefb; min-width: 0; }
.slot.filled { border-style: solid; border-color: #cfdccf; background: #fff; }
.slot.done { border-color: #9fc6aa; background: #f3f9f4; }
.slot-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.slot-name { font-weight: 600; font-size: 15px; line-height: 1.25; word-break: break-word; }
.slot-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.slot-form input { font-size: 16px; padding: 9px 10px; border-radius: 10px; min-width: 0; }
.slot-form input[name=kg] { font-family: var(--display); font-size: 22px; padding: 6px 10px; }
.slot-form .btn { padding: 9px 10px; width: 100%; }
.slot .kg { font-size: 22px; }

/* settings */
.set-row { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid #eee6d6; }
.set-row:first-of-type { border-top: 0; padding-top: 0; }
.set-row > b { font-size: 14px; }
.set-row .seg { margin-bottom: 0; }
.kv { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* people */
.people-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.people-head input { flex: 1; }
.big-count { font-family: var(--display); font-size: 34px; line-height: 1; color: var(--green); }

/* ---------- Toast & dialog ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 140%);
  background: #10281d; color: #fff; padding: 13px 18px; border-radius: 14px; font-weight: 600; font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); max-width: calc(100vw - 24px); z-index: 60; transition: transform 0.25s ease;
}
.toast.show { transform: translate(-50%, 0); }
.toast.gold { background: var(--gold); color: #2b1c00; }
.toast.bad { background: var(--red); }

dialog {
  border: 0; border-radius: 18px; padding: 0; width: min(460px, calc(100vw - 24px)); background: var(--card); color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
dialog::backdrop { background: rgba(10, 25, 18, 0.55); }
.dlg { padding: 18px; display: grid; gap: 12px; }
.dlg h3 { margin: 0; font-size: 18px; }
.dlg p { margin: 0; color: var(--ink-2); }
.dlg .btn-row { justify-content: flex-end; }

/* ---------- PIN gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px;
  background: #0d2219 url('/img/bg-river-sm.jpg') center / cover no-repeat;
}
.gate::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 24, 17, 0.72), rgba(8, 24, 17, 0.9)); }
.gate[hidden] { display: none; }
.gate-card { position: relative; width: min(380px, 100%); text-align: center; color: #fff; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; justify-items: center; }
.gate-card .t1 { width: 82%; }
.gate-card .t2 { width: 100%; }
.gate-card p { margin: 0; opacity: 0.85; font-size: 14.5px; }
.gate-card form { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 6px; }
.gate-card input { width: 100%; text-align: center; font-family: var(--display); font-size: 34px; letter-spacing: 0.3em; padding: 10px; border-color: transparent; }
.gate-card .msg { min-height: 20px; color: #ffb4a6; font-weight: 600; font-size: 14px; }
.gate-logos { display: flex; gap: 14px; align-items: center; justify-content: center; }
.gate-logos img { height: 40px; width: auto; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 420px) {
  .brand-title { height: 21px; }
  .clock { font-size: 22px; }
  .krs-mini { display: none; }
  .quota-num { font-size: 56px; }
}
@media print {
  .hero, .tabs, .toast, .phase, .no-print { display: none !important; }
  body { background: #fff; padding: 0; }
  .card { border: 0; margin: 0 0 12px; }
}
