/* 双人节拍 2.0 设计令牌与层序声明。 */
@layer tokens, legacy, base, shell, home, hall, room, lite;

@property --field-c1 { syntax: '<color>'; inherits: true; initial-value: #4f1738; }
@property --field-c2 { syntax: '<color>'; inherits: true; initial-value: #1c0c19; }
@property --field-c3 { syntax: '<color>'; inherits: true; initial-value: #130810; }
@property --field-a { syntax: '<color>'; inherits: true; initial-value: #7e2257; }
@property --field-b { syntax: '<color>'; inherits: true; initial-value: #3e2574; }

@layer tokens {
  :root {
    color-scheme: dark;
    /* 深梅紫夜色基底，不用纯黑 */
    --ink-0: #130810;
    --ink-1: #1c0c19;
    --ink-2: #281224;
    --ink-3: #361931;
    --panel-solid: #240f20;
    --panel-strong: #2e1329;
    --panel-elev: #351630;
    --veil: #ffffff0c;
    --veil-2: #ffffff16;
    --hair: #ffffff14;
    --hair-2: #ffffff24;

    /* 兼容旧样式变量的统一映射 */
    --bg: var(--ink-0);
    --panel: var(--panel-solid);
    --border: #4a2843;
    --text: #fbeef3;
    --soft: #e8cdd9;
    --dim: #b495a4;
    --muted: var(--soft);
    --subtle: var(--dim);

    /* 语义热感色：继续=玫红，慢=暖杏，停=冷紫，准许=柔金，安全暂停=素白 */
    --go: #ff5a93;
    --slow: #ffa66e;
    --stop: #a99bff;
    --grant: #f4d284;
    --safe: #e6e0ea;
    --danger: #ff7a82;

    --gold: #ff8fb1;
    --gold-2: #ffc8da;
    --gold-ink: #2c0817;
    --purple: var(--stop);
    --mint: #89e0d3;
    --pink: var(--gold);

    --rose-grad: linear-gradient(135deg, #ffc4d7 0%, #ff7ea8 50%, #e45288 100%);
    --lead-grad: linear-gradient(135deg, #ffecd6 0%, #ffbe8a 52%, #ef9064 100%);
    --either-grad: linear-gradient(135deg, #ffd4e5 0%, #ff99be 44%, #b594ff 100%);
    --grant-grad: linear-gradient(135deg, #fff1cf 0%, #f4d284 55%, #dba54d 100%);

    /* 动效曲线（带回退） */
    --spring: cubic-bezier(.34, 1.38, .5, 1);
    --out: cubic-bezier(.2, .8, .2, 1);

    /* 排版与圆角 */
    --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif SC", Georgia, "Times New Roman", serif;
    --hand: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", var(--serif);
    --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;

    --r-1: 12px;
    --r-2: 18px;
    --r-3: 24px;
    --r-pill: 999px;
    --nav-h: 64px;
    --header-h: 60px;

    font-family: var(--sans);
    font-synthesis: none;
    -webkit-font-smoothing: antialiased;
    background: var(--ink-0);
    color: var(--text);
  }

  @supports (transition-timing-function: linear(0, 1)) {
    :root {
      --spring: linear(0, .006, .025 2.8%, .101 6.1%, .539 18.9%, .721 25.3%, .849 31.5%, .937 38.1%, .968 41.8%, .991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001);
    }
  }

  /* 7 语种专属排版调优 */
  :lang(zh-Hant) {
    --serif: "Songti TC", "PMingLiU", "Noto Serif CJK TC", "Source Han Serif TC", Georgia, serif;
    --sans: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK TC", system-ui, sans-serif;
  }
  :lang(ja) {
    --serif: "Hiragino Mincho ProN", "YuMincho", "Noto Serif CJK JP", "Source Han Serif JP", serif;
    --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP", system-ui, sans-serif;
    line-break: strict;
  }
  :lang(ko) {
    --serif: "AppleMyungjo", "Batang", "Noto Serif CJK KR", serif;
    --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", system-ui, sans-serif;
    word-break: keep-all;
    overflow-wrap: break-word;
  }
  :lang(en), :lang(vi) {
    --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
    --hand: "Iowan Old Style", Georgia, serif;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  }
  :lang(th) {
    --serif: "Thonburi", "Leelawadee UI", "Noto Serif Thai", "Noto Sans Thai", serif;
    --sans: "Thonburi", "Sukhumvit Set", "Leelawadee UI", "Noto Sans Thai", system-ui, sans-serif;
    line-height: 1.64;
  }
  :lang(th) h1, :lang(th) h2, :lang(th) h3, :lang(th) button, :lang(th) a {
    letter-spacing: 0;
    line-height: 1.48;
  }
  :lang(en) .hand, :lang(vi) .hand, :lang(ko) .hand, :lang(th) .hand {
    font-style: italic;
  }
}

@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html {
    background: var(--ink-0);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
  }
  body {
    margin: 0;
    min-height: 100dvh;
    background: transparent;
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
  }
  img, svg { display: block; }
  button, input, textarea, select { font: inherit; color: inherit; }
  button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
  button:disabled { cursor: default; opacity: .45; }
  a { color: var(--gold); -webkit-tap-highlight-color: transparent; }
  :focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
  .serif { font-family: var(--serif); font-weight: 700; }
  .hand { font-family: var(--hand); font-weight: 500; }
  .tabular { font-variant-numeric: tabular-nums; }
  ::selection { background: #ff8fb144; }
}

/* Visibility and motion preferences override the component layers. */
[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms; transition-duration: .01ms; }
}
