/* ==========================================================
   MT2027 — M.TOURNAMENT 2027
   Homepage shell · hero / countdown / match center
   ========================================================== */

:root {
  --red: #c82016;
  --red-deep: #8c0f0a;
  --green: #177e32;
  --gold: #c8961e;
  --ink: #0c0b09;
  --ink-2: #1c1a17;
  --muted: #6f6a62;
  --muted-2: #928c82;
  --paper: #f7f5f0;
  --paper-2: #efeae0;
  --line: #ded8cb;
  --line-2: #e9e4d9;
  --white: #ffffff;

  /* 轮次色标（表格 / 时间轴 / 标签页共用） */
  --r1: #c82016;
  --r2: #7e0f0c;
  --r3: #14120f;
  --r4: #177e32;
  --r5: #c8961e;

  --display: "Barlow Condensed", "Oswald", "Arial Narrow", "Helvetica Neue", Arial,
    "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --sans: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei",
    "Hiragino Sans GB", Arial, sans-serif;

  --max: 1220px;
  --pad: clamp(20px, 4vw, 56px);
  --topbar-h: 64px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

::selection { background: var(--red); color: #fff; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* ---------- scroll progress ---------- */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 120;
  background: transparent; pointer-events: none;
}
.progress span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--red), #e8563f);
  transition: width 0.1s linear;
}

/* ==========================================================
   TOPBAR
   ========================================================== */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  background: rgba(247, 245, 240, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.topbar.is-stuck {
  border-bottom-color: var(--line);
  background: rgba(247, 245, 240, 0.94);
}
.topbar__inner {
  max-width: var(--max); margin-inline: auto;
  min-height: var(--topbar-h);
  padding: 12px var(--pad);
  display: flex; align-items: center; gap: 28px;
}

.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand__mark { width: 28px; height: auto; }
.brand__text { display: flex; align-items: baseline; gap: 8px; line-height: 1; }
.brand__en {
  font-family: var(--display); font-size: 12px; letter-spacing: 0.24em;
  font-weight: 700; color: var(--ink);
}
.brand__num {
  font-family: var(--display); font-size: 19px; font-weight: 800;
  letter-spacing: 0.04em; font-variant-numeric: tabular-nums;
}

.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a {
  position: relative; padding: 8px 12px; font-size: 13.5px; font-weight: 500;
  color: var(--muted); border-radius: 2px; white-space: nowrap;
  transition: color 0.25s var(--ease);
}
.nav a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px;
  height: 2px; background: var(--red); transform: scaleX(0); transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { transform: scaleX(1); }
.nav a.is-active { color: var(--ink); font-weight: 700; }
.nav a.is-active::after { transform: scaleX(1); }

.topbar__actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px; font-size: 14px; font-weight: 600; letter-spacing: 0.02em;
  border: 1px solid transparent; border-radius: 2px;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease),
    color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.btn--sm { padding: 9px 15px; font-size: 12.5px; }
.btn--ghost { border-color: var(--line); color: var(--ink); background: rgba(255, 255, 255, 0.6); }
.btn--ghost:hover { border-color: var(--ink); }

.menu-btn {
  display: none; width: 38px; height: 34px; position: relative;
  border: 1px solid var(--line);
}
.menu-btn span {
  position: absolute; left: 9px; right: 9px; height: 1.6px; background: var(--ink);
  transition: transform 0.3s var(--ease), opacity 0.2s;
}
.menu-btn span:nth-child(1) { top: 11px; }
.menu-btn span:nth-child(2) { top: 17px; }
.menu-btn span:nth-child(3) { top: 23px; }
.menu-btn.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-btn.is-open span:nth-child(2) { opacity: 0; }
.menu-btn.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ==========================================================
   HERO — 居中大 logo + 倒计时
   ========================================================== */
