:root {
  --bg: #070d0b;
  --bg-2: #0c1512;
  --panel: #101d18;
  --panel-2: #152620;
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef5f1;
  --muted: #8fa69b;
  --green: #39d98a;
  --green-dim: #1f8a5b;
  --orange: #ff8a3d;
  --orange-2: #ff5f1f;
  --red: #e8564f;
  --blue: #4b9cff;
  --gold: #ffd166;
  --felt-1: #12422f;
  --felt-2: #0a2a1f;
  --felt-3: #061a13;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(43, 122, 88, 0.28), transparent 60%),
    radial-gradient(900px 600px at 110% 20%, rgba(255, 138, 61, 0.08), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 45%);
  background-attachment: fixed;
}

button, input { font-family: inherit; }

button {
  cursor: pointer;
  border: 0;
  color: inherit;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
  filter: grayscale(0.4);
}

button:focus-visible, input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px clamp(14px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 16, 13, 0.72);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  font-size: 24px;
  color: #0b1a13;
  background: linear-gradient(145deg, #b9f4d6, #39d98a 55%, #168a55);
  box-shadow: 0 8px 22px rgba(57, 217, 138, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.brand-text h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0.04em;
  font-weight: 800;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.14em;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.4vw, 30px);
  margin-left: auto;
}

.top-meta > div {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}

.top-meta b {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.top-meta i { font-style: normal; font-size: 11px; color: var(--muted); }

.speed-toggle {
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  transition: 0.18s ease;
}

.speed-toggle[aria-pressed="true"] {
  color: #1b1206;
  background: linear-gradient(135deg, var(--gold), #ffae42);
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(255, 174, 66, 0.28);
}

/* ---------- 买入栏 ---------- */
.buyin-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1500px;
  margin: 12px auto 0;
  padding: 9px clamp(14px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(160deg, rgba(21, 38, 32, 0.92), rgba(10, 19, 15, 0.92));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
}

.buyin-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.buyin-presets { display: flex; gap: 6px; }

.buyin-presets button {
  min-width: 62px;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  color: #cfe3d7;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: 0.15s ease;
}

.buyin-presets button:hover { background: rgba(255, 255, 255, 0.11); }

.buyin-presets button.is-active {
  color: #082116;
  background: linear-gradient(145deg, #c8f8e1, var(--green));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(57, 217, 138, 0.24);
}

.buyin-stack {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.buyin-stack b {
  margin-left: 4px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}

.rebuy-btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 15px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #ffe0c8;
  background: linear-gradient(145deg, #6a2c16, #3f1c0f);
  border: 1px solid rgba(255, 138, 61, 0.5);
  transition: 0.16s ease;
}

.rebuy-btn:hover { filter: brightness(1.12); }

.rebuy-btn.is-needed {
  color: #291204;
  background: linear-gradient(145deg, #ffd0a5, var(--orange));
  border-color: transparent;
  animation: rebuyPulse 1.3s ease-in-out infinite;
}

@keyframes rebuyPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 138, 61, 0.4); }
  50% { box-shadow: 0 0 0 7px rgba(255, 138, 61, 0); }
}

/* ---------- 主布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: clamp(14px, 2vw, 26px);
  padding: clamp(14px, 2.4vw, 30px) clamp(14px, 3vw, 34px) 0;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
}

/* ---------- 牌桌 ---------- */
.table-area { min-width: 0; }

.table-frame {
  position: relative;
  padding: clamp(8px, 1.2vw, 15px);
  border-radius: 46% / 50%;
  background:
    linear-gradient(150deg, #7d5b34 0%, #4b341d 18%, #9a7244 38%, #4a321b 58%, #7a5833 80%, #392613 100%);
  box-shadow:
    var(--shadow),
    inset 0 2px 2px rgba(255, 224, 178, 0.35),
    inset 0 -6px 14px rgba(0, 0, 0, 0.6);
}

.table-felt {
  position: relative;
  aspect-ratio: 1.82 / 1;
  border-radius: 46% / 50%;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(51, 145, 103, 0.34), transparent 62%),
    radial-gradient(ellipse at 50% 55%, var(--felt-1), var(--felt-2) 58%, var(--felt-3) 100%);
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.62),
    inset 0 0 0 2px rgba(255, 255, 255, 0.06),
    inset 0 12px 28px rgba(0, 0, 0, 0.35);
  overflow: visible;
}

.table-felt::after {
  content: "";
  position: absolute;
  inset: 16% 18%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.055);
  pointer-events: none;
}

