/* Local fonts (no render-blocking external @import) */
@font-face {
  font-family: "Space Mono";
  src: url(../font/SpaceMono.ttf);
  font-display: swap;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #121214;
  color: #FFFFFF;
  font-family: "Space Mono", monospace;
  font-size: 16px;
  min-height: 100vh;
  background-image: url('../img/galaxy-bg.webp');
  background-image: image-set(url('../img/galaxy-bg.webp') type('image/webp'), url('../img/galaxyAll.gif') type('image/gif'));
  background-size: cover;
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
}

.wrapper {
  background-color: rgba(20, 20, 25, 0.85);
  backdrop-filter: blur(12px);
  width: 100%;
  max-width: 1200px;
  border: 1px solid rgba(151, 0, 189, 0.2);
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  position: relative;
  margin-top: 60px;
}

/* Header & Title */
.glow-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 30px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 0 0 10px rgba(151, 0, 189, 0.6), 0 0 20px rgba(151, 0, 189, 0.4);
}

/* Nav Icons */
.nav-icon-link {
  position: absolute;
  top: 30px;
  z-index: 10;
  transition: transform 0.2s ease;
}

.back-link {
  left: 30px;
}

.user-link {
  right: 30px;
}

.nav-icon-link:hover {
  transform: scale(1.1);
}

.icons {
  width: 28px;
  height: 28px;
  filter: invert(100%);
  opacity: 0.85;
  cursor: pointer;
  transition: opacity 0.2s, filter 0.2s;
}

.icons:hover {
  opacity: 1;
  filter: invert(34%) sepia(87%) saturate(2258%) hue-rotate(268deg) brightness(88%) contrast(110%); /* Violet theme tint */
}

.back {
  transform: rotate(180deg);
}

/* Controls section */
.scoreboard-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 30px;
}

@media (min-width: 768px) {
  .scoreboard-controls {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* Search Box */
.search-box {
  position: relative;
  flex: 1;
  max-width: 400px;
  width: 100%;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 45px;
  background-color: rgba(30, 30, 35, 0.7);
  border: 1px solid rgba(151, 0, 189, 0.3);
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.search-box input:focus {
  outline: none;
  border-color: #9700bd;
  box-shadow: 0 0 10px rgba(151, 0, 189, 0.2);
  background-color: rgba(30, 30, 35, 0.9);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.65);
    pointer-events: none;
}

/* Difficulty Tabs */
.tabs-container {
  display: flex;
  background-color: rgba(30, 30, 35, 0.6);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  gap: 4px;
}

.tab-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 10px 18px;
  font-family: inherit;
  font-size: 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #fff;
  background-color: #9700bd;
  box-shadow: 0 2px 8px rgba(151, 0, 189, 0.4);
}

/* Table Area */
.table-container {
  overflow-x: auto;
  position: relative;
  min-height: 200px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  text-align: left;
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
  background-color: rgba(30, 30, 35, 0.8);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.6);
  user-select: none;
}

th.sortable {
  cursor: pointer;
}

th.sortable:hover {
  color: #fff;
  background-color: rgba(151, 0, 189, 0.1);
}

/* Sorting indicators */
.sort-indicator::after {
  content: ' ↕';
  opacity: 0.35;
  font-size: 0.8rem;
}

th.sorted.asc .sort-indicator::after {
    content: ' ▲';
    opacity: 1;
    color: #d67bff;
}

th.sorted.desc .sort-indicator::after {
    content: ' ▼';
    opacity: 1;
    color: #d67bff;
}

tr {
  transition: background-color 0.2s ease;
}

tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Medal styles */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: bold;
}

.rank-gold {
  background-color: #ffd700;
  color: #000;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.rank-silver {
  background-color: #c0c0c0;
  color: #000;
  box-shadow: 0 0 10px rgba(192, 192, 192, 0.5);
}

.rank-bronze {
  background-color: #cd7f32;
  color: #000;
  box-shadow: 0 0 10px rgba(205, 127, 50, 0.5);
}

.score-highlight {
  color: #00e5ff;
  font-weight: bold;
}

.level-highlight {
    color: #ff4da6;
}

.difficulty-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: bold;
}

.badge-hard {
  background-color: rgba(255, 0, 0, 0.15);
  border: 1px solid rgba(255, 0, 0, 0.3);
  color: #ff4d4d;
}

.badge-impossible {
  background-color: rgba(151, 0, 189, 0.15);
  border: 1px solid rgba(151, 0, 189, 0.3);
  color: #e066ff;
}

.badge-run {
  background-color: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.3);
  color: #ffd700;
}

/* States */
.no-results {
    text-align: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 1.1rem;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #d67bff;
    font-size: 1.1rem;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(151, 0, 189, 0.4);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(151, 0, 189, 0.7);
}

@font-face {
    font-family: space;
    src: url(../font/Space.ttf);
}