.hero {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--topbar-h) + clamp(48px, 9vh, 96px)) var(--pad) clamp(96px, 14vh, 140px);
  overflow: hidden;
  background:
    radial-gradient(88% 62% at 50% 14%, #ffffff 0%, rgba(255, 255, 255, 0) 64%),
    linear-gradient(180deg, #fbf9f5 0%, var(--paper) 56%, var(--paper) 100%);
}

.hero__grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(to right, rgba(12, 11, 9, 0.042) 1px, transparent 1px);
  background-size: 25% 100%;
  mask-image: radial-gradient(120% 90% at 50% 40%, #000 0%, transparent 82%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 40%, #000 0%, transparent 82%);
}

.hero__glow {
  position: absolute; left: 50%; top: 46%; translate: -50% -50%;
  width: min(980px, 118vw); aspect-ratio: 1 / 1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(200, 32, 22, 0.055), rgba(200, 32, 22, 0) 72%);
}

.hero__inner {
  position: relative; z-index: 1;
  width: 100%; max-width: clamp(360px, 47vw, 720px);
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(30px, 5.4vh, 58px);
}

.hero__brand { margin: 0; display: flex; justify-content: center; width: 100%; }

.hero__logo {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 26px 42px rgba(12, 11, 9, 0.1));
  animation: brandIn 1s var(--ease) both;
}
@keyframes brandIn {
  from { opacity: 0; transform: translateY(16px) scale(0.986); }
  to { opacity: 1; transform: none; }
}

/* ---------- countdown (black box) ---------- */
.timer {
  position: relative;
  width: 100%;
  padding: clamp(20px, 3.2vw, 30px) clamp(20px, 3.6vw, 36px) clamp(16px, 2.4vw, 24px);
  background: var(--ink);
  color: #fff;
  overflow: hidden;
  box-shadow: 0 34px 64px -46px rgba(12, 11, 9, 0.92);
  animation: timerIn 1s var(--ease) 0.14s both;
}
@keyframes timerIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
.timer::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--red) 0 40%, var(--green) 40% 50%, rgba(255, 255, 255, 0.16) 50% 100%);
}
.timer::after {
  content: ""; position: absolute; right: -56px; top: -56px;
  width: 168px; height: 168px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.09); pointer-events: none;
}

.timer__label {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 clamp(12px, 1.8vw, 18px);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.26em;
  color: rgba(255, 255, 255, 0.5);
}
.timer__dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--red);
  box-shadow: 0 0 0 0 rgba(200, 32, 22, 0.5);
  animation: pulse 2.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(200, 32, 22, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(200, 32, 22, 0); }
  100% { box-shadow: 0 0 0 0 rgba(200, 32, 22, 0); }
}

.timer__clock {
  display: grid; grid-template-columns: repeat(4, 1fr);
  align-items: end;
}
.timer__unit {
  display: flex; align-items: baseline; gap: 4px;
  padding-left: clamp(6px, 1.2vw, 14px);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}
.timer__unit:first-child { padding-left: 0; border-left: 0; }
.timer__unit b {
  font-family: var(--display);
  font-size: clamp(30px, 4.4vw, 50px);
  font-weight: 800; line-height: 1;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}
.timer__unit i {
  font-style: normal;
  font-size: clamp(9px, 1vw, 11px);
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.04em;
}

.timer__sub {
  margin: clamp(14px, 1.8vw, 20px) 0 0;
  padding-top: clamp(11px, 1.4vw, 14px);
  border-top: 1px dashed rgba(255, 255, 255, 0.14);
  font-size: 11.5px; letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.42);
  font-variant-numeric: tabular-nums;
}

.timer[data-state="live"] .timer__label { color: rgba(255, 255, 255, 0.66); }
.timer[data-state="live"] .timer__dot { background: var(--green); animation: none; box-shadow: 0 0 0 3px rgba(23, 126, 50, 0.28); }

/* ---------- scroll cue ---------- */
.hero__cue {
  position: absolute; left: 50%; bottom: clamp(20px, 4vh, 34px); translate: -50% 0;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 10px; letter-spacing: 0.24em; color: var(--muted-2);
  transition: color 0.25s var(--ease);
}
.hero__cue:hover { color: var(--ink); }
.hero__cue-line {
  position: relative; width: 1px; height: 40px; overflow: hidden;
  background: linear-gradient(180deg, transparent 0%, var(--line) 45%, var(--line) 100%);
}
.hero__cue-line::after {
  content: ""; position: absolute; left: 0; top: 0;
  width: 100%; height: 42%;
  background: linear-gradient(180deg, transparent, var(--red));
  animation: cueRun 2.2s var(--ease) infinite;
}
@keyframes cueRun {
  0% { transform: translateY(-110%); }
  60%, 100% { transform: translateY(240%); }
}

