/* 社区首页（gokite.community/）2.7.0：夜色底，粒子山脊动画，Poki 放风筝。设计稿：Codex「顺风奔跑」。
   只给首页用；抽奖中心和单场页仍用 notary.css。动画脚本在 community-scene.js。 */

@font-face { font-family: "DM Sans"; src: url("/assets/dm-sans.woff2") format("woff2"); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: "DM Mono"; src: url("/assets/dm-mono.woff2") format("woff2"); font-weight: 400; font-display: swap; }
/* 品牌副字体 Crimson Text 的 600 斜体，只给大标题里的强调词用（手册：衬线只在少量需要精致对比的地方用） */
@font-face { font-family: "Crimson Text"; src: url("/assets/crimson-text-600i.woff2") format("woff2"); font-weight: 600; font-style: italic; font-display: swap; }

:root {
  --bg: #101011;
  --surface: #18181a;
  --surface-2: #232325;
  --ink: #fef8f0;
  --muted: #b3afa9;
  --rule: #333332;
  --rule-hover: #5a5753;   /* 描边在悬停时亮一档：语言按钮、次按钮 */
  --rule-strong: #6b6863;  /* 比分隔线亮两档：时间线圆点 */
  --accent: #ef936a;
  --accent-soft: #f4ac8c;
  --accent-halo: rgba(239, 147, 106, 0.16);  /* 强调色的淡光圈：时间线上「下一步」的圆点 */
  --status: #c5db90;
  --font: "DM Sans", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Hiragino Sans", "Noto Sans JP", "Apple SD Gothic Neo", "Noto Sans KR", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); color: var(--ink); }
body { margin: 0; background: var(--bg); font-family: var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }
::selection { background: var(--accent); color: var(--bg); }

.page { max-width: 1680px; margin: auto; padding: 0 64px; }
.skip-link { position: fixed; top: -80px; left: 20px; background: var(--ink); color: var(--bg); z-index: 10; padding: 12px; }
.skip-link:focus { top: 12px; }

/* 顶栏 */
.site-header { height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 16px; position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 23px; }
.brand img { width: 99px; height: 40px; display: block; object-fit: contain; }
.brand span { font-size: 16px; letter-spacing: -0.35px; padding-left: 23px; border-left: 1px solid var(--rule); line-height: 24px; }

/* 语言菜单（lang-menu.js 的结构，夜色版外观） */
.lang-menu { position: relative; flex: none; }
.lang-menu-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px 0 11px;
  font: 400 14px/1 var(--font); color: var(--ink); background: transparent;
  border: 1px solid var(--rule); border-radius: 999px; transition: border-color 0.15s ease, background-color 0.15s ease;
}
.lang-menu-btn:hover, .lang-menu-btn[aria-expanded="true"] { border-color: var(--rule-hover); background: var(--surface); }
.lang-menu-globe, .lang-menu-chevron { flex: none; color: var(--muted); }
.lang-menu-chevron { transition: transform 0.15s ease; }
.lang-menu-btn[aria-expanded="true"] .lang-menu-chevron { transform: rotate(180deg); }
.lang-menu-list {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 172px; margin: 0; padding: 5px; list-style: none;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.8);
  transform-origin: top right; animation: lang-menu-in 0.14s ease-out;
}
.lang-menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 40px; padding: 0 10px 0 12px;
  font: 400 15px/1 var(--font); color: var(--ink); text-align: left; background: transparent; border: 0; border-radius: 8px;
}
.lang-menu-item:hover, .lang-menu-item:focus-visible { background: var(--surface-2); }
.lang-menu-item:focus-visible { outline: 2px solid var(--status); outline-offset: -2px; }
.lang-menu-item[aria-checked="true"] { font-weight: 600; }
.lang-menu-check { flex: none; color: var(--status); visibility: hidden; }
.lang-menu-item[aria-checked="true"] .lang-menu-check { visibility: visible; }
.lang-menu [lang|="zh"] { font-family: "DM Sans", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif; }
.lang-menu [lang|="ja"] { font-family: "DM Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif; }
.lang-menu [lang|="ko"] { font-family: "DM Sans", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif; }
@keyframes lang-menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }

/* 首屏：下一场开奖 + 大标题 + 副标题 */
.hero { padding-top: 32px; }
.hero-copy { text-align: center; position: relative; z-index: 1; }
.draw-status { font: 12px var(--mono); display: inline-flex; align-items: center; gap: 10px; min-height: 32px; white-space: nowrap; transition: opacity 0.3s ease; }
.draw-status.is-empty { visibility: hidden; opacity: 0; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--status); flex-shrink: 0; }
.draw-status .arrow { margin-left: 7px; font: 18px var(--font); transition: transform 0.2s; }
.draw-status:hover .arrow { transform: translateX(4px); }
h1 { font-weight: 450; letter-spacing: -0.065em; margin: 23px 0 0; line-height: 1.02; font-size: clamp(48px, 5.9vw, 88px); }
/* 强调词（win）：Crimson Text 真斜体，和 DM Sans 形成「无衬线 + 衬线斜体」的对比。
   DM Sans 只有直体字形，以前的 italic 是浏览器硬斜出来的，字形僵、和后面的词挤在一起 */
