﻿:root {
  --bg: #12141a;
  --panel: #1a1d26;
  --panel-2: #21252f;
  --line: #2c3240;
  --text: #e7eaf0;
  --muted: #9aa3b2;
  --accent: #e0a44a;
  --good: #57b97a;
  --bad: #d26666;
  --radius: 12px;
  font-synthesis-weight: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 70% -10%, #232a3a 0%, var(--bg) 60%);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}

a {
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 20, 26, 0.85);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-mark {
  color: var(--accent);
  font-size: 18px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 14px;
}

.topnav a {
  text-decoration: none;
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.topnav a:hover,
.topnav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.status {
  font-size: 12px;
  color: var(--muted);
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.status[data-state="ok"] {
  color: var(--good);
  border-color: rgba(87, 185, 122, 0.4);
}

.status[data-state="fail"] {
  color: var(--bad);
  border-color: rgba(210, 102, 102, 0.4);
}

.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 64px;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
}

.panel-note {
  grid-column: 1 / -1;
  color: var(--muted);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel h1,
.panel h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.button {
  appearance: none;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.button:hover {
  border-color: var(--accent);
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

.room-list {
  display: grid;
  gap: 10px;
}

.room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}

button.room {
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

button.room:hover {
  border-color: var(--accent);
}

.room-title {
  font-weight: 600;
}

.room-meta {
  color: var(--muted);
  font-size: 13px;
}

.room-seats {
  grid-row: span 2;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

.empty {
  color: var(--muted);
  padding: 18px 4px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.project-list {
  display: grid;
  gap: 10px;
}

.project {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.project-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.project-desc {
  color: var(--muted);
  font-size: 13px;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.error-text {
  color: var(--bad);
}

.auth {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-name {
  font-size: 13px;
}

.button.primary {
  background: var(--accent);
  color: #241a08;
  border-color: transparent;
  font-weight: 600;
}

.button.small {
  padding: 5px 10px;
  font-size: 12px;
}

a.button {
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

.inline-link {
  margin-top: 10px;
}

.dialog {
  width: min(400px, calc(100vw - 32px));
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
}

.dialog::backdrop {
  background: rgba(6, 8, 12, 0.65);
}

.dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
  margin: 0;
}

.dialog-close button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  padding: 4px 9px;
  cursor: pointer;
}

.dialog-close button:hover {
  color: var(--text);
}

.tabs {
  display: flex;
  gap: 18px;
  margin-bottom: 16px;
}

.tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 6px 0;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.form {
  display: grid;
  gap: 12px;
}

.form[hidden] {
  display: none;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.field input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text);
  font: inherit;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-error {
  margin: 0;
  color: var(--bad);
  font-size: 13px;
}

.form-error[hidden] {
  display: none;
}

.panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.room-heading {
  min-width: 0;
}

.room-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.seats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.seat {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  min-height: 118px;
}

.seat.free {
  background: transparent;
  border-style: dashed;
}

.seat.owner {
  border-color: rgba(224, 164, 74, 0.55);
}

.seat.offline {
  opacity: 0.7;
}

.seat-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.seat-no {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.seat-state {
  color: var(--accent);
}

.seat-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.seat-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 20px;
}

.badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.badge.muted {
  opacity: 0.75;
}

.button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.room-hint {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.notice {
  font-size: 13px;
}

.join-box {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.join-box input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
  min-width: 180px;
}

.chat-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 12px;
}

.chat-row {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid transparent;
}

.chat-row.mine {
  border-color: rgba(224, 164, 74, 0.35);
}

.chat-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 3px;
}

.chat-name {
  font-weight: 600;
  color: var(--text);
}

.chat-text {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-form {
  display: flex;
  gap: 8px;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text);
  font: inherit;
}

.chat-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.empty.small {
  padding: 10px;
  font-size: 13px;
}

.dialog-title {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 600;
}

.field select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text);
  font: inherit;
}

.field select:focus {
  outline: none;
  border-color: var(--accent);
}

#match-view {
  max-width: none;
  padding: 10px 12px 14px;
  height: calc(100vh - 56px);
  min-height: 520px;
}

.match-layout {
  grid-template-columns: minmax(0, 1fr) clamp(260px, 22vw, 340px);
  align-items: stretch;
}

.match-layout.chat-off {
  grid-template-columns: minmax(0, 1fr);
}

.match-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.match-chat .chat-list {
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 12px;
}

.leaderboard {
  display: grid;
  gap: 6px;
}

.leader-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  font-size: 13px;
}

.leader-place {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.leader-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.leader-meta {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.leader-rating {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.admin-search {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  width: 200px;
}

.admin-search:focus {
  outline: none;
  border-color: var(--accent);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.pager-label {
  font-size: 12px;
  color: var(--muted);
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.zoom-controls .button {
  min-width: 34px;
  padding: 5px 8px;
}

.active-banner-panel {
  grid-column: 1 / -1;
  border-color: rgba(224, 164, 74, 0.45);
}

.active-banner-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.active-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  user-select: none;
}

.active-text {
  flex: 1 1 220px;
  font-size: 13px;
}

.active-row .button {
  flex: 0 0 auto;
}

.button.danger {
  border-color: rgba(210, 102, 102, 0.45);
  color: #e39a9a;
}

.button.danger:hover {
  border-color: var(--bad);
  color: #f0b4b4;
}

.match-panel {
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.match-frame-wrap {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

.match-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0e1015;
  display: block;
}

.user-name {
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px dashed var(--line);
}

.user-name:hover {
  border-bottom-color: var(--accent);
}

.admin-link {
  color: var(--accent);
  font-size: 12px;
}

.profile-card {
  display: grid;
  gap: 14px;
}

.profile-name {
  font-size: 22px;
  font-weight: 700;
}

.profile-login {
  color: var(--muted);
  font-size: 13px;
  margin-top: -8px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.profile-cell {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}

.profile-cell-title {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-cell-value {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 110px 90px 90px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  text-decoration: none;
  color: inherit;
  font-size: 13px;
}

.history-row:hover {
  border-color: var(--accent);
}

.history-project {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.history-date,
.history-place,
.history-score {
  color: var(--muted);
}

.history-delta {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.history-delta.up {
  color: var(--good);
}

.history-delta.down {
  color: var(--bad);
}

.admin-list {
  display: grid;
  gap: 8px;
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 13px;
}

.admin-name {
  flex: 1 1 220px;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: break-word;
}

.admin-login,
.admin-meta {
  color: var(--muted);
  white-space: nowrap;
}

.admin-row .button {
  margin-left: auto;
}

.admin-state {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.admin-state.banned {
  color: var(--bad);
  border-color: rgba(210, 102, 102, 0.4);
}

.admin-state.status-live {
  color: var(--accent);
  border-color: rgba(224, 164, 74, 0.4);
}

.admin-state.status-finished {
  color: var(--good);
  border-color: rgba(87, 185, 122, 0.4);
}

.match-results {
  display: grid;
  gap: 12px;
}

.results-title {
  margin: 0;
  font-size: 18px;
}

.results-reason {
  margin: 0;
  color: var(--muted);
}

.results-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.result-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 80px 80px 80px;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.result-row:first-child {
  border-top: 0;
}

.result-row.head {
  background: var(--panel-2);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.result-row.winner {
  background: rgba(224, 164, 74, 0.12);
}

.result-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.result-total {
  text-align: right;
  font-weight: 600;
}

.result-money,
.result-goods {
  text-align: right;
  color: var(--muted);
}

.result-delta {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.result-delta.up {
  color: var(--good);
}

.result-delta.down {
  color: var(--bad);
}

.results-back {
  justify-self: start;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .result-row {
    grid-template-columns: 40px minmax(0, 1fr) 54px 54px 54px;
    font-size: 13px;
  }

  .room-chat {
    order: 2;
  }
}

@media (max-width: 1000px) {
  .match-layout,
  .match-layout.chat-off {
    grid-template-columns: 1fr;
  }

  #match-view {
    height: auto;
    min-height: 0;
  }

  .match-frame-wrap {
    height: 62vh;
    min-height: 420px;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 10px 12px;
  }

  .layout {
    padding: 12px 10px 40px;
  }

  .panel {
    padding: 14px;
  }

  .history-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 2px;
  }

  .history-project {
    grid-column: 1 / -1;
  }

  .leader-meta {
    display: none;
  }

  .result-row {
    grid-template-columns: 32px minmax(0, 1fr) 46px 46px 46px;
    padding: 8px 10px;
  }

  .admin-name {
    flex-basis: 100%;
  }

  .admin-row .button {
    margin-left: 0;
  }

  .panel-head {
    flex-wrap: wrap;
  }

  .admin-search {
    width: 100%;
  }
}



.admin-projects-panel {
  grid-column: 1 / -1;
}

.dialog-wide {
  width: min(720px, calc(100vw - 32px));
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.field textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text);
  font: inherit;
  resize: vertical;
  min-height: 140px;
}

.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.admin-row--project .admin-meta {
  flex: 1 1 200px;
  white-space: normal;
}
