:root {
  color-scheme: light;
  --canvas: #e8ebef;
  --paper: #f6f7f8;
  --surface: #ffffff;
  --surface-soft: #f0f3f6;
  --ink: #17324d;
  --ink-strong: #0b274d;
  --text: #222a31;
  --muted: #737d89;
  --faint: #a2aab4;
  --line: #dce2e8;
  --line-strong: #c8d0d8;
  --positive: #c6483d;
  --negative: #28766f;
  --brass: #b88a3b;
  --focus: #316ca6;
  --shadow: 0 24px 70px rgb(23 50 77 / 18%);
  --radius: 14px;
  --font-scale: 1;
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Noto Sans CJK SC", sans-serif;
  font-synthesis: none;
}

html[data-theme="jade"] {
  --paper: #f4f7f5;
  --surface-soft: #edf3ef;
  --ink: #315c4b;
  --ink-strong: #1e4a39;
  --focus: #4c7d68;
}

html[data-theme="tea"] {
  --paper: #f8f5f0;
  --surface-soft: #f3ede6;
  --ink: #6a4935;
  --ink-strong: #563724;
  --focus: #8d664b;
}

html[data-font="large"] {
  --font-scale: 1.08;
}

html[data-font="xlarge"] {
  --font-scale: 1.16;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--canvas);
  color: var(--text);
  font-size: calc(16px * var(--font-scale));
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 36%, transparent);
  outline-offset: 2px;
}

.prototype-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(430px, 1fr);
}

.prototype-panel {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 32px 26px;
  background: #13283e;
  color: #fff;
  border-right: 1px solid rgb(255 255 255 / 8%);
}

.prototype-brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.prototype-brand img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 15px;
  border: 1px solid rgb(255 255 255 / 18%);
}

.prototype-brand strong,
.prototype-brand span {
  display: block;
}

.prototype-brand strong {
  font-size: 18px;
  letter-spacing: 0.01em;
}

.prototype-brand span {
  margin-top: 4px;
  color: #9fb0c1;
  font-size: 13px;
}

.prototype-intro {
  margin: 28px 0 20px;
  color: #b8c5d0;
  font-size: 14px;
  line-height: 1.75;
}

.prototype-routes {
  display: grid;
  gap: 6px;
}

.prototype-routes button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #cbd5df;
  text-align: left;
  cursor: pointer;
}

.prototype-routes button:hover,
.prototype-routes button.is-active {
  background: rgb(255 255 255 / 9%);
  color: #fff;
}

.prototype-routes button.is-active::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 10px;
  border-radius: 50%;
  background: #d4ac61;
  vertical-align: 2px;
}

.prototype-note {
  position: absolute;
  right: 26px;
  bottom: 28px;
  left: 26px;
  padding-top: 18px;
  border-top: 1px solid rgb(255 255 255 / 12%);
}

.prototype-note span {
  color: #d4ac61;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.prototype-note p {
  margin: 8px 0 0;
  color: #9fb0c1;
  font-size: 12px;
  line-height: 1.65;
}

.device-stage {
  min-width: 0;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
  background: #eef1f4;
}

.iphone-device {
  position: relative;
  width: 414px;
  height: min(878px, calc(100vh - 30px));
  padding: 9px;
  border: 1px solid #090a0c;
  border-radius: 53px;
  background:
    linear-gradient(90deg, #090a0c 0%, #5e6267 2%, #15171a 5%, #050607 50%, #26292d 95%, #666a70 98%, #0b0c0e 100%);
  box-shadow:
    0 44px 75px rgb(16 27 39 / 24%),
    0 12px 25px rgb(16 27 39 / 18%),
    inset 0 0 0 1px rgb(255 255 255 / 24%),
    inset 0 0 0 3px rgb(0 0 0 / 72%);
}

.iphone-device::after {
  content: "";
  position: absolute;
  right: 42px;
  bottom: -18px;
  left: 42px;
  height: 22px;
  border-radius: 50%;
  background: rgb(25 35 46 / 20%);
  filter: blur(13px);
  pointer-events: none;
}

.hardware-button {
  position: absolute;
  z-index: 0;
  width: 4px;
  border: 1px solid #050607;
  background: linear-gradient(90deg, #26292d, #777c82 50%, #16181b);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 12%);
}

.silent-button {
  top: 126px;
  left: -5px;
  height: 31px;
  border-radius: 3px 0 0 3px;
}

.volume-up-button,
.volume-down-button {
  left: -5px;
  height: 62px;
  border-radius: 4px 0 0 4px;
}

.volume-up-button {
  top: 184px;
}

.volume-down-button {
  top: 259px;
}

.power-button {
  top: 210px;
  right: -5px;
  height: 92px;
  border-radius: 0 4px 4px 0;
}

.device-frame {
  position: relative;
  z-index: 1;
  isolation: isolate;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid #17191c;
  border-radius: 44px;
  background: var(--paper);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 24%),
    inset 0 0 18px rgb(12 20 29 / 10%);
}

.ios-statusbar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 80;
  height: 47px;
  display: grid;
  grid-template-columns: 1fr 120px 1fr;
  align-items: center;
  padding: 0 21px;
  color: #101317;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.ios-statusbar time {
  justify-self: start;
  font-variant-numeric: tabular-nums;
}

.dynamic-island {
  position: relative;
  width: 116px;
  height: 32px;
  justify-self: center;
  border-radius: 18px;
  background: #030405;
  box-shadow: inset 0 -1px 2px rgb(255 255 255 / 8%);
}

.dynamic-island i {
  position: absolute;
  top: 11px;
  right: 10px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #203d65 0 16%, #09101a 45%, #020304 75%);
}

.ios-status-icons {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 7px;
}

.cellular {
  height: 11px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.cellular b {
  width: 2.5px;
  border-radius: 1px;
  background: currentColor;
}

.cellular b:nth-child(1) { height: 4px; }
.cellular b:nth-child(2) { height: 6px; }
.cellular b:nth-child(3) { height: 8px; }
.cellular b:nth-child(4) { height: 10px; }

.wifi {
  position: relative;
  width: 14px;
  height: 10px;
  overflow: hidden;
}

.wifi::before,
.wifi::after {
  content: "";
  position: absolute;
  left: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.wifi::before {
  top: 1px;
  width: 12px;
  height: 12px;
}

.wifi::after {
  top: 6px;
  width: 4px;
  height: 4px;
}

.battery {
  position: relative;
  width: 20px;
  height: 10px;
  padding: 1.5px;
  border: 1px solid currentColor;
  border-radius: 3px;
}

.battery::after {
  content: "";
  position: absolute;
  top: 2px;
  right: -3px;
  width: 2px;
  height: 4px;
  border-radius: 0 1px 1px 0;
  background: currentColor;
}

.battery b {
  display: block;
  width: 13px;
  height: 100%;
  border-radius: 1px;
  background: currentColor;
}

.home-indicator {
  position: absolute;
  bottom: 6px;
  left: 50%;
  z-index: 80;
  width: 124px;
  height: 4px;
  border-radius: 4px;
  background: #111418;
  pointer-events: none;
}

.app {
  height: 100%;
  overflow: hidden;
  background: var(--paper);
}

.screen {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.screen::-webkit-scrollbar {
  display: none;
}

.screen.has-tabbar {
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}

.screen.has-bottom-action {
  padding-bottom: calc(108px + env(safe-area-inset-bottom));
}

.page-content {
  padding: 0 22px 32px;
}

.safe-top {
  height: max(47px, env(safe-area-inset-top));
}

.topbar {
  min-height: 56px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 0 10px;
  border-bottom: 1px solid transparent;
}

.topbar.with-line {
  border-color: var(--line);
}

.topbar-title {
  margin: 0;
  color: var(--ink-strong);
  font-size: calc(20px * var(--font-scale));
  font-weight: 750;
  text-align: center;
  letter-spacing: 0.01em;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-soft);
}

.icon {
  width: 24px;
  height: 24px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.icon.is-filled {
  fill: currentColor;
  stroke: none;
}

.home-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0 18px;
}

.brand-avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 15px;
  border: 1px solid color-mix(in srgb, var(--brass) 48%, var(--line));
}

.home-head h1 {
  min-width: 0;
  flex: 1;
  margin: 0;
  color: var(--ink-strong);
  font-size: calc(25px * var(--font-scale));
  font-weight: 800;
  letter-spacing: 0.015em;
}

.avatar,
.avatar-sm,
.avatar-lg {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 37%, #cbd1d7 0 19%, transparent 20%),
    radial-gradient(ellipse at 50% 95%, #b8c0c8 0 38%, transparent 39%),
    #e9edf1;
  color: var(--ink);
  font-weight: 750;
  overflow: hidden;
}

.avatar {
  width: 42px;
  height: 42px;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  margin-left: -5px;
}

.avatar-sm:first-child {
  margin-left: 0;
}

.avatar-lg {
  width: 72px;
  height: 72px;
}

.avatar.is-profile {
  background: var(--ink);
  color: #fff;
  border-color: transparent;
}

.avatar-initial {
  background: var(--surface-soft);
}

.avatar-initial::before {
  content: attr(data-initial);
  position: relative;
  z-index: 2;
  font-size: 13px;
}

.avatar-initial.avatar,
.avatar-initial.avatar-lg {
  background: var(--surface-soft);
}

.avatar-initial.avatar-lg::before {
  font-size: 22px;
}

.primary-button,
.outline-button,
.text-button {
  min-height: 52px;
  border-radius: 11px;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 20px;
  border: 1px solid var(--ink-strong);
  background: var(--ink-strong);
  color: #fff;
  font-size: calc(18px * var(--font-scale));
  font-weight: 720;
  letter-spacing: 0.02em;
}

.primary-button:hover {
  filter: brightness(1.08);
}

.primary-button:disabled {
  border-color: var(--line-strong);
  background: var(--line-strong);
  cursor: not-allowed;
}

.outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-weight: 680;
}

.text-button {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 650;
}

.create-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 62px;
  margin: 4px 0 28px;
}

.create-button .icon {
  width: 27px;
  height: 27px;
}

.section-heading {
  position: relative;
  margin: 0;
  padding-left: 15px;
  color: var(--ink-strong);
  font-size: calc(21px * var(--font-scale));
  font-weight: 760;
}

