/* SPORT ARENA – reusable components. */

/* ---------- cards ---------- */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(25, 35, 62, 0.92), rgba(15, 22, 40, 0.94));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.card > * + * {
  margin-top: 12px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-lg);
  font-weight: 700;
}
.card h3 {
  font-size: var(--fs);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
}

.kicker {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.label {
  font-weight: 600;
  color: var(--text-2);
  font-size: var(--fs-sm);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 650;
  font-size: var(--fs);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s var(--ease),
    background-color 0.15s,
    border-color 0.15s,
    box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-primary {
  color: var(--text-on-accent);
  background: linear-gradient(135deg, #2a6ff2, #4d93ff);
  box-shadow: 0 10px 28px -12px rgba(47, 123, 255, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #3a7dff, #64a2ff);
  color: #fff;
}
.btn-secondary {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--line-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}
.btn-ghost {
  color: var(--text-2);
  background: transparent;
  border-color: var(--line);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, #c8484d, #e8656a);
}
.btn-danger:hover:not(:disabled) {
  color: #fff;
  background: linear-gradient(135deg, #d6555a, #f27a7e);
}
.btn-boss {
  color: #fff;
  background: linear-gradient(135deg, #5b49e0, #8f80ff);
  box-shadow: 0 10px 28px -12px rgba(143, 128, 255, 0.9);
}
.btn-boss:hover:not(:disabled) {
  color: #fff;
  background: linear-gradient(135deg, #6a59ec, #a093ff);
}
.btn-gold {
  color: #1c1405;
  background: linear-gradient(135deg, #f4c95d, #eba552);
  box-shadow: 0 10px 28px -12px rgba(244, 201, 93, 0.8);
}
.btn-gold:hover:not(:disabled) {
  color: #1c1405;
  background: linear-gradient(135deg, #f8d77c, #f2b468);
}
.btn-lg {
  min-height: 54px;
  padding: 12px 24px;
  font-size: var(--fs-lg);
  border-radius: 14px;
}
.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: var(--fs-sm);
  border-radius: 10px;
}
.btn-stacked {
  text-align: left;
  justify-content: flex-start;
}
.btn-stack {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.btn-sub {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-2);
  white-space: normal;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.btn-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-col .btn {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-2);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--line-strong);
}
.icon-btn[aria-pressed='true'] {
  color: var(--warn-text);
  border-color: rgba(245, 184, 74, 0.4);
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------- chips & badges ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--line);
}
.chip-muted {
  background: transparent;
}
.chip-gold {
  color: var(--gold-text);
  background: var(--gold-soft);
  border-color: rgba(244, 201, 93, 0.35);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid;
}
.badge-official {
  color: var(--success-text);
  background: var(--success-soft);
  border-color: rgba(60, 207, 142, 0.35);
}
.badge-structure {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: rgba(77, 147, 255, 0.35);
}
.badge-aligned {
  color: var(--violet-text);
  background: var(--violet-soft);
  border-color: rgba(143, 128, 255, 0.35);
}
.badge-supplementary {
  color: var(--warn-text);
  background: var(--warn-soft);
  border-color: rgba(245, 184, 74, 0.35);
}

.stars {
  display: inline-flex;
  gap: 2px;
  vertical-align: middle;
}
.star-on {
  color: var(--gold);
}
.star-off {
  color: var(--line-strong);
}

.lives {
  display: inline-flex;
  gap: 3px;
}
.life-on {
  color: #ff6b7d;
}
.life-off {
  color: var(--line-strong);
}

/* ---------- progress ---------- */
.progress {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  overflow: hidden;
}
.progress-sm {
  height: 6px;
}
.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  transition: width 0.6s var(--ease);
}
.progress-boss .progress-fill {
  background: linear-gradient(90deg, #8f80ff, #d06cff);
}
.progress-gold .progress-fill {
  background: linear-gradient(90deg, #e8a54b, #f4c95d);
}
.progress-warn .progress-fill {
  background: linear-gradient(90deg, #e8913a, var(--warn));
}

/* ---------- stats ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 12px;
}
.stat {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.stat > .icon {
  grid-row: span 2;
  color: var(--accent-text);
}
.stat-value {
  font-size: var(--fs-xl);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-label {
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-weight: 600;
}

/* ---------- notices & empty ---------- */
.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: var(--fs-sm);
}
.notice .icon {
  margin-top: 2px;
}
.notice-info {
  color: var(--text-2);
  background: var(--accent-soft);
  border-color: rgba(77, 147, 255, 0.3);
}
.notice-warn {
  color: var(--warn-text);
  background: var(--warn-soft);
  border-color: rgba(245, 184, 74, 0.32);
}
.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  padding: 28px 16px;
  color: var(--text-2);
}
.empty-title {
  font-weight: 700;
  color: var(--text);
}

/* ---------- forms ---------- */
.field {
  display: grid;
  gap: 6px;
}
.field + .field {
  margin-top: 14px;
}
.field-desc {
  font-size: var(--fs-sm);
  color: var(--text-3);
}
.input,
.select,
.textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: var(--text);
  min-height: 44px;
}
.textarea {
  resize: vertical;
  line-height: 1.5;
}
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-color: var(--accent-2);
}
.field-error {
  color: var(--danger-text);
  font-size: var(--fs-sm);
  min-height: 0;
}
.field-error:empty {
  display: none;
}

.field-range {
  grid-template-columns: 1fr auto;
  align-items: center;
}
.field-range label {
  grid-column: 1 / -1;
  font-weight: 600;
}
.field-range input[type='range'] {
  width: 100%;
  accent-color: var(--accent-2);
  min-height: 32px;
}
.range-value {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  min-width: 4ch;
  text-align: right;
}

.field-switch {
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 12px;
}
.field-switch .field-desc {
  grid-column: 2;
}
.field-switch label {
  font-weight: 600;
  cursor: pointer;
}
.field-switch input[type='checkbox'] {
  appearance: none;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s;
  margin: 0;
}
.field-switch input[type='checkbox']::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.2s var(--ease), background-color 0.2s;
}
.field-switch input[type='checkbox']:checked {
  background: var(--accent);
  border-color: var(--accent-2);
}
.field-switch input[type='checkbox']:checked::after {
  transform: translateX(20px);
  background: #fff;
}

/* segmented control & chip toggles: native inputs, styled sibling spans */
.segmented,
.chip-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.segment,
.chip-toggle {
  position: relative;
  cursor: pointer;
}
.segment input,
.chip-toggle input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.segment span,
.chip-toggle span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.chip-toggle span {
  border-radius: 999px;
}
.segment:hover span,
.chip-toggle:hover span {
  border-color: var(--accent-2);
  color: var(--text);
}
.segment input:checked + span {
  background: linear-gradient(135deg, #2a6ff2, #4d93ff);
  color: #fff;
  border-color: transparent;
}
.chip-toggle input:checked + span {
  background: var(--accent-soft);
  color: #dbe7ff;
  border-color: var(--accent-2);
}
.chip-toggle input:checked + span::before {
  content: '✓';
  margin-right: 6px;
  font-weight: 800;
}
.segment input:focus-visible + span,
.chip-toggle input:focus-visible + span {
  box-shadow: var(--ring);
}

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table thead th {
  color: var(--text-3);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.table tbody th {
  font-weight: 700;
}

/* ---------- dialogs & toasts ---------- */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 6, 14, 0.72);
  backdrop-filter: blur(6px);
  animation: fade-up 0.2s var(--ease);
}
.dialog {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 26px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #1a2546, #111a31);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  animation: pop 0.25s var(--ease);
}
.dialog-boss {
  border-color: rgba(143, 128, 255, 0.55);
  box-shadow: var(--shadow-lg), 0 0 60px -10px rgba(143, 128, 255, 0.45);
}
.dialog-gold {
  border-color: rgba(244, 201, 93, 0.5);
  box-shadow: var(--shadow-lg), 0 0 60px -12px rgba(244, 201, 93, 0.4);
}
.dialog-danger {
  border-color: rgba(242, 103, 107, 0.45);
}
.dialog-title {
  font-size: var(--fs-xl);
  font-weight: 800;
}
.dialog-body {
  margin-top: 12px;
  color: var(--text-2);
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 70;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: #1a2546;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  animation: fade-up 0.3s var(--ease);
  transition: opacity 0.3s, transform 0.3s;
}
.toast-out {
  opacity: 0;
  transform: translateY(6px);
}
.toast-success .icon {
  color: var(--success-text);
}
.toast-gold {
  border-color: rgba(244, 201, 93, 0.5);
}
.toast-gold .icon {
  color: var(--gold);
}
.toast-warn .icon {
  color: var(--warn-text);
}
