:root {
  --bg-dark: #0a1a0a;
  --bg-card: rgba(31, 65, 31, 0.85);
  --border-color: rgba(77, 184, 86, 0.22);
  --text-light: #e9f7d9;
  --text-muted: #a3c796;
  --accent: #7fd44f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, sans-serif;
  background: radial-gradient(circle at top, #1d3b1b 0%, #071207 65%);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px;
}

.container {
  width: min(1200px, 100%);
  display: grid;
  gap: 12px;
}

header {
  text-align: center;
  padding: 10px 24px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

header h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 3vw, 3rem);
}

header p {
  margin: 0;
  color: var(--text-muted);
}

/* Top page header for banner image */
#topHeader {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  /*margin-bottom: 18px;*/
  background: transparent;
  align-self: stretch;
}

#topHeaderImg {
  width: 100%;
  /*max-height: 220px;*/
  object-fit: cover;
  display: block;
  border-radius: 20px;
}

@media (max-width: 768px) {
  #topHeaderImg { max-height: 140px; }
}

/* Banner overlay + CTA */
#topHeader { position: relative; }
.banner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(7,18,7,0.45) 0%, rgba(7,18,7,0.15) 30%, rgba(7,18,7,0.0) 100%);
  z-index: 2;
}
.banner-content {
  pointer-events: auto;
  padding: 28px 36px;
  max-width: 1100px;
  position: relative;
  width: 100%;
  display: block;
  position: absolute;
  top: 10px;
}
.top-links {
  display: flex;
  gap: 10px;
  /*margin-bottom: 2px;*/
}
.admin-link:hover {
  border: 1px solid #7fd44f;
  background: rgba(127, 212, 79, 0.12);
}
.banner-content h1 {
  margin: 0 0 6px 0;
  color: var(--text-light);
  font-size: clamp(20px, 3.5vw, 36px);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.banner-cta {
  position: absolute;
  top: 12px;
  right: 18px;
  display: inline-block;
  margin-top: 0;
  background: var(--accent);
  color: #071207;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
  pointer-events: auto;
  border: 1px solid #1b3a1b;
  text-shadow: 0 0 8px rgba(127,212,79,0.95);
  animation: neon 1s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(127,212,79,0.35), 0 6px 18px rgba(7,18,7,0.45);
}
a.banner-cta {
  color: #1b3a1b;
}

.admin-link,
.tech-link {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  background: rgba(0,0,0,0.35);
  color: var(--text-light);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(127,212,79,0.18);
  z-index: 3;
}

@media (max-width: 768px) {
  .banner-overlay { justify-content: center; }
  .banner-content { padding: 16px; text-align: center; flex-direction: column; }
  .banner-links { position: static; justify-content: center; margin-bottom: 12px; }
  .banner-cta { position: static; margin: 8px auto 0; padding: 8px 14px; animation: none; box-shadow: none; }
  .admin-link,
  .tech-link { position: static; margin: 0; }
}

@keyframes neon {
  0% {
    box-shadow: 0 0 6px rgba(128, 212, 79, 0), 0 4px 14px rgba(7,18,7,0);
    transform: translateY(0);
  }
  25% {
    box-shadow: 0 0 14px rgba(127,212,79,0), 0 6px 18px rgba(7,18,7,0);
    transform: translateY(-1px);
  }
  50% {
    box-shadow: 0 0 22px rgba(19, 32, 11, 0.8), 0 10px 30px rgba(7,18,7,0);
    transform: translateY(-2px);
  }
  75% {
    box-shadow: 0 0 14px rgba(127,212,79,0), 0 6px 18px rgba(7,18,7,0);
    transform: translateY(-1px);
  }
  100% {
    box-shadow: 0 0 6px rgba(127,212,79,0), 0 4px 14px rgba(7,18,7,0);
    transform: translateY(0);
  }
}

.tabs-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0;
}

.tab-btn {
  border: none;
  padding: 14px 20px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-light);
}

.tab-btn.active {
  background: transparent;
  color: var(--text-light);
  border-bottom-color: #e29c03;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in;
}

.tab-content.active {
  display: block !important;
}

.session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.session-header > div {
  flex: 1;
}

.session-header h2 {
  margin: 0;
}

.btn-back {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-light);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.btn-back:hover {
  background: rgba(127, 212, 79, 0.12);
}