.section-heading::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 4px;
  border-radius: 3px;
  background: var(--ink);
}

.section-heading.plain {
  padding-left: 0;
}

.section-heading.plain::before {
  display: none;
}

.section-subhead {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: calc(13px * var(--font-scale));
}

.ledger-list {
  position: relative;
  margin: 20px 0 0 18px;
  padding-left: 26px;
}

.ledger-list::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 2px;
  background: var(--ink);
}

.ledger-entry {
  position: relative;
  min-height: 130px;
  padding: 18px 2px 18px 18px;
  border-bottom: 1px solid var(--line);
}

.ledger-entry:last-child {
  border-bottom: 0;
}

.ledger-marker {
  position: absolute;
  top: 24px;
  left: -47px;
  width: 42px;
  height: 42px;
  display: grid;
  grid-template-columns: repeat(2, 5px);
  grid-template-rows: repeat(2, 5px);
  place-content: center;
  gap: 4px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
}

.ledger-marker i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink);
}

.ledger-marker i:nth-child(3),
.ledger-marker i:nth-child(4) {
  background: var(--positive);
}

.match-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.match-row-title h3 {
  min-width: 0;
  flex: 1;
  margin: 0;
  color: var(--text);
  font-size: calc(18px * var(--font-scale));
  font-weight: 750;
  line-height: 1.35;
}

.chevron {
  color: var(--faint);
}

.match-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: calc(13px * var(--font-scale));
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
}

.status-dot.waiting {
  background: var(--faint);
}

.match-row-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.avatar-stack {
  display: flex;
  align-items: center;
}

.small-action {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: calc(13px * var(--font-scale));
  font-weight: 700;
  cursor: pointer;
}

.auto-settle-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 22px 0 0;
  color: var(--faint);
  font-size: calc(12px * var(--font-scale));
}

.auto-settle-hint .icon {
  width: 17px;
  height: 17px;
}

.tabbar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  min-height: calc(72px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 7px 6px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: rgb(255 255 255 / 97%);
}

.tabbar button {
  min-width: 0;
  min-height: 58px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #89939f;
  font-size: calc(11px * var(--font-scale));
  cursor: pointer;
}

.tabbar button.is-active {
  color: var(--ink-strong);
  font-weight: 750;
}

.tabbar .icon {
  width: 24px;
  height: 24px;
}

.match-title {
  margin: 26px 0 6px;
  color: var(--ink-strong);
  font-size: calc(25px * var(--font-scale));
  font-weight: 780;
  text-align: center;
}

.qr-wrap {
  width: min(230px, 70vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 24px auto 14px;
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: #fff;
}

.qr-code {
  width: 100%;
  height: 100%;
}

.invite-copy {
  margin: 0;
  color: var(--ink-strong);
  font-size: calc(16px * var(--font-scale));
  font-weight: 650;
  text-align: center;
}

.invite-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 15px 0 28px;
}

.share-invite-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 17px;
  border: 1px solid color-mix(in srgb, var(--ink) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 5%, var(--surface));
  box-shadow: 0 5px 14px color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink);
  font-size: calc(14px * var(--font-scale));
  font-weight: 680;
  cursor: pointer;
}

.share-invite-button .icon {
  width: 18px;
  height: 18px;
}

.participants-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.participants-heading h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: calc(19px * var(--font-scale));
}

.participants-heading span {
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
}

.participant-list,
.score-list,
.settings-list,
.settlement-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.participant-row,
.score-row,
.setting-row {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.participant-row strong {
  font-size: calc(16px * var(--font-scale));
}

.bottom-action {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  padding: 12px 22px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgb(246 247 248 / 97%);
  backdrop-filter: blur(8px);
}

.vip-limit-sheet {
  text-align: center;
}

.vip-limit-badge {
  width: fit-content;
  display: block;
  margin: 0 auto 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.vip-limit-sheet .section-subhead {
  max-width: 290px;
  margin: -4px auto 18px;
  line-height: 1.65;
}

.vip-limit-sheet .text-button {
  width: 100%;
  margin-top: 4px;
}

.bottom-action .text-button {
  width: 100%;
  margin-top: 4px;
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 14px -22px 22px;
  border-bottom: 1px solid var(--line);
}

.podium-item {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px;
  align-items: center;
  padding: 0 11px 18px;
  border-right: 1px solid var(--line);
}

.podium-item:last-child {
  border-right: 0;
}

.rank-dot {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.rank-dot.first {
  background: #e5bd61;
  color: #5b430f;
}

.podium-name,
.podium-score {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-name {
  color: var(--text);
  font-size: calc(13px * var(--font-scale));
  font-weight: 700;
}

.podium-score {
  grid-column: 2;
  margin-top: -6px;
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(21px * var(--font-scale));
  font-weight: 800;
}

.scorebook {
  position: relative;
  margin: 16px 0 26px 18px;
  padding-left: 32px;
}

.scorebook::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 0;
  width: 2px;
  background: var(--ink);
}

.round-badge {
  position: absolute;
  top: 4px;
  left: -17px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: 17px;
  font-weight: 800;
}

.score-row {
  justify-content: space-between;
  min-height: 58px;
}

.score-player {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
}

.score-value {
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(24px * var(--font-scale));
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.positive {
  color: var(--positive) !important;
}

.negative {
  color: var(--negative) !important;
}

.neutral {
  color: var(--ink) !important;
}

.departed {
  color: var(--faint);
}

.recent-list {
  position: relative;
  margin: 15px 0 0 18px;
  padding-left: 28px;
}

.recent-list::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 2px;
  background: var(--ink);
}

.recent-round {
  position: relative;
  padding: 14px 4px 14px 12px;
  border-bottom: 1px solid var(--line);
}

.recent-round::before {
  content: attr(data-round);
  position: absolute;
  top: 13px;
  left: -47px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: 14px;
  font-weight: 800;
}

.round-title {
  margin: 0;
  color: var(--text);
  font-size: calc(14px * var(--font-scale));
  font-weight: 700;
}

.round-changes {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 13px;
  margin-top: 9px;
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(13px * var(--font-scale));
  font-weight: 700;
}

.match-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 22px 0 10px;
}

.quick-action {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: calc(14px * var(--font-scale));
  font-weight: 670;
  cursor: pointer;
}

.record-help {
  margin: 2px 0 22px;
  color: var(--muted);
  font-size: calc(13px * var(--font-scale));
  text-align: center;
}

.record-list {
  margin: 12px 0 0;
}

.record-row {
  display: grid;
  grid-template-columns: 32px 38px minmax(52px, 1fr) 82px 62px;
  gap: 6px;
  align-items: center;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}

.record-row.is-muted {
  color: var(--faint);
}

.record-row .avatar {
  width: 38px;
  height: 38px;
}

.record-name {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: calc(15px * var(--font-scale));
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-input-wrap {
  position: relative;
}

.score-input {
  width: 100%;
  height: 50px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(23px * var(--font-scale));
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.record-row.is-muted .score-input {
  border-color: transparent;
  background: transparent;
  color: var(--faint);
}

.projected {
  grid-column: 5;
  color: var(--muted);
  font-size: calc(10px * var(--font-scale));
  line-height: 1.35;
  text-align: right;
}

.projected strong {
  display: block;
  margin-top: 2px;
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(15px * var(--font-scale));
}

.settlement-head {
  padding: 14px 22px 20px;
  text-align: center;
}

.settlement-head h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: calc(21px * var(--font-scale));
}

.settlement-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: calc(13px * var(--font-scale));
}

.ranking-list {
  margin: 0;
  padding: 0 22px;
  list-style: none;
}

.ranking-row {
  min-height: 72px;
  display: grid;
  grid-template-columns: 36px 42px 1fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.ranking-row:first-child {
  margin: 0 -8px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--brass) 34%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--brass) 5%, var(--surface));
}

.ranking-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-weight: 800;
}

.ranking-row:first-child .ranking-number {
  background: #e6bd62;
  color: #5d430e;
}

.ranking-name {
  font-size: calc(17px * var(--font-scale));
  font-weight: 760;
}

.ranking-score {
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(24px * var(--font-scale));
  font-weight: 800;
}

.calculation {
  margin: 28px 22px 0;
}

.calculation-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.calculation-head h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: calc(20px * var(--font-scale));
}

.calculation-head span {
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
}

.settlement-row {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(42px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(14px * var(--font-scale));
}

.settlement-row strong:first-child {
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    sans-serif;
}

.member-coefficient {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-strong);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(13px * var(--font-scale));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
}

.member-coefficient small {
  padding: 2px 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 8px;
}

.member-coefficient.is-override {
  border-color: color-mix(in srgb, var(--ink) 46%, var(--line));
  background: color-mix(in srgb, var(--ink) 5%, var(--surface));
}

.settled-score {
  min-width: 62px;
  text-align: right;
  white-space: nowrap;
}

.coefficient-control {
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--ink) 3%, var(--surface));
}

.coefficient-copy {
  min-width: 0;
}

.coefficient-copy strong,
.coefficient-copy small {
  display: block;
}

.coefficient-copy strong {
  color: var(--ink-strong);
  font-size: calc(14px * var(--font-scale));
  font-weight: 720;
}

.coefficient-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: calc(10px * var(--font-scale));
  line-height: 1.45;
}

.coefficient-control button {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-strong);
  box-shadow: 0 4px 12px rgb(20 34 50 / 5%);
  cursor: pointer;
}

.coefficient-control button b {
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(17px * var(--font-scale));
  font-variant-numeric: tabular-nums;
}

.coefficient-control button span {
  color: var(--muted);
  font-size: calc(11px * var(--font-scale));
}

.coefficient-control button .icon {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.coefficient-footnote {
  margin: 8px 2px 0;
  color: var(--faint);
  font-size: calc(9px * var(--font-scale));
  line-height: 1.5;
}

.match-insights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 24px 22px;
  border-bottom: 1px solid var(--line);
}

