:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  color: #f5f7f6;
  background: #0a0f0d;
  font-synthesis: none;
  --surface: #121a17;
  --surface-raised: #17211d;
  --surface-soft: #1d2924;
  --border: #2a3933;
  --muted: #9baba4;
  --green: #43d68b;
  --green-dark: #102f22;
  --red: #ff7b76;
  --red-dark: #3b1d1e;
  --blue: #73baff;
  --blue-dark: #142c42;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #0a0f0d;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(67, 214, 139, 0.1), transparent 34rem),
    #0a0f0d;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(42, 57, 51, 0.78);
  background: rgba(10, 15, 13, 0.88);
  backdrop-filter: blur(14px);
}

.header-inner,
.page-shell {
  width: min(100% - 28px, 720px);
  margin-inline: auto;
}

.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-inner h1 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.header-title-link {
  text-decoration: none;
}

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

.text-link,
.text-button {
  border: 0;
  padding: 8px 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.83rem;
  text-decoration: none;
  cursor: pointer;
}

.text-link:hover,
.text-button:hover {
  color: #ffffff;
}

.page-shell {
  padding-block: 22px 48px;
}

.filter-tabs[hidden] {
  display: none;
}

.filter-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}

.filter-tab {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.filter-tab.active {
  color: #0b1711;
  background: var(--green);
  box-shadow: 0 4px 18px rgba(67, 214, 139, 0.18);
}

.status-message {
  margin: 34px 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.games-list {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.game-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 17px;
  background: linear-gradient(145deg, rgba(23, 33, 29, 0.98), rgba(17, 25, 22, 0.98));
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.18);
}

.game-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.game-date {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.game-card h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.category-badge {
  flex: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 800;
}

.category-badge.official {
  border-color: rgba(255, 123, 118, 0.3);
  color: var(--red);
  background: var(--red-dark);
}

.category-badge.practice {
  border-color: rgba(115, 186, 255, 0.3);
  color: var(--blue);
  background: var(--blue-dark);
}

.game-note {
  margin: 12px 0 0;
  border-left: 2px solid var(--green);
  padding-left: 10px;
  color: #c4d0cb;
  font-size: 0.88rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 17px;
}

.video-item {
  min-width: 0;
}

.video-item.is-playing {
  grid-column: 1 / -1;
}

.video-player {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: #050706;
}

.video-player iframe,
.video-trigger {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-loading {
  position: absolute;
  inset: 0;
  display: grid;
  margin: 0;
  place-items: center;
  color: var(--muted);
  font-size: 0.76rem;
}

.video-trigger {
  position: relative;
  display: block;
  padding: 0;
  background: #050706;
  cursor: pointer;
}

.video-trigger::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.3), transparent 65%);
  transition: background 160ms ease;
}

.video-trigger:hover::after {
  background: rgba(0, 0, 0, 0.1);
}

.video-trigger img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-mark {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  display: grid;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  place-items: center;
  padding-left: 3px;
  color: #ffffff;
  background: rgba(5, 7, 6, 0.76);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  transform: translate(-50%, -50%);
}

.video-label {
  overflow: hidden;
  margin: 7px 2px 0;
  color: #d9e1dd;
  font-size: 0.78rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-form {
  display: grid;
  gap: 11px;
  margin-top: 12px;
  border: 1px solid rgba(67, 214, 139, 0.22);
  border-radius: 12px;
  padding: 12px;
  background: rgba(16, 47, 34, 0.48);
}

.clip-form[hidden] {
  display: none;
}

.clip-capture-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(84px, 0.65fr);
  gap: 8px;
}

.clip-capture-button {
  min-width: 0;
  color: var(--green);
  font-size: 0.8rem;
}

.clip-time-field,
.clip-field {
  display: grid;
  gap: 5px;
}

.clip-time-field span,
.clip-field span {
  color: #ced8d3;
  font-size: 0.72rem;
  font-weight: 700;
}

.clip-time-field input {
  min-height: 42px;
  padding: 8px 10px;
  text-align: center;
}

.clip-submit-button {
  width: 100%;
}

.game-clips {
  margin-top: 18px;
  border-top: 1px solid rgba(42, 57, 51, 0.7);
  padding-top: 15px;
}

.game-clips[hidden] {
  display: none;
}

.game-clips h3 {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.05em;
}

.game-clips-list {
  display: grid;
  gap: 6px;
}

.game-clip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.game-clip-button {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px;
  color: inherit;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
  cursor: pointer;
}

.game-clip-button:hover {
  border-color: var(--border);
  background: var(--surface-soft);
}

.game-clip-icon {
  display: grid;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  place-items: center;
  padding-left: 2px;
  color: #09150f;
  background: var(--green);
  font-size: 0.65rem;
}

