/* 101-server — общая тема для dev / stats / index */

:root {
  --bg0: #0c0e12;
  --bg1: #12151c;
  --surface: #1a1e28;
  --surface2: #222831;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #e8eaf0;
  --muted: #8f96a3;
  --accent: #e5a93d;
  --accent-hover: #f0be5c;
  --accent-muted: rgba(229, 169, 61, 0.15);
  --ok: #7fd99a;
  --err: #f07178;
  --link: #8ab4ff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg0);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(229, 169, 61, 0.12), transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 50%, rgba(138, 180, 255, 0.06), transparent 50%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 40%, var(--bg0) 100%);
}

a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.shell {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.15rem;
}
.brand span {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.nav a {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  text-decoration: none;
  border: 1px solid transparent;
}
.nav a:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  text-decoration: none;
}
.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--accent-muted);
  border-color: rgba(229, 169, 61, 0.35);
}

h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.lead {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.panel {
  margin: 1rem 0;
  padding: 1.1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel h2 {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin: 0.45rem 0;
}
.row:first-child {
  margin-top: 0;
}
.row:last-child {
  margin-bottom: 0;
}

label {
  margin-right: 0.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

button,
input,
select {
  font: inherit;
}
input,
select {
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface2);
  color: var(--text);
}
input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  vertical-align: middle;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(229, 169, 61, 0.45);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover:not(:disabled) {
  background: #2a303c;
  border-color: rgba(255, 255, 255, 0.18);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent-hover) 0%, var(--accent) 100%);
  border-color: rgba(0, 0, 0, 0.2);
  color: #1a1308;
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #f5c86a 0%, var(--accent-hover) 100%);
  border-color: rgba(0, 0, 0, 0.25);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}
.status-pill.ok::before {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}
.status-pill.err::before {
  background: var(--err);
}

.red {
  color: var(--err);
}

.json {
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.85rem;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow: auto;
  max-height: 12rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.hand {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.card-btn {
  min-width: 3.1rem;
  font-weight: 600;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.card-btn.playable {
  outline: 2px solid rgba(127, 217, 154, 0.65);
  outline-offset: 2px;
}

.msg {
  min-height: 1.5rem;
  font-size: 0.9rem;
}
.msg.ok {
  color: var(--ok);
}
.msg.err {
  color: var(--err);
}

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.85rem;
  margin: 1rem 0 1.25rem;
}
.stat-tile {
  padding: 1rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.stat-tile .label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.stat-tile .value {
  font-size: 1.65rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
th,
td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
}
tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}
tr:last-child td {
  border-bottom: none;
}
code {
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}

.badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-yes {
  background: rgba(127, 217, 154, 0.12);
  color: var(--ok);
  border: 1px solid rgba(127, 217, 154, 0.25);
}
.badge-no {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px solid var(--border);
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

/* Landing */
.hero {
  text-align: center;
  padding: 2rem 0 1rem;
}
.hero h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: 0.5rem;
}
.hero .lead {
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}
.cta-row .btn {
  min-width: 10rem;
}

.shell-wide {
  max-width: 72rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.9rem;
}

.section-head h2,
.section-head h3 {
  margin: 0;
}

.section-head h3 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  gap: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field > span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  min-height: 2.5rem;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.dev-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(18rem, 1fr);
  gap: 1rem;
  align-items: start;
}

.summary-box {
  padding: 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
  color: var(--text);
}

.chip strong {
  font-weight: 700;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-size: 0.9rem;
}

.toggle-line input {
  margin: 0;
}

.players-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.player-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.68rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
}

.player-pill.you {
  background: var(--accent-muted);
  border-color: rgba(229, 169, 61, 0.35);
}

.player-pill.active {
  border-color: rgba(138, 180, 255, 0.32);
  box-shadow: 0 0 0 1px rgba(138, 180, 255, 0.16) inset;
}

.player-pill .meta {
  color: var(--muted);
  font-size: 0.76rem;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.room-item {
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.room-item.is-active {
  border-color: rgba(229, 169, 61, 0.35);
  background: var(--accent-muted);
}

.room-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.room-code {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
}

.room-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.85rem;
}

.metric-card {
  padding: 0.9rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.metric-card .label {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-card .value {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(17rem, 1fr);
  gap: 1rem;
  margin-top: 1rem;
  align-items: start;
}

.aside-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-btn {
  min-height: 2.5rem;
}

.card-btn.playable {
  box-shadow: 0 0 0 1px rgba(127, 217, 154, 0.3) inset;
}

.hand:empty::before {
  content: "Карты появятся после старта игры.";
  color: var(--muted);
  font-size: 0.9rem;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 15rem;
  overflow: auto;
}

.log-item {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.77rem;
  line-height: 1.45;
}

.empty-card {
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.debug-details {
  margin-top: 1rem;
}

.debug-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 760px) {
  .shell {
    padding: 1rem 1rem 2rem;
  }

  .dev-grid,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .actions-row .btn,
  .room-item .btn {
    flex: 1 1 12rem;
  }

  .nav {
    width: 100%;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 0.5rem 0.6rem;
  }
}