h1 em {
  font-family: "Crimson Text", Georgia, serif; font-style: italic; font-weight: 600;
  font-size: 1.17em;      /* Crimson 的小写字母比 DM Sans 矮，放大到 x 高度对齐 */
  line-height: 0.8;       /* 放大后不把这一行撑高 */
  letter-spacing: -0.012em; padding-right: 0.05em; /* 斜体最后一笔往右探，给后面的词留点距离 */
  color: var(--accent-soft);
}
/* 中日韩：字距不能像拉丁字母那样收得那么紧，不用斜体 */
h1 { text-wrap: balance; }
/* 中日韩只在标点和空格处换行，不把「相聚」这样的词拆到两行；万一一段比整行还长才强制断开 */
h1.whole { letter-spacing: -0.02em; line-height: 1.12; word-break: keep-all; overflow-wrap: anywhere; }
/* 中日韩：Crimson 没有这些字形，保持无衬线直体，加粗一点做强调 */
h1.whole em { font-family: inherit; font-style: normal; font-size: 1em; line-height: inherit; font-weight: 620; letter-spacing: inherit; padding: 0; }
.subtitle { font-size: 15px; line-height: 1.65; color: var(--muted); margin: 20px auto 0; letter-spacing: -0.15px; max-width: 34em; }

/* 动画带：粒子山脊在这里，Poki 和风筝画在盖满全屏的 .flight-layer 上 */
.artwork { position: relative; margin: 1px -64px 0; height: 367px; min-width: 0; }
.artwork canvas { display: block; width: 100%; height: 100%; position: relative; z-index: 0; }
.art-tools { position: absolute; bottom: 12px; left: 64px; right: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; pointer-events: none; z-index: 2; }
.art-caption { font: 10px var(--mono); color: var(--muted); letter-spacing: 0.02em; }
.motion-toggle {
  pointer-events: auto; background: var(--bg); border: 0; padding: 10px 0 10px 10px; min-height: 44px;
  font: 10px var(--mono); display: flex; align-items: center; gap: 9px; color: var(--muted);
}
.motion-toggle:hover { color: var(--ink); }
.motion-toggle:disabled { cursor: default; }
.motion-symbol { height: 9px; width: 8px; border-left: 2px solid currentColor; border-right: 2px solid currentColor; }
.motion-toggle[aria-pressed="true"] .motion-symbol { height: 0; width: 0; border: 5px solid transparent; border-left: 7px solid currentColor; border-right: 0; }
.motion-toggle:disabled .motion-symbol { width: 6px; height: 6px; border: 1px solid currentColor; border-radius: 50%; }
.flight-layer { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; }

/* 三个入口 */
.entries { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.entry { position: relative; padding: 25px 32px 26px 0; min-width: 0; }
.entry + .entry { padding-left: 32px; }
.entry + .entry::before { content: ""; position: absolute; left: 0; top: 27px; bottom: 27px; width: 1px; background: var(--rule); }
.entry-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 31px; font-weight: 450; letter-spacing: -1.2px; }
.entry-title svg { flex: none; width: 22px; height: 22px; stroke-width: 1.25; transition: transform 0.25s; }
.entry:hover .entry-title svg { transform: translate(4px, -4px); }
.entry:hover .entry-title { color: var(--accent); }
.entry p { font-size: 13px; line-height: 1.5; color: var(--muted); margin: 9px 0 0; }

/* Events 一格分成线上、线下两个按钮（2.13.0 起；2.14.0 换成 Codex 设计的「拉开中缝」动效）。
   封面和两个链接叠在同一个网格单元里，格子高度取两者较高的，分裂时不撑动版面。
   默认（触屏、手机）直接显示两个按钮；只有能悬停的桌面才平时显示一个 Events，悬停或键盘聚焦时分裂。 */
.entry-split { display: grid; }
.entry-split > .split-face, .entry-split > .split-links { grid-area: 1 / 1; min-width: 0; }
.split-face { display: none; }
.split-links { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--split-gap, 44px); }
.split-link { position: relative; display: block; min-width: 0; }
.split-link .entry-title { font-size: 27px; letter-spacing: -1px; }
/* 整格悬停时不整体变色，只有指着（或键盘聚焦）的那个按钮变色、箭头往右上走 */
.entry-split:hover .entry-title { color: inherit; }
.entry-split:hover .entry-title svg { transform: none; }
.entry-split .split-link:hover .entry-title, .entry-split .split-link:focus-visible .entry-title { color: var(--accent); }
.entry-split .split-link:hover .entry-title svg, .entry-split .split-link:focus-visible .entry-title svg { transform: translate(4px, -4px); }

