:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f2f6f7;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  -webkit-text-size-adjust: 100%;
}

[hidden] {
  display: none !important;
}

button {
  min-width: 78px;
  min-height: 40px;
  border: 1px solid #bdc8d4;
  border-radius: 6px;
  background: #ffffff;
  color: #17202a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  border-color: #66788a;
}

.app-shell {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  border-bottom: 1px solid #d7dfe7;
  background: rgba(255, 255, 255, 0.96);
  min-height: 72px;
  padding: 10px 28px;
  backdrop-filter: blur(12px);
}

.brand-link {
  display: inline-grid;
  gap: 1px;
  min-width: 132px;
  color: #17202a;
  text-decoration: none;
}

.brand-link span,
.label {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  color: #627386;
}

.brand-link strong {
  font-size: 20px;
  line-height: 1.1;
}

.site-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.site-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 0 10px;
  color: #526273;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active {
  background: #eef4fb;
  color: #17202a;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 42px;
  line-height: 1.05;
}

h2 {
  font-size: 24px;
  line-height: 1.15;
}

h3 {
  font-size: 18px;
}

.home-view {
  display: grid;
  gap: 28px;
  padding: 42px 26px 64px;
}

.hero,
.explore-section {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  border: 1px solid #dce5e8;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(63, 149, 0, 0.08), rgba(37, 99, 235, 0.04)),
    #ffffff;
  padding: 30px;
  box-shadow: 0 14px 36px rgba(23, 32, 42, 0.06);
}

.hero .description {
  font-size: 17px;
}

.hero-actions,
.section-title {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  margin-bottom: 16px;
}

.primary-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  border: 1px solid #2563eb;
  border-radius: 6px;
  padding: 0 16px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
}

.primary-link:hover,
.admin-link:hover,
.wechat-login:hover,
.text-button:hover {
  transform: translateY(-1px);
}

.play-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 360px));
  gap: 16px;
}

.play-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
  align-items: start;
  width: 100%;
  min-height: 286px;
  text-align: left;
  padding: 14px;
  border-color: #d4dde6;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(23, 32, 42, 0.07);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.play-card-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid #d7dfe7;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(63, 149, 0, 0.22)),
    #f6f7f9;
  background-position: center;
  background-size: cover;
}

.play-card-cover.is-generated {
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.play-card-copy {
  min-width: 0;
}

.play-card.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb inset;
}

.play-card:hover {
  border-color: #8ca0b3;
  box-shadow: 0 16px 38px rgba(23, 32, 42, 0.1);
  transform: translateY(-2px);
}

.play-card-title {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-card-description {
  display: -webkit-box;
  min-height: 40px;
  overflow: hidden;
  color: #526273;
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.play-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #627386;
  font-size: 12px;
}

.play-card-meta span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid #d7dfe7;
  border-radius: 999px;
  padding: 0 10px;
  background: #f8fafc;
  color: #526273;
  font-weight: 800;
}

.play-card-action {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid #bdc8d4;
  border-radius: 6px;
  background: #ffffff;
  color: #17202a;
  font-size: 13px;
  font-weight: 800;
}

.viewer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: calc(100vh - 69px);
  padding: 26px;
  gap: 18px;
}

.viewer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  width: min(1180px, 100%);
  margin: 0 auto;
  border: 1px solid #dce5e8;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px 18px;
  box-shadow: 0 12px 32px rgba(23, 32, 42, 0.05);
}

.viewer-head > div {
  min-width: 0;
}

.viewer-head .text-button {
  justify-self: end;
}

.viewer-head h2 {
  font-size: 30px;
  line-height: 1.08;
}