.table-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
  width: min(56%, 560px);
  text-align: center;
  z-index: 2;
}

.street-pill {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(233, 255, 244, 0.78);
  background: rgba(4, 16, 11, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.board {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(4px, 0.8vw, 10px);
  min-height: clamp(52px, 8.4vw, 102px);
  margin: 10px 0 8px;
  perspective: 900px;
}

.board .card-slot {
  width: clamp(38px, 5.5vw, 70px);
  height: clamp(52px, 7.8vw, 98px);
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.015);
}

.pot-line {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 16px;
  border-radius: 999px;
  font-size: 11px;
  color: rgba(224, 246, 233, 0.72);
  background: rgba(2, 10, 7, 0.48);
}

.pot-line b {
  font-size: clamp(15px, 1.7vw, 20px);
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.result-line {
  min-height: 22px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.table-hint {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 座位 ---------- */
.seats { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

.seat {
  position: absolute;
  width: clamp(86px, 9.4vw, 132px);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 6px 6px;
  border-radius: 14px;
  background: rgba(7, 19, 14, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.36);
  transition: opacity 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.seat-0 { left: 50%; top: 94%; width: clamp(120px, 12vw, 158px); z-index: 5; }
.seat-1 { left: 12%; top: 77%; }
.seat-2 { left: 7%; top: 27%; }
.seat-3 { left: 50%; top: 5%; }
.seat-4 { left: 93%; top: 27%; }
.seat-5 { left: 88%; top: 77%; }

.seat.is-current {
  border-color: rgba(255, 209, 102, 0.75);
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.55), 0 0 26px rgba(255, 190, 80, 0.28), 0 10px 24px rgba(0, 0, 0, 0.4);
}

.seat.is-hero { background: rgba(9, 26, 19, 0.9); }

.seat.is-folded {
  opacity: 0.34;
  filter: grayscale(0.85);
}

.seat.is-allin { border-color: rgba(255, 138, 61, 0.6); }
.seat.is-allin .seat-stack { color: var(--orange); }

.seat.is-thinking {
  border-color: rgba(255, 209, 102, 0.72);
}

.seat.is-thinking .seat-avatar {
  animation: seatThinking 1.05s ease-in-out infinite;
}

.seat-thinking {
  margin-top: -1px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

@keyframes seatThinking {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.28), 0 0 8px rgba(255, 209, 102, 0.15); }
  50% { box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.05), 0 0 18px rgba(255, 209, 102, 0.55); }
}

.seat-top {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  justify-content: center;
}

.seat-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: clamp(24px, 2.6vw, 32px);
  height: clamp(24px, 2.6vw, 32px);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  color: #dff7e9;
  background: linear-gradient(145deg, #2b5c47, #16362a);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.seat-0 .seat-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(145deg, #d7f8e7, #39d98a 60%, #168a55);
  color: #08301f;
}

.seat-id { min-width: 0; text-align: left; line-height: 1.15; }

.seat-name {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  font-size: clamp(10px, 0.95vw, 12px);
  font-weight: 700;
  white-space: nowrap;
}

.seat-name .pos {
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #0d1f17;
  background: var(--gold);
}

.seat-style {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  color: var(--muted);
}

.seat-stack {
  font-size: clamp(10px, 0.95vw, 12px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #d9eee3;
}

.seat-cards {
  position: absolute;
  bottom: calc(100% - 2px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
}

.seat-0 .seat-cards {
  bottom: calc(100% - 8px);
  gap: 5px;
}

.seat-bet {
  position: absolute;
  left: 50%;
  top: calc(100% + 5px);
  transform: translateX(-50%);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  color: #1b1206;
  background: linear-gradient(180deg, #ffe3a1, #ffc247);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.seat-bet::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: rgba(90, 55, 0, 0.45);
}

.seat-bet span { margin-left: 6px; }

.seat-status {
  position: absolute;
  right: -4px;
  top: -6px;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 8px;
  font-weight: 800;
  color: #351a05;
  background: var(--orange);
}

/* ---------- 扑克牌 ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(22px, 2.6vw, 34px);
  height: clamp(31px, 3.7vw, 48px);
  border-radius: 5px;
  background: linear-gradient(160deg, #ffffff, #eef1ef 70%, #dfe5e1);
  color: #111a16;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22), 0 4px 10px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.card .r { font-size: clamp(11px, 1.35vw, 17px); }
.card .s { font-size: clamp(10px, 1.2vw, 15px); margin-top: 1px; }

.card.red { color: #d1303a; }
.card.black { color: #17211c; }

.card.big {
  width: clamp(38px, 4.4vw, 54px);
  height: clamp(52px, 6.1vw, 74px);
  border-radius: 7px;
}

.card.big .r { font-size: clamp(18px, 2.1vw, 25px); }
.card.big .s { font-size: clamp(16px, 1.9vw, 23px); }

.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.11) 0 3px, transparent 3px 7px),
    linear-gradient(150deg, #224f6e, #123049 55%, #0b2033);
  border: 1px solid rgba(180, 220, 255, 0.22);
}

.card.back::after {
  content: "♠";
  font-size: clamp(12px, 1.4vw, 18px);
  color: rgba(214, 236, 255, 0.5);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.board .card {
  width: clamp(38px, 5.5vw, 70px);
  height: clamp(52px, 7.8vw, 98px);
  border-radius: 8px;
}

.board .card .r { font-size: clamp(17px, 2.4vw, 28px); }
.board .card .s { font-size: clamp(15px, 2.1vw, 25px); }

.board .card.deal-flip {
  transform-origin: 50% 62%;
  backface-visibility: hidden;
  animation: cardFlipIn 400ms cubic-bezier(0.2, 0.8, 0.25, 1) both;
  animation-delay: var(--deal-delay, 0ms);
}

@keyframes cardFlipIn {
  0% { opacity: 0.25; transform: rotateY(90deg) scale(0.88); }
  62% { opacity: 1; transform: rotateY(-7deg) scale(1.055); }
  82% { transform: rotateY(2deg) scale(0.99); }
  100% { opacity: 1; transform: rotateY(0) scale(1); }
}

/* ---------- 侧栏 ---------- */
.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.advice-card {
  position: relative;
  padding: 17px 18px 15px;
  border-radius: var(--radius);
  background:
    radial-gradient(140% 120% at 0% 0%, rgba(57, 217, 138, 0.16), transparent 52%),
    linear-gradient(160deg, #162a22, #0e1b16 65%);
  border: 1px solid rgba(57, 217, 138, 0.25);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.advice-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--green), transparent 80%);
}

.advice-card.is-warn { border-color: rgba(255, 138, 61, 0.45); }
.advice-card.is-warn::before { background: linear-gradient(180deg, var(--orange), transparent 80%); }
.advice-card.is-fold { border-color: rgba(232, 86, 79, 0.34); }
.advice-card.is-fold::before { background: linear-gradient(180deg, var(--red), transparent 80%); }

.advice-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.advice-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.advice-tag {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #0c2418;
  background: var(--green);
}

.advice-card.is-warn .advice-tag { background: var(--gold); }
.advice-card.is-fold .advice-tag { background: #ff8079; color: #2a0807; }

.advice-action {
  font-size: clamp(23px, 2.4vw, 30px);
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1.18;
  color: #effff6;
  text-shadow: 0 4px 18px rgba(57, 217, 138, 0.18);
}

.advice-reason {
  min-height: 42px;
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.55;
  color: #b9cec2;
}

.advice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.advice-grid > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.2);
}

.advice-grid span {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.advice-grid b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #e8f6ee;
}

.advice-note {
  margin-top: 9px;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: rgba(143, 166, 155, 0.7);
}

/* ---------- 操作区 ---------- */
.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #13221c, #0d1814);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.quick-fold {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 62px;
  border-radius: 13px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #2a1202;
  background:
    radial-gradient(120% 180% at 50% -40%, #ffd7a6, transparent 55%),
    linear-gradient(135deg, var(--orange), var(--orange-2));
  box-shadow: 0 10px 26px rgba(255, 95, 31, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}

.quick-fold small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  opacity: 0.72;
}

.quick-fold:hover { box-shadow: 0 12px 34px rgba(255, 95, 31, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.quick-fold:active { transform: translateY(1px) scale(0.995); }

.action-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 9px; }

.btn {
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.03em;
  background: var(--panel-2);
  border: 1px solid var(--line);
  transition: 0.15s ease;
}

.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-fold {
  color: #ffd9d6;
  background: linear-gradient(160deg, #56211f, #361413);
  border-color: rgba(232, 86, 79, 0.4);
}

.btn-call {
  color: #e7f2ff;
  background: linear-gradient(160deg, #1c4d7d, #113252);
  border-color: rgba(75, 156, 255, 0.4);
}

.btn-call.is-check {
  color: #dff7e9;
  background: linear-gradient(160deg, #23503e, #143327);
  border-color: rgba(57, 217, 138, 0.35);
}

.btn-raise {
  width: 100%;
  margin-top: 2px;
  color: #1d1304;
  background: linear-gradient(145deg, #ffe3a1, #ffc247 55%, #e8a21f);
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(255, 194, 71, 0.2);
}

.raise-box {
  padding: 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.055);
}

.raise-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--muted);
}

.raise-head b {
  font-size: 18px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 30px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(57, 217, 138, 0.75), rgba(255, 209, 102, 0.85), rgba(255, 138, 61, 0.9));
}

input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(57, 217, 138, 0.75), rgba(255, 209, 102, 0.85), rgba(255, 138, 61, 0.9));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #ffd166 55%, #d28b12);
  border: 2px solid #fff6dc;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #ffd166 55%, #d28b12);
  border: 2px solid #fff6dc;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}

.presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin: 4px 0 8px;
}

.presets button {
  min-height: 34px;
  padding: 4px 2px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #cfe3d7;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: 0.14s ease;
}

.presets button:hover { background: rgba(255, 255, 255, 0.12); }
.presets button[data-allin] { color: #ffd1b8; border-color: rgba(255, 138, 61, 0.35); }

/* ---------- 仪表盘 ---------- */
.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 26px);
  max-width: 1500px;
  margin: 0 auto;
  padding: clamp(16px, 2.4vw, 26px) clamp(14px, 3vw, 34px) 8px;
}

.panel {
  padding: 17px 18px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(20, 35, 29, 0.9), rgba(10, 19, 15, 0.92));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.05em;
}

.panel-sub { font-size: 10px; color: var(--muted); }

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

.stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.045);
}

