:root {
  color-scheme: dark;
  --bg: #0b0d11;
  --surface: #12161d;
  --surface-raised: #191f28;
  --surface-hover: #222a35;
  --border: #2b3441;
  --text: #f2f5f8;
  --muted: #9aa6b5;
  --accent: #e11d2e;
  --accent-hover: #ff3445;
  --accent-soft: rgba(225, 29, 46, .14);
  --radius: 12px;
  --shadow: 0 12px 32px rgba(0,0,0,.22);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(ellipse at 85% -10%, rgba(225,29,46,.13), transparent 38%), var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  text-align: left;
}

h1, h2, h3, h4, h5, h6 { margin: 0; color: var(--text); line-height: 1.25; }
h1 { font-size: clamp(1.45rem, 2.4vw, 2rem); letter-spacing: -.035em; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .6rem; }
p { color: var(--muted); }
a, a:link, a:active, a:visited { color: #ff6570; text-decoration: none; transition: color .16s ease; }
a:hover { color: #fff; text-decoration: underline; }
img { max-width: 100%; height: auto; border: 0; }
form { margin: 0; padding: 0; }
label { color: var(--muted); cursor: pointer; }
textarea, input, select, button {
  max-width: 100%;
  font: inherit;
}
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  color: var(--text);
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .58rem .72rem;
  min-height: 40px;
}
textarea { min-width: min(100%, 280px); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}
input.button, input.submit, input.login, input.logout, input.reset, input.cancel, button {
  cursor: pointer;
  border: 1px solid #b71927;
  border-radius: 8px;
  background-color: var(--accent);
  background-image: none;
  color: white;
  padding: .55rem .9rem;
  min-height: 40px;
  font-weight: 700;
  transition: background .16s ease, transform .16s ease;
}
input.button:hover, input.submit:hover, input.login:hover, input.logout:hover, input.reset:hover, input.cancel:hover, button:hover {
  background-color: var(--accent-hover);
  color: white;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* Main responsive shell */
#skel {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 36px) 40px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 22px 26px;
  text-align: left;
}
#head {
  display: block;
  grid-column: 1 / -1;
  position: relative;
  overflow: hidden;
  padding: clamp(22px, 4vw, 38px);
  min-height: 145px;
  border: 1px solid #34303a;
  border-radius: 18px;
  background: linear-gradient(112deg, rgba(225,29,46,.22), transparent 45%), linear-gradient(135deg, #1b2029, #101319 72%);
  box-shadow: var(--shadow);
}
#head::after {
  content: "";
  position: absolute;
  right: -35px;
  top: -70px;
  width: 270px;
  height: 270px;
  border: 34px solid rgba(225,29,46,.12);
  transform: rotate(25deg) skew(-12deg);
  pointer-events: none;
}
#head h3 { position: relative; z-index: 1; margin: 0 0 8px; font-size: clamp(1.5rem, 3.2vw, 2.5rem); font-weight: 900; letter-spacing: -.05em; text-transform: uppercase; }
#head h3 a, #head h3 a:visited { color: #fff; }
#head h3 a:hover { color: #ff6975; text-decoration: none; }
#head .brand-mark { color: var(--accent); }
#head .brand-meta { position: relative; z-index: 1; color: var(--muted); font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; }
#head .brand-status { display: inline-flex; align-items: center; gap: 7px; margin-top: 14px; color: #e3e8ee; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
#head .brand-status::before { content: ""; width: 7px; height: 7px; background: #38d98a; border-radius: 50%; box-shadow: 0 0 12px rgba(56,217,138,.45); }

#nav {
  grid-column: 1;
  align-self: start;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(18,22,29,.92);
}
#nav ul { list-style: none; margin: 0; padding: 0; }
#nav ul li { display: block; width: auto; margin: 2px 0; padding: 0; }
#nav ul li.head { margin: 18px 8px 6px; padding: 0; color: #788494; font-size: .69rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
#nav ul li.head:first-child { margin-top: 3px; }
#nav ul li a { display: block; padding: 9px 11px; border-radius: 8px; color: #cbd3dd; font-size: .91rem; font-weight: 600; }
#nav ul li a:hover, #nav ul li a:focus-visible { color: #fff; background: var(--surface-hover); text-decoration: none; }
#nav ul li a[href*="login"], #nav ul li a[href*="logout"] { color: #ff7780; }