.description {
  margin: 6px 0 0;
  max-width: 760px;
  color: #526273;
  line-height: 1.55;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.admin-link,
.wechat-login,
.text-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border: 1px solid #bdc8d4;
  border-radius: 6px;
  padding: 0 13px;
  color: #17202a;
  background: #ffffff;
  text-decoration: none;
  font-weight: 700;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.wechat-login {
  border-color: #14b56a;
  background: #14b56a;
  color: #ffffff;
}

.signin-panel {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: start center;
  padding: 82px 18px 24px;
  background: rgba(23, 32, 42, 0.24);
}

.signin-card {
  display: grid;
  width: min(460px, 100%);
  gap: 16px;
  border: 1px solid #d7dfe7;
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
  box-shadow: 0 24px 70px rgba(23, 32, 42, 0.24);
}

.signin-head,
.signin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.signin-form {
  display: grid;
  gap: 12px;
}

.signin-form label {
  display: grid;
  gap: 6px;
  color: #526273;
  font-size: 13px;
  font-weight: 750;
}

.signin-form input {
  min-height: 42px;
  border: 1px solid #bdc8d4;
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
}

.signin-actions button:first-child {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
}

.signin-divider {
  border-top: 1px solid #d7dfe7;
  padding-top: 12px;
  color: #627386;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.wechat-port {
  border-color: #14b56a;
  color: #0f7d4a;
}

.signin-status {
  min-height: 20px;
  margin: 0;
  color: #526273;
  font-size: 13px;
}

.user-badge {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  border: 1px solid #d7dfe7;
  border-radius: 6px;
  padding: 0 10px;
  background: #ffffff;
  color: #17202a;
  font-size: 14px;
  font-weight: 700;
}

.text-button {
  min-width: 0;
  min-height: 28px;
  padding: 0 8px;
  color: #526273;
  font-size: 13px;
}

.field-wrap {
  display: grid;
  grid-template-columns: minmax(320px, 500px) minmax(280px, 380px);
  justify-content: center;
  gap: clamp(22px, 4vw, 48px);
  align-items: center;
  min-height: 0;
  width: min(1180px, 100%);
  margin: 0 auto;
  border: 1px solid #dce5e8;
  border-radius: 8px;
  background: #ffffff;
  padding: 24px;
  box-shadow: 0 16px 42px rgba(23, 32, 42, 0.07);
}

.field {
  position: relative;
  justify-self: center;
  width: min(38vw, 430px);
  max-height: calc(100vh - 250px);
  aspect-ratio: 0.55;
  overflow: hidden;
  border: 4px solid #ffffff;
  outline: 8px solid #2c8200;
  border-radius: 0;
  background: #368c00;
  box-shadow: 0 18px 38px rgba(23, 32, 42, 0.18);
}

.end-zone {
  position: absolute;
  left: 0;
  right: 0;
  display: grid;
  place-items: center;
  color: rgba(24, 73, 0, 0.38);
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 850;
  text-transform: uppercase;
}

.top-zone {
  top: 0;
  height: 20%;
}

.bottom-zone {
  bottom: 0;
  height: 20%;
}

.playing-zone {
  position: absolute;
  inset: 20% 0;
  display: grid;
  place-items: center;
  color: rgba(24, 73, 0, 0.38);
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 850;
  text-transform: uppercase;
}

.goal-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 4px dashed rgba(255, 255, 255, 0.92);
}

.top-line {
  top: 20%;
}

.bottom-line {
  bottom: 20%;
}

#actionLayer,
.player-layer {
  position: absolute;
  inset: 0;
}

#actionLayer {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.player {
  position: absolute;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(23, 32, 42, 0.28);
  transition:
    left 260ms ease,
    top 260ms ease;
}

.player.animating {
  transition: none;
}

.player.team-red {
  background: #ef4444;
}

.player.team-blue {
  background: #2563eb;
}

.player.kind-cone {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: #f59e0b;
  color: #17202a;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  font-size: 10px;
}

.player.disc {
  background: #f8fafc;
  color: #17202a;
}

.action-line {
  stroke: #17202a;
  stroke-width: 1.05;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 3 2;
  fill: none;
}

.route-point {
  fill: rgba(23, 32, 42, 0.9);
  stroke: #ffffff;
  stroke-width: 0.7;
}

.throw-line {
  stroke: #ef4444;
  stroke-width: 1.35;
  stroke-linecap: round;
  fill: none;
}