.insight {
  min-width: 0;
  padding: 0 8px 20px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.insight:last-child {
  border-right: 0;
}

.insight span,
.insight strong {
  display: block;
}

.insight span {
  color: var(--muted);
  font-size: calc(11px * var(--font-scale));
}

.insight strong {
  margin-top: 7px;
  color: var(--ink);
  font-size: calc(16px * var(--font-scale));
}

.settlement-actions {
  padding: 0 22px 34px;
}

.settlement-actions .outline-button {
  width: 100%;
}

.history-toolbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 -22px;
  padding: 0 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.month-selector {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-strong);
  font-weight: 750;
  cursor: pointer;
}

.history-summary {
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
}

.history-entry {
  min-height: 150px;
}

.history-score {
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(15px * var(--font-scale));
  font-weight: 800;
}

.history-status {
  color: var(--ink);
  font-size: calc(12px * var(--font-scale));
}

.analysis-ranges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 2px 0 22px;
  border-bottom: 1px solid var(--line);
}

.analysis-ranges button {
  position: relative;
  min-height: 50px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.analysis-ranges button.is-active {
  color: var(--ink-strong);
  font-weight: 750;
}

.analysis-ranges button.is-active::after {
  content: "";
  position: absolute;
  right: 24%;
  bottom: -1px;
  left: 24%;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--ink);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-bottom: 1px solid var(--line);
}

.metric {
  min-height: 112px;
  display: grid;
  place-items: center;
  align-content: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.metric:nth-child(even) {
  border-right: 0;
}

.metric:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.metric strong,
.metric span {
  display: block;
}

.metric strong {
  color: var(--ink-strong);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(38px * var(--font-scale));
  font-weight: 800;
  line-height: 1;
}

.metric span {
  margin-top: 9px;
  color: var(--text);
  font-size: calc(13px * var(--font-scale));
}

.tie-count {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
  text-align: center;
}

.chart-section {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.chart-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.chart-title-row h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: calc(19px * var(--font-scale));
}

.chart-title-row span {
  color: var(--muted);
  font-size: calc(11px * var(--font-scale));
}

.bar-chart {
  position: relative;
  height: 220px;
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin: 22px 0 0;
  padding: 0 2px;
}

.bar-chart::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--ink);
}

.bar-item {
  position: relative;
  min-width: 0;
  flex: 1;
}

.bar {
  position: absolute;
  right: 2px;
  left: 2px;
  min-height: 5px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(
    to top,
    var(--positive),
    color-mix(in srgb, var(--positive) 72%, white)
  );
}

.bar.positive-bar {
  bottom: 50%;
}

.bar.negative-bar {
  top: 50%;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(
    to bottom,
    var(--negative),
    color-mix(in srgb, var(--negative) 72%, white)
  );
}

.bar-label {
  position: absolute;
  right: -8px;
  left: -8px;
  color: var(--muted);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: 9px;
  text-align: center;
}

.bar-label.above {
  bottom: calc(50% + var(--bar-height) + 4px);
  color: var(--positive);
}

.bar-label.below {
  top: calc(50% + var(--bar-height) + 4px);
  color: var(--negative);
}

.chart-index {
  position: absolute;
  right: 0;
  bottom: -22px;
  left: 0;
  color: var(--faint);
  font-size: 9px;
  text-align: center;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.summary-cell {
  min-width: 0;
  padding: 0 8px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.summary-cell:last-child {
  border-right: 0;
}

.summary-cell span,
.summary-cell strong {
  display: block;
}

.summary-cell span {
  color: var(--muted);
  font-size: calc(10px * var(--font-scale));
}

.summary-cell strong {
  margin-top: 7px;
  color: var(--positive);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(18px * var(--font-scale));
}

.profile-head {
  min-height: 138px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 -22px 24px;
  padding: 16px 22px 22px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.profile-copy {
  min-width: 0;
  flex: 1;
}

.profile-copy strong {
  display: block;
  color: var(--ink-strong);
  font-size: calc(22px * var(--font-scale));
}

.profile-copy span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
  line-height: 1.55;
}

.profile-avatar-wrap {
  position: relative;
}

.complete-badge {
  position: absolute;
  right: -8px;
  bottom: -4px;
  padding: 4px 8px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 10px;
  white-space: nowrap;
}

.settings-section {
  margin-top: 26px;
}

.settings-section .section-heading {
  margin-bottom: 10px;
}

.setting-row {
  justify-content: space-between;
  min-height: 58px;
}

.setting-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 650;
}

.setting-label .icon {
  width: 21px;
  height: 21px;
  color: var(--ink);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 220px;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 9px;
}

.segmented button {
  min-height: 38px;
  padding: 0 7px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: calc(11px * var(--font-scale));
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.is-active {
  background: var(--ink);
  color: #fff;
}

.theme-options {
  display: flex;
  gap: 13px;
}

.theme-button {
  min-width: 52px;
  min-height: 50px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}

.theme-swatch {
  position: relative;
  width: 24px;
  height: 24px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #17324d;
}

.theme-button[data-theme-choice="jade"] .theme-swatch {
  background: #315c4b;
}

.theme-button[data-theme-choice="tea"] .theme-swatch {
  background: #6a4935;
}

.theme-button.is-active .theme-swatch::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) translate(-1px, -1px);
}

.about-logo {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 9px;
}

.setting-value {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 49;
  background: rgb(11 39 77 / 28%);
  animation: fade-in 160ms ease-out;
}

.bottom-sheet {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  padding: 20px 22px calc(18px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  box-shadow: 0 -14px 40px rgb(11 39 77 / 14%);
  animation: sheet-up 200ms ease-out;
}

.bottom-sheet h3 {
  margin: 0 0 14px;
  color: var(--ink-strong);
  font-size: calc(19px * var(--font-scale));
}

.sheet-action {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}

.sheet-action.danger {
  color: var(--positive);
}

.coefficient-sheet-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.coefficient-sheet h3 {
  margin-bottom: 6px;
}

.coefficient-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin-top: 18px;
}

.coefficient-presets button {
  min-width: 0;
  min-height: 38px;
  padding: 0 3px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(13px * var(--font-scale));
  cursor: pointer;
}

.coefficient-presets button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.coefficient-editor {
  margin: 16px 0 12px;
}

.coefficient-editor > label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: calc(11px * var(--font-scale));
}

.coefficient-input-wrap {
  height: 52px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
}

.coefficient-input-wrap > span {
  display: grid;
  place-items: center;
  align-self: stretch;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: 18px;
}

.coefficient-input-wrap input {
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0 13px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink-strong);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.coefficient-sheet > .primary-button {
  margin-top: 4px;
}

