/* Shared components used by both pages. Page-specific layout lives in lobby.css / viewer.css. */

/* ---------- Icons ---------- */
.icon { width: 20px; height: 20px; flex: none; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 24px; height: 24px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-5);
  border-radius: var(--r-control);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast), color var(--dur-fast);
}
.btn--primary { background: var(--paper); color: var(--paper-ink); }
.btn--primary:hover { background: #ffffff; }
.btn--ghost { border: 1px solid var(--line-strong); color: var(--text); }
.btn--ghost:hover { background: var(--ink-2); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-control);
  color: var(--text-2);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.icon-btn:hover { background: var(--ink-2); color: var(--text); }
.icon-btn[aria-pressed="true"] { background: var(--ink-3); color: var(--text); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn--solid { background: var(--ink-2); color: var(--text); }
.icon-btn--solid:hover { background: var(--ink-3); }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-chip);
  background: var(--ink-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
.chip--outline { background: transparent; border: 1px solid var(--line-strong); }

/* ---------- Segmented control (filters, tabs, language) ---------- */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: calc(var(--r-control) + 3px);
  background: var(--ink-1);
  border: 1px solid var(--line);
}
.segmented button,
.segmented a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 var(--s-3);
  border-radius: var(--r-control);
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.segmented button:hover { color: var(--text); }
.segmented [aria-pressed="true"],
.segmented [aria-selected="true"] {
  background: var(--ink-3);
  color: var(--text);
}
.segmented .count {
  font-stretch: var(--narrow);
  font-weight: 700;
  color: var(--text-3);
}
.segmented [aria-pressed="true"] .count { color: var(--text-2); }

/* Language switch is a two-option segmented control */
.lang-switch button { min-height: 30px; padding: 0 10px; font-size: var(--fs-xs); }

/* ---------- Inputs ---------- */
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search .icon {
  position: absolute;
  left: 12px;
  color: var(--text-3);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 42px;
  padding: 0 var(--s-3) 0 40px;
  border-radius: var(--r-control);
  background: var(--ink-1);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: var(--fs-sm);
  transition: border-color var(--dur-fast);
}
.search input::placeholder { color: var(--text-3); }
.search input:focus-visible { outline: none; border-color: var(--focus); }

.select {
  appearance: none;
  -webkit-appearance: none;
  height: 36px;
  padding: 0 28px 0 12px;
  border-radius: var(--r-control);
  background: var(--ink-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b6bbdf' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 700;
  font-stretch: var(--narrow);
  cursor: pointer;
}

/* ---------- Team swatch (shape + color, rendered as inline SVG) ---------- */
.swatch { width: 14px; height: 14px; flex: none; }

/* ---------- Dialog (match picker, shortcuts) ---------- */
.dialog {
  width: min(560px, calc(100vw - 2 * var(--gutter)));
  max-height: min(80dvh, 720px);
  padding: 0;
  border: 0;
  border-radius: var(--r-panel);
  background: var(--ink-1);
  color: var(--text);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.dialog::backdrop { background: rgba(5, 7, 22, 0.66); backdrop-filter: blur(3px); }
.dialog[open] { display: flex; flex-direction: column; animation: dialog-in var(--dur) var(--ease-out); }
.dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--line);
}
.dialog__head h2 { font-size: var(--fs-lg); font-weight: 700; }
.dialog__body { overflow: auto; padding: var(--s-2); }

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
}

/* On phones dialogs become bottom sheets */
@media (max-width: 719px) {
  .dialog {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
    max-height: 82dvh;
    border-radius: var(--r-panel) var(--r-panel) 0 0;
    padding-bottom: var(--safe-b);
  }
  @keyframes dialog-in { from { transform: translateY(24px); opacity: 0.4; } }
}

/* ---------- Keyboard hint ---------- */
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--ink-2);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-2);
}

/* ---------- Status messages ---------- */
.notice {
  display: grid;
  place-items: center;
  gap: var(--s-3);
  padding: var(--s-10) var(--s-6);
  text-align: center;
  color: var(--text-2);
}
.notice h2, .notice h3 { color: var(--text); font-size: var(--fs-lg); }
.notice p { max-width: 42ch; font-size: var(--fs-sm); }

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--ink-3);
  border-top-color: var(--text-2);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Chip buttons (toggles, small actions) ---------- */
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--r-chip);
  background: var(--ink-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.chip-btn:hover { color: var(--text); }
.chip-btn[aria-pressed="true"] { background: var(--ink-4); color: var(--text); }