.controls {
  display: grid;
  gap: 18px;
  align-content: center;
  align-self: center;
  width: 100%;
  max-width: 380px;
  border: 1px solid #dce5e8;
  border-radius: 8px;
  background: #f8fafc;
  padding: 22px;
}

.step-copy h3 {
  font-size: 24px;
  line-height: 1.15;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 10px;
}

.buttons button {
  min-height: 46px;
}

#playBtn {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.step-timeline {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 0 2px;
  width: min(1120px, 100%);
  margin: 0 auto;
}

.timeline-step {
  flex: 0 0 auto;
  min-width: 58px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
}

.timeline-step.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
}

.timeline-step.done {
  border-color: #8ca0b3;
}

@media (max-width: 900px) {
  .site-header,
  .hero,
  .viewer-head {
    grid-template-columns: 1fr;
  }

  .site-header {
    position: static;
  }

  .site-nav,
  .top-actions,
  .hero-actions {
    justify-content: flex-start;
  }

  h1 {
    font-size: 34px;
  }

  .viewer {
    min-height: auto;
    padding: 18px 16px;
  }

  .viewer-head {
    align-items: start;
  }

  .controls {
    display: grid;
    max-width: none;
  }

  .field-wrap {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }

  .field {
    width: min(76vw, 360px);
    max-height: none;
    justify-self: center;
  }

  .player {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 640px) {
  button,
  .admin-link,
  .wechat-login,
  .text-button,
  .primary-link {
    min-height: 44px;
  }

  .site-header {
    gap: 12px;
    padding: 12px 16px;
  }

  .brand-link {
    grid-template-columns: 1fr;
  }

  .brand-link strong {
    font-size: 18px;
  }

  .site-nav {
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    white-space: nowrap;
  }

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

  .top-actions > * {
    justify-content: center;
    width: 100%;
  }

  .signin-panel {
    align-items: stretch;
    padding: 14px;
  }

  .signin-card {
    align-self: start;
  }

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

  .user-badge {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }

  .home-view {
    gap: 22px;
    padding: 20px 16px 34px;
  }

  .hero {
    gap: 18px;
    padding: 12px 0 22px;
  }

  h1 {
    font-size: 30px;
    line-height: 1.1;
  }

  h2 {
    font-size: 22px;
  }

  .hero .description,
  .description {
    font-size: 15px;
    line-height: 1.5;
  }

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

  .hero-actions > * {
    justify-content: center;
    width: 100%;
  }

  .play-grid {
    grid-template-columns: 1fr;
  }

  .play-card {
    grid-template-columns: 76px minmax(0, 1fr);
    min-height: 144px;
    padding: 13px;
  }

  .play-card-cover {
    width: 76px;
  }

  .play-card-title {
    white-space: normal;
  }

  .play-card-action {
    min-height: 38px;
  }

  .viewer {
    gap: 12px;
    padding: 14px 14px 22px;
  }

  .viewer-head {
    gap: 10px;
    padding: 14px;
  }

  .viewer-head .text-button {
    justify-self: start;
  }

  .field-wrap {
    gap: 18px;
    padding: 14px;
  }

  .field {
    width: min(82vw, 320px);
    outline-width: 7px;
    border-width: 3px;
    box-shadow: 0 12px 28px rgba(23, 32, 42, 0.16);
  }

  .end-zone,
  .playing-zone {
    font-size: 18px;
  }

  .player {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  .controls {
    gap: 12px;
    padding: 16px;
  }

  .buttons {
    gap: 8px;
  }

  .buttons button {
    min-width: 0;
    padding: 0 8px;
  }

  .step-timeline {
    margin: 0 -14px;
    padding: 8px 14px 2px;
    scroll-padding-inline: 14px;
  }

  .timeline-step {
    min-width: 46px;
    min-height: 40px;
  }
}

@media (max-width: 380px) {
  .play-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .play-card-cover {
    width: 64px;
  }

  .field {
    width: min(80vw, 288px);
  }
}
