* {
    margin: 0; /* Removes all default outer spacing */
    padding: 0; /* Removes all default inner spacing */
    box-sizing: border-box; /* Makes width include padding + border */
}

body {
    font-family: 'Courier New', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Main font stack */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); /* Page background gradient */
    min-height: 100vh; /* Full viewport height */
    padding: 20px; /* Page padding */
}

body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); /* Dark mode background */
}

.theme-toggle {
    position: fixed; /* Stays in the same place on screen */
    top: 20px;
    right: 20px;
    background: #667eea; /* Button color */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px; /* Rounded button */
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s; /* Smooth hover animation */
    z-index: 1000; /* Always on top */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); /* Soft shadow */
}

.theme-toggle:hover {
    background: #764ba2; /* Hover color */
    transform: scale(1.05); /* Slight zoom on hover */
}

body.dark-mode .theme-toggle {
    background: #e94560; /* Dark mode button color */
}

body.dark-mode .theme-toggle:hover {
    background: #ff6b6b; /* Dark mode hover color */
}

.container {
    max-width: 1200px; /* Max width of content */
    margin: 0 auto; /* Center horizontally */
}

.info-section {
    background: white;
    border-radius: 12px; /* Rounded corners */
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); /* Deep shadow */
    padding: 20px;
    margin-bottom: 10px; /* Space between sections */
}

body.dark-mode .info-section {
    background: #0f3460; /* Dark mode background */
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 1.25em;
}

h2 {
    text-align: center;
    color: #aa3;
    margin-bottom: 10px;
    font-size: 1.0em;
}

h3 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 0.8em;
}

body.dark-mode h1 {
    color: #e8e8e8; /* Light text in dark mode */
}

.info-table {
    width: 100%;
    border-collapse: collapse; /* Removes spacing between table cells */
    margin: 10px 0;
}

.info-table tr {
    border-bottom: 2px solid #e0e0e0; /* Row separator */
    transition: background 0.3s; /* Smooth hover */
}

.info-table tr:last-child {
    border-bottom: none; /* Remove last border */
}

.info-table tr:hover {
    background: #f5f5f5; /* Row hover effect */
}


.info-table td {
    padding: 5px; 6px; /* Cell padding */
    font-size: 0.9em; /* Smaller text */
}

.info-table td:first-child {
    width: 300px; /* Label column width */
    font-weight: bold;
    color: #667eea; /* Label color */
    border-right: 2px solid #e0e0e0; /* Vertical separator */
}

.info-table td:last-child {
    color: #333; /* Value color */
}

.info-table a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.info-table a:hover {
    color: #764ba2;
    text-decoration: underline; /* Underline on hover */
}

body.dark-mode .info-table tr {
    border-bottom: 2px solid #1a1a2e; /* Dark mode separator */
}

body.dark-mode .info-table tr:hover {
    background: #1a1a2e; /* Dark mode hover */
}

body.dark-mode .info-table td:first-child {
    color: #e94560;
    border-right: 2px solid #1a1a2e;
}

body.dark-mode .info-table td:last-child {
    color: #e8e8e8;
}

body.dark-mode .info-table a {
    color: #e94560;
}

body.dark-mode .info-table a:hover {
    color: #ff6b6b;
}

.status-finished {
    color: #27ae60 !important; /* Green status */
    font-weight: bold;
}

body.dark-mode .status-finished {
    color: #2ecc71 !important;
}

.status-ongoing {
    color: #f39c12 !important; /* Orange status */
    font-weight: bold;
}

body.dark-mode .status-ongoing {
    color: #f1c40f !important;
}
.rankings-section {
    background: white;
    border-radius: 16px; 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); 
    padding: 30px;
    border: 1px solid rgba(0, 0, 0, 0.05); 
    transition: all 0.3s ease; 
}

.rankings-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

/* --- DARK MODE  */
body.dark-mode .rankings-section {
    background: #1a1a2e; 
    color: #e8e8e8;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); 
}

.rankings-section h2 {
    color: #16213e;
    margin-bottom: 20px;
    font-weight: 700;
}

body.dark-mode .rankings-section h2 {
    color: #4ecca3; 
}

.table-wrapper {
    overflow-x: auto; 
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); /* Header gradient */
    color: white;
}

body.dark-mode thead {
    background: linear-gradient(135deg, #e94560 0%, #0f3460 100%);
}

th {
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    cursor: pointer; /* Indicates sortable columns */
    user-select: none; /* Prevents text selection */
    position: relative;
    transition: background 0.3s;
}

th:first-child,
th:nth-child(3),
th:nth-child(4),
th:nth-child(5),
th:nth-child(6),
th:nth-child(7) {
    text-align: right; /* Align numeric columns */
}

th:nth-child(2) {
    text-align: center; /* Center team names */
}

th:hover {
    background: rgba(255, 255, 255, 0.1); /* Subtle hover */
}

th.sortable::after {
    content: ' ⇅'; /* Sorting icon */
    opacity: 0.5;
    font-size: 0.8em;
}

th.sorted-asc::after {
    content: ' ▲'; /* Ascending arrow */
    opacity: 1;
}

th.sorted-desc::after {
    content: ' ▼'; /* Descending arrow */
    opacity: 1;
}

td {
    padding: 4px 5px;
    border-bottom: 1px solid #fee; /* Row separator */
    text-align: left;
}

body.dark-mode td {
    border-bottom: 1px solid #333;
}

td:first-child,
td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6),
td:nth-child(7) {
    text-align: right; /* Align numeric cells */
    padding-right: 15px;
}