.game-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    box-sizing: border-box;
    z-index: 100;
    background: linear-gradient(180deg, rgba(32,33,36,0.85) 0%, rgba(32,33,36,0) 100%);
    backdrop-filter: blur(4px);
    border-bottom: 1px solid rgba(151, 0, 189, 0.15);
}

.header-logo a {
    font-family: space, sans-serif;
    font-size: 2.2rem;
    color: #ffffff;
    text-decoration: none;
    text-shadow: 0 0 8px rgba(151, 0, 189, 0.6);
    transition: all 0.3s ease;
}

.header-logo a:hover {
    color: #d67bff;
    text-shadow: 0 0 12px #9700bd, 0 0 20px #9700bd;
}

.header-nav {
    display: flex;
    gap: 20px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(32, 33, 36, 0.6);
    border: 1px solid rgba(151, 0, 189, 0.4);
    border-radius: 8px;
    padding: 8px 16px;
    color: #ffffff;
    text-decoration: none;
    font-family: "Space Mono", monospace;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(151, 0, 189, 0.25);
    border-color: #9700bd;
    box-shadow: 0 0 10px rgba(151, 0, 189, 0.4);
    transform: translateY(-2px);
}

.nav-svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.seed-badge {
    display: inline-block;
    background-color: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: #00e5ff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.seed-badge:hover {
    background-color: rgba(0, 229, 255, 0.25);
    border-color: #00e5ff;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}
/* ── v2 consistency overrides: align header/footer/utils with main theme ── */
.game-header {
    height: clamp(40px, 6vh, 60px);
    padding: 0 clamp(10px, 4vw, 40px);
    background: rgba(20, 20, 24, 0.75);
    border-bottom: 1px solid rgba(151, 0, 189, 0.2);
}

.header-logo a {
    font-size: clamp(1.2rem, 3.5vw, 2.2rem);
}

.header-nav {
    gap: clamp(10px, 2vw, 20px);
}

.nav-btn {
    font-size: clamp(0.75rem, 1.5vw, 0.95rem);
    padding: clamp(6px, 1.2vh, 10px) clamp(10px, 1.5vw, 16px);
}

.nav-btn:focus-visible,
button:focus-visible,
input:focus-visible,
a:focus-visible,
th.sortable:focus-visible {
    outline: 2px solid #e07bff;
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.site-footer {
    text-align: center;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 24px;
}

.site-footer nav {
    margin-bottom: 2px;
}

.site-footer a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}

.site-footer a:hover {
    color: #e07bff;
    text-decoration: underline;
}

.noscript-note {
    margin-top: 16px;
    color: #ffd75e;
    text-align: center;
}

/* Sortable headers are interactive: keyboard + pointer affordance */
th.sortable {
    cursor: pointer;
}

@media (max-width: 560px) {
    body {
        padding: 24px 12px;
    }

    .wrapper {
        padding: 20px 14px;
        margin-top: 56px;
    }

    .glow-title {
        font-size: 1.6rem;
    }

    th, td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }

    .nav-label {
        display: none;
    }

    .header-logo a {
        font-size: 1.1rem;
    }

    .nav-btn {
        padding: 6px 10px;
    }

    /* Difficulty tabs wrap instead of overflowing the card */
    .tabs-container {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1 1 auto;
        padding: 10px 12px;
        font-size: 0.85rem;
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-btn:hover {
        transform: none;
    }
}

/* Seed badges are real buttons now: strip native button chrome */
button.seed-badge {
    appearance: none;
    -webkit-appearance: none;
    background-color: rgba(0, 229, 255, 0.1);
    font-family: inherit;
}

/* ── v2 exact-match: nav buttons identical to main theme ── */
.nav-btn {
    background: rgba(255, 255, 255, 0.08);
    gap: clamp(4px, 1vw, 8px);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.nav-btn:hover {
    border-color: rgba(183, 0, 221, 0.95);
    box-shadow: 0 0 15px rgba(183, 0, 221, 0.5);
}

.nav-svg {
    width: clamp(12px, 2vw, 18px);
    height: clamp(12px, 2vw, 18px);
}

/* Collapsible wordmark (matches main theme) */
.logo-short {
    display: none;
}

@media (max-width: 640px) {
    .header-logo .logo-full {
        display: none;
    }

    .header-logo .logo-short {
        display: inline;
    }
}

/* Copy affordance inside seed buttons (text, not an emoji) */
.copy-hint {
    font-size: 0.7rem;
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Leaderboard pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.pagination[hidden] {
    display: none;
}

.page-btn {
    min-width: 40px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(151, 0, 189, 0.35);
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: rgba(151, 0, 189, 0.3);
    border-color: #b700dd;
}

.page-btn.active {
    background: #9700bd;
    border-color: #9700bd;
    font-weight: bold;
}

.page-btn:disabled:not(.active) {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-btn:focus-visible {
    outline: 2px solid #e07bff;
    outline-offset: 2px;
}

.page-gap {
    color: rgba(255, 255, 255, 0.5);
    padding: 0 2px;
}

.page-info {
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 2px;
}