.coefficient-follow-button {
  width: 100%;
  margin-top: 10px;
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.coefficient-follow-button:disabled {
  color: var(--faint);
  cursor: default;
  opacity: 0.58;
}

.coefficient-sheet > .text-button {
  width: 100%;
  margin-top: 3px;
}

.history-range-options {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.history-range-options button {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  padding: 9px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.history-range-options button > span,
.history-range-options strong,
.history-range-options small {
  display: block;
}

.history-range-options strong {
  font-size: calc(14px * var(--font-scale));
}

.history-range-options small {
  margin-top: 4px;
  color: var(--muted);
  font-size: calc(10px * var(--font-scale));
}

.history-range-options .icon {
  width: 19px;
  height: 19px;
  color: transparent;
}

.history-range-options button.is-active {
  color: var(--ink);
}

.history-range-options button.is-active .icon {
  color: var(--ink);
}

.history-range-sheet > .text-button {
  width: 100%;
  margin-top: 7px;
}

.toast {
  position: absolute;
  right: 24px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: 24px;
  z-index: 1000;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgb(19 40 62 / 94%);
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast button {
  min-height: 30px;
  margin-left: 8px;
  padding: 0 8px;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.prototype-only {
  color: var(--muted);
  font-size: 11px;
}

.empty-copy {
  margin: 60px 0 0;
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}

@media (max-width: 720px) {
  .prototype-shell {
    display: block;
    min-height: 100dvh;
  }

  .prototype-panel {
    display: none;
  }

  .device-stage {
    display: block;
    min-height: 100dvh;
    padding: 0;
  }

  .iphone-device {
    width: 100vw;
    height: 100dvh;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .iphone-device::after,
  .hardware-button,
  .ios-statusbar,
  .home-indicator {
    display: none;
  }

  .device-frame {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .safe-top {
    height: max(18px, env(safe-area-inset-top));
  }
}

@media (max-height: 700px) and (min-width: 721px) {
  .iphone-device {
    height: calc(100vh - 20px);
  }

  .device-stage {
    padding: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Table-first scoring flow: intentionally follows familiar WeChat utility UI. */
.match-table-page,
.record-table-page {
  background: #f5f6f8;
}

.match-table-page .topbar,
.record-table-page .topbar {
  background: #fff;
}

.record-table-page .topbar > .icon-button:first-child .icon {
  display: none;
}

.record-table-page .topbar > .icon-button:first-child::before {
  content: "";
  width: 10px;
  height: 10px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
}

.match-table-content,
.record-table-content {
  background: #fff;
}

.participant-toolbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #f5f6f8;
}

.participant-toolbar > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.participant-toolbar strong {
  color: var(--text);
  font-size: calc(17px * var(--font-scale));
}

.participant-toolbar span {
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
}

.participant-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.participant-toolbar-actions button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: calc(14px * var(--font-scale));
  font-weight: 680;
  cursor: pointer;
}

.participant-toolbar-actions .icon {
  width: 17px;
  height: 17px;
}

.score-table-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  background: #fff;
}

.score-table-scroll::-webkit-scrollbar {
  display: none;
}

.score-table {
  width: 100%;
}

.score-table-head,
.score-table-row {
  display: grid;
}

.score-table-head {
  min-height: 124px;
  border-bottom: 1px solid var(--line);
  background: #f5f6f8;
}

.round-head-cell,
.participant-column-head,
.round-cell,
.round-score {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.round-head-cell {
  position: sticky;
  left: 0;
  z-index: 3;
  flex-direction: column;
  gap: 6px;
  border-right: 1px solid var(--line);
  background: #f5f6f8;
  color: var(--muted);
  font-size: calc(12px * var(--font-scale));
}

.round-head-cell button {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 680;
  cursor: pointer;
}

.participant-column-head {
  flex-direction: column;
  gap: 5px;
  padding: 11px 4px 10px;
  border-right: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.participant-column-head:last-child {
  border-right: 0;
}

.participant-column-head .avatar {
  width: 38px;
  height: 38px;
}

.participant-column-head span {
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: calc(14px * var(--font-scale));
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-column-head strong {
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(19px * var(--font-scale));
  font-variant-numeric: tabular-nums;
}

.score-table-row {
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.score-table-row:nth-child(even) {
  background: #fbfbfc;
}

.round-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  flex-direction: column;
  align-items: flex-start;
  padding: 0 12px;
  border-right: 1px solid var(--line);
  background: inherit;
}

.round-cell strong {
  color: var(--text);
  font-size: calc(14px * var(--font-scale));
  font-weight: 680;
}

.round-cell time {
  margin-top: 5px;
  color: var(--faint);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(11px * var(--font-scale));
}

.round-score {
  border-right: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(20px * var(--font-scale));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.round-score:last-child {
  border-right: 0;
}

.match-table-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgb(255 255 255 / 98%);
}

.match-table-actions .primary-button,
.match-table-actions .outline-button {
  width: 100%;
  min-height: 50px;
  border-radius: 7px;
}

.record-table-head,
.record-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 84px;
  gap: 8px;
  align-items: center;
  padding: 0 16px;
}

.record-table-head {
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: calc(13px * var(--font-scale));
}

.record-table-head span:nth-child(2) {
  text-align: center;
}

.record-table-head span:last-child {
  text-align: right;
}

.record-table-row {
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.record-participant {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.record-participant .avatar {
  width: 38px;
  height: 38px;
}

.record-participant span {
  overflow: hidden;
  color: var(--text);
  font-size: calc(16px * var(--font-scale));
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-result-toggle {
  height: 46px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
}

.record-result-toggle button {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: calc(15px * var(--font-scale));
  font-weight: 650;
  cursor: pointer;
}

.record-result-toggle button + button {
  border-left: 1px solid var(--line-strong);
}

.record-result-toggle .is-win.is-active {
  color: var(--positive);
  background: color-mix(in srgb, var(--positive) 8%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--positive);
}

.record-result-toggle .is-loss.is-active {
  color: var(--negative);
  background: color-mix(in srgb, var(--negative) 8%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--negative);
}

.record-result-toggle button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid currentColor;
  outline-offset: -3px;
}

.record-result-toggle.is-disabled {
  border-color: color-mix(in srgb, var(--line) 76%, transparent);
  background: transparent;
}

.record-result-toggle.is-disabled button {
  color: var(--faint);
  cursor: default;
}

.record-table-row .record-score-input {
  width: 100%;
  height: 46px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: calc(22px * var(--font-scale));
  text-align: right;
}

.record-table-row.is-spectator .record-score-input {
  border-color: color-mix(in srgb, var(--line) 76%, transparent);
  background: transparent;
  color: var(--faint);
  opacity: 1;
}

.record-table-actions {
  display: grid;
  gap: 10px;
  padding: 22px 16px 28px;
  background: #f5f6f8;
}

.record-table-actions .primary-button,
.record-table-actions .outline-button {
  width: 100%;
  min-height: 52px;
  border-radius: 7px;
  font-size: calc(17px * var(--font-scale));
}

/* Remove the decorative timeline from overview pages as well. */
.ledger-list {
  margin: 12px 0 0;
  padding-left: 0;
}

.ledger-list::before,
.ledger-marker {
  display: none;
}

.ledger-entry,
.history-entry {
  min-height: 116px;
  padding: 17px 0;
}

.section-heading {
  padding-left: 0;
  font-size: calc(18px * var(--font-scale));
}

.section-heading::before {
  display: none;
}

.screen[data-screen="lobby"] .participant-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  padding: 8px 0;
}

.screen[data-screen="lobby"] .participant-row {
  min-width: 0;
  min-height: 76px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 8px 2px;
  border-bottom: 0;
  text-align: center;
}

.screen[data-screen="lobby"] .participant-row .avatar {
  width: 38px;
  height: 38px;
}

.screen[data-screen="lobby"] .participant-row strong {
  max-width: 100%;
  overflow: hidden;
  font-size: calc(13px * var(--font-scale));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen[data-screen="lobby"] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen[data-screen="lobby"] .safe-top,
.screen[data-screen="lobby"] .topbar {
  flex: 0 0 auto;
}

.screen[data-screen="lobby"] .lobby-content {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 16px;
  scroll-padding-bottom: 24px;
  scrollbar-width: none;
}

.screen[data-screen="lobby"] .lobby-content::-webkit-scrollbar {
  display: none;
}

.screen[data-screen="lobby"] .match-title {
  margin: 16px 0 0;
}

.screen[data-screen="lobby"] .match-start-time {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: calc(11px * var(--font-scale));
  text-align: center;
}

.screen[data-screen="lobby"] .qr-wrap {
  width: min(194px, 58vw);
  margin: 14px auto 9px;
  padding: 11px;
}

.screen[data-screen="lobby"] .invite-copy {
  font-size: calc(15px * var(--font-scale));
}

.screen[data-screen="lobby"] .invite-actions {
  margin: 10px 0 14px;
}

.screen[data-screen="lobby"] .participants-heading {
  padding-bottom: 5px;
}

.lobby-participant-scroll {
  width: 100%;
  overflow-x: hidden;
}

.lobby-participant-scroll::-webkit-scrollbar {
  display: none;
}

@media (max-width: 340px) {
  .score-table-head,
  .score-table-row {
    grid-auto-columns: minmax(70px, 1fr);
  }

  .record-table-head,
  .record-table-row {
    grid-template-columns: minmax(0, 1fr) 84px 76px;
    gap: 6px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .record-participant {
    gap: 7px;
  }

  .record-participant .avatar {
    width: 34px;
    height: 34px;
  }

  .record-score-cell {
    grid-template-columns: 44px 1fr;
  }

  .round-cell {
    padding-right: 6px;
    padding-left: 6px;
  }

  .round-cell time {
    font-size: calc(9px * var(--font-scale));
  }
}

/* Profile service grid and routed information pages. */
.profile-tools-section {
  margin-top: 18px;
}

.profile-tools-section .section-heading {
  margin: 0 4px 8px;
}

.profile-tools-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.profile-tool {
  min-width: 0;
  min-height: 88px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 8px 2px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  font-size: calc(11px * var(--font-scale));
  line-height: 1.3;
  cursor: pointer;
}

.profile-tool:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.profile-tool-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--ink) 7%, var(--surface));
  color: var(--ink);
}

.profile-tool-icon.is-member {
  background: color-mix(in srgb, var(--brass) 16%, var(--surface));
  color: color-mix(in srgb, var(--brass) 78%, var(--ink-strong));
}

.profile-tool-icon .icon {
  width: 22px;
  height: 22px;
}

.profile-tool-icon img {
  width: 28px;
  height: 28px;
  display: block;
  border-radius: 8px;
  object-fit: cover;
}

html[data-variant="modern"] .profile-tools-grid {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgb(20 34 50 / 4%);
}

html[data-variant="modern"] .profile-tool:hover {
  background: var(--surface-soft);
}

html[data-variant="kami"] .profile-tools-section {
  margin-top: 20px;
}

html[data-variant="kami"] .profile-tools-grid {
  gap: 7px 0;
  padding: 9px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

html[data-variant="kami"] .profile-tool {
  min-height: 86px;
  border-radius: 5px;
  font-size: calc(11px * var(--font-scale));
  font-weight: 400;
  letter-spacing: 0.04em;
}

html[data-variant="kami"] .profile-tool-icon {
  width: 38px;
  height: 38px;
  border: 1px solid #c9c1af;
  border-radius: 6px;
  background: transparent;
}

html[data-variant="kami"] .profile-tool-icon.is-member {
  background: color-mix(in srgb, var(--brass) 9%, var(--paper));
}

.info-page-content {
  padding-bottom: 48px;
}

.info-page-hero {
  padding: 30px 0 24px;
  border-bottom: 1px solid var(--line);
}

.info-page-hero > img {
  width: 54px;
  height: 54px;
  display: block;
  margin-bottom: 20px;
  border-radius: 15px;
  object-fit: cover;
}

.info-page-hero > span {
  color: var(--ink);
  font-size: calc(12px * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.06em;
}

.info-page-hero h2 {
  margin: 8px 0 0;
  color: var(--ink-strong);
  font-size: calc(25px * var(--font-scale));
  line-height: 1.25;
}

.info-page-hero p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: calc(13px * var(--font-scale));
  line-height: 1.75;
}

.info-page-list {
  margin-top: 10px;
}

.info-page-item {
  min-height: 92px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.info-page-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: calc(13px * var(--font-scale));
  font-weight: 760;
}

.info-page-item strong {
  display: block;
  color: var(--text);
  font-size: calc(15px * var(--font-scale));
}

.info-page-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: calc(11px * var(--font-scale));
  line-height: 1.6;
}

.info-page-action {
  width: 100%;
  min-height: 52px;
  margin-top: 24px;
}

html[data-variant="modern"] .info-page-list {
  overflow: hidden;
  margin-top: 18px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgb(20 34 50 / 4%);
}

html[data-variant="kami"] .info-page-hero > span,
html[data-variant="kami"] .info-page-hero h2,
html[data-variant="kami"] .info-page-item strong {
  font-weight: 500;
}

html[data-variant="kami"] .info-page-hero h2 {
  letter-spacing: 0.06em;
}

html[data-variant="kami"] .info-page-mark {
  border: 1px solid #c9c1af;
  border-radius: 6px;
  background: transparent;
  font-weight: 500;
}

.history-started-at {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: calc(11px * var(--font-scale));
}

.history-entry.is-ongoing .history-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink);
  font-weight: 700;
}

.history-entry.is-ongoing .history-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent);
}

@media (max-width: 340px) {
  .profile-tools-grid {
    gap: 2px;
  }

  .profile-tool {
    min-height: 84px;
    font-size: calc(10px * var(--font-scale));
  }

  .profile-tool-icon {
    width: 36px;
    height: 36px;
  }
}

/* --------------------------------------------------------------------------
   A/B prototype surfaces
   -------------------------------------------------------------------------- */

.prototype-app-body {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: var(--paper);
}

.prototype-app-body .app {
  position: relative;
  width: 100%;
  height: 100%;
}

html[data-embedded="true"] .safe-top {
  height: 47px;
}

/* Variant A — refined native utility. */
html[data-variant="modern"] {
  --canvas: #e9edf2;
  --paper: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f1f4f7;
  --ink: #13294b;
  --ink-strong: #102a47;
  --text: #1c2530;
  --muted: #758190;
  --faint: #a4adb8;
  --line: #e2e7ed;
  --line-strong: #cdd5de;
  --positive: #d84b3f;
  --negative: #14806f;
  --brass: #b9904c;
  --focus: #346fa8;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

html[data-variant="modern"][data-theme="jade"] {
  --paper: #f4f7f6;
  --surface-soft: #edf3f1;
  --ink: #245f52;
  --ink-strong: #17483e;
  --focus: #4c7d70;
}

html[data-variant="modern"][data-theme="tea"] {
  --paper: #f8f5f1;
  --surface-soft: #f2ece5;
  --ink: #704c36;
  --ink-strong: #563825;
  --focus: #916b50;
}

html[data-variant="modern"] .screen {
  background: var(--paper);
}

html[data-variant="modern"] .topbar {
  min-height: 52px;
}

html[data-variant="modern"] .topbar-title {
  font-size: calc(17px * var(--font-scale));
  font-weight: 720;
  letter-spacing: 0;
}

html[data-variant="modern"] .icon-button {
  width: 40px;
  height: 40px;
}

html[data-variant="modern"] .icon-button .icon {
  width: 21px;
  height: 21px;
}

html[data-variant="modern"] .page-content {
  padding-right: 16px;
  padding-left: 16px;
}

html[data-variant="modern"] .primary-button,
html[data-variant="modern"] .outline-button {
  border-radius: 10px;
}

html[data-variant="modern"] .primary-button {
  border-color: var(--ink-strong);
  background: var(--ink-strong);
  box-shadow: 0 7px 16px color-mix(in srgb, var(--ink-strong) 18%, transparent);
  font-size: calc(16px * var(--font-scale));
  font-weight: 680;
}

html[data-variant="modern"] .outline-button {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  font-weight: 650;
}

html[data-variant="modern"] .home-head {
  padding-top: 12px;
}

html[data-variant="modern"] .home-head h1 {
  font-size: calc(22px * var(--font-scale));
  font-weight: 760;
}

html[data-variant="modern"] .create-button {
  min-height: 56px;
  margin-bottom: 22px;
}

html[data-variant="modern"] .section-heading {
  color: #5f6c7a;
  font-size: calc(13px * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.06em;
}

html[data-variant="modern"] .ledger-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

html[data-variant="modern"] .ledger-entry {
  min-height: 112px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 7px 22px rgb(20 34 50 / 5%);
}

html[data-variant="modern"] .match-row-title h3 {
  font-size: calc(16px * var(--font-scale));
  font-weight: 690;
}

html[data-variant="modern"] .small-action {
  min-height: 34px;
  border-color: color-mix(in srgb, var(--ink) 48%, var(--line));
  border-radius: 9px;
  font-weight: 650;
}

html[data-variant="modern"] .tabbar {
  min-height: calc(68px + env(safe-area-inset-bottom));
  padding-top: 5px;
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 -8px 24px rgb(18 32 48 / 4%);
  backdrop-filter: blur(18px);
}

html[data-variant="modern"] .tabbar button {
  min-height: 54px;
}

html[data-variant="modern"] .tabbar .icon {
  width: 22px;
  height: 22px;
}

html[data-variant="modern"] .profile-head {
  min-height: 108px;
  gap: 14px;
  margin: 8px 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(20 34 50 / 6%);
}

html[data-variant="modern"] .profile-head .avatar-lg {
  width: 62px;
  height: 62px;
}

html[data-variant="modern"] .profile-copy strong {
  font-size: calc(20px * var(--font-scale));
  font-weight: 720;
}

html[data-variant="modern"] .profile-copy span {
  margin-top: 5px;
  font-size: calc(11px * var(--font-scale));
}

html[data-variant="modern"] .complete-badge {
  right: -5px;
  bottom: -3px;
  padding: 3px 7px;
  border: 2px solid var(--surface);
  border-radius: 8px;
  font-size: 9px;
}

html[data-variant="modern"] .settings-section {
  margin-top: 18px;
}

html[data-variant="modern"] .settings-section .section-heading {
  margin: 0 4px 8px;
}

html[data-variant="modern"] .settings-list {
  overflow: hidden;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgb(20 34 50 / 4%);
}

html[data-variant="modern"] .setting-row {
  min-height: 52px;
}

html[data-variant="modern"] .setting-label {
  gap: 9px;
  font-size: calc(14px * var(--font-scale));
  font-weight: 610;
}

html[data-variant="modern"] .setting-label .icon {
  width: 19px;
  height: 19px;
}

html[data-variant="modern"] .settings-section:first-of-type .setting-row {
  min-height: 64px;
}

html[data-variant="modern"] .segmented {
  width: 205px;
  border-color: var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
}

html[data-variant="modern"] .segmented button {
  min-height: 34px;
  border-color: var(--line);
}

html[data-variant="modern"] .segmented button.is-active {
  background: var(--ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #fff 12%, transparent);
}

html[data-variant="modern"] .theme-options {
  gap: 9px;
}

html[data-variant="modern"] .theme-button {
  min-width: 45px;
  min-height: 46px;
}

html[data-variant="modern"] .theme-swatch {
  width: 22px;
  height: 22px;
  border-radius: 7px;
}

html[data-variant="modern"] .about-logo {
  width: 24px;
  height: 24px;
  border-radius: 7px;
}

html[data-variant="modern"] .match-table-page,
html[data-variant="modern"] .record-table-page {
  background: var(--paper);
}

html[data-variant="modern"] .match-table-page .topbar,
html[data-variant="modern"] .record-table-page .topbar,
html[data-variant="modern"] .match-table-content,
html[data-variant="modern"] .record-table-content {
  background: var(--surface);
}

html[data-variant="modern"] .participant-toolbar {
  min-height: 54px;
  background: var(--paper);
}

html[data-variant="modern"] .score-table-head {
  min-height: 112px;
  background: #f7f9fb;
}

html[data-variant="modern"] .round-head-cell {
  background: #f7f9fb;
}

html[data-variant="modern"] .participant-column-head .avatar {
  width: 34px;
  height: 34px;
}

html[data-variant="modern"] .score-table-row {
  min-height: 70px;
}

html[data-variant="modern"] .score-table-row:nth-child(even) {
  background: #fbfcfd;
}

html[data-variant="modern"] .round-score,
html[data-variant="modern"] .participant-column-head strong,
html[data-variant="modern"] .score-input,
html[data-variant="modern"] .metric strong,
html[data-variant="modern"] .ranking-score {
  font-family: "DIN Alternate", "SF Pro Display", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

html[data-variant="modern"] .match-table-actions {
  padding-top: 9px;
  background: rgb(255 255 255 / 97%);
  box-shadow: 0 -8px 24px rgb(18 32 48 / 5%);
}

html[data-variant="modern"] .record-table-row {
  background: var(--surface);
}

html[data-variant="modern"] .record-table-actions {
  background: var(--paper);
}

html[data-variant="modern"] .history-toolbar,
html[data-variant="modern"] .chart-section,
html[data-variant="modern"] .summary-row {
  border-color: var(--line);
}

html[data-variant="modern"] .metric-grid {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 7px 22px rgb(20 34 50 / 4%);
}

html[data-variant="modern"] .metric {
  min-height: 102px;
}

/* Variant B — warm editorial ledger language. */
html[data-variant="kami"] {
  --canvas: #e8e6dc;
  --paper: #f5f4ed;
  --surface: #faf9f5;
  --surface-soft: #eeece3;
  --ink: #1b365d;
  --ink-strong: #141413;
  --text: #3d3d3a;
  --muted: #6b6a64;
  --faint: #a4a198;
  --line: #e5e3d8;
  --line-strong: #ccc9bd;
  --positive: #d84b3f;
  --negative: #14806f;
  --brass: #8b755c;
  --focus: #1b365d;
  font-family:
    "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC",
    Georgia, serif;
}

html[data-variant="kami"][data-theme="jade"] {
  --ink: #504e49;
  --focus: #504e49;
}

html[data-variant="kami"][data-theme="tea"] {
  --ink: #75523e;
  --focus: #75523e;
}

html[data-variant="kami"] body,
html[data-variant="kami"] .app,
html[data-variant="kami"] .screen {
  background: var(--paper);
}

html[data-variant="kami"] button,
html[data-variant="kami"] input {
  font-family: inherit;
}

html[data-variant="kami"] .safe-top + .topbar {
  position: relative;
  min-height: 56px;
  padding-top: 0;
  border-color: var(--line);
  background: var(--paper);
}

html[data-variant="kami"] .topbar-title {
  color: var(--ink-strong);
  font-size: calc(20px * var(--font-scale));
  font-weight: 500;
  letter-spacing: 0.04em;
}

html[data-variant="kami"] .icon-button {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: var(--text);
}

html[data-variant="kami"] .icon {
  stroke-width: 1.45;
}

html[data-variant="kami"] .page-content {
  padding-right: 18px;
  padding-left: 18px;
}

html[data-variant="kami"] .positive {
  color: var(--positive);
}

html[data-variant="kami"] .negative {
  color: var(--negative);
}

html[data-variant="kami"] .primary-button,
html[data-variant="kami"] .outline-button,
html[data-variant="kami"] .text-button {
  border-radius: 8px;
}

html[data-variant="kami"] .primary-button {
  border-color: var(--ink);
  background: var(--ink);
  color: #faf9f5;
  box-shadow: 0 5px 14px rgb(27 54 93 / 12%);
  font-size: calc(17px * var(--font-scale));
  font-weight: 500;
  letter-spacing: 0.06em;
}

html[data-variant="kami"] .outline-button {
  border-color: #9c927f;
  background: transparent;
  color: var(--text);
  font-weight: 500;
}

html[data-variant="kami"] .share-invite-button {
  border-color: #c9c1af;
  background: color-mix(in srgb, var(--surface) 88%, #e9e4d8);
  box-shadow: 0 4px 12px rgb(74 63 48 / 7%);
  color: var(--text);
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-weight: 500;
}

html[data-variant="kami"] .home-head {
  align-items: flex-start;
  padding-top: 18px;
  border-bottom: 1px solid var(--line-strong);
}

html[data-variant="kami"] .brand-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  filter: saturate(0.55) sepia(0.1);
}

html[data-variant="kami"] .home-head h1 {
  padding-top: 6px;
  color: var(--ink-strong);
  font-size: calc(23px * var(--font-scale));
  font-weight: 500;
  letter-spacing: 0.08em;
}

html[data-variant="kami"] .create-button {
  min-height: 52px;
  margin: 18px 0 28px;
}

html[data-variant="kami"] .section-heading {
  position: relative;
  padding-left: 12px;
  color: var(--ink-strong);
  font-size: calc(17px * var(--font-scale));
  font-weight: 500;
  letter-spacing: 0.08em;
}

html[data-variant="kami"] .section-heading::before {
  display: block;
  top: 2px;
  bottom: 2px;
  width: 1px;
  border-radius: 0;
  background: #9c927f;
}

html[data-variant="kami"] .ledger-list {
  margin-top: 10px;
}

html[data-variant="kami"] .ledger-entry {
  min-height: 108px;
  padding: 17px 4px;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
}

html[data-variant="kami"] .match-row-title h3 {
  color: var(--ink-strong);
  font-size: calc(17px * var(--font-scale));
  font-weight: 500;
  letter-spacing: 0.04em;
}

html[data-variant="kami"] .match-meta,
html[data-variant="kami"] .auto-settle-hint {
  color: var(--muted);
}

html[data-variant="kami"] .status-dot {
  border: 1px solid var(--ink);
  background: transparent;
}

html[data-variant="kami"] .small-action {
  min-height: 34px;
  border-color: #9c927f;
  border-radius: 6px;
  color: var(--text);
  font-weight: 500;
}

html[data-variant="kami"] .tabbar {
  min-height: calc(68px + env(safe-area-inset-bottom));
  padding-top: 5px;
  border-color: var(--line-strong);
  background: rgb(250 249 245 / 96%);
  backdrop-filter: blur(14px);
}

html[data-variant="kami"] .tabbar button {
  min-height: 54px;
  color: #6b6a64;
  font-size: calc(11px * var(--font-scale));
}

html[data-variant="kami"] .tabbar button.is-active {
  color: var(--ink);
  font-weight: 500;
}

html[data-variant="kami"] .tabbar .icon {
  width: 21px;
  height: 21px;
}

html[data-variant="kami"] .profile-head {
  min-height: 118px;
  gap: 14px;
  margin: 0 0 20px;
  padding: 18px 4px 22px;
  border-bottom: 1px solid var(--line-strong);
}

html[data-variant="kami"] .profile-head .avatar-lg {
  width: 62px;
  height: 62px;
}

html[data-variant="kami"] .avatar,
html[data-variant="kami"] .avatar-sm,
html[data-variant="kami"] .avatar-lg {
  border-color: #d4d0c3;
  background:
    radial-gradient(circle at 50% 37%, #bdb9b0 0 19%, transparent 20%),
    radial-gradient(ellipse at 50% 95%, #aaa69d 0 38%, transparent 39%),
    #e8e6dc;
}

html[data-variant="kami"] .profile-copy strong {
  color: var(--ink-strong);
  font-size: calc(21px * var(--font-scale));
  font-weight: 500;
  letter-spacing: 0.04em;
}

html[data-variant="kami"] .profile-copy span {
  margin-top: 6px;
  color: var(--muted);
  font-size: calc(11px * var(--font-scale));
}

html[data-variant="kami"] .complete-badge {
  right: -10px;
  bottom: -3px;
  padding: 3px 7px;
  border: 1px solid #9c927f;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 9px;
}

html[data-variant="kami"] .settings-section {
  margin-top: 20px;
}

html[data-variant="kami"] .settings-section .section-heading {
  margin-bottom: 7px;
}

html[data-variant="kami"] .settings-list {
  background: transparent;
}

html[data-variant="kami"] .setting-row {
  min-height: 51px;
  border-color: var(--line-strong);
}

html[data-variant="kami"] .setting-label {
  position: relative;
  gap: 0;
  padding-left: 13px;
  color: var(--text);
  font-size: calc(14px * var(--font-scale));
  font-weight: 400;
  letter-spacing: 0.04em;
}

html[data-variant="kami"] .setting-label::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 4px;
  height: 1px;
  background: #9c927f;
}

html[data-variant="kami"] .setting-label .icon,
html[data-variant="kami"] .about-logo {
  display: none;
}

html[data-variant="kami"] .settings-section:first-of-type .setting-label {
  padding-left: 0;
}

html[data-variant="kami"] .settings-section:first-of-type .setting-label::before {
  display: none;
}

html[data-variant="kami"] .settings-section:first-of-type .setting-row {
  min-height: 62px;
}

html[data-variant="kami"] .segmented {
  width: 218px;
  border-color: #9c927f;
  border-radius: 6px;
  background: transparent;
}

html[data-variant="kami"] .segmented button {
  min-height: 36px;
  border-color: var(--line-strong);
  color: var(--text);
  font-weight: 400;
}

html[data-variant="kami"] .segmented button.is-active {
  background: var(--ink);
  color: #faf9f5;
}

html[data-variant="kami"] .theme-options {
  gap: 10px;
}

html[data-variant="kami"] .theme-button {
  min-width: 48px;
  min-height: 47px;
}

html[data-variant="kami"] .theme-swatch {
  width: 23px;
  height: 23px;
  border: 1px solid #bdb8aa;
  border-radius: 6px;
  background: #1b365d;
}

html[data-variant="kami"] .theme-button[data-theme-choice="jade"] .theme-swatch {
  background: #6b6a50;
}

html[data-variant="kami"] .theme-button[data-theme-choice="tea"] .theme-swatch {
  background: #75523e;
}

html[data-variant="kami"] .setting-value {
  color: var(--muted);
}

html[data-variant="kami"] .match-title,
html[data-variant="kami"] .settlement-head h2,
html[data-variant="kami"] .bottom-sheet h3 {
  color: var(--ink-strong);
  font-weight: 500;
  letter-spacing: 0.06em;
}

html[data-variant="kami"] .qr-wrap {
  border: 1px solid #9c927f;
  border-radius: 8px;
  background: var(--surface);
}

html[data-variant="kami"] .participant-list,
html[data-variant="kami"] .participants-heading {
  border-color: var(--line-strong);
}

html[data-variant="kami"] .bottom-action {
  border-color: var(--line-strong);
  background: rgb(250 249 245 / 96%);
}

html[data-variant="kami"] .match-table-page,
html[data-variant="kami"] .record-table-page,
html[data-variant="kami"] .match-table-content,
html[data-variant="kami"] .record-table-content {
  background: var(--paper);
}

html[data-variant="kami"] .match-table-page .topbar,
html[data-variant="kami"] .record-table-page .topbar {
  background: var(--paper);
}

html[data-variant="kami"] .participant-toolbar {
  min-height: 54px;
  border-color: var(--line-strong);
  background: var(--paper);
}

html[data-variant="kami"] .participant-toolbar strong {
  color: var(--ink-strong);
  font-size: calc(15px * var(--font-scale));
  font-weight: 500;
}

html[data-variant="kami"] .participant-toolbar span {
  color: var(--muted);
}

html[data-variant="kami"] .participant-toolbar-actions button {
  color: var(--text);
  font-weight: 400;
}

html[data-variant="kami"] .score-table-scroll,
html[data-variant="kami"] .score-table {
  background: var(--paper);
}

html[data-variant="kami"] .score-table-head {
  min-height: 116px;
  border-color: var(--line-strong);
  background: var(--paper);
}

html[data-variant="kami"] .round-head-cell {
  border-color: var(--line-strong);
  background: var(--paper);
  color: var(--muted);
}

html[data-variant="kami"] .round-head-cell button {
  color: var(--text);
  font-weight: 400;
}

html[data-variant="kami"] .participant-column-head {
  border-right: 0;
}

html[data-variant="kami"] .participant-column-head .avatar {
  width: 34px;
  height: 34px;
}

html[data-variant="kami"] .participant-column-head span {
  color: var(--ink-strong);
  font-size: calc(15px * var(--font-scale));
  font-weight: 400;
}

html[data-variant="kami"] .participant-column-head strong,
html[data-variant="kami"] .round-score,
html[data-variant="kami"] .score-input,
html[data-variant="kami"] .metric strong,
html[data-variant="kami"] .ranking-score,
html[data-variant="kami"] .settlement-row {
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-weight: 500;
  font-variant-numeric: tabular-nums lining-nums;
}

html[data-variant="kami"] .score-table-row {
  min-height: 72px;
  border-color: var(--line-strong);
  background: var(--paper);
}

html[data-variant="kami"] .score-table-row:nth-child(even) {
  background: #f8f7f1;
}

html[data-variant="kami"] .round-cell {
  border-color: var(--line-strong);
}

html[data-variant="kami"] .round-cell strong {
  color: var(--ink-strong);
  font-size: calc(14px * var(--font-scale));
  font-weight: 500;
}

html[data-variant="kami"] .round-cell time {
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
}

html[data-variant="kami"] .round-score {
  border-right: 0;
  font-size: calc(20px * var(--font-scale));
}

html[data-variant="kami"] .match-table-actions {
  padding-top: 9px;
  border-color: var(--line-strong);
  background: rgb(250 249 245 / 97%);
  box-shadow: 0 -6px 18px rgb(80 78 73 / 5%);
}

html[data-variant="kami"] .record-table-head,
html[data-variant="kami"] .record-table-row {
  border-color: var(--line-strong);
  background: var(--paper);
}

html[data-variant="kami"] .record-participant span {
  color: var(--ink-strong);
  font-weight: 400;
}

html[data-variant="kami"] .score-input {
  border-color: #c9c5b8;
  border-radius: 5px;
  background: var(--surface);
}

html[data-variant="kami"] .record-result-toggle {
  border-color: #c9c5b8;
  border-radius: 5px;
  background: var(--surface);
}

html[data-variant="kami"] .record-result-toggle button + button {
  border-color: #c9c5b8;
}

html[data-variant="kami"] .record-table-actions {
  background: var(--paper);
}

html[data-variant="kami"] .history-toolbar {
  border-color: var(--line-strong);
}

html[data-variant="kami"] .month-selector {
  color: var(--ink-strong);
  font-weight: 500;
}

html[data-variant="kami"] .analysis-ranges {
  border-color: var(--line-strong);
}

html[data-variant="kami"] .analysis-ranges button.is-active {
  color: var(--ink);
  font-weight: 500;
}

html[data-variant="kami"] .analysis-ranges button.is-active::after {
  height: 1px;
  border-radius: 0;
  background: var(--ink);
}

html[data-variant="kami"] .metric-grid {
  border-color: var(--line-strong);
}

html[data-variant="kami"] .metric {
  min-height: 104px;
  border-color: var(--line-strong);
}

html[data-variant="kami"] .metric strong {
  color: var(--ink-strong);
  font-size: calc(34px * var(--font-scale));
}

html[data-variant="kami"] .chart-section,
html[data-variant="kami"] .summary-row {
  border-color: var(--line-strong);
}

html[data-variant="kami"] .chart-title-row h2 {
  color: var(--ink-strong);
  font-weight: 500;
}

html[data-variant="kami"] .bar-chart::before {
  background: #9c927f;
}

html[data-variant="kami"] .bar {
  background: linear-gradient(
    to top,
    var(--positive),
    color-mix(in srgb, var(--positive) 72%, white)
  );
}

html[data-variant="kami"] .bar.negative-bar {
  background: linear-gradient(
    to bottom,
    var(--negative),
    color-mix(in srgb, var(--negative) 72%, white)
  );
}

html[data-variant="kami"] .summary-cell {
  border-color: var(--line-strong);
}

html[data-variant="kami"] .summary-cell strong {
  color: var(--positive);
  font-family: Georgia, serif;
  font-weight: 500;
}

html[data-variant="kami"] .ranking-row,
html[data-variant="kami"] .calculation-head,
html[data-variant="kami"] .settlement-row,
html[data-variant="kami"] .coefficient-control,
html[data-variant="kami"] .match-insights {
  border-color: var(--line-strong);
}

html[data-variant="kami"] .coefficient-control {
  border-radius: 7px;
  background: rgb(250 249 245 / 62%);
}

html[data-variant="kami"] .coefficient-copy strong {
  font-weight: 500;
  letter-spacing: 0.04em;
}

html[data-variant="kami"] .coefficient-control button {
  border-color: #b9b5a8;
  border-radius: 5px;
  background: transparent;
  box-shadow: none;
}

html[data-variant="kami"] .coefficient-control button b {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

html[data-variant="kami"] .ranking-row:first-child {
  border-radius: 6px;
  background: #eeece3;
}

html[data-variant="kami"] .ranking-number {
  border: 1px solid #b9b5a8;
  background: transparent;
  color: var(--text);
  font-family: Georgia, serif;
  font-weight: 500;
}

html[data-variant="kami"] .ranking-row:first-child .ranking-number {
  border-color: var(--ink);
  background: var(--ink);
  color: #faf9f5;
}

html[data-variant="kami"] .bottom-sheet {
  border-top: 1px solid #c9c5b8;
  border-radius: 14px 14px 0 0;
  background: var(--surface);
  box-shadow: 0 -12px 34px rgb(80 78 73 / 10%);
}

html[data-variant="kami"] .sheet-backdrop {
  background: rgb(61 61 58 / 24%);
}

html[data-variant="kami"] .sheet-action {
  border-color: var(--line-strong);
  color: var(--text);
  font-weight: 400;
}

html[data-variant="kami"] .toast {
  border: 1px solid rgb(250 249 245 / 18%);
  border-radius: 6px;
  background: rgb(20 20 19 / 94%);
  color: #faf9f5;
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

@media (max-width: 360px) {
  html[data-variant="modern"] .segmented,
  html[data-variant="kami"] .segmented {
    width: 190px;
  }

  html[data-variant="modern"] .theme-options,
  html[data-variant="kami"] .theme-options {
    gap: 4px;
  }

  .participant-toolbar {
    gap: 4px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .participant-toolbar > div:first-child {
    gap: 4px;
    white-space: nowrap;
  }

  html[data-variant="modern"] .participant-toolbar strong,
  html[data-variant="kami"] .participant-toolbar strong {
    font-size: calc(12px * var(--font-scale));
  }

  .participant-toolbar span {
    font-size: calc(9px * var(--font-scale));
  }

  .participant-toolbar-actions {
    gap: 0;
  }

  .participant-toolbar-actions button {
    padding-right: 5px;
    padding-left: 5px;
    font-size: calc(11px * var(--font-scale));
  }
}

/* Phone chrome stays fixed; only the page body scrolls beneath it. */
.screen > .safe-top {
  position: sticky;
  top: 0;
  z-index: 46;
  background: var(--paper);
}

html[data-variant] .screen > .safe-top + .topbar {
  position: sticky;
  top: max(47px, env(safe-area-inset-top));
  z-index: 45;
  background: color-mix(in srgb, var(--paper) 97%, transparent);
  backdrop-filter: blur(14px);
}

.tabbar {
  position: fixed;
}

/* --------------------------------------------------------------------------
   Competitor-faithful match ledger and single-active-match home flow
   -------------------------------------------------------------------------- */

.home-launch {
  display: grid;
  justify-items: center;
  margin: 42px 0 0;
  padding: 0 18px;
  text-align: center;
}

.home-profile-cta {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 2px 14px 4px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--ink-strong);
  cursor: pointer;
}

.home-profile-cta .avatar-lg {
  width: 66px;
  height: 66px;
  margin-bottom: 3px;
  box-shadow: 0 8px 22px rgb(20 34 50 / 7%);
}

.home-profile-cta strong {
  font-size: calc(16px * var(--font-scale));
  font-weight: 720;
}

.home-profile-cta > span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  color: var(--muted);
  font-size: calc(10px * var(--font-scale));
  line-height: 1.4;
}

.home-profile-cta .icon {
  width: 14px;
  height: 14px;
}

.home-profile-cta:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.home-launch h2 {
  margin: 24px 0 0;
  color: var(--ink-strong);
  font-size: calc(23px * var(--font-scale));
  font-weight: 720;
  letter-spacing: 0.02em;
}

.home-launch .create-button {
  width: 100%;
  min-height: 54px;
  margin: 28px 0 0;
}

.home-launch small {
  margin-top: 13px;
  color: var(--muted);
  font-size: calc(11px * var(--font-scale));
}

.single-match-hint {
  margin: 72px 0 0;
  color: var(--faint);
  font-size: calc(11px * var(--font-scale));
  line-height: 1.6;
  text-align: center;
}

.prototype-state-toggle {
  width: 100%;
  margin-top: 4px;
  color: var(--muted);
  font-size: calc(11px * var(--font-scale));
  font-weight: 500;
}

.dialog-backdrop {
  position: absolute;
  inset: 0;
  z-index: 80;
  background: rgb(16 22 29 / 36%);
  backdrop-filter: blur(2px);
  animation: fade-in 140ms ease-out;
}

.confirm-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 81;
  width: min(300px, calc(100% - 48px));
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 14px;
  background: rgb(255 255 255 / 97%);
  box-shadow: 0 24px 58px rgb(14 23 34 / 24%);
  text-align: center;
  transform: translate(-50%, -54%);
  animation: dialog-in 170ms ease-out;
}

.confirm-dialog h2 {
  margin: 24px 22px 0;
  color: #171b20;
  font-size: calc(18px * var(--font-scale));
  font-weight: 680;
}

.confirm-dialog p {
  margin: 9px 24px 22px;
  color: #5f6670;
  font-size: calc(13px * var(--font-scale));
  line-height: 1.65;
}

.confirm-dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid #e4e6e8;
}

.confirm-dialog-actions button {
  min-height: 50px;
  border: 0;
  border-right: 1px solid #e4e6e8;
  background: transparent;
  color: #4e5761;
  font-size: calc(16px * var(--font-scale));
  cursor: pointer;
}

.confirm-dialog-actions button:last-child {
  border-right: 0;
}

.confirm-dialog-actions button.is-primary {
  color: #2476ba;
  font-weight: 680;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96);
  }
}

html[data-variant="kami"] .home-profile-cta {
  border-radius: 8px;
}

html[data-variant="kami"] .home-profile-cta .avatar-lg {
  border-color: #c9c1af;
  box-shadow: none;
}

html[data-variant="kami"] .home-profile-cta strong {
  font-weight: 500;
  letter-spacing: 0.06em;
}

html[data-variant="kami"] .home-launch h2 {
  font-weight: 500;
  letter-spacing: 0.08em;
}

html[data-variant="kami"] .confirm-dialog {
  border-color: #cbc7b9;
  border-radius: 8px;
  background: #faf9f5;
  box-shadow: 0 22px 52px rgb(61 61 58 / 20%);
}

html[data-variant="kami"] .confirm-dialog h2 {
  font-weight: 500;
}

html[data-variant="kami"] .confirm-dialog-actions,
html[data-variant="kami"] .confirm-dialog-actions button {
  border-color: #d9d5c8;
}

.match-reference-page {
  --match-positive: #c8433b;
  --match-negative: #58b789;
  --match-neutral: #c8433b;
  background: #f6f6f6;
  color: #2d3033;
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    sans-serif;
}

.match-reference-page .safe-top {
  background: #fff;
}

.match-reference-page .topbar {
  position: sticky;
  top: 47px;
  z-index: 45;
  min-height: 54px;
  padding-top: 0;
  border-color: #ededed;
  background: rgb(255 255 255 / 98%);
  backdrop-filter: blur(14px);
}

html[data-variant="kami"] .match-reference-page .topbar::before {
  content: none;
}

.match-reference-page .topbar-title,
html[data-variant="kami"] .match-reference-page .topbar-title {
  color: #151719;
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    sans-serif;
  font-size: calc(18px * var(--font-scale));
  font-weight: 690;
  letter-spacing: 0;
}

.match-reference-page .icon-button,
html[data-variant="kami"] .match-reference-page .icon-button {
  color: #24282c;
}

.match-participant-summary {
  position: relative;
  z-index: 3;
  padding: 18px 18px 15px;
  background: #efefef;
}

.match-summary-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.match-summary-title {
  display: grid;
  justify-items: start;
}

.match-summary-title > strong {
  color: #303438;
  font-size: calc(17px * var(--font-scale));
  font-weight: 480;
}

.player-sort-button {
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 7px 0 0 -7px;
  padding: 0 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #686d72;
  font-size: calc(11px * var(--font-scale));
  cursor: pointer;
}

.player-sort-button:active {
  background: rgb(0 0 0 / 5%);
}

.player-sort-button span {
  color: #3c4146;
}

.player-sort-button small {
  font-size: inherit;
}

.player-sort-button b {
  color: #8e949a;
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: 500;
}

.match-total-scroll {
  overflow-x: auto;
  margin: 18px -8px 0;
  scrollbar-width: none;
}

.match-total-scroll::-webkit-scrollbar,
.match-round-table-scroll::-webkit-scrollbar {
  display: none;
}

.match-total-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(54px, 1fr);
  align-items: start;
}

.match-total-player {
  min-width: 0;
  display: grid;
  justify-items: center;
}

.match-total-player .avatar {
  width: 44px;
  height: 44px;
  border: 1px solid #e0e3e5;
  border-radius: 5px;
}

.match-total-player > strong {
  margin-top: 8px;
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(19px * var(--font-scale));
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.match-reference-page .positive {
  color: var(--match-positive);
}

.match-reference-page .negative {
  color: var(--match-negative);
}

.match-reference-page .neutral {
  color: var(--match-neutral);
}

.match-round-table-scroll {
  width: 100%;
  overflow-x: auto;
  background: #fff;
  scrollbar-width: none;
}

.match-round-table {
  width: max-content;
  min-width: 100%;
  background: #fff;
}

.match-round-avatar-head {
  position: relative;
  z-index: 35;
  width: max-content;
  min-width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 64px;
  grid-auto-flow: column;
  grid-auto-columns: calc((100vw - 64px) / var(--visible-result-columns));
  align-items: center;
  border-bottom: 1px solid #f0f0f0;
  background: rgb(255 255 255 / 98%);
  backdrop-filter: blur(12px);
}

.match-round-avatar-head > div {
  display: grid;
  place-items: center;
}

.match-round-avatar-head > span {
  position: sticky;
  left: 0;
  z-index: 2;
  align-self: stretch;
  background: inherit;
}

.match-round-avatar-head .avatar {
  width: 38px;
  height: 38px;
  border: 1px solid #e3e5e6;
  border-radius: 5px;
}

.match-round-row {
  width: max-content;
  min-width: 100%;
  min-height: 84px;
  display: grid;
  grid-template-columns: 64px;
  grid-auto-flow: column;
  grid-auto-columns: calc((100vw - 64px) / var(--visible-result-columns));
  align-items: center;
  background: #fff;
}

.match-round-row:nth-child(odd) {
  background: #fafafa;
}

.match-round-label {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 0;
  display: grid;
  align-content: center;
  align-self: stretch;
  padding-left: 16px;
  background: inherit;
}

.match-round-label strong,
.match-round-label time {
  display: block;
  white-space: nowrap;
}

.match-round-label strong {
  color: #32363a;
  font-size: calc(14px * var(--font-scale));
  font-weight: 510;
}

.match-round-label time {
  margin-top: 6px;
  color: #a0a3a6;
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(12px * var(--font-scale));
  font-variant-numeric: tabular-nums;
}

.match-round-value {
  min-width: 0;
  display: grid;
  place-items: center;
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(18px * var(--font-scale));
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.ended-match-link {
  width: 100%;
  min-height: 92px;
  display: grid;
  place-items: center;
  padding: 0 18px;
  border: 0;
  border-top: 1px solid #e8e8e8;
  background: #f8f7f7;
  color: #3b8fd0;
  font-size: calc(16px * var(--font-scale));
  cursor: pointer;
}

.match-reference-page .avatar-yang {
  background:
    linear-gradient(145deg, transparent 0 49%, #d2dde5 50% 67%, transparent 68%),
    linear-gradient(35deg, #edf2f5 0 48%, #dae5eb 49% 66%, #eef2f4 67%);
}

.match-reference-page .avatar-lin {
  background:
    radial-gradient(circle at 64% 30%, #f2d1bb 0 8%, transparent 9%),
    radial-gradient(ellipse at 48% 88%, #6c89a7 0 42%, transparent 43%),
    linear-gradient(145deg, #8aa4bd, #dce7ef);
}

.match-reference-page .avatar-chen {
  background:
    radial-gradient(circle at 50% 46%, #f1e7dd 0 26%, transparent 27%),
    radial-gradient(circle at 43% 45%, #4a433e 0 3%, transparent 4%),
    radial-gradient(circle at 57% 45%, #4a433e 0 3%, transparent 4%),
    #d8c8bb;
}

.match-reference-page .avatar-zhou {
  background:
    radial-gradient(circle at 42% 48%, #b99470 0 18%, transparent 19%),
    radial-gradient(circle at 65% 42%, #d5b18a 0 17%, transparent 18%),
    linear-gradient(150deg, #8b6a50, #e6d1b4);
}

.match-reference-page .avatar-viewer {
  background:
    linear-gradient(155deg, transparent 0 55%, #8ea6b8 56% 61%, transparent 62%),
    linear-gradient(25deg, #dfe8ed 0 45%, #a9c1ce 46% 58%, #e5ecef 59%);
}

html[data-variant="kami"] .match-reference-page,
html[data-variant="kami"] .match-reference-page .match-round-table,
html[data-variant="kami"] .match-reference-page .match-round-table-scroll {
  background: #f7f7f6;
}

html[data-variant="kami"] .match-reference-page .match-participant-summary {
  background: #eeeeeb;
}

html[data-variant="kami"] .match-reference-page .match-round-row:nth-child(odd) {
  background: #fafaf8;
}

html[data-variant="kami"] .match-reference-page .ended-match-link {
  background: #f5f4f0;
}

/* Shared H5 prototype component primitives. The native Mini Program maps these
   roles to TDesign components while keeping the score table product-specific. */
.ui-segmented-tabs,
.ui-data-matrix,
.ui-list-panel,
.ui-confirm-dialog,
.ui-score-table {
  --ui-hairline: var(--line);
  --ui-surface: var(--surface);
  --ui-muted: var(--muted);
}

.screen[data-screen="analysis"] .page-content {
  padding-right: 18px;
  padding-left: 18px;
}

.analysis-ranges.ui-segmented-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 22px;
}

.analysis-ranges.ui-segmented-tabs button {
  min-width: 0;
  padding: 0 2px;
  font-size: calc(13px * var(--font-scale));
  white-space: nowrap;
}

.analysis-ranges.ui-segmented-tabs button.is-active::after {
  right: 18%;
  left: 18%;
}

.metric-grid.ui-data-matrix {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(20 34 50 / 5%);
}

.metric-grid.ui-data-matrix .metric {
  min-height: 104px;
  border-color: var(--line);
}

.metric-grid.ui-data-matrix .metric strong {
  font-size: calc(34px * var(--font-scale));
}

.metric-grid.ui-data-matrix .metric span {
  font-size: calc(13px * var(--font-scale));
}

.blessing-section {
  margin-top: 28px;
  padding: 18px 16px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(20 34 50 / 5%);
}

.blessing-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 11px;
}

.blessing-head h2,
.blessing-head p {
  margin: 0;
}

.blessing-head h2 {
  color: var(--ink-strong);
  font-size: calc(19px * var(--font-scale));
  font-weight: 720;
}

.blessing-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: calc(11px * var(--font-scale));
}

.blessing-head > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: calc(10px * var(--font-scale));
  white-space: nowrap;
}

.blessing-head > span .icon {
  width: 14px;
  height: 14px;
}

.blessing-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.blessing-row {
  min-height: 70px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border-top: 1px solid var(--line);
}

.blessing-row .avatar {
  width: 38px;
  height: 38px;
}

.blessing-copy {
  min-width: 0;
}

.blessing-copy strong,
.blessing-copy span {
  display: block;
}

.blessing-copy strong {
  color: var(--text);
  font-size: calc(15px * var(--font-scale));
  font-weight: 660;
}

.blessing-copy span {
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: calc(10px * var(--font-scale));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blessing-row > b {
  color: var(--positive);
  font-family: "DIN Alternate", "Arial Narrow", sans-serif;
  font-size: calc(14px * var(--font-scale));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.blessing-note {
  margin: 8px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: calc(9px * var(--font-scale));
  line-height: 1.6;
  text-align: center;
}

.blessing-section + .chart-section {
  margin-top: 24px;
}

html[data-variant="kami"] .metric-grid.ui-data-matrix,
html[data-variant="kami"] .blessing-section {
  border-color: var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 7px 20px rgb(80 78 73 / 4%);
}

html[data-variant="kami"] .blessing-head h2,
html[data-variant="kami"] .blessing-copy strong {
  font-weight: 500;
}

html[data-variant="kami"] .blessing-row > b {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

@media (max-width: 340px) {
  .match-participant-summary {
    padding-right: 12px;
    padding-left: 12px;
  }

  .match-total-scroll {
    margin-right: -4px;
    margin-left: -4px;
  }

  .match-total-player .avatar {
    width: 38px;
    height: 38px;
  }

  .match-round-avatar-head .avatar {
    width: 34px;
    height: 34px;
  }

  .match-round-label {
    padding-left: 9px;
  }

  .match-round-label strong {
    font-size: calc(12px * var(--font-scale));
  }

  .match-round-label time {
    font-size: calc(9px * var(--font-scale));
  }

  .match-round-value {
    font-size: calc(16px * var(--font-scale));
  }

  .analysis-ranges.ui-segmented-tabs button {
    font-size: calc(11px * var(--font-scale));
  }

  .blessing-section {
    padding-right: 12px;
    padding-left: 12px;
  }

  .blessing-row {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .blessing-row .avatar {
    width: 34px;
    height: 34px;
  }
}
