@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #080d0c;
  --panel: #101816;
  --panel-raised: #151f1b;
  --line: #27352e;
  --line-bright: #3b5145;
  --muted: #91a198;
  --text: #f0f5f1;
  --green: #b7f34b;
  --green-dark: #20331a;
  --red: #ff786e;
  --mono: 'DM Mono', ui-monospace, monospace;
  --sans: 'DM Sans', Arial, sans-serif;
  --display: 'Barlow Condensed', Impact, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font: 14px/1.5 var(--sans);
  background:
    radial-gradient(ellipse at 79% -15%, #1a2a20 0, transparent 37%),
    radial-gradient(ellipse at 4% 42%, #122019 0, transparent 27%),
    var(--bg);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  content: '';
  opacity: .12;
  background-image: linear-gradient(#ffffff09 1px, transparent 1px), linear-gradient(90deg, #ffffff09 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(28px, calc((100vw - 1500px) / 2));
  border-bottom: 1px solid #29372f;
  background: #080d0ceF;
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.4px;
  text-decoration: none;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: #899990;
  font: 9px var(--mono);
  letter-spacing: 1.7px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #d0ff8a66;
  border-radius: 12px 12px 12px 4px;
  background: linear-gradient(145deg, #c6fa65, #88bd36);
  box-shadow: 0 0 24px #a6e55024;
  color: #111a10;
  font: 800 21px var(--display);
}

.connection {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #a3b1a9;
  font: 10px var(--mono);
  letter-spacing: .3px;
}

.connection i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e6b65c;
  box-shadow: 0 0 12px #e6b65c77;
}

.connection.online i {
  background: var(--green);
  box-shadow: 0 0 12px #b7f34b99;
}

.layout {
  display: grid;
  max-width: 1500px;
  grid-template-columns: minmax(0, 1.8fr) minmax(290px, .76fr);
  gap: 18px;
  margin: auto;
  padding: 26px 30px 48px;
}

.main-column,
.side-column {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
}

.card {
  min-width: 0;
  padding: 21px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, #141d19 0%, #101715 70%);
  box-shadow: 0 18px 50px #00000025, inset 0 1px #ffffff08;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.section-heading h1,
.section-heading h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: -.45px;
}

.section-heading h1 {
  font: 600 30px/.98 var(--display);
  letter-spacing: .1px;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 7px;
  color: #9bb77e;
  font: 9px var(--mono);
  letter-spacing: 1.55px;
}

.badge {
  padding: 6px 9px;
  border: 1px solid var(--line-bright);
  border-radius: 6px;
  color: #9aa69f;
  font: 9px var(--mono);
  letter-spacing: 1px;
}

.badge.active {
  border-color: #688c3b;
  background: #b7f34b12;
  color: var(--green);
}

.badge.error {
  border-color: #874f4c;
  color: var(--red);
}

input {
  font-family: var(--sans);
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.match-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 11px;
}

.match-form label {
  display: grid;
  gap: 7px;
  color: #b4c0b8;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2px;
}

.match-form input,
.token-form input {
  height: 42px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid #33443a;
  border-radius: 8px;
  outline: 0;
  background: #0b110f;
  color: var(--text);
  font: 12px var(--mono);
  transition: border-color .15s, box-shadow .15s;
}

.match-form input:focus,
.token-form input:focus {
  border-color: #9bcf51;
  box-shadow: 0 0 0 3px #a6df4818;
}

.match-form input::placeholder,
.token-form input::placeholder {
  color: #66756c;
}

.button {
  min-height: 37px;
  padding: 0 12px;
  border: 1px solid #36483d;
  border-radius: 8px;
  background: #1b2721;
  color: #e7eee8;
  font: 600 10px var(--sans);
  cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #78964e;
  background: #25342a;
}

.button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.button-primary {
  height: 42px;
  padding: 0 19px;
  border-color: var(--green);
  background: var(--green);
  color: #11180e;
}

.button-primary:hover:not(:disabled) {
  border-color: #d1ff82;
  background: #d1ff82;
}

.button-live {
  border-color: #668c3c;
  background: #1d2a18;
  color: var(--green);
}

.button-stop {
  border-color: #704640;
  color: #ff958a;
}

.button-small {
  min-height: 29px;
  padding: 0 10px;
  font-size: 9px;
}

.match-details {
  min-height: 42px;
  margin-top: 18px;
  padding-top: 13px;
  border-top: 1px solid #29372f;
  color: var(--muted);
  font-size: 11px;
}

.match-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.match-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.stream-options {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 9px 13px;
  border: 1px solid #28372d;
  border-radius: 9px;
  background: #0d1512;
  box-shadow: inset 0 1px 3px #00000044;
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  color: #c7d5cd;
}

.toggle-control input {
  display: none;
}

.toggle-slider {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  border: 1px solid #4a5c51;
  border-radius: 999px;
  background: #1c2722;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #899c92;
  transition: transform 0.2s, background 0.2s;
}

.toggle-control input:checked + .toggle-slider {
  background: #254019;
  border-color: #8ac53e;
}

.toggle-control input:checked + .toggle-slider::before {
  transform: translateX(14px);
  background: #bbf84d;
}

.toggle-state-text {
  color: #798a81;
  font-size: 10px;
  font-family: var(--mono);
  transition: color 0.2s;
}

.toggle-control input:checked ~ .toggle-label .toggle-state-text {
  color: #a3e846;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.notice {
  min-height: 14px;
  margin: 10px 0 0;
  color: #9ca9a1;
  font-size: 10px;
}

.notice.error {
  color: var(--red);
}

.pitch-card {
  padding-bottom: 15px;
}

.pitch-card .section-heading {
  margin-bottom: 14px;
}

.frame-readout {
  color: #9aa79f;
  font: 9px var(--mono);
  text-align: right;
}

.frame-readout strong {
  display: block;
  margin-bottom: 2px;
  color: var(--green);
  font-size: 15px;
}

.pitch-wrap {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border: 1px solid #090a0d;
  border-radius: 10px;
  background: #101a14;
  box-shadow: inset 0 0 42px #0005;
}

.pitch-wrap::after {
  position: absolute;
  inset: 0;
  border: 1px solid #ffffff09;
  border-radius: inherit;
  content: '';
  pointer-events: none;
}

.pitch-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1.78;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #aebcaf;
  font-size: 11px;
  text-align: center;
  pointer-events: none;
}

.empty-state.hidden {
  display: none;
}

.playback {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 13px;
}

.playback input {
  flex: 1;
  accent-color: var(--green);
}

.playback span {
  min-width: 62px;
  color: #95a39a;
  font: 9px var(--mono);
  text-align: right;
}

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

.match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid #29372f;
  border-radius: 9px;
  background: #0d1411;
}

