:root {
  --canvas: #e8eeea;
  --canvas-deep: #dce5df;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-soft: #f4f7f5;
  --ink: #102019;
  --ink-soft: #53635a;
  --hairline: #d6dfd9;
  --hero: #122019;
  --hero-soft: #26382e;
  --red: #d83e45;
  --green: #168353;
  --gold: #bd9650;
  --blue: #3f7184;
  --shadow-sm: 0 8px 24px rgba(22, 39, 30, 0.07);
  --shadow-md: 0 18px 48px rgba(22, 39, 30, 0.11);
}

html {
  background: var(--canvas);
}

body.prediction-page,
body.betting-page {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 0%, rgba(76, 117, 94, 0.13), transparent 26rem),
    radial-gradient(circle at 96% 16%, rgba(189, 150, 80, 0.09), transparent 30rem),
    linear-gradient(145deg, var(--canvas) 0%, #f3f6f4 54%, var(--canvas-deep) 100%);
  background-attachment: fixed;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

body.prediction-page::before,
body.betting-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  display: block;
  pointer-events: none;
  opacity: 0.34;
  background-image: radial-gradient(rgba(20, 39, 29, 0.14) 0.7px, transparent 0.7px);
  background-size: 18px 18px;
  mask-image: linear-gradient(to bottom, #000, transparent 72%);
}

.app {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px clamp(18px, 3vw, 42px) 42px;
}

.topbar {
  position: relative;
  display: block;
  min-height: 224px;
  margin: 0 0 22px;
  padding: 32px 34px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background-color: var(--hero);
  background-image:
    linear-gradient(90deg, rgba(12, 27, 19, 0.99) 0%, rgba(14, 30, 21, 0.95) 44%, rgba(14, 30, 21, 0.3) 74%, rgba(14, 30, 21, 0.04) 100%),
    url("header-visual.png");
  background-repeat: no-repeat;
  background-position: center, right center;
  background-size: 100% 100%, auto 100%;
  box-shadow: 0 22px 60px rgba(16, 32, 23, 0.2);
  animation: heroIn 0.58s cubic-bezier(.2,.7,.2,1) both;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.22;
  background:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(90deg, #000, transparent 72%);
}

.topbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(213, 181, 115, .55), transparent);
}

.topbar .title {
  position: relative;
  z-index: 2;
  width: min(620px, 62%);
}

.eyebrow {
  margin-bottom: 11px;
  color: #bda875;
  font-family: Bahnschrift, "Microsoft YaHei UI", sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.19em;
}

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

.title h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.18;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.22);
}

.title p {
  margin: 9px 0 0;
  color: #aebbb4;
  font-size: 0.87rem;
  line-height: 1.6;
}

.system-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  color: #e1e9e4;
  backdrop-filter: blur(10px);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.system-state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #60d194;
  box-shadow: 0 0 0 4px rgba(96, 209, 148, 0.14);
  animation: livePulse 2.2s ease-in-out infinite;
}

.tabs {
  position: absolute;
  bottom: 24px;
  left: 34px;
  z-index: 3;
  display: inline-flex;
  gap: 4px;
  margin: 0;
  padding: 4px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 13px;
  background: rgba(4, 16, 10, 0.42);
  backdrop-filter: blur(14px);
}

.tab {
  position: relative;
  min-width: 96px;
  padding: 10px 17px;
  overflow: hidden;
  border-radius: 9px;
  color: #aebbb4;
  text-align: center;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
  transition: color .2s ease, background-color .2s ease, transform .2s ease;
}

.tab:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
}

.tab.active {
  color: #16251d;
  background: #f6f8f7;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.2);
}

.tab.active::after {
  display: none;
}

.tab:active {
  transform: scale(.97);
}

.summary {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 14px;
  margin: 0 0 18px;
}

.prediction-page .summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.betting-page .summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  position: relative;
  min-height: 142px;
  padding: 19px 20px 18px;
  overflow: hidden;
  border: 1px solid rgba(199, 211, 203, 0.9);
  border-top: 3px solid #84958b;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.99), rgba(247,250,248,.96));
  box-shadow: var(--shadow-sm);
  transition: transform .24s cubic-bezier(.2,.7,.2,1), box-shadow .24s ease, border-color .24s ease;
  animation: cardIn .52s cubic-bezier(.2,.7,.2,1) both;
}

.card:nth-child(2) { animation-delay: .06s; }
.card:nth-child(3) { animation-delay: .12s; }
.card:nth-child(4) { animation-delay: .18s; }

