:root {
  --asphalt: #0b0c0f;
  --pit: #14161c;
  --kerb-red: #e10600;
  --kerb-yellow: #f0c400;
  --paper: #f3efe6;
  --muted: #9a9386;
  --line: rgba(243, 239, 230, 0.12);
  --ok: #7dce7d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--asphalt);
  color: var(--paper);
  font-family: "Noto Sans TC", sans-serif;
}

body {
  min-height: 100vh;
  background-image:
    linear-gradient(180deg, rgba(225, 6, 0, 0.08), transparent 28%),
    repeating-linear-gradient(
      90deg,
      transparent 0 18px,
      rgba(255, 255, 255, 0.015) 18px 19px
    );
}

h1,
h2,
.logo-mark,
.eyebrow,
.btn {
  font-family: "Barlow Condensed", "Noto Sans TC", sans-serif;
  letter-spacing: 0.04em;
}

h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(2.4rem, 8vw, 5.4rem);
  line-height: 0.9;
  text-transform: uppercase;
}

h2 {
  margin: 0 0 0.6rem;
  font-size: 1.5rem;
  text-transform: uppercase;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--kerb-red);
  font-weight: 800;
}

.logo-text {
  display: flex;
  flex-direction: column;
  font-weight: 700;
}

.logo-text small {
  color: var(--muted);
  font-weight: 400;
}

.nav {
  display: flex;
  gap: 0.4rem;
}

.nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  font: inherit;
}

.nav button.is-active,
.nav button:hover {
  color: var(--paper);
  box-shadow: inset 0 -2px 0 var(--kerb-red);
}

.page {
  display: none;
  padding: 1.5rem 1.25rem 3rem;
  max-width: 1100px;
  margin: 0 auto;
}

.page.is-visible {
  display: block;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--kerb-red);
  text-transform: uppercase;
  font-weight: 700;
}

.lede {
  max-width: 36rem;
  margin: 0.75rem 0 1.4rem;
  color: var(--paper);
  font-family: "Barlow Condensed", "Noto Sans TC", sans-serif;
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  word-spacing: 0.16em;
  line-height: 1.35;
}

#home.page {
  max-width: none;
  padding: 0 0 3rem;
}

.hero {
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 5.5rem clamp(1.25rem, 6vw, 5rem) 3.2rem;
  background-image:
    linear-gradient(90deg, rgba(11, 12, 15, 0.58) 0%, rgba(11, 12, 15, 0.18) 40%, rgba(11, 12, 15, 0.05) 100%),
    linear-gradient(180deg, rgba(11, 12, 15, 0.12) 0%, rgba(11, 12, 15, 0.38) 100%),
    url("images/hero-rig-club.jpg");
  background-size: cover;
  background-position: center 40%;
}

.hero h1,
.hero .lede {
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.55);
}

.rig-board {
  max-width: 1100px;
  margin: 1.75rem auto 0;
  padding: 0 1.25rem;
}

.hero-actions,
.lap-form,
.form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  border: 0;
  cursor: pointer;
  padding: 0.75rem 1.1rem;
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
}

.btn-primary {
  background: var(--kerb-red);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--line);
}

.btn:hover {
  filter: brightness(1.08);
}

.booking-layout,
.driver-layout,
.plans,
.rig-status {
  display: grid;
  gap: 1rem;
}

