/* Local public-playtest dashboard. */

.telemetry-button {
  position: absolute;
  z-index: 18;
  top: 112px;
  left: 16px;
  min-width: 118px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid rgba(110, 206, 194, 0.72);
  border-radius: 999px;
  color: #c5f3eb;
  background: linear-gradient(180deg, rgba(36, 104, 101, 0.98), rgba(8, 45, 49, 0.99));
  box-shadow:
    inset 0 0 0 3px rgba(4, 20, 22, 0.46),
    0 6px 18px rgba(0, 0, 0, 0.36);
  cursor: pointer;
}

.telemetry-button:hover { filter: brightness(1.1); }
.telemetry-button:active:not(:disabled) { transform: translateY(1px); }

.telemetry-button-icon {
  color: #f0d183;
  font-size: 15px;
  line-height: 1;
}

.telemetry-button-text {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.075em;
  white-space: nowrap;
}

.telemetry-button:focus-visible,
.telemetry-close:focus-visible,
.telemetry-dashboard button:focus-visible,
.telemetry-dashboard a:focus-visible {
  outline: 3px solid #77d4c8;
  outline-offset: 3px;
}

@media (max-width: 420px) {
  .telemetry-button {
    min-width: 108px;
    width: 108px;
    height: 36px;
    padding-inline: 8px;
  }
}

@media (min-width: 900px) {
  .telemetry-button {
    position: static;
    inset: auto;
    width: 100%;
    min-width: 0;
    max-width: 190px;
    height: 40px;
    justify-self: center;
    padding-inline: 7px;
    transform: none;
  }

  .telemetry-button:active:not(:disabled) { transform: translateY(1px); }

  .telemetry-button-text {
    font-size: 7px;
    white-space: normal;
    text-align: center;
  }
}

@media (min-width: 900px) and (max-height: 760px) {
  .telemetry-button { height: 36px; }
}

body.telemetry-open { overflow: hidden; }

.telemetry-layer {
  position: fixed;
  z-index: 1100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2.4vw, 28px);
  overflow: hidden;
  background: rgba(2, 8, 11, 0.84);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.telemetry-layer.is-open { opacity: 1; }

.telemetry-dashboard {
  width: min(1050px, 100%);
  max-height: min(92dvh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid rgba(220, 180, 96, 0.88);
  border-radius: 22px;
  color: var(--cream);
  background:
    radial-gradient(circle at 78% 0%, rgba(69, 158, 148, 0.17), transparent 35%),
    linear-gradient(150deg, rgba(28, 61, 64, 0.995), rgba(4, 18, 23, 0.998));
  box-shadow:
    0 0 0 5px rgba(7, 17, 20, 0.96),
    0 0 0 7px rgba(127, 94, 45, 0.76),
    0 30px 90px rgba(0, 0, 0, 0.76),
    inset 0 0 55px rgba(80, 165, 155, 0.07);
  opacity: 0;
  transform: translateY(12px) scale(0.988);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.telemetry-layer.is-open .telemetry-dashboard {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.telemetry-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(218, 181, 105, 0.42);
  background: linear-gradient(180deg, rgba(8, 29, 34, 0.99), rgba(8, 24, 29, 0.96));
}

.telemetry-kicker {
  display: block;
  margin-bottom: 3px;
  color: #79c2b9;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.2em;
}

.telemetry-header h2 {
  margin: 0;
  color: #f0d68e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 3.2vw, 31px);
  letter-spacing: 0.07em;
}

.telemetry-header p {
  margin: 4px 0 0;
  color: #829e9a;
  font-size: 9px;
  letter-spacing: 0.045em;
}

.telemetry-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(231, 119, 92, 0.82);
  border-radius: 50%;
  color: #ffd5c7;
  background: linear-gradient(180deg, #a94a3b, #60241e);
  box-shadow: inset 0 0 0 3px rgba(44, 12, 10, 0.36);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.telemetry-body {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(218, 181, 105, 0.62) rgba(4, 17, 21, 0.5);
}

.telemetry-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 9px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid rgba(218, 181, 105, 0.38);
  border-radius: 13px;
  background: rgba(5, 21, 25, 0.76);
}

.telemetry-storage-status {
  color: #79a29d;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.09em;
}

.telemetry-actions button,
.telemetry-actions a,
.telemetry-clear-confirm button {
  min-height: 36px;
  border: 1px solid rgba(117, 190, 181, 0.52);
  border-radius: 9px;
  color: #d8eee8;
  background: linear-gradient(180deg, rgba(33, 81, 81, 0.98), rgba(10, 39, 43, 0.99));
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.telemetry-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 10px;
  text-decoration: none;
}

.telemetry-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.telemetry-actions button { padding-inline: 10px; }

.telemetry-actions .danger,
.telemetry-clear-confirm .danger {
  border-color: rgba(231, 112, 88, 0.72);
  color: #ffd5cc;
  background: linear-gradient(180deg, rgba(151, 59, 47, 0.98), rgba(73, 24, 21, 0.99));
}

.telemetry-clear-confirm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  margin-bottom: 12px;
  padding: 11px 12px;
  border: 1px solid rgba(237, 103, 79, 0.78);
  border-radius: 12px;
  background: rgba(80, 26, 22, 0.94);
}

.telemetry-clear-confirm strong,
.telemetry-clear-confirm span { display: block; }
.telemetry-clear-confirm strong { color: #ffd0c7; font-size: 11px; }
.telemetry-clear-confirm span { margin-top: 3px; color: #c9958d; font-size: 8px; }
.telemetry-clear-confirm button { padding-inline: 12px; }

.telemetry-section {
  min-width: 0;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(218, 181, 105, 0.32);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(204, 164, 79, 0.045), transparent 40%),
    rgba(5, 20, 24, 0.68);
  box-shadow: inset 0 0 0 3px rgba(3, 13, 16, 0.25);
}

.telemetry-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(99, 172, 164, 0.28);
}

.telemetry-section-head h3 {
  margin: 0;
  color: #76c5bb;
  font-size: 9px;
  letter-spacing: 0.14em;
}

.telemetry-section-head span {
  color: #6f918d;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-align: right;
}

.telemetry-stat-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.telemetry-stat-grid article,
.telemetry-reach-grid article {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(116, 185, 177, 0.24);
  border-radius: 9px;
  background: rgba(13, 43, 48, 0.78);
}

.telemetry-stat-grid span,
.telemetry-reach-grid span {
  display: block;
  min-height: 17px;
  color: #789a96;
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.telemetry-stat-grid strong,
.telemetry-reach-grid strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: #f0d28a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  text-overflow: ellipsis;
}

.telemetry-reach-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.telemetry-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.telemetry-bars { display: grid; gap: 7px; }

.telemetry-bars > div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 30px;
  gap: 7px;
  align-items: center;
}