/* 三个入口并排时：字号、间距按这一格的实际宽度缩放（cqi 是这一格宽度的百分之一），标题不折行 */
@media (min-width: 651px) {
  .entry-split { container: events / inline-size; }
  .split-links { --split-gap: clamp(10px, calc(18cqi - 32px), 44px); }
  .split-link .entry-title { font-size: clamp(20px, 8.5cqi, 27px); gap: clamp(4px, 3cqi, 12px); }
  /* 中日韩字形占满整个字身，同样字号看着比拉丁字母大，标题小一号，也更放得下 */
  :lang(zh) .split-link .entry-title, :lang(ja) .split-link .entry-title, :lang(ko) .split-link .entry-title { font-size: clamp(16px, 7.6cqi, 24px); }
  .split-link .entry-title svg { width: clamp(14px, 6.8cqi, 22px); height: clamp(14px, 6.8cqi, 22px); }
  .split-link > p { font-size: clamp(11px, 4.5cqi, 13px); }
  /* 实在放不下时的兜底：省略号，不折行、不压到旁边的格子 */
  .entry-split p, .entry-split .entry-title > span:first-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  /* 格子变窄后不再对半分，按两边标题的实际长度分：英文 In person 长，日文 オンライン 长，中文一样长。
     副标题不参与分配（contain），只按标题算 */
  @container events (max-width: 320px) {
    .split-links { display: flex; }
    .split-link { flex: 1 1 auto; }
    .split-link > p { contain: inline-size; }
  }
  /* 再窄（平板竖屏、很窄的窗口）：副标题可以折成两行，比省略号好读；这时标题比封面小，格子高度几乎不变 */
  @container events (max-width: 240px) {
    .entry-split .split-link > p { white-space: normal; text-overflow: clip; line-height: 1.35; }
  }
  /* 最窄（不到 190px，700px 左右的窗口）：两个小按钮去掉箭头，把位置留给标题 */
  @container events (max-width: 190px) {
    .split-link .entry-title { gap: 0; }
    .split-link .entry-title svg { display: none; }
  }
  /* 中缝：两个按钮之间那根带铜色光的细线，画在第一个按钮右边、两栏间距的正中 */
  .split-link:first-child::after {
    content: ""; position: absolute; top: 4px; bottom: 4px; left: calc(100% + var(--split-gap) / 2); width: 1px;
    background: linear-gradient(var(--rule), var(--accent) 50%, var(--rule)); pointer-events: none;
  }
}

/* 能悬停的桌面：「拉开中缝」。分裂约 0.37 秒：Events 微微上移淡出，中缝从中间长出来，Online、In person 从中缝两侧往外滑到位；
   合并约 0.36 秒：两边文字先往中缝收拢淡出，中缝收短，Events 再落回原位。
   触发只认悬停和键盘聚焦（:focus-visible）。不用 :focus-within：鼠标点过的链接会一直留着焦点，移开后合并不回去（2.13.0 的问题）。
   两个链接一直在页面里、可以 Tab 到；合并时不接鼠标，分裂后各自整块可点。只移动链接里的文字和图标，链接本身不动。 */
@media (hover: hover) and (min-width: 651px) {
  .entry-split { --split-ease: cubic-bezier(0.25, 1, 0.5, 1); }
  .split-face { display: block; }
  .split-face, .split-links, .split-link { pointer-events: none; }
  .split-link { --split-shift: 12px; }
  .split-link + .split-link { --split-shift: -12px; }
  .split-link .entry-title svg { transition: transform 145ms var(--split-ease); }

  /* 合并状态（鼠标移开后回到这里）：各自的 transition 就是合并的节奏 */
  .entry-split .split-face {
    opacity: 1; transform: translateY(0);
    transition: opacity 185ms linear 155ms, transform 220ms var(--split-ease) 135ms;
  }
  .entry-split .split-link > :where(.entry-title, p) {
    opacity: 0; transform: translateX(var(--split-shift));
    transition: opacity 145ms linear, transform 250ms var(--split-ease), color 125ms linear;
  }
  .entry-split .split-link:first-child::after {
    opacity: 0; transform: scaleY(0.08);
    transition: opacity 175ms linear 55ms, transform 250ms var(--split-ease) 55ms;
  }

  /* 分裂状态 */
  .entry-split:where(:hover, :has(.split-link:focus-visible)) .split-face {
    opacity: 0; transform: translateY(-5px);
    transition: opacity 105ms linear, transform 220ms var(--split-ease);
  }
  .entry-split:where(:hover, :has(.split-link:focus-visible)) .split-link { pointer-events: auto; }
  .entry-split:where(:hover, :has(.split-link:focus-visible)) .split-link > :where(.entry-title, p) {
    opacity: 1; transform: translateX(0);
    transition: opacity 170ms linear 90ms, transform 300ms var(--split-ease) 65ms, color 125ms linear;
  }
  .entry-split:where(:hover, :has(.split-link:focus-visible)) .split-link:first-child::after {
    opacity: 1; transform: scaleY(1);
    transition: opacity 155ms linear 25ms, transform 300ms var(--split-ease) 25ms;
  }
}
/* 手机：三个入口上下排，Events 这一块直接是上下两个按钮 */
@media (max-width: 650px) {
  .entry-split .split-links { grid-template-columns: minmax(0, 1fr); }
  .entry-split .split-link + .split-link { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--rule); }
  .entry-split .split-link .entry-title { font-size: 29px; letter-spacing: -0.9px; }
}

