:root {
  --felt: #17513e;
  --felt-deep: #0d3528;
  --felt-light: #1f6a51;
  --line: rgba(247, 242, 228, 0.26);
  --ivory: #f7f2e4;
  --ink: #1e2226;
  --red: #bf2a2f;
  --gold: #e6b94a;
  --text: #edf3ed;
  --muted: #b4ccbf;

  --font-body: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  --font-title: "KaiTi", "STKaiti", "Kaiti SC", "Noto Serif SC", serif;
  --font-number: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", sans-serif;
  --font-card: Georgia, "Times New Roman", serif;

  --slot-width: 62px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  /* 像灯从牌桌正上方照下来：中间亮，四周暗。 */
  background:
    radial-gradient(120% 90% at 50% 0%, var(--felt-light) 0%, var(--felt) 45%, var(--felt-deep) 100%)
    fixed var(--felt-deep);
}

h1,
h2,
p,
ol,
dl,
dd {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 28px 56px;
}

.masthead {
  margin-bottom: 32px;
}

.masthead h1 {
  font-family: var(--font-title);
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.04em;
}

.masthead p {
  margin-top: 10px;
  max-width: 34em;
  color: var(--muted);
}

h2 {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 400;
  color: var(--muted);
}

.fine {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* ---------- 牌 ---------- */

.card {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  aspect-ratio: 5 / 7;
  font-family: var(--font-card);
  color: var(--ink);
  background: var(--ivory);
}

.card.red {
  color: var(--red);
}

.face {
  display: grid;
  justify-items: center;
  line-height: 1;
}

.rank {
  font-weight: 700;
  letter-spacing: -0.04em;
}

/* ---------- 牌桌上的格子 ---------- */

.slots {
  display: flex;
  gap: 8px;
}

.slot {
  width: var(--slot-width);
  background: rgba(13, 53, 40, 0.55);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

.slot.filled {
  background: var(--ivory);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
}

.slot.active {
  box-shadow: inset 0 0 0 2.5px var(--gold);
}

.slot .rank {
  font-size: 28px;
}

.slot .suit {
  margin-top: 2px;
  font-size: 24px;
}

.slot .face {
  animation: deal 160ms ease-out;
}

@keyframes deal {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.92);
  }
}

.table-top {
  display: flex;
  gap: 36px;
  align-items: flex-start;
}

.opponents {
  flex: 1;
  min-width: 0;
}

.stepper {
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
}

.stepper button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 22px;
  line-height: 1;
}

.stepper button:hover:not([aria-disabled="true"]) {
  background: rgba(247, 242, 228, 0.12);
}

.stepper button[aria-disabled="true"] {
  opacity: 0.3;
  cursor: default;
}

.stepper output {
  min-width: 36px;
  text-align: center;
  font-family: var(--font-number);
  font-size: 26px;
  line-height: 1;
}

/* 公共牌区域用一圈细线围起来，像牌桌上印的那道线。 */
.board {
  margin-top: 26px;
  padding: 16px 18px 14px;
  border: 1.5px solid var(--line);
  border-radius: 22px;
}

.board-streets {
  display: flex;
  gap: 16px;
}

.board-street-name {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.actions button {
  min-height: 40px;
  padding: 0 18px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: none;
  font-size: 14px;
}

.actions button:hover {
  background: rgba(247, 242, 228, 0.12);
}

/* ---------- 胜率 ---------- */

.result {
  margin-top: 30px;
}

.streets {
  display: flex;
  padding: 0;
  list-style: none;
  border-top: 1.5px solid var(--line);
  border-bottom: 1.5px solid var(--line);
}

.street {
  flex: 1 1 0;
  min-width: 0;
  padding: 12px 0 12px 14px;
  border-left: 1.5px solid var(--line);
  color: var(--muted);
  transition: flex-grow 200ms ease;
}

.street:first-child {
  padding-left: 0;
  border-left: 0;
}

.street.current {
  flex-grow: 2.4;
  color: var(--text);
}

.street-name {
  display: block;
  font-size: 13px;
}

.street-rate {
  display: block;
  margin-top: 4px;
  font-family: var(--font-number);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}

.street.reached .street-rate {
  color: var(--text);
}

.street.current .street-rate {
  font-size: clamp(46px, 11vw, 64px);
  line-height: 1;
  color: var(--gold);
}

.detail {
  margin-top: 18px;
}

.bar {
  display: flex;
  height: 10px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--felt-deep);
}

.bar span {
  display: block;
  height: 100%;
}

.bar-win {
  background: var(--gold);
}

.bar-tie {
  background: var(--ivory);
}

.bar-lose {
  background: var(--felt-deep);
}

.split {
  display: flex;
  gap: 24px;
  margin-top: 10px;
}

.split div {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.split dt {
  font-size: 14px;
  color: var(--muted);
}

.split dt::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
}

.split-win dt::before {
  background: var(--gold);
}

.split-tie dt::before {
  background: var(--ivory);
}

.split-lose dt::before {
  background: var(--felt-deep);
  box-shadow: 0 0 0 1px var(--line);
}

.split dd {
  font-family: var(--font-number);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.equity-note {
  margin-top: 6px;
}

.made-hand {
  margin-top: 10px;
}

.note {
  margin-top: 12px;
  min-height: 1.5em;
  font-size: 14px;
  color: var(--muted);
}

/* ---------- 选牌 ---------- */

.picker {
  padding: 20px 22px 24px;
  border-radius: 22px;
  background: rgba(13, 53, 40, 0.6);
}

.picker h2 {
  margin-bottom: 2px;
}

.picker-rows {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.picker-row {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 5px;
}

.pick {
  border-radius: 5px;
  box-shadow: 0 1.5px 0 rgba(0, 0, 0, 0.28);
}

.pick .rank {
  font-size: 17px;
}

.pick .suit {
  margin-top: 1px;
  font-size: 15px;
}

.pick:hover:not([aria-disabled="true"]) {
  transform: translateY(-2px);
}

.pick[aria-disabled="true"] {
  opacity: 0.2;
  box-shadow: none;
  cursor: default;
}

/* ---------- 窄屏：上下排列，选牌区每种花色排两行，方便手指点 ---------- */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .table {
    max-width: 520px;
  }
}

@media (max-width: 560px) {
  :root {
    --slot-width: 52px;
  }

  .page {
    padding: 24px 16px 40px;
  }

  .masthead {
    margin-bottom: 24px;
  }

  .table-top {
    gap: 20px;
  }

  .board {
    padding: 14px 12px 12px;
  }

  .board-streets {
    gap: 10px;
  }

  .slots {
    gap: 6px;
  }

  .slot .rank {
    font-size: 23px;
  }

  .slot .suit {
    font-size: 20px;
  }

  .street {
    padding-left: 10px;
  }

  .picker {
    padding: 16px 14px 18px;
  }

  .picker-row {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
  }

  /* 牌做扁一点、点数和花色并排，这样胜率和选牌区能同屏看到。 */
  .pick {
    aspect-ratio: 5 / 4;
  }

  .pick .face {
    grid-auto-flow: column;
    align-items: center;
    gap: 1px;
  }

  .pick .rank {
    font-size: 18px;
  }

  .pick .suit {
    margin-top: 0;
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slot .face {
    animation: none;
  }

  .street {
    transition: none;
  }

  .pick:hover:not([aria-disabled="true"]) {
    transform: none;
  }
}