tbody tr {
    transition: all 0.3s; /* Smooth hover + scale */
}

tbody tr:hover {
    background: #f5f5f5;
    transform: scale(1.01); /* Slight zoom */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark-mode tbody tr:hover {
    background: #1a1a2e;
}

.rank {
    width: 40px; 
    font-weight: bold;
    color: #667eea;
}

body.dark-mode .rank {
    color: #e94560;
}

.team-name {
    font-weight: 600;
    color: #333;
}

body.dark-mode .team-name {
    color: #e8e8e8;
}

.elo-rating {
    font-weight: bold;
    color: #764ba2;
    font-size: 1.1em;
}

body.dark-mode .elo-rating {
    color: #ff6b6b;
}

.delta {
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px; /* Rounded badge */
}

.delta.positive {
    color: #27ae60;
    background: #d5f4e6; /* Light green background */
}

.delta.negative {
    color: #e74c3c;
    background: #fadbd8; /* Light red background */
}

body.dark-mode .delta.positive {
    color: #2ecc71;
    background: #1a4d2e;
}

body.dark-mode .delta.negative {
    color: #ff6b6b;
    background: #4d1f1f;
}

.top-3 {
    background: linear-gradient(90deg, #ffe4b3 0%, #ffffff 100%); /* Highlight top 3 rows */
}

body.dark-mode .top-3 {
    background: linear-gradient(90deg, #2d4059 0%, #0f3460 100%);
}

.top-3 .rank {
    font-size: 1.2em; /* Bigger rank number */
}

@media (max-width: 768px) {
    .info-section,
    .rankings-section {
        padding: 15px; /* Smaller padding on mobile */
    }

   th, td {
       padding: 5px 6px;
       font-size: 0.9em;
   }
   
   .theme-toggle {
       top: 10px;
       right: 10px;
       padding: 8px 15px;
       font-size: 12px;
    }
}

.nav-back {
    display: inline-block;
    background-color: #111;
    color: yellow;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 25px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.nav-back:hover {
    opacity: 1;
    color: #fff; /* Hover color */
}

/* Tooltip trigger */
.tip {
    position: relative;
    cursor: help; /* Indicates extra info */
}

.tip:hover::after {
    content: attr(data-tip); /* Shows tooltip text */
    position: absolute;
    left: 0;
    top: 100%;
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    width: 300px;
    white-space: normal;
    z-index: 9999;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Tooltip block version */
.tooltip {
  position: relative;
  display: inline-block;
  border-bottom: 2px dotted #ffff; /* Visual indicator */
  cursor: help;
  color: #2196F3;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 600px;
  background-color: #333;
  color: #fff;
  text-align: left;
  border-radius: 6px;
  padding: 15px;
  position: absolute;
  z-index: 1;
  top: 125%; /* Position below */
  left: 50%;
  margin-left: -225px; /* Center horizontally */
  opacity: 0;
  transition: opacity 0.3s;
  font-family: 'times new roman' 'segoe ui', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  box-shadow: 0px 5px 15px rgba(0,0,0,0.3);
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1; /* Fade in */
}

.btn-download {
    padding: 4px 10px;
    background: #f0f0b0;
    color: #f0f0f0; !important;
    border-radius: 2px;
    text-decoration: none;
	margin-left: 100px;
}

pre.crosstable {
    background: linear-gradient(135deg, #fafffa 0%, #fefffe 100%); /* Page background gradient */
	width: 100%
    color: #3113ed;
    padding: 12px 16px;
    border: 1px solid #444;
    border-radius: 6px;
    font-family: "Courier New", "Consolas",  monospace;
    font-size: 16px;
    line-height: 1.35;
    white-space: pre;      /* keep exact spacing */
    overflow-x: auto;      /* allow horizontal scroll if needed */
}

pre.crosstable .header {
    color: #fff;
    font-weight: bold;
}

pre.crosstable .engine {
    color: #9ecbff;        /* light blue for engine names */
}

pre.crosstable .score {
    color: #f0d48a;        /* soft gold for scores */
}

pre.crosstable .dash {
    color: #666;           /* muted dash for diagonal */
}

body.dark-mode .crosstable {
    background: linear-gradient(90deg, #2d4059 0%, #0f3460 100%);
    color: #dadada;
}