.match-row strong {
  display: block;
  color: #e6ece7;
  font-size: 11px;
  font-weight: 600;
}

.match-row small {
  display: block;
  margin-top: 4px;
  color: #91a097;
  font-size: 9px;
}

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

.metrics-card>.eyebrow {
  margin-bottom: 12px;
}

.metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid #27352e;
  color: #9ca9a1;
  font-size: 10px;
}

.metric strong {
  color: #eff5f0;
  font: 17px var(--mono);
}

.metric strong small {
  color: #8c9a91;
  font-size: 9px;
}

.token-card .section-heading {
  margin-bottom: 7px;
}

.token-card h2,
.activity-card h2 {
  font-size: 16px;
}

.token-card .muted {
  margin: 10px 0 14px;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.activity-card {
  min-height: 230px;
}

.activity-log {
  display: grid;
  max-height: 360px;
  gap: 10px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-log li {
  display: grid;
  grid-template-columns: 48px 48px minmax(0, 1fr);
  gap: 7px;
  font-size: 9px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.activity-log time,
.activity-log .category {
  color: #819087;
  font: 8px var(--mono);
}

.activity-log .category {
  color: #a6ce75;
}

.activity-log li.error .category {
  color: var(--red);
}

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

  .side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .activity-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .topbar {
    height: 66px;
    padding: 0 16px;
  }

  .brand {
    gap: 9px;
    font-size: 14px;
  }

  .brand-mark {
    width: 35px;
    height: 35px;
  }

  .connection {
    font-size: 9px;
  }

  .layout {
    gap: 13px;
    padding: 14px 12px 28px;
  }

  .main-column,
  .side-column {
    gap: 13px;
  }

  .card {
    padding: 16px;
    border-radius: 12px;
  }

  .match-form {
    grid-template-columns: 1fr;
  }

  .match-form .button {
    width: 100%;
  }

  .side-column {
    grid-template-columns: 1fr;
  }

  .activity-card {
    grid-column: auto;
  }

  .section-heading h1 {
    font-size: 26px;
  }

  .pitch-wrap {
    min-height: 160px;
  }
}