:root {
  color: #13231e;
  background: #f3f7f5;
  font-family:
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --accent: #0b6b4f;
  --accent-dark: #084f3c;
  --danger: #9f2d24;
  --muted: #5c6b65;
  --surface: #ffffff;
  --surface-soft: #e7f2ed;
  --border: #cad9d2;
  --shadow: 0 12px 28px rgb(18 51 40 / 12%);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f3f7f5;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at top right, #dcefe7 0, transparent 38rem),
    #f3f7f5;
  font-size: 18px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 12px 16px;
  transform: translateY(-150%);
  border-radius: 10px;
  color: #ffffff;
  background: #13231e;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding:
    max(12px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    12px
    max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid rgb(11 93 70 / 14%);
  background: rgb(255 255 255 / 92%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
}

.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset 0 0 0 5px #ffffff;
  outline: 2px solid var(--accent);
}

.connection-status {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.connection-status[data-state="online"] {
  color: var(--accent-dark);
}

.connection-status[data-state="offline"],
.connection-status[data-state="error"] {
  color: var(--danger);
}

#app {
  width: min(100%, 720px);
  margin: 0 auto;
  padding:
    28px
    max(18px, env(safe-area-inset-right))
    max(34px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.screen {
  display: grid;
  gap: 22px;
}

.screen-heading {
  margin: 0;
  color: #102d24;
  font-size: clamp(30px, 8vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.screen-copy {
  max-width: 34rem;
  margin: 0;
  color: var(--muted);
  font-size: 19px;
}

.panel {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.loading {
  min-height: 45vh;
  place-content: center;
  text-align: center;
}

.loading-dot {
  width: 52px;
  height: 52px;
  margin: 0 auto;
  border: 7px solid #c9ded5;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-dot {
    animation: none;
  }
}

.pair-form {
  display: grid;
  gap: 16px;
}

.pair-label {
  font-weight: 800;
}

.pair-input {
  width: 100%;
  min-height: 64px;
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  color: #13231e;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-align: center;
}

.pair-input:focus {
  border-color: var(--accent);
  outline: 4px solid rgb(11 107 79 / 18%);
}

.primary-button,
.secondary-button,
.event-card,
.player-play-button {
  min-height: 56px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  padding: 14px 20px;
  color: #ffffff;
  background: var(--accent);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-dark);
}

.secondary-button {
  padding: 13px 18px;
  border: 2px solid var(--border);
  color: #143d31;
  background: #ffffff;
}

button:focus-visible {
  outline: 4px solid rgb(11 107 79 / 24%);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.form-error,
.error-message {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.events {
  display: grid;
  gap: 16px;
}

.event-card {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 2px solid transparent;
  color: #13231e;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}

.event-card:hover,
.event-card:focus-visible {
  border-color: var(--accent);
}

.event-card-copy {
  display: grid;
  gap: 6px;
}

.live-label {
  width: fit-content;
  padding: 3px 9px;
  border-radius: 999px;
  color: #ffffff;
  background: #b42318;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.event-title {
  font-size: 24px;
  font-weight: 850;
  line-height: 1.28;
}

.event-subtitle {
  color: var(--muted);
  font-size: 17px;
  font-weight: 600;
}

.play-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--accent);
  font-size: 24px;
}

.empty-state {
  padding: 28px;
  border: 2px dashed var(--border);
  border-radius: 18px;
  color: var(--muted);
  background: rgb(255 255 255 / 62%);
  text-align: center;
}

.player-screen {
  width: min(100vw, 980px);
  margin-left: min(0px, calc((720px - 100vw) / 2));
}

.player-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.player-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
}

.player-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  background: #000000;
  box-shadow: var(--shadow);
}

.player-stage video,
.player-stage iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000000;
}

.player-play-button {
  position: absolute;
  inset: 50% auto auto 50%;
  min-width: 180px;
  padding: 14px 20px;
  transform: translate(-50%, -50%);
  color: #ffffff;
  background: rgb(11 107 79 / 94%);
}

.player-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .event-card {
    padding: 18px;
  }

  .event-title {
    font-size: 22px;
  }

  .play-mark {
    width: 52px;
    height: 52px;
  }

  .player-actions {
    grid-template-columns: 1fr;
  }
}