/* 页脚：官方链接 + 防骗提示 */
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 28px; min-height: 80px; border-top: 1px solid var(--rule); }
.socials { display: flex; align-items: center; column-gap: 14px; flex-wrap: wrap; font-size: 12px; }
.socials a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 24px; }
.socials i { font-style: normal; opacity: 0.4; }
.socials a:hover { text-decoration: underline; text-underline-offset: 4px; }
.safety { font-size: 11px; line-height: 1.6; color: var(--muted); margin: 0; text-align: right; }

@media (min-height: 960px) and (min-width: 901px) {
  .page { padding-top: 14px; }
  .site-header { height: 120px; }
  .hero { padding-top: 45px; }
  .artwork { height: 410px; }
}
@media (max-width: 1000px) {
  .page { padding: 0 36px; }
  .brand { gap: 17px; }
  .brand span { padding-left: 17px; }
  h1 { font-size: 6.05vw; }
  .artwork { margin-left: -36px; margin-right: -36px; height: 350px; }
  .art-tools { left: 36px; right: 36px; }
  .entry { padding-right: 20px; }
  .entry + .entry { padding-left: 20px; }
  .entry-title { font-size: 28px; }
  .site-footer { gap: 20px; }
  .socials { column-gap: 9px; }
  .safety { max-width: 310px; }
}
@media (max-width: 650px) {
  .page { padding: 0 24px; }
  .site-header { height: 88px; }
  .brand { gap: 13px; }
  .brand img { width: 80px; height: 34px; }
  .brand span { font-size: 13px; padding-left: 13px; }
  .lang-menu-btn { font-size: 13px; padding: 0 10px 0 9px; gap: 6px; }
  .hero { padding-top: 26px; }
  .hero-copy { text-align: left; }
  .draw-status { font-size: 10px; gap: 8px; }
  h1 { font-size: 51px; max-width: 340px; line-height: 1.05; margin-top: 24px; letter-spacing: -3px; }
  h1.whole { font-size: 40px; letter-spacing: -0.02em; line-height: 1.15; }
  .subtitle { font-size: 14px; max-width: 300px; margin: 19px 0 0; }
  .artwork { height: 306px; margin: 3px -24px 0; }
  .art-tools { left: 24px; right: 24px; bottom: 0; }
  .art-caption { font-size: 9px; }
  .motion-toggle { font-size: 9px; }
  .entries { display: block; margin-top: 9px; }
  .entry, .entry + .entry { display: block; padding: 21px 0; border-bottom: 1px solid var(--rule); }
  .entry:last-child { border-bottom: 0; }
  .entry + .entry::before { display: none; }
  .entry-title { font-size: 29px; letter-spacing: -0.9px; }
  .entry-title svg { width: 23px; height: 23px; }
  .entry p { font-size: 12px; margin-top: 5px; }
  .site-footer { display: block; padding: 18px 0 27px; min-height: 116px; }
  .socials { column-gap: 11px; }
  .safety { text-align: left; font-size: 11px; max-width: 320px; margin-top: 10px; }
}
/* 很窄的手机（320 到 400）：顶栏的品牌和语言按钮要放得下 */
@media (max-width: 400px) {
  .page { padding: 0 20px; }
  .brand { gap: 10px; }
  .brand img { width: 68px; height: 29px; }
  .brand span { font-size: 12px; padding-left: 10px; }
  .lang-menu-btn { padding: 0 9px 0 8px; gap: 5px; }
  .artwork { margin-left: -20px; margin-right: -20px; }
  .art-tools { left: 20px; right: 20px; }
  h1 { font-size: 46px; }
  h1.whole { font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
