:root {
  --bg: #050720;
  --panel: #ffffff;
  --ink: #101326;
  --muted: #6f7485;
  --line: #d8deea;
  --navy: #02043d;
  --accent: #ffd200;
  --accent-dark: #d7a935;
  --green: #00d689;
  --row: #f7f9fe;
  --shadow: 0 22px 55px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 72% 0, rgba(0, 214, 137, 0.16), transparent 28%),
    linear-gradient(180deg, #030420 0, #070a35 360px, #f3f6fb 360px),
    var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 300px;
  padding: 34px 36px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(2, 4, 61, 0.95) 0%, rgba(2, 4, 61, 0.84) 42%, rgba(2, 4, 61, 0.28) 100%),
    linear-gradient(180deg, rgba(2, 4, 61, 0.12), rgba(2, 4, 61, 0.62)),
    url("assets/road-to-1000-2026-banner.png") center / cover;
  border: 1px solid rgba(255, 210, 0, 0.34);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: #fff;
}

.hero::before {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(170deg, rgba(255, 210, 0, 0.92) 0 3px, transparent 3px 16px, rgba(255, 210, 0, 0.72) 16px 20px, transparent 20px 100px),
    linear-gradient(352deg, transparent 0 78%, rgba(0, 214, 137, 0.92) 78% 80%, transparent 80%);
  content: "";
  pointer-events: none;
}

.hero > * {
  position: relative;
}

.hero.compact {
  min-height: 230px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 620px;
  font-size: clamp(2rem, 5vw, 4.7rem);
  font-weight: 900;
  line-height: 1.05;
  text-transform: uppercase;
}

.hero p,
.table-header p,
.empty-state span,
#driverPoints,
.upload-card p {
  color: var(--muted);
}

.hero p {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.78);
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 124px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(255, 210, 0, 0.54);
  border-radius: 6px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.admin-link:hover {
  background: rgba(255, 210, 0, 0.12);
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--navy);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.file-button:hover {
  background: var(--accent-dark);
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.empty-state,
.content {
  margin-top: 22px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 280px;
  gap: 8px;
  text-align: center;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.sheet-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.sheet-tabs button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(0, 214, 137, 0.34);
  border-radius: 6px;
  background: #06107a;
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
}

.sheet-tabs button:hover {
  border-color: var(--green);
  background: #0b1ca8;
}

.sheet-tabs button[aria-selected="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--navy);
  font-weight: 900;
}

.table-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.table-header h2 {
  font-size: 1.45rem;
}

#searchInput {
  width: min(320px, 100%);
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.table-wrap,
.details-table-wrap {
  overflow: auto;
}

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  background: var(--navy);
  color: #ffffff;
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

td:first-child,
td:last-child,
th:first-child,
th:last-child {
  width: 128px;
  text-align: right;
}

td:nth-child(2),
th:nth-child(2) {
  min-width: 220px;
}

tbody tr {
  background: var(--panel);
}

tbody tr:nth-child(even) {
  background: var(--row);
}

.driver-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #06107a;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.driver-button:hover {
  color: #008f68;
  text-decoration: underline;
}

dialog {
  width: min(760px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(2, 4, 61, 0.72);
}

.details-panel header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.details-panel h3 {
  margin-top: 8px;
  font-size: 1.55rem;
}

.rank-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff6bf;
  color: #2a2500;
  font-size: 0.85rem;
  font-weight: 700;
}

#closeDialog {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}

.auth-panel,
.upload-panel {
  margin-top: 22px;
}

.auth-form,
.upload-card,
.upload-result {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-form {
  max-width: 520px;
}

.auth-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

.auth-row,
.action-row {
  display: flex;
  gap: 10px;
}

.auth-row input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.auth-row button,
.action-row button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--navy);
  cursor: pointer;
  font-weight: 800;
}

.auth-row button:hover,
.action-row button:hover {
  background: var(--accent-dark);
}

.form-message {
  min-height: 20px;
  margin-top: 10px;
  color: #9b1414;
  font-weight: 700;
}

.upload-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.upload-card h2,
.upload-result h2 {
  margin: 0 0 8px;
}

.upload-result {
  margin-top: 16px;
}

.action-row {
  margin-top: 18px;
  flex-wrap: wrap;
}

.details-table-wrap {
  max-height: min(58vh, 520px);
}

.site-footer {
  margin-top: 18px;
  padding: 16px 4px 4px;
  color: #394057;
  font-size: 0.9rem;
}

.details-table-wrap td:first-child,
.details-table-wrap th:first-child {
  width: auto;
  text-align: left;
}

.details-table-wrap td:nth-child(2),
.details-table-wrap th:nth-child(2),
.details-table-wrap td:nth-child(3),
.details-table-wrap th:nth-child(3) {
  width: 132px;
  text-align: right;
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 16px 0;
  }

  .hero,
  .table-header,
  .upload-card,
  .auth-row {
    align-items: stretch;
    flex-direction: column;
  }

  .file-button,
  #searchInput,
  .admin-link,
  .auth-row button {
    width: 100%;
  }

  th,
  td {
    padding: 12px 10px;
  }
}
