:root {
  color-scheme: light;
  --red: #0f8b8d;
  --red-dark: #0b6f71;
  --ink: #171717;
  --muted: #858585;
  --line: #d9d9d9;
  --soft: #f6f6f6;
  --panel: #ffffff;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: #edf2f4;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.phone-shell {
  width: min(100%, 540px);
  min-height: 100vh;
  margin: 0 auto;
  overflow-x: hidden;
  padding-bottom: calc(106px + var(--safe-bottom));
  background: var(--panel);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  color: white;
  background: linear-gradient(135deg, #0f8b8d, #125f78);
}

.ghost-pill,
.mini-actions {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  color: white;
  background: rgba(255, 255, 255, 0.22);
  font-weight: 750;
  white-space: nowrap;
}

.title-button {
  min-width: 0;
  border: 0;
  color: white;
  background: transparent;
  font-size: clamp(18px, 5vw, 22px);
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-tabs {
  position: sticky;
  top: 54px;
  z-index: 4;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(88px, 1fr);
  gap: 6px;
  overflow-x: auto;
  padding: 7px 8px 8px;
  background: white;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.play-tabs::-webkit-scrollbar {
  display: none;
}

.play-tabs button {
  height: 48px;
  border: 1px solid #aaaaaa;
  border-radius: 6px;
  background: white;
  color: #161616;
  font-size: clamp(15px, 4.2vw, 18px);
  font-weight: 800;
  white-space: nowrap;
}

.play-tabs .active {
  border-color: var(--red);
  color: var(--red);
}

.date-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 18px;
  border-bottom: 2px solid #a3a3a3;
  font-size: clamp(16px, 4.5vw, 19px);
}

.switch input {
  display: none;
}

.switch span {
  position: relative;
  display: block;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: #cfcfcf;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  content: "";
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}

.switch input:checked + span {
  background: var(--red);
}

.switch input:checked + span::after {
  transform: translateX(24px);
}

.notice {
  margin: 8px;
  border: 1px solid #b7e2df;
  border-radius: 6px;
  padding: 9px 10px;
  background: #effaf8;
  color: #0b6466;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.match-list {
  background: white;
}

.match-card {
  border-bottom: 1px solid #aaaaaa;
}

.match-title {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 28px minmax(0, 1fr) auto auto;
  gap: 7px;
  align-items: center;
  min-height: 44px;
  padding: 0 8px 0 12px;
  font-size: clamp(16px, 4.5vw, 19px);
}

.match-title span:first-child {
  color: #333333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-title strong {
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-title em {
  font-style: normal;
  text-align: center;
}

.result-tag {
  border-radius: 999px;
  padding: 3px 7px;
  background: #e8f6f4;
  color: var(--red);
  font-size: 11px;
  white-space: nowrap;
}

.single-tag {
  border-radius: 999px;
  padding: 3px 7px;
  background: #fff7e8;
  color: #c47a13;
  font-size: 11px;
  white-space: nowrap;
}

.result-tag.pending {
  background: #f2f2f2;
  color: #777777;
}

.match-body {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 7px;
  padding: 0 8px 10px;
}

.match-meta {
  display: grid;
  place-content: center;
  gap: 8px;
  min-height: 88px;
  background: #f7f7f7;
  color: #2e2e2e;
  text-align: center;
}

.match-meta strong {
  font-size: clamp(17px, 4.8vw, 20px);
  font-weight: 550;
}

.match-meta span {
  font-size: 14px;
}

.match-odds {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.odds-row {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 5px;
  align-items: center;
}

.odds-row.wide {
  align-items: start;
}

.goal-line {
  color: var(--red);
  font-size: clamp(14px, 4vw, 18px);
  text-align: center;
  word-break: keep-all;
}

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

.odds-grid.many {
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
}

.odd-button {
  min-height: 46px;
  border: 1px solid #9e9e9e;
  border-radius: 6px;
  background: linear-gradient(#ffffff, #fbfbfb);
  color: var(--red);
  font-weight: 850;
  padding: 5px 2px;
}

.odd-button span,
.odd-button strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.odd-button strong {
  font-size: clamp(14px, 4vw, 17px);
}

.odd-button span {
  margin-top: 3px;
  color: #999999;
  font-size: 14px;
  font-weight: 500;
}

.odd-button.selected {
  border-color: var(--red);
  background: var(--red);
  color: white;
}

.odd-button.selected span {
  color: white;
}

.odd-button:disabled {
  color: #b5b5b5;
  background: #f8f8f8;
}

.closed-pool,
.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.trend-panel {
  margin: 0 8px 10px 107px;
  border: 1px solid #ececec;
  border-radius: 6px;
  background: #fcfcfc;
}

.trend-empty,
.trend-panel summary {
  padding: 9px 10px;
  color: #333333;
  font-size: 12px;
}

.trend-panel summary {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}

.trend-panel summary span {
  color: var(--muted);
}

.trend-content {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px;
  padding: 0 10px 10px;
}

.trend-content svg {
  width: 100%;
  height: 60px;
}

.line {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line.win {
  stroke: var(--red);
}

.line.draw {
  stroke: #888888;
}

.line.lose {
  stroke: #2978d8;
}

.trend-table {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-content: center;
  gap: 5px 8px;
  color: #777777;
  font-size: 11px;
  text-align: center;
}

.trend-table b {
  color: #333333;
  font-weight: 650;
}

.bet-slip {
  position: fixed;
  right: 50%;
  bottom: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: 86px 1fr 86px;
  gap: 8px;
  width: min(100%, 540px);
  min-height: 96px;
  padding: 8px 10px calc(6px + var(--safe-bottom));
  background: white;
  border-top: 1px solid #9f9f9f;
  transform: translateX(50%);
}

.slip-badge {
  position: absolute;
  top: -12px;
  left: 4px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--red);
  color: white;
  font-size: 20px;
  font-weight: 850;
}

.slip-tool,
.scheme-button {
  border: 1px solid #b4b4b4;
  border-radius: 6px;
  background: white;
  color: #333333;
  font-size: clamp(14px, 4vw, 17px);
}

.multiplier-field {
  grid-column: 1;
  grid-row: 2;
  color: var(--red);
  font-weight: 850;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.multiplier-field input {
  width: 48px;
  border: 0;
  outline: 0;
  color: var(--red);
  background: transparent;
  font-weight: 850;
  text-align: center;
}

.slip-summary {
  display: grid;
  align-content: center;
  gap: 4px;
  grid-column: 2;
  color: var(--muted);
  font-size: 13px;
}

.slip-summary strong {
  color: var(--red);
  font-size: clamp(17px, 4.8vw, 20px);
}

.scheme-button {
  grid-column: 3;
  grid-row: 1 / 3;
  border-color: var(--red);
  background: var(--red);
  color: white;
  font-weight: 850;
}

dialog {
  width: min(94vw, 500px);
  max-height: 86vh;
  border: 0;
  border-radius: 8px;
  padding: 0;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.38);
}

dialog form {
  max-height: 86vh;
  overflow: auto;
  padding: 16px;
}

dialog header {
  position: sticky;
  top: -16px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: -16px -16px 14px;
  padding: 14px 16px;
  background: white;
  border-bottom: 1px solid var(--line);
}

dialog header button {
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 15px;
}

.scheme-section {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.scheme-section h3 {
  margin: 0;
  font-size: 17px;
}

.scheme-summary-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  border-left: 4px solid var(--red);
  border-radius: 8px;
  padding: 16px;
  background: #fbfbfb;
  box-shadow: 0 4px 18px rgba(15, 139, 141, 0.08);
}

.scheme-summary-card span {
  display: block;
  color: #888888;
  font-size: 13px;
}

.scheme-summary-card strong {
  display: block;
  margin-top: 6px;
  color: #222222;
  font-size: 22px;
}

.profit {
  color: #16a05d !important;
}

.loss {
  color: #1f9d63 !important;
}

.scheme-list,
.split-list {
  display: grid;
  gap: 10px;
}

.scheme-item,
.split-item {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.scheme-item.refreshing {
  opacity: 0.68;
  pointer-events: none;
}

.scheme-item.saved strong {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.scheme-item.saved strong span {
  color: var(--red);
}

.scheme-item span,
.scheme-note,
.split-item em,
.scheme-item small {
  color: #666666;
  line-height: 1.6;
}

.split-item {
  grid-template-columns: 1fr auto;
}

.split-item em {
  grid-column: 1 / -1;
  font-style: normal;
}

.stake-input {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #555555;
}

.stake-input input {
  width: 120px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
}

.stake-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.account-input input {
  flex: 1;
  min-width: 0;
}

.dialog-action {
  height: 42px;
  border: 0;
  border-radius: 6px;
  color: white;
  background: var(--red);
  font-weight: 800;
}

.mini-dialog-action {
  min-height: 34px;
  border: 1px solid var(--red);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--red);
  background: white;
  font-weight: 750;
}

.scheme-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.scheme-edit-grid label,
.scheme-note-input {
  display: grid;
  gap: 4px;
  color: #666666;
  font-size: 12px;
}

.scheme-edit-grid input,
.scheme-note-input input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
}

.scheme-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 390px) {
  .match-title {
    grid-template-columns: 56px minmax(0, 1fr) 24px minmax(0, 1fr) auto auto;
    padding-left: 8px;
  }

  .match-body {
    grid-template-columns: 82px 1fr;
  }

  .trend-panel {
    margin-left: 93px;
  }

  .bet-slip {
    grid-template-columns: 78px 1fr 78px;
  }
}

@media (min-width: 720px) {
  body {
    background: #dddddd;
  }

  .phone-shell,
  .bet-slip {
    box-shadow: 0 0 36px rgba(0, 0, 0, 0.12);
  }
}
