:root {
  color-scheme: dark;
  font-family:
    Arial,
    Helvetica,
    sans-serif;
  color: #ffffff;
  background: #050505;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--page-surface);
}

.detail {
  min-height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), var(--page-surface) 92%),
    var(--page-surface);
}

.detail__nav {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px clamp(20px, 5vw, 76px);
}

.detail__back,
.detail__season {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}

.detail__back {
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.detail__back:hover,
.detail__back:focus-visible {
  color: #ffffff;
  border-color: var(--accent);
  outline: none;
}

.detail__visual {
  position: relative;
  display: grid;
  min-height: min(76dvh, 880px);
  overflow: hidden;
  background: var(--image-surface);
}

.detail__visual::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 26%, transparent 62%, var(--page-surface) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.26), transparent 30%, transparent 70%, rgba(0, 0, 0, 0.16));
}

.detail__visual img {
  width: 100%;
  height: 100%;
  min-height: min(76dvh, 880px);
  object-fit: contain;
}

/* ── Danmaku / Bullet Comments ── */

.detail__danmaku {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}

.detail__danmaku-item {
  --danmaku-duration: 8s;
  position: absolute;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  animation: danmaku-scroll var(--danmaku-duration) linear forwards;
  will-change: transform;
  pointer-events: auto;
}

.detail__danmaku-item:hover {
  animation-play-state: paused;
}

@keyframes danmaku-scroll {
  from {
    transform: translateX(100vw);
  }
  to {
    transform: translateX(-100%);
  }
}

/* 弹幕颜色变体（随机交替） */
.detail__danmaku-item:nth-child(3n) {
  color: var(--accent);
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.58);
}

.detail__danmaku-item:nth-child(5n + 2) {
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.38);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ── Danmaku Sender ── */

.danmaku-sender {
  position: absolute;
  right: clamp(20px, 5vw, 76px);
  bottom: clamp(28px, 5vw, 72px);
  z-index: 5;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

/* Global floating sender — fixed to viewport */
.global-sender {
  position: fixed;
  z-index: 9999;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.global-sender:active {
  cursor: grabbing;
}

.danmaku-sender:active {
  cursor: grabbing;
}

.danmaku-sender--dragging {
  cursor: grabbing;
  opacity: 0.92;
}

.danmaku-sender__form {
  display: flex;
  align-items: center;
  height: 44px;
  width: 44px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  transition:
    width 380ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
    border-color 300ms ease,
    box-shadow 300ms ease;
  overflow: hidden;
}

.danmaku-sender__form:hover,
.danmaku-sender__form:focus-within {
  width: 272px;
  border-color: var(--accent);
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.45);
}

.danmaku-sender__trigger {
  order: -1;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 900;
  color: #ffffff;
  cursor: pointer;
  user-select: none;
  letter-spacing: 0.06em;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.danmaku-sender__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 0.78rem;
  padding: 0 4px;
  outline: none;
  font-family: inherit;
  caret-color: var(--accent);
}

.danmaku-sender__input::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.74rem;
}