.booking-layout,
.driver-layout {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.rig-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.rig-board-copy h2 {
  margin-bottom: 0.2rem;
}

.rig-board-copy p:last-child {
  margin-top: 0.2rem;
}

.live-tag {
  color: var(--kerb-red);
  text-transform: none;
}

.f1-clock {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.f1-clock-face {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #fffdf6 0 68%, #e8e2d2 100%);
  border: 3px solid #c5a35a;
  box-shadow: 0 0 0 2px #111, inset 0 0 0 2px #111;
}

.f1-clock-brand {
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #006039;
  font-family: Cinzel, serif;
  font-size: 0.52rem;
  letter-spacing: 0.16em;
  z-index: 1;
}

.f1-crown {
  width: 11px;
  height: 8px;
  margin-bottom: 1px;
  background: #006039;
  clip-path: polygon(50% 0, 68% 32%, 100% 28%, 78% 55%, 86% 100%, 50% 72%, 14% 100%, 22% 55%, 0 28%, 32% 32%);
}

.f1-clock-marks span {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 2px;
  height: 7px;
  margin-left: -1px;
  background: #111;
  transform-origin: 50% 39px;
  transform: rotate(calc(var(--i) * 30deg));
}

.f1-clock-marks span:nth-child(3n) {
  height: 9px;
  width: 2.5px;
}

.f1-hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  transform-origin: 50% 100%;
  border-radius: 2px;
  z-index: 2;
}

.f1-hand-hour {
  width: 4px;
  height: 26px;
  margin-left: -2px;
  background: #111;
}

.f1-hand-minute {
  width: 3px;
  height: 34px;
  margin-left: -1.5px;
  background: #222;
}

.f1-hand-second {
  width: 2px;
  height: 36px;
  margin-left: -1px;
  background: #006039;
}

.f1-clock-cap {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: #006039;
  z-index: 3;
}

.f1-clock-digital {
  display: flex;
  flex-direction: column;
  min-width: 92px;
}

.f1-clock-digital span {
  color: #c5a35a;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
}

.f1-clock-digital strong {
  color: #f3efe6;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.55rem;
  letter-spacing: 0.06em;
  line-height: 1;
}

.rig-status {
  grid-template-columns: repeat(4, 1fr);
}

.rig-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-height: 108px;
  padding: 0.75rem;
  text-align: left;
  color: inherit;
  background: var(--pit);
  border: 1px solid var(--line);
  cursor: pointer;
  font: inherit;
}

.rig-card strong {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.06em;
}

.rig-card .status {
  font-size: 0.92rem;
  font-weight: 700;
}

.rig-card.is-idle {
  border-color: rgba(125, 206, 125, 0.45);
}

.rig-card.is-idle .status {
  color: var(--ok);
}

.rig-card.is-busy {
  border-color: rgba(240, 196, 0, 0.5);
}

.rig-card.is-busy .status {
  color: var(--kerb-yellow);
}

.rig-card.is-maint {
  opacity: 0.45;
  cursor: not-allowed;
}

.rig-card.is-maint .status {
  color: var(--muted);
}

.plans {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.panel {
  background: var(--pit);
  border: 1px solid var(--line);
  padding: 1.1rem;
}

.plan {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
  color: inherit;
  background: var(--pit);
  border: 1px solid var(--line);
  padding: 1.1rem;
  cursor: pointer;
}

.plan.is-current {
  border-color: var(--kerb-red);
}

.plan-price {
  font-size: 2rem;
  font-family: "Barlow Condensed", sans-serif;
  margin: 0;
  color: var(--paper);
}

.plan small {
  color: var(--muted);
}

.page-head {
  margin-bottom: 1.4rem;
}

.form label,
.lap-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

input,
select {
  width: 100%;
  background: #0b0c0f;
  color: var(--paper);
  border: 1px solid var(--line);
  padding: 0.7rem;
  font: inherit;
}

.form-hint {
  margin: 0;
  width: 100%;
}

.sim-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.sim {
  min-height: 72px;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  font: inherit;
  text-align: left;
  padding: 0.7rem;
}

.sim.is-selected {
  border-style: solid;
  border-color: var(--kerb-red);
  background: rgba(225, 6, 0, 0.12);
}

.sim.is-taken {
  opacity: 0.4;
  cursor: not-allowed;
}

.message {
  min-height: 1.4em;
  margin: 0;
  width: 100%;
}

.message.is-ok {
  color: var(--ok);
}

.message.is-err {
  color: #ff8a80;
}

.booking-list,
.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
}

.booking-list li,
.leaderboard li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.leaderboard-panel {
  margin-top: 1rem;
}

.footer {
  padding: 1rem 1.25rem 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (min-width: 800px) {
  .sim-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 720px) {
  .rig-board-head {
    align-items: flex-start;
  }

  .f1-clock-face {
    width: 76px;
    height: 76px;
  }

  .f1-clock-marks span {
    transform-origin: 50% 31px;
  }

  .f1-hand-hour {
    height: 18px;
  }

  .f1-hand-minute {
    height: 26px;
  }

  .f1-hand-second {
    height: 28px;
  }
}