.stat span { font-size: 9px; letter-spacing: 0.08em; color: var(--muted); }
.stat b { font-size: 17px; font-variant-numeric: tabular-nums; }
.stat small { font-size: 8px; color: rgba(143, 166, 155, 0.72); }

.targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 11px;
}

.target {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 11px;
  color: #c6d8ce;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.target .dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #5f7369;
  box-shadow: 0 0 0 3px rgba(95, 115, 105, 0.12);
}

.target b { margin-left: auto; font-size: 11px; font-variant-numeric: tabular-nums; }

.target.good .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(57, 217, 138, 0.16), 0 0 10px rgba(57, 217, 138, 0.4); }
.target.good b { color: var(--green); }
.target.warn .dot { background: var(--gold); box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.14); }
.target.warn b { color: var(--gold); }
.target.bad .dot { background: var(--red); box-shadow: 0 0 0 3px rgba(232, 86, 79, 0.14); }
.target.bad b { color: #ff8d87; }

.sub-head {
  margin: 16px 0 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.pos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.pos-table th {
  padding: 5px 7px;
  text-align: right;
  font-size: 9px;
  font-weight: 600;
  color: rgba(143, 166, 155, 0.8);
  border-bottom: 1px solid var(--line);
}

.pos-table th:first-child, .pos-table td:first-child { text-align: left; }

.pos-table td {
  padding: 6px 7px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}

.pos-table tr:last-child td { border-bottom: 0; }
.pos-table td.pos-name { color: #b9cec2; }
.pos-table .up { color: var(--green); }
.pos-table .down { color: #ff8d87; }

.allin-log {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 150px;
  overflow-y: auto;
}

.allin-item {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 10px;
  line-height: 1.5;
  color: #c0d3c8;
  background: rgba(255, 138, 61, 0.055);
  border-left: 2px solid rgba(255, 138, 61, 0.55);
}

.allin-item b { color: #ffd0b3; }

.empty {
  padding: 9px 2px;
  font-size: 10px;
  color: rgba(143, 166, 155, 0.6);
}

/* ---------- 日志 ---------- */
.log-panel { display: flex; flex-direction: column; }

.log {
  flex: 1;
  min-height: 220px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
  font-size: 11px;
  line-height: 1.65;
}

.log-line {
  padding: 3px 2px;
  color: #a9bdb1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.028);
}

.log-line.is-hand {
  margin-top: 5px;
  color: var(--gold);
  font-weight: 700;
}

.log-line.is-result { color: #cfe9da; }
.log-line.is-warn { color: #ffb27d; }

/* 滚动条 */
.log::-webkit-scrollbar, .allin-log::-webkit-scrollbar { width: 5px; }
.log::-webkit-scrollbar-thumb, .allin-log::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.foot {
  padding: 15px 20px 24px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: rgba(143, 166, 155, 0.55);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1120px) {
  .layout { grid-template-columns: minmax(0, 1fr) 330px; }
  .dashboard { grid-template-columns: 1fr; }
  .log { max-height: 300px; }
}

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 10px 16px; }
  .top-meta { margin-left: 0; order: 3; width: 100%; justify-content: space-between; }
  .speed-toggle { margin-left: auto; }
  .layout { display: flex; flex-direction: column; }
  .side { display: contents; }
  .table-area { order: 1; }
  .controls { order: 2; }
  .advice-card { order: 3; }
  .table-felt { aspect-ratio: 1.62 / 1; }
  .table-center { width: 63%; }
  .seat-0 { top: 91%; }
  .seat-1 { left: 13%; top: 78%; }
  .seat-2 { left: 9%; top: 26%; }
  .seat-3 { top: 6%; }
  .seat-4 { left: 91%; top: 26%; }
  .seat-5 { left: 87%; top: 78%; }
  .controls { gap: 8px; padding: 10px; }
  .quick-fold { min-height: 52px; font-size: 18px; }
  .action-row { gap: 7px; }
  .btn { min-height: 44px; }
  .raise-box { padding: 8px; }
  .raise-head { margin-bottom: 3px; }
  input[type="range"] { height: 24px; }
  .presets { margin: 2px 0 6px; }
  .presets button { min-height: 32px; }
  .buyin-bar { flex-wrap: wrap; margin-top: 8px; }
  .buyin-stack { margin-left: 0; }
}

@media (max-width: 620px) {
  .topbar { padding: 8px 10px; gap: 6px 10px; }
  .brand-mark { width: 34px; height: 34px; font-size: 19px; }
  .brand-text h1 { font-size: 15px; }
  .brand-text p { font-size: 9px; }
  .top-meta b { font-size: 15px; }
  .top-meta > div { gap: 4px; }
  .speed-toggle { padding: 8px 12px; font-size: 11px; }

  .buyin-bar { gap: 6px; padding: 7px 10px; border-radius: 10px; }
  .buyin-label { font-size: 10px; }
  .buyin-presets { flex: 1; min-width: 0; gap: 4px; }
  .buyin-presets button { flex: 1; min-width: 0; min-height: 30px; padding: 4px 3px; font-size: 10px; }
  .buyin-stack { order: 5; width: 100%; font-size: 10px; }
  .buyin-stack b { font-size: 12px; }
  .rebuy-btn { min-height: 30px; padding: 4px 10px; font-size: 10px; }

  .layout { padding: 8px 10px 0; gap: 10px; }

  .table-frame { padding: 6px; border-radius: 44% / 48%; }
  .table-felt { aspect-ratio: auto; height: clamp(195px, 54vw, 240px); }
  .table-felt::after { inset: 13% 10%; }
  .table-center { width: 66%; top: 39%; }
  .board { gap: 3px; min-height: 48px; margin: 6px 0 6px; }
  .board .card { width: 34px; height: 47px; border-radius: 6px; }
  .board .card .r { font-size: 15px; }
  .board .card .s { font-size: 13px; }
  .board .card-slot { width: 34px; height: 47px; }
  .pot-line { padding: 3px 12px; font-size: 10px; }
  .pot-line b { font-size: 15px; }
  .result-line { min-height: 14px; font-size: 10px; line-height: 1.2; margin-top: 3px; }

  .seat { width: 76px; padding: 5px 4px 4px; border-radius: 10px; gap: 2px; }
  .seat-0 { width: 120px; top: 94%; }
  .seat-1 { left: 14%; top: 77%; }
  .seat-2 { left: 11%; top: 25%; }
  .seat-3 { top: 5%; }
  .seat-4 { left: 89%; top: 25%; }
  .seat-5 { left: 86%; top: 77%; }
  .seat-avatar { width: 20px; height: 20px; font-size: 9px; }
  .seat-0 .seat-avatar { width: 27px; height: 27px; }
  .seat-name { font-size: 9px; }
  .seat-name .pos { font-size: 8px; padding: 0 4px; }
  .seat-style { display: none; }
  .seat-stack { font-size: 9px; }
  .seat-bet { font-size: 8px; padding: 1px 7px; top: calc(100% + 3px); }
  .seat-cards { bottom: calc(100% - 1px); }
  .seat-0 .seat-cards { bottom: calc(100% - 4px); }
  .card { width: 19px; height: 27px; }
  .card .r { font-size: 9px; }
  .card .s { font-size: 8px; }
  .card.big { width: 32px; height: 44px; }
  .card.big .r { font-size: 14px; }
  .card.big .s { font-size: 12px; }

  .advice-card { padding: 14px 15px; }
  .advice-action { font-size: 23px; }
  .advice-reason { font-size: 12px; }
  .advice-grid b { font-size: 11px; }
  .controls { gap: 6px; padding: 8px; }
  .quick-fold { min-height: 44px; font-size: 17px; }
  .quick-fold small { font-size: 9px; }
  .btn { min-height: 40px; font-size: 14px; }
  .raise-box { padding: 7px; }
  .raise-head { margin-bottom: 2px; font-size: 10px; }
  .raise-head b { font-size: 16px; }
  input[type="range"] { height: 22px; }
  .presets { margin: 1px 0 5px; }
  .presets button { min-height: 28px; font-size: 9px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .targets { grid-template-columns: 1fr; }
  .dashboard { padding: 12px 10px 4px; }
  .panel { padding: 14px; }
  .log { max-height: 260px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}

/* ---------- 账号 · 同步 · 建议开关 ---------- */
.is-hidden { display: none !important; }

.top-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.sync-status {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sync-status.is-pending { color: var(--gold); }

.account-area {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.account-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  color: #cfeadb;
}

.tool-btn,
.advice-toggle {
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  transition: 0.18s ease;
  white-space: nowrap;
}

.tool-btn:hover,
.advice-toggle:hover {
  background: #1b3027;
  border-color: rgba(57, 217, 138, 0.28);
}

.tool-btn-quiet { color: var(--muted); }

.advice-toggle[aria-pressed="true"] {
  color: #0b1a13;
  background: linear-gradient(135deg, #b9f4d6, #39d98a);
  border-color: transparent;
}

.advice-toggle[aria-pressed="false"] {
  color: var(--muted);
}

.account-panel,
.sync-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: 280px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(160deg, #152a22, #0b1712);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.account-panel {
  display: grid;
  gap: 10px;
}

.panel-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}

.field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-size: 14px;
}

.field input::placeholder { color: #5b7268; }

.account-buttons {
  display: flex;
  gap: 8px;
}

.account-buttons button {
  flex: 1;
  padding: 10px;
  border-radius: 9px;
  font-weight: 800;
  font-size: 13px;
  color: #08130e;
  background: linear-gradient(135deg, #b9f4d6, #39d98a);
}

.account-buttons button#btnRegister {
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.account-error {
  min-height: 15px;
  font-size: 11px;
  line-height: 1.4;
  color: #ff9b95;
}

.sync-panel code {
  display: block;
  margin: 10px 0;
  padding: 10px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--gold);
  word-break: break-all;
  user-select: all;
}

.sync-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-panel-actions button {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}

.sync-panel-actions span {
  font-size: 11px;
  color: var(--green);
}

.sync-hint {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

.advice-off-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: rgba(21, 38, 32, 0.55);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  transition: 0.18s ease;
}

.advice-off-bar:hover {
  border-color: rgba(57, 217, 138, 0.4);
  color: var(--text);
}

.advice-off-bar small {
  font-size: 10px;
  color: var(--green-dim);
}

@media (max-width: 860px) {
  .top-tools {
    margin-left: auto;
    order: 2;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .speed-toggle { margin-left: 0; }
  .advice-off-bar { order: 3; }
}

@media (max-width: 620px) {
  .top-tools { gap: 6px; }
  .sync-status { max-width: 110px; font-size: 10px; }
  .tool-btn,
  .advice-toggle { padding: 8px 10px; font-size: 11px; }
  .account-panel,
  .sync-panel {
    width: min(280px, calc(100vw - 20px));
    right: 0;
  }
}
