:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  background: #f2f5f7;
  color: #172936;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }

header { background: #163142; color: #fff; }
.menubar, .replay-main { width: min(100% - 2rem, 76rem); margin-inline: auto; }
.menubar {
  min-height: 3.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  align-items: center;
  justify-content: space-between;
}
.brand { font-size: 1.18rem; font-weight: 750; }
.replay-link { color: #fff; min-height: 44px; display: inline-flex; align-items: center; }
.replay-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; margin-block: 1rem 2rem; }

.toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: .75rem;
}
.toolbar h1 { flex: 1 1 12rem; margin: 0; align-self: center; font-size: clamp(1.3rem, 2.5vw, 1.85rem); }
.toolbar label { display: grid; min-width: 0; gap: .3rem; font-size: .875rem; font-weight: 600; }
.toolbar input, .toolbar select, .toolbar button {
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  padding: .55rem .75rem;
  border: 1px solid #647581;
  border-radius: .3rem;
  background: #fff;
  color: #172936;
  font: inherit;
}
.toolbar input { width: 100%; font-size: 1rem; }
.toolbar button { cursor: pointer; font-weight: 650; }
.toolbar button:not(.outline) { background: #173c53; color: #fff; }
.toolbar button:disabled { color: #4f606c; background: #e9edf0; cursor: default; }
.toolbar button:not(:disabled):active { background: #d6e5ed; color: #172936; }
:focus-visible { outline: 3px solid #0b5790; outline-offset: 3px; }
.replay-link:focus-visible { outline-color: #fff; }

#replay-status {
  margin: 0;
  padding: .65rem .8rem;
  border-left: 3px solid #397388;
  background: #e7eff3;
  color: #233d4c;
  overflow-wrap: anywhere;
}
#live-session-form label { flex: 0 1 min(24rem, 100%); }
#replay-login label { flex: 0 1 18rem; }

.card { padding: .75rem; border: 1px solid #bfcbd3; border-radius: .45rem; background: #fff; }
.cardhead {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .3rem .8rem;
  padding: 0 .25rem .3rem;
  font-weight: 700;
}
.muted, .chartfoot { color: #45515d; font-size: .875rem; font-weight: 450; }
.chartfoot { padding: .2rem .25rem 0; }
canvas { display: block; width: 100%; }
.replay-wave canvas { height: clamp(220px, 37vh, 350px); }
.replay-psd canvas { height: clamp(185px, 28vh, 270px); }

@media (max-width: 49rem) {
  .replay-toolbar h1 { flex-basis: 100%; }
}
@media (max-width: 34rem) {
  .menubar, .replay-main { width: calc(100% - 1rem); }
  .replay-main { margin-top: .65rem; }
  .replay-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .replay-toolbar h1 { grid-column: 1 / -1; }
  #live-session-form, #replay-login { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; }
  .card { padding: .5rem; }
  .replay-wave canvas { height: 230px; }
}