.danmaku-sender__submit {
  flex-shrink: 0;
  height: 30px;
  padding: 0 14px;
  margin-right: 7px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateX(8px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
  pointer-events: none;
}

.danmaku-sender__form:hover .danmaku-sender__submit,
.danmaku-sender__form:focus-within .danmaku-sender__submit {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* 用户发送的弹幕特殊样式 */
.detail__danmaku-item--user {
  color: #ffffff !important;
  background: rgba(0, 0, 0, 0.68) !important;
  border-color: var(--accent) !important;
  font-weight: 800 !important;
}

/* Own danmaku — dashed border + "我" tag */
.detail__danmaku-item--own {
  border-style: dashed !important;
  border-color: #f0a028 !important;
  background: rgba(30, 20, 5, 0.72) !important;
}

.detail__danmaku-item--own::after {
  content: "· 我";
  margin-left: 6px;
  font-size: 0.58rem;
  color: #f0a028;
  opacity: 0.8;
}

/* Delete hint — inside the danmaku, left of text, visible on hover */
.danmaku-delete-hint {
  display: none;
  margin-right: 4px;
  background: #e13a3f;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.55rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  vertical-align: middle;
  line-height: 1.5;
}

.detail__danmaku-item--own:hover .danmaku-delete-hint {
  display: inline;
}

.detail__title {
  position: absolute;
  right: clamp(20px, 5vw, 76px);
  bottom: clamp(28px, 5vw, 72px);
  left: clamp(20px, 5vw, 76px);
  z-index: 2;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
}

.detail__eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.detail h1 {
  margin: 0;
  font-size: clamp(4.5rem, 12vw, 12rem);
  line-height: 0.76;
  letter-spacing: 0;
}

.detail__index {
  color: rgba(255, 255, 255, 0.54);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

/* ── Information Section ── */

.detail__information {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(68px, 8vw, 128px) 0 clamp(88px, 10vw, 160px);
}

.detail__information h2 {
  max-width: 18ch;
  margin: 0 0 clamp(24px, 3vw, 40px);
  font-size: clamp(2.5rem, 5.2vw, 6rem);
  line-height: 0.94;
  letter-spacing: 0;
  text-transform: uppercase;
}

.detail__overview {
  max-width: 56rem;
  margin-bottom: clamp(48px, 6vw, 80px);
  color: rgba(255, 255, 255, 0.68);
  font-size: clamp(1rem, 1.2vw, 1.12rem);
  line-height: 1.82;
  border-left: 3px solid var(--accent);
  padding-left: clamp(20px, 3vw, 32px);
}

/* ── Facts Grid Layout ── */

.detail__specs {
  display: flex;
  flex-direction: column;
  gap: clamp(48px, 5vw, 72px);
}

.detail__spec-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail__spec-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.detail__spec-label::before {
  content: "";
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--accent);
  opacity: 0.7;
}

.detail__facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
}

.detail__fact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: clamp(16px, 2vw, 22px) clamp(16px, 2vw, 24px);
  background: var(--page-surface);
  transition: background 200ms ease;
}

.detail__fact:hover {
  background: color-mix(in srgb, var(--accent) 6%, var(--page-surface));
}

.detail__fact span {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.3;
}

.detail__fact strong {
  font-size: 0.84rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.45;
  word-break: break-word;
}

/* ── Brand colour variables ── */

.detail--ferrari {
  --accent: #f0474b;
  --image-surface: #42070c;
  --page-surface: #170305;
}

.detail--mercedes {
  --accent: #5edbd1;
  --image-surface: #071a1b;
  --page-surface: #030d0e;
}

.detail--redbull {
  --accent: #4c78df;
  --image-surface: #090d18;
  --page-surface: #03050b;
}

.detail--alpine {
  --accent: #ef78d6;
  --image-surface: #24113a;
  --page-surface: #0d0715;
}

.detail--racing-bulls {
  --accent: #b9a7f3;
  --image-surface: #17162e;
  --page-surface: #090814;
}

.detail--cadillac {
  --accent: #d7e2e8;
  --image-surface: #172128;
  --page-surface: #080c0f;
}

.detail--haas {
  --accent: #f15d59;
  --image-surface: #401112;
  --page-surface: #160606;
}

.detail--audi {
  --accent: #f23a30;
  --image-surface: #260706;
  --page-surface: #0d0303;
}

.detail--williams {
  --accent: #4aa8f4;
  --image-surface: #071e3b;
  --page-surface: #030b16;
}

.detail--mclaren {
  --accent: #ff8a1f;
  --image-surface: #3a1703;
  --page-surface: #130801;
}

.detail--aston {
  --accent: #49c5a4;
  --image-surface: #073027;
  --page-surface: #02110e;
}

/* ── Responsive ── */

@media (max-width: 1024px) {
  .detail__facts {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail__information h2 {
    font-size: clamp(2.2rem, 7vw, 4rem);
  }
}

@media (max-width: 760px) {
  .detail__nav {
    padding-top: 20px;
  }

  .detail__visual,
  .detail__visual img {
    min-height: 66dvh;
  }

  .detail__title {
    align-items: start;
    flex-direction: column;
    gap: 20px;
  }

  .detail h1 {
    font-size: clamp(4rem, 24vw, 7rem);
  }

  .detail__information h2 {
    font-size: clamp(2rem, 9vw, 3.6rem);
    margin-bottom: 20px;
  }

  .detail__overview {
    font-size: 0.96rem;
    margin-bottom: 40px;
    padding-left: 18px;
  }

  .detail__facts {
    grid-template-columns: 1fr;
  }

  .detail__fact {
    padding: 14px 16px;
  }

  .detail__specs {
    gap: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .detail__fact {
    transition: none;
  }
}