/* ==========================================================
   MATCH CENTER
   ========================================================== */
.match {
  position: relative;
  padding: clamp(52px, 7vw, 88px) 0 clamp(64px, 9vw, 108px);
  background: var(--paper-2);
  border-top: 1px solid var(--line);
}

.match__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
  padding-bottom: 18px; margin-bottom: clamp(22px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
}
.match__k {
  margin: 0 0 9px; font-size: 10px; font-weight: 700;
  letter-spacing: 0.3em; color: var(--red);
}
.match__t {
  margin: 0; font-family: var(--display);
  font-size: clamp(28px, 3.6vw, 40px); font-weight: 800;
  line-height: 1; letter-spacing: 0.02em;
}
.match__state {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0; padding: 7px 13px;
  border: 1px solid var(--line); background: #fff;
  font-size: 12px; color: var(--muted); letter-spacing: 0.04em;
}
.match__state i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2);
}
.match__state.is-live { border-color: rgba(200, 32, 22, 0.35); color: var(--red-deep); }
.match__state.is-live i { background: var(--red); animation: pulse 2.4s infinite; }

.match__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(14px, 1.8vw, 22px);
}

.board {
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line);
}
.board__head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 13px 18px;
  background: var(--ink); color: #fff;
}
.board__head h3 {
  margin: 0; font-family: var(--display);
  font-size: 15.5px; font-weight: 800; letter-spacing: 0.1em;
}
.board__head em {
  font-style: normal; font-size: 9px; letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.42); font-weight: 600;
}
.board__meta {
  margin-left: auto; font-size: 11px; letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.5); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* seats */
