:root {
  --twitch-purple:#9146FF;
  --twitch-purple-dark:#772CE8;
  --twitch-purple-hover:#a16bff;
  --twitch-bg:#0E0E10;
  --twitch-surface:#18181B;
  --twitch-surface-hover:#1F1F23;
  --twitch-row-hover:rgba(145,70,255,0.08);
  --twitch-border:#303032;
  --twitch-text:#EFEFF1;
  --twitch-text-muted:#ADADB8;
  --font-main:'Inter',sans-serif;
  --font-mono:'Share Tech Mono',monospace;
}

body {
  min-height:100vh;
  margin:0;
  font-family:var(--font-main);
  color:var(--twitch-text);
  background-color:var(--twitch-bg);
  background-image:linear-gradient(rgba(145,70,255,0.02) 1px,transparent 1px),linear-gradient(90deg,rgba(145,70,255,0.02) 1px,transparent 1px);
  background-size:32px 32px;
  padding-bottom:100px;
}

::-webkit-scrollbar {width:8px}
::-webkit-scrollbar-track {background:var(--twitch-bg)}
::-webkit-scrollbar-thumb {background:#3e3e42;border-radius:4px}
::-webkit-scrollbar-thumb:hover {background:var(--twitch-purple)}

.container-main {
  background:var(--twitch-surface);
  border:1px solid var(--twitch-border);
  border-radius:12px;
  padding:2rem 1.5rem;
  margin:2.5rem auto;
  max-width:1000px;
  box-shadow:0 20px 60px rgba(0,0,0,0.6),0 0 0 1px rgba(145,70,255,0.08);
  position:relative;
  overflow:hidden;
}

.container-main::before {
  content:'';
  position:absolute;
  top:0;left:0;
  width:100%;height:5px;
  background:linear-gradient(90deg,var(--twitch-purple),#00d4ff);
  box-shadow:0 4px 20px rgba(145,70,255,0.4);
}

h1 {
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:2px;
  margin-bottom:2.5rem;
  text-align:center;
  font-size:2.8rem;
  background:linear-gradient(90deg,#fff,var(--twitch-purple),#fff);
  /*-webkit-background-clip:text;*/
  background-clip:text;
  -webkit-text-fill-color:transparent;
  text-shadow:0 0 30px rgba(145,70,255,0.25);
}

.period-selector .btn-group {
  width:100%;
  display:flex;
  background:rgba(0,0,0,0.25);
  border:1px solid var(--twitch-border);
  border-radius:10px;
  padding:5px;
  box-shadow:inset 0 2px 10px rgba(0,0,0,0.4);
}

.period-selector .btn {
  flex:1 1 0;
  min-width:0;
  color:var(--twitch-text-muted);
  background:transparent;
  border:none;
  font-weight:600;
  padding:12px 16px;
  border-radius:8px;
  transition:all 0.25s ease;
  white-space:nowrap;
  text-align:center;
}

.period-selector .btn:hover {color:white;background:rgba(255,255,255,0.06)}
.period-selector .btn.active {background:var(--twitch-purple);color:white;box-shadow:0 0 20px rgba(145,70,255,0.5)}

.table-wrapper {
  max-width:100%;
  background:rgba(20,20,25,0.6);
  border-radius:10px;
  border:1px solid var(--twitch-border);
  overflow:hidden;
  overflow-x:auto;
  box-shadow:inset 0 0 15px rgba(0,0,0,0.5);
}

.rating-table {
  width:100%;
  min-width:600px;
  table-layout:fixed;
}

.rating-table th {
  background:rgba(30,30,35,0.7);
  border-bottom:2px solid var(--twitch-border);
  color:var(--twitch-text-muted);
  text-transform:uppercase;
  font-size:0.85rem;
  letter-spacing:1px;
  padding:1.1rem 1.4rem;
}

.rating-table td {
  border-top:1px solid rgba(48,48,50,0.5);
  padding:1.2rem 1.4rem;
  vertical-align:middle;
  background:var(--twitch-surface);
  color:var(--bs-table-color-state,var(--bs-table-color-type,#c69fff));
  transition:background 0.2s ease;
}

.rating-table td:nth-child(3) {color:#d4b3ff;font-weight:500}
.rating-table tr:hover td {background:var(--twitch-row-hover)}
.rating-table tr:nth-child(1) .place-cell {color:#ffcc00}
.rating-table tr:nth-child(2) .place-cell {color:#e0e0e0}
.rating-table tr:nth-child(3) .place-cell {color:#ffaa33}

.rating-table th:nth-child(1),.rating-table td:nth-child(1) {width:8%}
.rating-table th:nth-child(2),.rating-table td:nth-child(2) {width:12%}
.rating-table th:nth-child(3),.rating-table td:nth-child(3) {width:55%}
.rating-table th:nth-child(4),.rating-table td:nth-child(4) {width:25%}

.place-cell {
  font-size:1.65rem;
  font-weight:800;
  color:#b085ff;
  text-align:center;
  width:70px;
}

.avatar {
  width:52px;
  height:52px;
  border-radius:50%;
  object-fit:cover;
  border:2px solid rgba(145,70,255,0.2);
  box-shadow:0 0 12px rgba(145,70,255,0.15);
}

.points {
  font-family:var(--font-mono);
  font-size:1.4rem;
  font-weight:700;
  color:#c69fff;
  text-align:right;
}

.admin-link {
  color:var(--twitch-text-muted);
  font-weight:500;
  text-decoration:none;
  transition:color 0.25s;
}

.admin-link:hover {color:var(--twitch-purple)}

.rules-btn {
  position:fixed;
  bottom:32px;
  right:32px;
  z-index:1000;
  width:60px;
  height:60px;
  border-radius:50%;
  background:rgba(20,20,25,0.85);
  border:2px solid var(--twitch-purple);
  color:var(--twitch-purple);
  font-size:1.6rem;
  font-weight:bold;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 8px 25px rgba(145,70,255,0.25);
  transition:all 0.28s ease;
}

.rules-btn:hover {
  background:var(--twitch-purple);
  color:white;
  transform:scale(1.12) rotate(8deg);
  box-shadow:0 12px 35px rgba(145,70,255,0.55);
}

.modal-content {
  background:#17171c;
  border:1px solid var(--twitch-border);
  border-radius:14px;
  box-shadow:0 30px 70px rgba(0,0,0,0.75);
}

.modal-header {
  border-bottom:1px solid var(--twitch-border);
  padding:1.5rem 1.75rem;
}

.modal-title {
  font-weight:800;
  letter-spacing:1px;
  text-transform:uppercase;
}

.modal-body {
  padding:1.75rem;
  color:#e0e0ff;
  line-height:1.7;
}

.modal-body ul li {
  margin-bottom:0.65rem;
  color:#d4b3ff;
}

.modal-body .text-muted {
  color:#9a9ab8 !important;
  font-size:0.88rem;
}

.form-control,.form-select {
  background:#0f0f14;
  border:1px solid var(--twitch-border);
  color:white;
}

.form-control:focus,.form-select:focus {
  border-color:var(--twitch-purple);
  box-shadow:0 0 0 3px rgba(145,70,255,0.25);
  background:#141418;
}

.btn-primary {
  background:var(--twitch-purple);
  border:none;
}

.btn-primary:hover {background:var(--twitch-purple-dark)}

.btn-outline-primary {
  color:var(--twitch-purple);
  background:transparent;
  border:1px solid var(--twitch-purple);
  border-radius:8px;
  transition:all 0.25s ease;
}

.btn-outline-primary:hover {
  background:rgba(145,70,255,0.08);
  color:var(--twitch-purple);
  border-color:var(--twitch-purple-hover);
  box-shadow:0 0 15px rgba(145,70,255,0.3);
  transform:translateY(-1px);
}

.btn-success {background:#00C853}

.btn-outline-success {
  color:#00C853;
  background:transparent;
  border:1px solid #00C853;
  border-radius:8px;
  transition:all 0.25s ease;
}

.btn-outline-success:hover {
  background:rgba(0,200,83,0.08);
  color:#00C853;
  border-color:#00C853;
  box-shadow:0 0 15px rgba(0,200,83,0.3);
  transform:translateY(-1px);
}

.btn-outline-info {
  color:#17a2b8;
  background:transparent;
  border:1px solid #17a2b8;
  border-radius:8px;
  transition:all 0.25s ease;
}

.btn-outline-info:hover {
  background:rgba(23,162,184,0.08);
  color:#17a2b8;
  border-color:#17a2b8;
  box-shadow:0 0 15px rgba(23,162,184,0.3);
  transform:translateY(-1px);
}

.btn-outline-warning {
  color:#ffc107;
  background:transparent;
  border:1px solid #ffc107;
  border-radius:8px;
  transition:all 0.25s ease;
}

.btn-outline-warning:hover {
  background:rgba(255,193,7,0.08);
  color:#ffc107;
  border-color:#ffc107;
  box-shadow:0 0 15px rgba(255,193,7,0.3);
  transform:translateY(-1px);
}

.btn-outline-secondary {
  color:var(--twitch-text-muted);
  background:transparent;
  border:1px solid var(--twitch-border);
  border-radius:8px;
  transition:all 0.25s ease;
}

.btn-outline-secondary:hover {
  background:rgba(255,255,255,0.06);
  color:var(--twitch-text);
  border-color:var(--twitch-border);
  box-shadow:0 0 10px rgba(145,70,255,0.1);
  transform:translateY(-1px);
}

.input-with-status {position:relative}

.status-icon {
  position:absolute;
  right:14px;
  top:50%;
  transform:translateY(-50%);
  color:#00C853;
  font-size:1.4rem;
  opacity:0;
  transition:opacity 0.3s ease;
  pointer-events:none;
}

.status-icon.show {opacity:1}

.modal .btn {
  padding:0.75rem 1.5rem;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.5px;
}

.toast {
  background:#1a1a22;
  border:1px solid var(--twitch-border);
  color:white;
}

.extra-row td {
  background: var(--twitch-surface-hover);
  padding: 1rem;
  font-size: 0.95rem;
  color: var(--twitch-text-muted);
  border-top: none !important;
}

.extra-row td div {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 1rem;
}

.user-name {
  cursor: pointer;
  color: var(--twitch-purple);
  text-decoration: underline;
}

.user-name:hover {
  color: var(--twitch-purple-hover);
}

@media (max-width:992px) {
  .container-main {margin:1.5rem;padding:1.5rem}
  h1 {font-size:2.2rem}
}

@media (max-width:576px) {
  .period-selector .btn {padding:10px 8px;font-size:0.9rem}
  .place-cell {font-size:1.4rem;width:50px}
  .avatar {width:44px;height:44px}
}

.form-control,.form-select {color:#9a9ab8 !important}
.form-control::placeholder,.form-select option {color:#6c6c78 !important}
.form-control:focus,.form-select:focus {color:#d0d0d8 !important;background-color:#141418 !important}
.form-control:not(:placeholder-shown) {color:#c0c0d0 !important}

/* Player Profile Menu */
.player-profile-menu {
  position: absolute !important;
  top: 20px !important;
  left: 20px !important;
  right: auto !important;
  bottom: auto !important;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(20, 20, 25, 0.95);
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(145, 70, 255, 0.4);
  z-index: 1000;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 20px rgba(145, 70, 255, 0.15);
  transition: all 0.3s ease;
}

.player-profile__avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(145, 70, 255, 0.5);
  flex-shrink: 0;
}

.player-profile__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.player-profile__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.player-profile__name {
  color: var(--twitch-text);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-profile__level {
  color: var(--twitch-text-muted);
  font-size: 0.85rem;
}

.player-profile-menu.hidden {
  display: none;
}

/* Next Game Countdown */
.next-game-countdown {
  min-height: 20px;
  font-size: 0.85rem;
  color: #9146ff;
  text-align: center;
  font-weight: 500;
  opacity: 0.6;
}

/* Player Profile in Result Screens */
.player-profile-result {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(20, 20, 25, 0.95);
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(145, 70, 255, 0.4);
  margin-bottom: 30px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 20px rgba(145, 70, 255, 0.15);
  z-index: 100;
}

.player-profile-result.hidden {
  display: none;
}

.player-profile-result .player-profile__avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 2px solid rgba(145, 70, 255, 0.5);
  overflow: hidden;
  flex-shrink: 0;
}

.player-profile-result .player-profile__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.player-profile-result .player-profile__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.player-profile-result .player-profile__name {
  color: var(--twitch-text);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-profile-result .player-profile__level {
  color: var(--twitch-text-muted);
  font-size: 0.85rem;
}