.telemetry-bars span,
.telemetry-bars strong {
  color: #8ba8a4;
  font-size: 8px;
  font-weight: 900;
}

.telemetry-bars strong { color: #e5cb88; text-align: right; }

.telemetry-bars i {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(5, 15, 18, 0.85);
  box-shadow: inset 0 0 0 1px rgba(116, 185, 177, 0.18);
}

.telemetry-bars b {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: linear-gradient(90deg, #276d67, #72c8b8);
}

.danger-bars b { background: linear-gradient(90deg, #7a2d25, #d26954); }

.telemetry-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(111, 177, 169, 0.2);
  border-radius: 9px;
}

.telemetry-dashboard table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8px;
}

.telemetry-dashboard th,
.telemetry-dashboard td {
  padding: 7px 9px;
  border-bottom: 1px solid rgba(111, 177, 169, 0.13);
  text-align: right;
  white-space: nowrap;
}

.telemetry-dashboard th:first-child,
.telemetry-dashboard td:first-child { text-align: left; }
.telemetry-dashboard th { color: #74948f; font-size: 7px; letter-spacing: 0.08em; }
.telemetry-dashboard td { color: #c2d0cb; }
.telemetry-dashboard tr:last-child td { border-bottom: 0; }
.telemetry-dashboard tr.success td:nth-child(2) { color: #8edab9; }
.telemetry-dashboard tr.failure td:nth-child(2) { color: #ef8b76; }

.telemetry-export-note {
  margin: 2px 0 0;
  color: #668783;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: 0.035em;
  text-align: center;
}

@media (max-width: 899px) {
  .telemetry-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .telemetry-reach-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .telemetry-actions { justify-content: flex-start; }
}

@media (max-width: 639px) {
  .telemetry-layer { padding: 8px; }
  .telemetry-dashboard { max-height: calc(100dvh - 16px); border-radius: 16px; }
  .telemetry-header { padding: 12px; }
  .telemetry-header h2 { font-size: 21px; }
  .telemetry-header p { max-width: 230px; }
  .telemetry-close { width: 40px; height: 40px; }
  .telemetry-body { padding: 10px; }
  .telemetry-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); }
  .telemetry-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .telemetry-actions a,
  .telemetry-actions button { padding-inline: 5px; }
  .telemetry-clear-confirm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .telemetry-clear-confirm > div { grid-column: 1 / -1; }
  .telemetry-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .telemetry-reach-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .telemetry-two-column { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .telemetry-section { padding: 10px; }
  .telemetry-bars > div { grid-template-columns: 82px minmax(0, 1fr) 24px; }
  .recent-rounds-table table { min-width: 560px; }
}

@media (max-width: 350px) {
  .telemetry-layer { padding: 5px; }
  .telemetry-dashboard { max-height: calc(100dvh - 10px); }
  .telemetry-header { gap: 8px; padding: 10px; }
  .telemetry-header h2 { font-size: 19px; }
  .telemetry-header p { font-size: 8px; }
  .telemetry-body { padding: 8px; }
  .telemetry-actions { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .telemetry-layer,
  .telemetry-dashboard { transition: none; }
}