.seats {
  list-style: none; margin: 0; padding: 0; flex: 1;
  display: grid; grid-template-columns: 1fr; gap: 1px;
  background: var(--line-2);
}
.seats li {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px;
  background: #fff;
}
.seat__wind {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 26px; height: 26px;
  background: var(--paper-2); color: var(--muted);
  font-family: var(--display); font-size: 12.5px; font-weight: 800;
  line-height: 1;
}
.seats li.is-dealer .seat__wind { background: var(--red); color: #fff; }
.seat__name {
  font-size: 14px; font-weight: 600; color: var(--muted-2); letter-spacing: 0.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.seats li.is-set .seat__name { color: var(--ink); }
.seat__tag {
  margin-left: auto; font-size: 10px; letter-spacing: 0.12em; color: var(--muted-2);
  white-space: nowrap;
}
.seats li.is-dealer .seat__tag { color: var(--red); }

/* score table */
.board__body { flex: 1; display: flex; }
.scoretbl {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
}
.scoretbl thead th {
  background: #f6f2ea;
  padding: 9px 14px; text-align: left; white-space: nowrap;
  font-size: 10px; letter-spacing: 0.12em; font-weight: 700; color: var(--muted);
}
.scoretbl tbody td {
  padding: 12px 14px; border-top: 1px solid var(--line-2);
  color: var(--muted-2); font-variant-numeric: tabular-nums;
}
.scoretbl tbody tr:first-child td { border-top: 0; }
.scoretbl .ta-r { text-align: right; }
.scoretbl .col-rank {
  width: 54px; font-family: var(--display); font-weight: 800;
  font-size: 14px; color: var(--muted);
}

.board__note {
  margin: 0; padding: 11px 18px;
  border-top: 1px solid var(--line-2);
  font-size: 11px; color: var(--muted-2); letter-spacing: 0.02em;
}

/* ==========================================================
   FOOTER
   ========================================================== */
.footer {
  background: var(--ink); color: rgba(255, 255, 255, 0.7);
  padding: clamp(44px, 6vw, 72px) 0 30px;
}
.footer__top {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 28px; padding-bottom: 26px; border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.footer__brand img { width: 190px; height: auto; opacity: 0.95; }
.footer__brand p {
  margin: 12px 0 0; font-size: 11.5px; letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.35);
}
.footer__nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer__nav a { font-size: 13px; color: rgba(255, 255, 255, 0.55); transition: color 0.2s; }
.footer__nav a:hover { color: #fff; }

.footer__orgs {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 20px;
  padding: 22px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.footer__k { font-size: 10px; letter-spacing: 0.22em; color: rgba(255, 255, 255, 0.3); }
.footer__orgs ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px 18px;
}
.footer__orgs li { font-size: 12.5px; color: rgba(255, 255, 255, 0.62); }
.footer__orgs li::before { content: "/"; color: rgba(255, 255, 255, 0.2); margin-right: 8px; }

.footer__bottom {
  padding-top: 22px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px 24px;
}
.footer__legal { display: flex; flex-direction: column; gap: 2px; }
.footer__bottom p { margin: 0; font-size: 12px; color: rgba(255, 255, 255, 0.45); }
.footer__fine { color: rgba(255, 255, 255, 0.3) !important; }

.footer__doc {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff; font-size: 12px; letter-spacing: 0.08em;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.footer__doc svg { opacity: 0.62; transition: transform 0.25s var(--ease), opacity 0.25s; }
.footer__doc:hover { border-color: rgba(255, 255, 255, 0.65); background: rgba(255, 255, 255, 0.06); }
.footer__doc:hover svg { opacity: 1; transform: translate(1px, -1px); }

/* ==========================================================
   TO TOP / TOAST
   ========================================================== */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--ink); color: #fff; border-radius: 2px;
  opacity: 0; translate: 0 12px; pointer-events: none;
  transition: opacity 0.3s var(--ease), translate 0.3s var(--ease), background 0.2s;
}
.to-top.is-show { opacity: 1; translate: 0 0; pointer-events: auto; }
.to-top:hover { background: var(--red); }

.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 150;
  padding: 11px 18px;
  background: var(--ink); color: #fff;
  font-size: 12.5px; letter-spacing: 0.04em;
  border-radius: 2px;
  box-shadow: 0 20px 40px -24px rgba(0, 0, 0, 0.8);
  opacity: 0; translate: -50% 12px; pointer-events: none;
  transition: opacity 0.28s var(--ease), translate 0.28s var(--ease);
  max-width: calc(100vw - 40px); text-align: center;
}
.toast.is-show { opacity: 1; translate: -50% 0; }
.toast b { color: #fff; }

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 1080px) {
  .match__grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .nav {
    position: fixed; inset: var(--topbar-h) 0 auto 0;
    flex-direction: column; align-items: stretch;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: 8px var(--pad) 22px; gap: 0;
    transform: translateY(-120%); transition: transform 0.4s var(--ease);
    box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.25);
  }
  .nav.is-open { transform: none; }
  .nav a { padding: 13px 4px; border-bottom: 1px solid var(--line-2); font-size: 15px; }
  .nav a::after { display: none; }
  .menu-btn { display: block; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 58px; }
  .brand__mark { width: 24px; }
  .brand__en { font-size: 10.5px; letter-spacing: 0.18em; }
  .brand__num { font-size: 16px; }

  .hero { padding-bottom: clamp(84px, 13vh, 110px); }
  .hero__inner { gap: 30px; max-width: 100%; }

  .timer { padding: 18px 18px 14px; }
  .timer__clock { gap: 2px; }
  .timer__unit { padding-left: 6px; gap: 2px; }
  .timer__unit b { font-size: clamp(26px, 8.4vw, 34px); }
  .timer__unit i { font-size: 9px; }
  .timer__sub { font-size: 10.5px; line-height: 1.6; }

  .seats { grid-template-columns: 1fr; }
  .seats li { padding: 12px 16px; }
  .board__head { padding: 12px 14px; gap: 8px; }
  .board__head em { display: none; }
  .scoretbl thead th, .scoretbl tbody td { padding: 10px 12px; }
  .board__note { padding: 10px 14px; }

  .footer__brand img { width: 155px; }
}

@media (max-height: 700px) and (min-width: 641px) {
  .hero { padding-top: calc(var(--topbar-h) + 40px); padding-bottom: 76px; }
  .hero__inner { gap: 26px; max-width: min(47vw, 520px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