.card::after {
  content: "";
  position: absolute;
  top: -46px;
  right: -42px;
  width: 132px;
  height: 132px;
  border: 24px solid rgba(73, 103, 86, 0.035);
  border-radius: 50%;
}

.card:hover {
  transform: translateY(-5px);
  border-color: #b8c7be;
  box-shadow: var(--shadow-md);
}

.card-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card .label {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.05em;
}

.card-mark {
  padding: 4px 7px;
  border: 1px solid currentColor;
  border-radius: 6px;
  color: #68786f;
  font-family: Bahnschrift, sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  opacity: 0.78;
}

.card .value {
  position: relative;
  z-index: 1;
  margin-top: 13px;
  color: var(--ink);
  font-family: Bahnschrift, "Microsoft YaHei UI", sans-serif;
  font-size: clamp(1.32rem, 2vw, 1.72rem);
  font-weight: 760;
  letter-spacing: -0.025em;
  line-height: 1.08;
}

.card .note {
  position: relative;
  z-index: 1;
  margin-top: 9px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.55;
}

.tone-gold { border-top-color: var(--gold); }
.tone-gold .card-mark { color: #987332; background: #fff9eb; }
.tone-blue { border-top-color: var(--blue); }
.tone-blue .card-mark { color: #35677a; background: #f0f7f9; }
.tone-slate { border-top-color: #66766d; }
.tone-slate .card-mark { color: #57675e; background: #f2f5f3; }
.tone-profit,
.card.positive { border-top-color: var(--red); }
.tone-profit .card-mark { color: #b62f35; background: #fff2f2; }
.tone-loss,
.card.negative { border-top-color: var(--green); }
.tone-loss .card-mark { color: #126d45; background: #edf9f2; }

.betting-page .value.positive,
.betting-page .money.positive {
  color: var(--red);
}

.betting-page .value.negative,
.betting-page .money.negative {
  color: var(--green);
}

.rule-bar {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 0 0 18px;
  padding: 15px 18px;
  overflow: hidden;
  border: 1px solid #c8d3cc;
  border-left: 0;
  border-radius: 15px;
  background:
    linear-gradient(90deg, #1a2a21 0, #24372c 15%, rgba(255,255,255,.98) 15%, rgba(255,255,255,.98) 100%);
  box-shadow: var(--shadow-sm);
  color: #425249;
  font-size: 0.8rem;
}

.rule-bar strong {
  min-width: 170px;
  color: #f5f8f6;
  font-family: Bahnschrift, "Microsoft YaHei UI", sans-serif;
  font-size: 0.86rem;
  letter-spacing: .02em;
}

.rule-bar span {
  position: relative;
  padding-left: 14px;
}

.rule-bar span::before {
  content: "";
  position: absolute;
  top: .52em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
}

.panel {
  position: relative;
  margin: 0 0 18px;
  overflow: hidden;
  border: 1px solid rgba(199, 211, 203, 0.94);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: panelIn .58s .12s cubic-bezier(.2,.7,.2,1) both;
}

.panel-head {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0;
  padding: 21px 24px 17px;
  border-bottom: 1px solid var(--hairline);
  background:
    linear-gradient(90deg, rgba(245,248,246,.96), rgba(255,255,255,.98));
}

.panel-head::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 24px;
  width: 54px;
  height: 2px;
  background: linear-gradient(90deg, var(--red), #e88c8f);
}

.section-label {
  margin-bottom: 6px;
  color: #8b6f37;
  font-family: Bahnschrift, sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.panel-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 750;
  letter-spacing: -0.015em;
}

.panel-head p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.55;
}

.table-wrap {
  overflow-x: auto;
  scrollbar-color: #aebbb3 #eef2ef;
  scrollbar-width: thin;
}

.table-wrap::-webkit-scrollbar {
  height: 9px;
}

.table-wrap::-webkit-scrollbar-track {
  background: #eef2ef;
}

.table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid #eef2ef;
  border-radius: 999px;
  background: #aebbb3;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 14px;
  border-bottom: 1px solid #d3ddd6;
  background: #eaf0ec;
  color: #405148;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: .035em;
  white-space: nowrap;
}

tbody td {
  padding: 15px 14px;
  border: 0;
  border-bottom: 1px solid #e2e8e4;
  background: rgba(255,255,255,.95);
  color: #1d2d24;
  vertical-align: top;
  font-size: 0.83rem;
  transition: background-color .18s ease;
}

tbody tr:nth-child(even) td {
  background: #f7faf8;
}

tbody tr:hover td {
  background: #edf4f0;
}

tbody tr.selected td {
  background: #fff5f5;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody td + td {
  border-left: 1px solid rgba(218, 226, 221, .6);
}

.period,
.money {
  font-family: Bahnschrift, "Microsoft YaHei UI", sans-serif;
  font-variant-numeric: tabular-nums;
}

.period {
  color: #16261d;
  font-size: 0.94rem;
  font-weight: 760;
  white-space: nowrap;
}

.kind,
.small,
.line-label,
.muted {
  color: var(--ink-soft);
}

.kind,
.small {
  margin-top: 5px;
  font-size: 0.72rem;
  line-height: 1.5;
}

.line {
  gap: 6px;
  font-size: 0.82rem;
}

.line-label {
  min-width: 48px;
  font-size: 0.72rem;
}

.chip {
  min-width: 31px;
  height: 31px;
  padding: 0 7px;
  border: 1px solid #d2dcd5;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff, #f0f4f1);
  color: #213228;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
  font-family: Bahnschrift, sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
}

.chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(35, 57, 44, .12);
}

.chip.hit {
  border: 2px solid var(--red);
  background: linear-gradient(180deg, #fff, #fff4f4);
  color: #c63238;
  box-shadow: 0 0 0 4px rgba(216, 62, 69, .1);
}

.chip.special {
  border-color: #ceb06f;
  background: linear-gradient(180deg, #fffdf6, #faf2df);
  color: #805f20;
}

.status {
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 0.7rem;
  font-weight: 750;
}

.status.pending {
  border-color: #e5ce91;
  background: #fff8e5;
  color: #805d11;
}

.status.verified,
.status.settled {
  border-color: #c9d8df;
  background: #eff7fa;
  color: #315f73;
}

.summary-text {
  color: #26372e;
  font-size: 0.8rem;
  line-height: 1.65;
}

.money {
  font-size: 0.84rem;
  font-weight: 740;
}

.profit-row td:first-child {
  box-shadow: inset 3px 0 0 var(--red);
}

.loss-row td:first-child {
  box-shadow: inset 3px 0 0 var(--green);
}

.pending-row td:first-child {
  box-shadow: inset 3px 0 0 var(--gold);
}

.hit-badge {
  min-width: 58px;
  padding: 6px 10px;
  border-color: #c7d3cb;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #edf3ef);
  color: #23362a;
  box-shadow: 0 3px 8px rgba(35, 54, 43, .06);
}

.foot {
  margin: 0;
  padding: 13px 18px;
  border-top: 1px solid var(--hairline);
  color: #65746c;
  font-size: 0.72rem;
  line-height: 1.6;
}

.betting-page > .app > .foot {
  padding: 2px 4px 8px;
  border: 0;
}

.ripple {
  background: rgba(255,255,255,.24);
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(-12px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .62; transform: scale(.86); }
}

@media (max-width: 1100px) {
  .betting-page .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rule-bar {
    background: #fff;
  }

  .rule-bar strong {
    width: 100%;
    padding: 9px 12px;
    border-radius: 9px;
    background: #1c2d23;
  }
}

@media (max-width: 820px) {
  .app {
    padding: 14px 12px 28px;
  }

  .topbar {
    min-height: 246px;
    padding: 24px 20px 82px;
    border-radius: 19px;
    background-size: 100% 100%, auto 82%;
  }

  .topbar .title {
    width: 100%;
  }

  .eyebrow {
    font-size: .6rem;
  }

  .title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .title h1 {
    font-size: 1.55rem;
  }

  .title p {
    margin-top: 12px;
  }

  .tabs {
    right: 20px;
    bottom: 20px;
    left: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tab {
    min-width: 0;
  }

  .prediction-page .summary,
  .betting-page .summary {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 124px;
  }

  .panel {
    border-radius: 16px;
  }

  .panel-head {
    padding: 18px 17px 14px;
  }

  .panel-head::after {
    left: 17px;
  }

  .rule-bar {
    border-left: 1px solid #c8d3cc;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar,
  .card,
  .panel,
  .system-state::before {
    animation: none;
  }
}

/* Ink and ivory palette */
:root {
  --canvas: #ebe8e1;
  --canvas-deep: #ddd8ce;
  --surface: rgba(253, 251, 247, 0.97);
  --surface-soft: #f5f1ea;
  --ink: #171d24;
  --ink-soft: #5f6267;
  --hairline: #ded8ce;
  --hero: #111823;
  --hero-soft: #242c36;
  --red: #c83d45;
  --green: #1f7f69;
  --gold: #b89961;
  --blue: #596f86;
  --shadow-sm: 0 8px 24px rgba(24, 28, 35, 0.07);
  --shadow-md: 0 18px 48px rgba(24, 28, 35, 0.12);
}

body.prediction-page,
body.betting-page {
  background-color: var(--canvas);
  background-image:
    linear-gradient(rgba(250, 248, 243, 0.4), rgba(244, 241, 234, 0.48)),
    url("page-background.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

body.prediction-page::before,
body.betting-page::before {
  display: none;
}

.topbar {
  border-color: rgba(255, 255, 255, 0.1);
  background-color: var(--hero);
  background-image:
    linear-gradient(90deg, rgba(10, 16, 27, 0.99) 0%, rgba(13, 20, 31, 0.95) 44%, rgba(13, 20, 31, 0.32) 74%, rgba(13, 20, 31, 0.04) 100%),
    url("header-visual-v2.png");
  box-shadow: 0 22px 60px rgba(17, 23, 33, 0.24);
}

.eyebrow { color: #c4aa78; }
.title p,
.tab { color: #b7bdc5; }
.system-state { color: #e5e8ed; }
.tabs { background: rgba(6, 10, 17, 0.46); }

.tab.active {
  color: #171d24;
  background: #f8f5ef;
}

.card {
  border-color: rgba(216, 209, 197, 0.94);
  background: linear-gradient(145deg, rgba(255,254,251,.99), rgba(247,243,236,.97));
}

.card:hover { border-color: #c9bead; }
.card-mark { color: #6d6d70; }
.tone-gold .card-mark { color: #8a692f; background: #fcf6e9; }
.tone-blue .card-mark { color: #4c6279; background: #eef2f6; }
.tone-slate .card-mark { color: #5f6267; background: #f1efeb; }
.tone-profit .card-mark { color: #a92f36; background: #fff0f0; }
.tone-loss .card-mark { color: #176c59; background: #edf8f4; }

.rule-bar {
  border-color: #d5cec2;
  background:
    linear-gradient(90deg, #171d27 0, #28313d 15%, rgba(253,251,247,.99) 15%, rgba(253,251,247,.99) 100%);
  color: #565a61;
}

.panel {
  border-color: rgba(216, 209, 197, 0.96);
}

.panel-head {
  background: linear-gradient(90deg, rgba(246,242,235,.97), rgba(253,251,247,.99));
}

.section-label { color: #9a7840; }

.table-wrap {
  scrollbar-color: #aaa49a #eeeae3;
}

.table-wrap::-webkit-scrollbar-track { background: #eeeae3; }
.table-wrap::-webkit-scrollbar-thumb {
  border-color: #eeeae3;
  background: #aaa49a;
}

thead th {
  border-bottom-color: #d9d2c7;
  background: #eeeae3;
  color: #4d5056;
}

tbody td {
  border-bottom-color: #e5dfd5;
  background: rgba(253,251,247,.97);
  color: #252a30;
}

tbody tr:nth-child(even) td { background: #f7f3ed; }
tbody tr:hover td { background: #f0ece5; }
tbody td + td { border-left-color: rgba(222, 216, 206, 0.72); }
.period { color: #1d232a; }
.summary-text { color: #30343a; }

.chip {
  border-color: #d8d1c6;
  background: linear-gradient(180deg, #fffefa, #f1ede6);
  color: #282d33;
}

.chip:hover { box-shadow: 0 5px 12px rgba(39, 42, 48, .13); }

.chip.special {
  border-color: #c8a867;
  background: linear-gradient(180deg, #fffdf7, #f6edda);
  color: #76571e;
}

.status.verified,
.status.settled {
  border-color: #cbd4de;
  background: #f0f4f8;
  color: #4b6279;
}

.hit-badge {
  border-color: #d3ccc1;
  background: linear-gradient(180deg, #fffefa, #f0ece5);
  color: #282e35;
  box-shadow: 0 3px 8px rgba(40, 43, 49, .07);
}

.foot { color: #6a6867; }

@media (max-width: 1100px) {
  .rule-bar { background: #fdfbf7; }
  .rule-bar strong { background: #1a212c; }
}

@media (max-width: 820px) {
  .rule-bar { border-left-color: #d5cec2; }
}
