:root {
  color-scheme: dark;
  --bg: #07080b;
  --surface: #111318;
  --surface-2: #171a21;
  --surface-3: #20242d;
  --text: #ffffff;
  --muted: #bfc2c9;
  --gold: #e5393f;
  --gold-2: #ffffff;
  --red: #b91524;
  --red-2: #ff3341;
  --line: rgba(255, 255, 255, 0.11);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(185, 21, 36, 0.24), transparent 32%),
    linear-gradient(315deg, rgba(255, 255, 255, 0.08), transparent 36%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.shell {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 46px;
}

.hidden {
  display: none !important;
}

.site-header,
.dashboard-head,
.section-title,
.actions,
.export-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.site-header,
.dashboard-head,
.section-title {
  justify-content: space-between;
}

.site-header {
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-weight: 900;
  letter-spacing: 0.04em;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(185, 21, 36, 0.5));
  color: var(--gold-2);
  font-weight: 950;
  overflow: hidden;
  position: relative;
}

.mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.mark img + span {
  display: none;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  background: rgba(17, 19, 24, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mode-switch button {
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
}

.mode-switch button.active {
  background: var(--gold);
  color: #170e05;
  font-weight: 850;
}

.hero {
  min-height: 270px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  gap: 24px;
  align-items: end;
  margin-bottom: 18px;
  padding: clamp(22px, 5vw, 48px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(7, 8, 11, 0.94), rgba(7, 8, 11, 0.5)),
    url("./assets/kapak-banner.avif") center / cover;
  box-shadow: var(--shadow);
}

.hero h1 {
  max-width: 760px;
  margin: 8px 0 0;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1.02;
}

.hero-copy {
  max-width: 660px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.03rem;
}

.eyebrow {
  margin: 0;
  color: var(--gold-2);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-stats,
.summary-list,
.branch-cards {
  display: grid;
  gap: 10px;
}

.hero-stats {
  grid-template-columns: repeat(3, 1fr);
}

.hero-stats span,
.summary-list span,
.branch-card {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 24, 0.82);
  color: var(--muted);
}

.hero-stats span {
  aspect-ratio: auto;
  min-height: 92px;
  place-items: start;
  text-align: left;
  border-radius: 8px;
  background:
    linear-gradient(140deg, rgba(185, 21, 36, 0.26), transparent 55%),
    rgba(17, 19, 24, 0.88);
}

.hero-stats strong,
.summary-list strong,
.branch-card strong {
  color: var(--text);
  font-size: 1.55rem;
}

.hero-stats strong {
  font-size: 2.1rem;
}

.view {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 24, 0.94);
  box-shadow: var(--shadow);
}

.leaderboard-panel {
  margin-bottom: 18px;
}

.leaderboard-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 42px 54px minmax(180px, 1fr) repeat(5, minmax(78px, auto));
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(185, 21, 36, 0.12), rgba(255, 255, 255, 0.03));
}

.rank-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-weight: 900;
}

.leaderboard-name {
  display: grid;
  gap: 3px;
}

.leaderboard-name span,
.leaderboard-row > span {
  color: var(--muted);
}

.leaderboard-row strong,
.point-cell strong {
  color: var(--text);
}

.auth-card {
  max-width: 760px;
  margin: 0 auto;
}

h2,
p {
  margin-top: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.18rem;
}

.hint,
.error,
.success {
  color: var(--muted);
  font-size: 0.9rem;
}

.error {
  color: #ff9a9a;
}

.success {
  color: #9ee7b0;
}

.form-grid,
.portal-grid,
.records-grid,
.filters {
  display: grid;
  gap: 14px;
}

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

.photo-editor {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

#profilePhotoPreview,
.table-avatar {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--gold-2);
  object-fit: cover;
  font-weight: 900;
}

#profilePhotoPreview:not([src]),
#profilePhotoPreview[src=""] {
  visibility: hidden;
}

.table-avatar {
  width: 44px;
  height: 44px;
  font-size: 0.75rem;
}

.table-avatar.placeholder {
  display: inline-grid;
}

.detail-stack {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.detail-stack span {
  display: block;
  color: var(--muted);
}

.detail-stack strong {
  color: var(--gold-2);
  font-weight: 850;
}

.muted-cell {
  color: var(--muted);
}

.compact-form {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}

.portal-grid {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c0e13;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 51, 65, 0.18);
}