#content {
  grid-column: 2;
  min-width: 0;
  padding: clamp(18px, 2.4vw, 30px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(18,22,29,.88);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
#content h1 { margin-bottom: 1rem; }
#content h2 { color: #e5eaf0; padding-left: 0; margin-top: 1.65rem; }
#content h3 { color: #dce3ec; }
#content .item { min-height: 0; margin-bottom: 18px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-raised); }
#content .item .text, #content .reply_item .text { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
#content .item .movie { float: right; width: min(150px, 35%); padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: #0d1117; text-align: center; }
#login { position: static; width: min(100%, 460px); margin: 20px auto; text-align: left; }
#login table.login { position: static; left: auto; }

/* Tables: retain existing markup while making wide result tables scrollable */
table { max-width: 100%; border-collapse: collapse; border-spacing: 0; color: var(--text); }
#content table { width: auto; margin: .65rem 0 1rem; }
#content td, #content th { padding: 9px 11px; border-bottom: 1px solid var(--border); vertical-align: middle; }
#content th, #content tr.head td { background: #242b35; color: #f6f8fb; font-weight: 800; text-align: left; }
#content tr.odd td { background: #171d25; }
#content tr.even td { background: #11161d; }
#content tr:hover td { background: #202733; }
#content table form { white-space: normal; }
#content table input, #content table select { max-width: 100%; }
.abbr { border-bottom: 1px dotted #a9b4c2; }
.toolbar button { border: 1px solid var(--border); border-radius: 6px; background: var(--surface-raised); color: var(--text); padding: 5px 8px; }
input.search { padding-left: 10px; background-image: none; }
input.user, input.password { padding-left: 10px; background-image: none; }
.small { color: var(--muted); font-size: .8rem; }
#error, #msg { margin: 0 0 18px; padding: 13px 15px; border-radius: 9px; background-image: none; }
#error { border: 1px solid #9f2631; background-color: rgba(225,29,46,.12); color: #ffb4bb; }
#msg { border: 1px solid #315e7a; background-color: rgba(48,132,180,.12); color: #b7e3ff; }

@media (max-width: 820px) {
  #skel { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px 12px 28px; }
  #head { grid-column: 1; min-height: 120px; padding: 22px; }
  #nav { grid-column: 1; padding: 10px; }
  #nav ul { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
  #nav ul li { margin: 0; }
  #nav ul li.head { flex-basis: 100%; margin: 12px 8px 2px; }
  #nav ul li.head:first-child { margin-top: 3px; }
  #nav ul li a { padding: 8px 10px; }
  #content { grid-column: 1; padding: 18px 14px; }
}
@media (max-width: 520px) {
  body { font-size: 14px; }
  #head { border-radius: 12px; }
  #head::after { right: -115px; }
  #content { border-radius: 10px; }
  #content td, #content th { padding: 7px 8px; }
  #content table { font-size: .86rem; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { width: 100%; }
  input.button, input.submit, input.login, input.logout, input.reset, input.cancel { width: auto; }
  #content .item .movie { float: none; width: 100%; margin: 0 0 12px; }
}


/* Individual-driver season selection */
.driver-selection { margin: 12px 0; padding: 18px; background: var(--panel, #171b23); border: 1px solid var(--border, #303744); border-radius: 12px; }
.driver-selection-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:14px; }
.driver-selection-heading h2 { margin:0 0 5px; font-size:1.15rem; }
.driver-selection-heading p { margin:0; color:var(--muted, #a5adba); }
#driver-selected-count { white-space:nowrap; color:#ff5964; }
.driver-selection-tools { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.driver-selection-tools input[type=search] { flex:1 1 220px; min-width:160px; }
.driver-checkbox-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px 12px; }
.driver-checkbox-item { display:flex; align-items:center; gap:9px; min-width:0; padding:10px 12px; border:1px solid var(--border, #303744); border-radius:8px; background:rgba(255,255,255,.025); cursor:pointer; }
.driver-checkbox-item:hover { border-color:#ef4444; background:rgba(239,68,68,.07); }
.driver-checkbox-item input { accent-color:#ef3340; flex:0 0 auto; width:16px; height:16px; }
.driver-checkbox-item span { overflow-wrap:anywhere; }
@media (max-width:900px) { .driver-checkbox-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:560px) { .driver-checkbox-grid { grid-template-columns:1fr; } .driver-selection { padding:12px; } .driver-selection-heading { flex-direction:column; } .driver-selection-tools .button { flex:1 1 auto; } }