.game-clip-details {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.game-clip-title {
  overflow: hidden;
  font-size: 0.84rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-clip-meta {
  color: var(--muted);
  font-size: 0.7rem;
}

.clip-download-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(67, 214, 139, 0.3);
  border-radius: 8px;
  padding: 6px 9px;
  color: var(--green);
  background: rgba(16, 47, 34, 0.55);
  font-size: 0.72rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.clip-download-link:hover {
  border-color: var(--green);
  background: var(--green-dark);
}

.clip-file-pending {
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

.clips-shell {
  display: grid;
  gap: 18px;
}

.clips-heading {
  margin: 7px 0 2px;
}

.clips-heading h2 {
  margin: 4px 0 7px;
  font-size: 1.45rem;
}

.clips-heading > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.65;
}

.clips-grid {
  display: grid;
  gap: 16px;
}

.clip-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(23, 33, 29, 0.98), rgba(17, 25, 22, 0.98));
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.18);
}

.clip-card-player {
  border-radius: 0;
}

.clip-card-body {
  padding: 14px 15px 16px;
}

.clip-card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.clip-card-title-row h2 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.45;
}

.clip-card-game,
.clip-card-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.clip-card-game {
  margin-top: 7px;
  color: #d3dcd8;
}

.clip-card-actions {
  display: flex;
  min-height: 34px;
  align-items: center;
  margin-top: 11px;
}

.card-empty {
  margin: 16px 0 0;
  padding: 14px;
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.84rem;
  text-align: center;
}

.login-page {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 380px);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px 24px;
  background: linear-gradient(145deg, rgba(23, 33, 29, 0.98), rgba(15, 22, 19, 0.98));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.login-mark {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 18px;
  border: 1px solid rgba(67, 214, 139, 0.35);
  border-radius: 15px;
  place-items: center;
  background: var(--green-dark);
  font-size: 1.55rem;
}

.login-card h1 {
  margin: 0;
  font-size: 1.65rem;
}

.login-lead {
  margin: 8px 0 25px;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label,
.field > span,
.category-field legend,
.field-label-row > span:first-child {
  color: #ced8d3;
  font-size: 0.84rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
  color: #f5f7f6;
  background: #0c1310;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input {
  min-height: 44px;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(67, 214, 139, 0.16);
}

.login-form button,
.primary-button {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  color: #08130d;
  background: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.login-form button {
  margin-top: 7px;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.form-message {
  margin: 4px 0;
  font-size: 0.84rem;
  line-height: 1.5;
}

.error-message {
  color: #ff9b97;
}

.success-message {
  color: var(--green);
}

.admin-shell {
  display: grid;
  gap: 20px;
}

.admin-panel {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  background: rgba(18, 26, 23, 0.88);
}

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

.section-heading h2 {
  margin: 2px 0 0;
  font-size: 1.25rem;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.game-form,
.field {
  display: grid;
  gap: 8px;
}

.game-form {
  gap: 18px;
}

.field-grid {
  display: grid;
  gap: 15px;
}

.field small,
.field-hint {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.category-field {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  margin: 0;
  border: 0;
  padding: 0;
}

.category-field legend {
  width: 100%;
  margin-bottom: 8px;
}

.category-field label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #dbe3df;
  font-size: 0.9rem;
}

.category-field input {
  width: 18px;
  min-height: auto;
  height: 18px;
  margin: 0;
  accent-color: var(--green);
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.video-rows {
  display: grid;
  gap: 8px;
}

.video-input-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 7px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(42, 57, 51, 0.55);
}

.video-input-label {
  grid-column: 1;
}

.remove-row-button {
  grid-column: 2;
  grid-row: 1 / 3;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.secondary-button,
.danger-button {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 12px;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  color: #cbd6d0;
}

.danger-button {
  border-color: rgba(255, 123, 118, 0.28);
  color: var(--red);
  background: rgba(59, 29, 30, 0.5);
}

.add-row-button {
  width: 100%;
  margin-top: 10px;
  border-style: dashed;
  color: var(--green);
}

.compact-button {
  min-height: 36px;
  padding: 6px 11px;
  font-size: 0.8rem;
}

.admin-games {
  display: grid;
  gap: 10px;
}

.admin-game-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface-raised);
}

.admin-game-meta,
.admin-game-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.admin-game-card h3 {
  margin: 3px 0 4px;
  font-size: 1rem;
}

.admin-game-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-game-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (min-width: 560px) {
  .header-inner,
  .page-shell {
    width: min(100% - 48px, 720px);
  }

  .page-shell {
    padding-top: 30px;
  }

  .game-card,
  .admin-panel {
    padding: 22px;
  }

  .field-grid {
    grid-template-columns: 0.8fr 1.2fr;
  }

  .video-input-row {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) 42px;
    padding-bottom: 0;
    border-bottom: 0;
  }

  .video-input-label {
    grid-column: 2;
  }

  .remove-row-button {
    grid-column: 3;
    grid-row: 1;
  }

  .admin-game-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .clip-capture-grid {
    grid-template-columns: 1fr 0.72fr 1fr 0.72fr;
    align-items: end;
  }

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

@media (max-width: 400px) {
  .header-inner {
    gap: 10px;
  }

  .header-inner h1 {
    font-size: 1.05rem;
  }

  .header-actions {
    gap: 9px;
  }

  .text-link,
  .text-button {
    font-size: 0.76rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
