.match-card.clickable {
  cursor: pointer;
}

.sponsor-note {
  position: relative;
  display: inline-flex;
  overflow: hidden;
  margin-top: 18px;
  padding: 11px 17px;
  border: 1px solid #ffda68b8;
  border-radius: 10px;
  background: linear-gradient(110deg, #ff3d8124, #ffc83d24 35%, #61e7ff20 68%, #ad68ff28);
  box-shadow: 0 0 24px #ffca3a2e, inset 0 0 18px #ffffff12;
  color: #fff6c9;
  font-size: clamp(15px, 1.5vw, 19px);
  font-weight: 900;
  line-height: 1.5;
  letter-spacing: .02em;
  text-shadow: 0 0 8px #ffcc5c, 0 0 18px #ff4fa388;
}

.sponsor-note::after {
  position: absolute;
  inset: -80% -25%;
  content: "";
  background: linear-gradient(105deg, transparent 42%, #ffffffa8 49%, #fff6bccc 51%, transparent 58%);
  transform: translateX(-65%);
  animation: sponsor-glint 3.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sponsor-glint {
  0%, 18% { transform: translateX(-65%); opacity: 0; }
  35% { opacity: 1; }
  58%, 100% { transform: translateX(65%); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sponsor-note::after { animation: none; }
}

.login-entry {
  border: 1px solid var(--acid);
  color: var(--acid);
}

.admin-session {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 12px;
}

.text-button {
  border: 0;
  background: none;
  color: var(--red);
  cursor: pointer;
}

.upload-actions {
  display: grid;
  grid-template-columns: minmax(100px, .7fr) minmax(180px, 1.3fr);
  gap: 10px;
}

.upload-actions button {
  min-height: 44px;
}

.upload-actions button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #080a07dc;
  backdrop-filter: blur(10px);
}

.modal.hidden {
  display: none;
}

.modal-card {
  position: relative;
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 80px #0009;
}

.modal-card h2 {
  margin: 7px 0 25px;
}

.modal-card .field {
  margin-bottom: 16px;
}

.modal-card .primary {
  width: 100%;
  margin-top: 8px;
}

.password-input {
  position: relative;
  display: block;
}

.password-input input {
  width: 100%;
  padding-right: 46px;
}

.password-input button {
  position: absolute;
  top: 50%;
  right: 1px;
  width: 42px;
  height: calc(100% - 2px);
  transform: translateY(-50%);
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 17px;
}

.password-input button:hover {
  color: var(--acid);
}

.login-error {
  margin: -8px 0 14px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

.login-error.hidden {
  display: none;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}

.image-modal-card {
  width: min(1100px, 100%);
  max-height: 90vh;
  overflow: auto;
}

.view-image {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--acid);
  padding: 6px 9px;
  cursor: pointer;
  white-space: nowrap;
}

.record-row {
  grid-template-columns: 52px 1fr auto;
}

.admin-player-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.admin-player-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.admin-player-row strong,
.admin-player-row small {
  display: block;
}

.admin-player-row small {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--mono);
}

.admin-player-row.hidden-player {
  opacity: .55;
}

#admin {
  max-width: 1800px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin: -18px 0 30px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.admin-tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 12px 20px;
  font-weight: 800;
  cursor: pointer;
}

.admin-tabs button:hover {
  color: var(--ink);
  border-color: #59604f;
}

.admin-tabs button.active {
  border-color: var(--acid);
  background: var(--acid);
  color: #10120d;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.ai-service-card {
  max-width: 980px;
  padding: 26px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.ai-service-card textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  background: #0e100c;
  color: var(--ink);
  padding: 14px;
  line-height: 1.6;
}

.ai-query-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

.ai-query-actions button {
  min-width: 150px;
}

.ai-query-actions button:disabled {
  cursor: wait;
  opacity: .55;
}

.ai-query-result {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.ai-answer {
  line-height: 1.75;
}

.system-admin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
}

.system-card {
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.system-card h3 {
  margin: 0 0 20px;
}

.system-card>.primary {
  width: 100%;
}

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

.system-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  background: #0e100c;
}

.system-row div {
  min-width: 0;
}

.system-row strong,
.system-row small {
  display: block;
}

.system-row small {
  margin-top: 5px;
  color: var(--muted);
}

.system-row b {
  color: var(--acid);
  font: 800 22px var(--mono);
}

.audit-row {
  align-items: flex-start;
}

.audit-row ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

#admin .admin-layout {
  grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
  align-items: start;
}

#admin .upload-card,
#admin .editor-card {
  min-width: 0;
}

#admin .editor-card {
  overflow: hidden;
}

#admin .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-color: var(--acid) #0e100c;
  scrollbar-width: thin;
}

#admin .edit-table {
  min-width: 1380px;
}

.position-cell {
  color: var(--acid);
  font-family: var(--mono);
  font-weight: 800;
}

.position-tag {
  display: inline-block;
  padding: 3px 6px;
  border: 1px solid var(--acid);
  color: var(--acid);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}

.primary-position-tag {
  padding: 5px 8px;
  font-size: 13px;
}

#admin .edit-table .shot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

#admin .edit-table .shot input {
  width: 58px;
  min-width: 58px;
  text-align: center;
  appearance: textfield;
}

#admin .edit-table .shot input::-webkit-inner-spin-button,
#admin .edit-table .shot input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

#admin .editor-actions {
  position: relative;
  width: 100%;
}

#admin #save-match {
  flex: 0 0 auto;
  margin-left: auto;
}

.match-card.clickable:hover {
  background: #20241b;
}

.match-note {
  display: block;
  margin-top: 7px;
  color: var(--acid);
  font-size: 14px;
  font-weight: 800;
}

.match-score {
  color: var(--acid);
  font-family: var(--mono);
  white-space: nowrap;
}

.admin-actions {
  display: flex;
  gap: 8px;
}

.danger {
  border: 1px solid #704238;
  background: transparent;
  color: var(--red);
  padding: 9px 13px;
  font-weight: 700;
  cursor: pointer;
}

.match-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.match-detail-head h2 {
  margin: 0;
}

.result-win {
  color: var(--acid);
  font-weight: 800;
}

.score-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--line);
}

.scoreboard {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) repeat(var(--period-count, 1), 54px) 80px;
  align-items: center;
  background: var(--line);
  gap: 1px;
  border: 1px solid var(--line);
  margin: 16px 0 24px;
}

.scoreboard--total-only {
  grid-template-columns: minmax(140px, 1fr) 80px;
}

.scoreboard > span {
  background: var(--panel);
  padding: 13px;
  text-align: center;
  font-family: var(--mono);
}

.scoreboard .team-name {
  text-align: left;
  font-family: var(--sans);
  font-weight: 800;
}

.scoreboard .total {
  color: var(--acid);
  font-size: 22px;
  font-weight: 800;
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.image-gallery a {
  display: block;
  border: 1px solid var(--line);
  background: var(--panel);
}

.image-gallery img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
}

@media (max-width: 900px) {
  .admin-tabs button { padding: 11px 14px; }
  .ai-query-actions { align-items: stretch; flex-direction: column; }
  .system-admin-grid { grid-template-columns: 1fr; }
  .score-meta { grid-template-columns: repeat(2, 1fr); }
  .scoreboard { overflow-x: auto; }
  #admin .admin-layout { grid-template-columns: 1fr; }
}