.btn-danger {
  background: #2f5f2f;
  color: white;
  padding: 10px 16px;
  white-space: nowrap;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-standard {
  background: var(--accent);
  color: #071207;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

.btn-standard:hover {
  opacity: 0.9;
}

.scale-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: rgba(30, 41, 59, 0.5);
}

.scale-item-info {
  flex: 1;
  color: var(--text-light);
}

.scale-item-buttons {
  display: flex;
  gap: 8px;
}

.btn-edit, .btn-delete {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}

.btn-edit {
  background: #fbbf24;
  color: #1f2937;
}

.btn-delete {
  background: #ef4444;
  color: white;
}

.btn-edit:hover, .btn-delete:hover {
  opacity: 0.85;
}

.sessions-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

.session-card {
  padding: 5px 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(10, 18, 10, 0.55);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.session-card:hover {
  border-color: #7fd44f;
  background: rgba(16, 34, 16, 0.9);
  transform: translateY(-2px);
}

.session-card.terminated {
  /*border-color: rgba(239, 68, 68, 0.9);*/
  background: rgba(85, 0, 0, 0.35);
}
.session-card.terminated:hover {
  border-color: rgba(239, 68, 68, 0.9);
}

.session-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.session-name {
  font-weight: 700;
  color: var(--text-light);
  min-width: 160px;
}

.session-date,
.session-info,
.session-desc {
  color: var(--text-muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-desc {
  flex: 1;
  min-width: 180px;
  max-width: 380px;
}

.btn-session-terminate {
  margin-top: 0;
  width: auto;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  flex-shrink: 0;
}

.btn-session-terminate.btn-active {
  border: 1px solid rgba(127, 212, 79, 0.85);
  background: rgba(127, 212, 79, 0.15);
  color: #d6f7c1;
}

.btn-session-terminate.btn-active:hover {
  background: rgba(127, 212, 79, 0.3);
}

.btn-session-terminate.btn-terminated {
  border: 1px solid rgba(239, 68, 68, 0.85);
  background: rgba(239, 68, 68, 0.15);
  color: #ffd6d6;
}

.btn-session-terminate.btn-terminated:hover {
  background: rgba(239, 68, 68, 0.3);
}

.card {
  padding: 24px;
  margin-bottom: 24px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-light);
}

input[type="text"],
input[type="date"],
input[type="number"],
select {
  flex: 1 1 20px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(7,18,7,0.9);;
  color: var(--text-light);
  font-size: 14px;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: brightness(0) invert(1);
}

input[type="date"]::-moz-calendar-picker-indicator {
  color: #fff;
}

.time-input,
.score-input {
  flex: 0 0 150px;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: #7fd44f;
  box-shadow: 0 0 0 3px rgba(127, 212, 79, 0.14);
}

button {
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  background: var(--accent);
  color: var(--bg-dark);
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  transition: opacity 0.2s, transform 0.2s;
}

button:hover {
  opacity: 0.9;
}

button:active {
  transform: scale(0.98);
}

.btn-large {
  width: 100%;
  padding: 16px 24px;
  font-size: 16px;
}

.session-select {
  width: 100%;
  margin-bottom: 16px;
  font-size: 14px;
}

ul {
  margin: 0;
  padding-left: 20px;
  list-style: none;
}

ul li {
  padding: 8px 0;
  color: var(--text-muted);
}

.participant-item,
.game-item {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px !important;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: rgb(35 31 25 / 50%);
}

.participant-item span,
.game-item span {
  flex: 1;
  color: var(--text-light);
}

.participant-actions,
.game-actions {
  display: flex;
  gap: 8px;
  margin-left: 12px;
}

.btn-edit-participant,
.btn-edit-game {
  background: #fbbf24;
  color: #1f2937;
}

.btn-delete-participant,
.btn-delete-game {
  background: #ef4444;
  color: white;
}

.game-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.game-type {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-warning {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(77, 184, 86, 0.2);
  margin-bottom: 10px;
  background: rgba(10, 18, 10, 0.75);
  color: var(--text-light);
}

#gameParticipantsPanel {
  border: 1px solid rgba(77, 184, 86, 0.16);
}

#gameParticipantsList {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

thead {
  border-bottom: 2px solid var(--border-color);
}

th,
td {
  padding: 14px 12px;
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--text-muted);
  font-weight: 600;
}

tr:hover {
  background: rgba(127, 212, 79, 0.08);
}

#detailedStats {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.stat-item {
  padding: 12px 12px;
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 20px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: rgba(10, 18, 10, 0.75);
}

.stat-item strong {
  max-width: 200px;
}

#sessionContent {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 1024px) {
  body {
    padding: 18px;
  }

  .container {
    gap: 18px;
  }

  header,
  .session-header,
  .card {
    padding: 22px;
  }

  .tabs-container {
    gap: 10px;
  }

  .tab-btn {
    flex: 1 1 140px;
    font-size: 13px;
    padding: 12px 16px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 14px;
    align-items: stretch;
  }

  .container {
    width: 100%;
  }

  header,
  .session-header,
  .card {
    padding: 20px;
    border-radius: 18px;
  }

  .tabs-container {
    flex-direction: column;
    align-items: stretch;
  }

  .tab-btn {
    width: 100%;
    text-align: left;
  }

  .form-row,
  .participant-actions,
  .game-actions,
  .stat-item {
    flex-direction: column;
    gap: 12px;
  }

  input[type="text"],
  input[type="date"],
  input[type="number"],
  select,
  button {
    width: 100%;
  }

  .time-input,
  .score-input {
    flex: 1 1 auto;
    min-width: 0;
  }

  .session-header {
    flex-direction: column;
    align-items: stretch;
  }

  .session-header > div {
    width: 100%;
  }

  table {
    display: block;
    width: 100%;
    overflow-x: auto;
  }
}

@media (max-width: 580px) {
  header h1 {
    font-size: 2rem;
  }

  header,
  .card,
  .session-header {
    padding: 18px;
  }

  .tab-btn {
    font-size: 13px;
    padding: 10px 14px;
  }

  th,
  td {
    padding: 12px 10px;
    font-size: 13px;
  }

  .participant-item,
  .game-item,
  .checkbox-item {
    flex-direction: column;
    align-items: stretch;
  }

  .participant-actions,
  .game-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
tbody#rankingTable  tr td {
  padding: 2px 12px;
}
.game-item-header strong {
  color: var(--text-light);
}
.logout-link{
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  background: var(--accent);
  color: var(--bg-dark);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(127,212,79,0.18);
  z-index: 3;
}
.logout-link:hover {
  border: 1px solid #7fd44f;
  background: rgba(127, 212, 79, 0.12);
  color: var(--TEXT-LIGHT);
}