:root {
  --bg: #030814; --bg2: #071a33; --fg: #e8f4ff; --muted: #8fb3cf; --faint: #5d7f99;
  --cyan: #3fd2ff; --cyan-dim: rgba(63, 210, 255, .35); --orange: #ff8a24; --orange-hi: #ffa64d;
  --panel: rgba(6, 30, 46, .82); --line: rgba(63, 210, 255, .28); --red: #ff5d6c; --green: #5dffb0;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--fg); background: radial-gradient(ellipse at top, var(--bg2), var(--bg) 70%) fixed;
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 8px 18px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
h1 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1 span { color: var(--cyan); }
h2 { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
#srv { color: var(--muted); font-variant-numeric: tabular-nums; }
#srv.bad { color: var(--red); }
#srv:empty { display: none; }
main { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; padding: 16px 24px 32px; }
@media (max-width: 900px) { main { grid-template-columns: 1fr; } }
section { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; min-width: 0; }
.col { display: grid; gap: 16px; align-content: start; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 4px 8px; }
td { padding: 7px 8px; border-top: 1px solid rgba(63, 210, 255, .12); }
td.num, th.num { text-align: right; }
tbody tr.player { cursor: pointer; }
tbody tr.player:hover { background: rgba(63, 210, 255, .07); }
tbody tr.sel { background: rgba(63, 210, 255, .14); }
.tag { display: inline-block; padding: 0 7px; border-radius: 9px; font-size: 11px; border: 1px solid var(--line); color: var(--muted); }
.tag.game { border-color: var(--orange); color: var(--orange-hi); }
.empty { color: var(--faint); padding: 10px 0 2px; }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.row label { width: 92px; color: var(--muted); font-size: 13px; }
input { flex: 1; min-width: 0; padding: 7px 9px; border-radius: 5px; border: 1px solid var(--line); background: rgba(0, 0, 0, .35);
  color: var(--fg); font: inherit; }
input:focus { outline: none; border-color: var(--cyan); }
select { height: 36px; padding: 0 34px 0 10px; border-radius: 5px; border: 1px solid var(--line); color: var(--fg);
  font: inherit; line-height: 34px; cursor: pointer; -webkit-appearance: none; appearance: none;
  background: rgba(0, 0, 0, .35) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238fb3cf' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center; }
select:focus { outline: none; border-color: var(--cyan); }
select option { background: #071a33; color: var(--fg); }
input:not([type=number]):not(.short) { height: 36px; }
input.short { flex: 0 0 110px; }
button { padding: 7px 14px; border-radius: 5px; border: 1px solid var(--cyan-dim); background: rgba(63, 210, 255, .1);
  color: var(--fg); font: inherit; font-weight: 600; cursor: pointer; }
button:hover { border-color: var(--cyan); background: rgba(63, 210, 255, .2); }
button.warn { border-color: rgba(255, 93, 108, .5); background: rgba(255, 93, 108, .1); }
button.warn:hover { border-color: var(--red); }
.hint { color: var(--faint); font-size: 12px; margin: 2px 0 10px; }
.who { font-size: 16px; font-weight: 700; margin: 0 0 2px; }
.who small { color: var(--muted); font-weight: 400; }
ul.inv { margin: 6px 0 0; padding: 0; list-style: none; max-height: 220px; overflow: auto; font-size: 13px; }
ul.inv li { padding: 3px 0; border-top: 1px solid rgba(63, 210, 255, .1); color: var(--muted); }
ul.inv li.eq { color: var(--fg); }
#log { margin: 0; padding: 0; list-style: none; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; max-height: 260px; overflow: auto; }
#log li { padding: 3px 0; border-top: 1px solid rgba(63, 210, 255, .1); white-space: pre-wrap; word-break: break-word; }
#log li.err { color: var(--red); }
#log li.ok { color: var(--green); }
#detail[hidden], main[hidden] { display: none; }
.loading.boot { min-height: 50vh; }
.loading.boot.done { display: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
nav { display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; min-width: 0; scrollbar-width: none; padding: 2px 0; }
nav::-webkit-scrollbar { display: none; }
nav.more-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
nav.more-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px); mask-image: linear-gradient(90deg, transparent, #000 36px); }
nav.more-l.more-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
nav a { flex: none; white-space: nowrap; color: var(--muted); text-decoration: none; padding: 4px 12px; border-radius: 14px; border: 1px solid transparent; font-weight: 600; font-size: 13px; }
nav a:hover { color: var(--fg); border-color: var(--line); }
header .logout { margin-left: 0; align-self: center; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 8px; border: 1px solid rgba(255, 110, 110, .45); background: rgba(255, 110, 110, .08);
  color: #ff9a9a; font-weight: 700; font-size: 13px; text-decoration: none; transition: background .15s, color .15s; }
header .logout svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#srv + .logout { margin-left: 4px; }
header .logout:hover { background: rgba(255, 110, 110, .22); color: #fff; border-color: rgba(255, 110, 110, .8); }
header .logout.login { border-color: var(--cyan-dim); background: rgba(63, 210, 255, .1); color: var(--cyan); }
header .logout.login:hover { background: rgba(63, 210, 255, .22); color: #fff; border-color: var(--cyan); }
nav a.on { color: var(--fg); border-color: var(--cyan-dim); background: rgba(63, 210, 255, .1); }
#srv { margin-left: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 1500px) and (min-width: 701px) {
  header { grid-template-columns: auto minmax(0, 1fr) auto; }
  #srv { grid-column: 1 / -1; grid-row: 2; font-size: 12px; }
  nav a { padding: 4px 10px; }
}

#accounts button.pw { padding: 2px 9px; font-size: 12px; font-weight: 500; }

.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 30px 8px; color: var(--muted);
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.loading.small { justify-content: flex-start; padding: 6px 0; gap: 9px; font-size: 11px; }
.loading::before { content: ""; width: 26px; height: 26px; flex: none; border-radius: 50%;
  border: 2px solid rgba(63, 210, 255, .15); border-top-color: var(--cyan); border-right-color: var(--cyan);
  background: radial-gradient(circle, rgba(63, 210, 255, .9) 0 2px, rgba(63, 210, 255, .25) 3px, transparent 6px);
  box-shadow: 0 0 10px rgba(63, 210, 255, .35), inset 0 0 6px rgba(63, 210, 255, .25);
  outline: 1px dashed rgba(63, 210, 255, .35); outline-offset: 3px;
  animation: pso-spin 1s linear infinite, pso-core 1.6s ease-in-out infinite; }
.loading.small::before { width: 16px; height: 16px; outline-offset: 2px; }
.loading { animation: pso-blink 1.6s ease-in-out infinite; }
@keyframes pso-spin { to { transform: rotate(360deg); } }
@keyframes pso-core { 50% { box-shadow: 0 0 16px rgba(63, 210, 255, .6), inset 0 0 9px rgba(63, 210, 255, .45); } }
@keyframes pso-blink { 50% { color: var(--cyan); } }
@media (prefers-reduced-motion: reduce) { .loading, .loading::before { animation-duration: 3s; } }

@media (max-width: 700px) {
  header { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 10px; padding: 10px 12px 8px;
    position: sticky; top: 0; z-index: 20; background: rgba(3, 8, 20, .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
  h1 { font-size: 15px; }
  header .logout { grid-column: 2; grid-row: 1; margin: 0; padding: 6px 10px; }
  #srv { grid-column: 1 / -1; grid-row: 3; margin: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  nav { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; flex-wrap: nowrap; margin: 0 -12px; padding: 2px 12px 4px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-padding: 0 12px; }
  nav::-webkit-scrollbar { display: none; }
  nav a { flex: none; padding: 7px 13px; white-space: nowrap; }
  main { padding: 10px 10px 28px; gap: 10px; }
  .col { gap: 10px; }
  section { padding: 12px; border-radius: 10px; }
  section table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  td, th { padding-left: 6px; padding-right: 6px; }
  input, select, textarea { font-size: 16px; }
  input:not([type=number]):not(.short), select { height: 42px; }
  input[type=number] { min-height: 42px; }
  button { min-height: 40px; }
  .row label { width: 100%; }
  .row label + input, .row label + select { flex: 1 1 160px; }
  input.short { flex: 1 1 100px; }
  select { max-width: 100%; min-width: 0; }
  section { scroll-margin-top: 118px; }
  .tag { white-space: nowrap; }
  .actions { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)) !important; flex-wrap: wrap; gap: 6px 8px !important; }
  .actions .msg { flex-basis: 100%; order: -1; font-size: 12px !important; }
  .actions button { flex: 1; }
}