.primary,
.ghost,
.danger {
  padding: 0 16px;
  font-weight: 820;
}

.primary {
  background: var(--red-2);
  color: #ffffff;
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.danger {
  border: 1px solid rgba(255, 51, 65, 0.42);
  background: rgba(185, 21, 36, 0.18);
  color: #ffb8bd;
}

.badge,
.status-pill {
  width: max-content;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  color: var(--gold-2);
  padding: 5px 10px;
  font-size: 0.78rem;
}

.summary-panel {
  position: sticky;
  top: 16px;
}

.summary-list {
  grid-template-columns: 1fr;
  margin: 16px 0;
}

.record-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.record-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.record-item strong,
.record-item span,
.record-item small {
  display: block;
}

.record-item span,
.record-item small {
  color: var(--muted);
  margin-top: 4px;
}

.icon-button {
  width: 38px;
  min-height: 38px;
  border: 1px solid rgba(227, 57, 57, 0.36);
  background: rgba(185, 21, 36, 0.12);
  color: #ffb4b4;
  font-size: 1.25rem;
}

.toolbar-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.filters {
  grid-template-columns: 220px minmax(220px, 1fr) 180px;
}

.export-actions {
  justify-content: end;
}

.branch-cards {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.branch-card {
  text-align: left;
  cursor: pointer;
}

.branch-card:hover {
  border-color: rgba(255, 51, 65, 0.66);
}

.admin-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.admin-athlete-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 24, 0.96);
  box-shadow: var(--shadow);
}

.admin-athlete-card.compact {
  width: 100%;
  min-height: 150px;
  color: var(--text);
  text-align: left;
}

.card-main-button {
  min-height: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.admin-athlete-card.compact:hover {
  border-color: rgba(255, 51, 65, 0.66);
  background: rgba(24, 27, 34, 0.98);
}

.admin-card-head {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.admin-card-head .table-avatar {
  width: 58px;
  height: 58px;
}

.admin-card-head h3 {
  margin: 0 0 4px;
  font-size: 1.08rem;
}

.admin-card-head p {
  margin: 0;
  color: var(--muted);
}

.compact-info {
  display: grid;
  gap: 8px;
}

.score-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-info span {
  display: grid;
  gap: 2px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.compact-info small {
  color: var(--muted);
}

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

.admin-info-grid span {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c0e13;
  color: var(--text);
  overflow-wrap: anywhere;
}

.admin-info-grid small {
  color: var(--muted);
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.card-actions {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 8px;
}

.admin-detail-grid section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.admin-detail-grid h4 {
  margin: 0 0 10px;
  color: var(--gold-2);
}

.athlete-detail {
  display: grid;
  gap: 18px;
}

.detail-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.detail-page-head h2 {
  margin: 2px 0 4px;
  font-size: 1.5rem;
}

.detail-info-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.table-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.table-title p {
  margin: 0;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  background: var(--surface-3);
  color: var(--gold-2);
  font-size: 0.8rem;
  text-transform: uppercase;
}

td {
  color: var(--muted);
}

td strong {
  color: var(--text);
}

#emptyAdminState {
  padding: 18px 20px;
}

@media (max-width: 980px) {
  .hero,
  .portal-grid,
  .records-grid,
  .toolbar-panel,
  .filters,
  .admin-cards,
  .admin-detail-grid,
  .detail-info-grid,
  .leaderboard-row {
    grid-template-columns: 1fr;
  }

  .leaderboard-row {
    align-items: start;
  }

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

  .summary-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 20px, 1240px);
    padding-top: 12px;
  }

  .site-header,
  .dashboard-head,
  .section-title,
  .actions,
  .export-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    align-self: flex-start;
  }

  .mode-switch,
  .form-grid,
  .compact-form,
  .hero-stats,
  .branch-cards,
  .admin-info-grid {
    grid-template-columns: 1fr;
  }

  .admin-card-head {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .admin-card-head .status-pill {
    grid-column: 1 / -1;
  }

  .hero {
    min-height: 440px;
    align-items: end;
    padding: 20px;
  }

  .hero h1 {
    font-size: 2.35rem;
  }

  .panel {
    padding: 16px;
  }

  .primary,
  .ghost,
  .danger {
    width: 100%;
  }

  .score-row,
  .card-actions {
    grid-template-columns: 1fr;
  }
}
