/* Whale demo - mobile UI ----------------------------------------------- */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --line: #e6e8eb;
  --text: #1d2129;
  --text-2: #4e5969;
  --muted: #86909c;
  --primary: #c0392b;
  --primary-hover: #a73225;
  --accent: #1f8a3f;
  --warn: #d97706;
  --danger: #e02020;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

button { font-family: inherit; font-size: inherit; cursor: pointer; }
textarea, input { font-family: inherit; font-size: inherit; }

/* ---------- login ---------- */

.login-shell {
  min-height: 100vh;
  padding: 32px 16px;
  background: linear-gradient(160deg, #b91c1c 0%, #7f1d1d 100%);
  display: flex; flex-direction: column;
  align-items: center;
}

.login-hero { text-align: center; color: #fff; padding: 32px 0 24px; }
.login-hero__title { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.login-hero__sub { margin-top: 6px; opacity: .8; font-size: 12px; }

.login-card {
  width: 100%; max-width: 360px;
  background: #fff; border-radius: 12px;
  padding: 22px 18px 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  display: flex; flex-direction: column; gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; color: var(--text-2); }
.field__input {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 15px;
  background: var(--surface-2); color: var(--text);
  transition: border-color .15s;
}
.field__input:focus { border-color: var(--primary); outline: none; background: #fff; }

.primary-btn {
  height: 42px; border: none; border-radius: 8px;
  background: var(--primary); color: #fff;
  font-size: 15px; font-weight: 600;
  transition: background .15s, transform .05s;
}
.primary-btn:hover:not(:disabled) { background: var(--primary-hover); }
.primary-btn:active:not(:disabled) { transform: scale(.98); }
.primary-btn:disabled { background: #d4a8a3; cursor: not-allowed; }
.primary-btn--lg { height: 48px; font-size: 16px; }

.ghost-btn {
  border: 1px solid rgba(255,255,255,.4); background: transparent;
  color: #fff; padding: 4px 12px; border-radius: 6px; font-size: 12px;
}

.error-msg { margin: 0; min-height: 18px; color: var(--danger); font-size: 13px; }
.muted-hint { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
.member-layout-switch {
  width: 100%;
  max-width: 360px;
  margin-top: auto;
  padding: 26px 0 4px;
  text-align: center;
  color: rgba(255, 255, 255, .82);
  font-size: 13px;
}
.member-layout-switch__item {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .82);
  padding: 4px 2px;
  font: inherit;
}
.member-layout-switch__item:not(.is-current) {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.member-layout-switch__item.is-current {
  color: #fff;
  font-weight: 700;
  cursor: default;
  pointer-events: none;
  text-decoration: none;
}
.member-layout-switch__sep { padding: 0 8px; opacity: .65; }

/* ---------- bet shell ---------- */

.bet-shell { min-height: 100vh; display: flex; flex-direction: column; }

.bet-header {
  background: var(--primary); color: #fff;
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
}
.bet-header__title { font-size: 16px; font-weight: 600; }
.bet-header__sub   { font-size: 12px; opacity: .85; margin-top: 2px; }

.credit-bar {
  background: #fff; border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr 1fr 1fr;
}
.credit-bar__cell { padding: 10px 12px; border-right: 1px solid var(--line); }
.credit-bar__cell:last-child { border-right: none; }
.credit-bar__label { font-size: 11px; color: var(--muted); }
.credit-bar__value { font-size: 16px; font-weight: 600; color: var(--text); }
.credit-bar__cell--accent .credit-bar__value { color: var(--accent); }

.game-tabs {
  display: flex; background: #fff; border-bottom: 1px solid var(--line);
}
.game-tab {
  flex: 1; height: 40px; border: none; background: transparent;
  color: var(--text-2); font-size: 14px; position: relative;
}
.game-tab.is-active { color: var(--primary); font-weight: 600; }
.game-tab.is-active::after {
  content: ""; position: absolute; left: 30%; right: 30%; bottom: 0;
  height: 2px; background: var(--primary); border-radius: 2px;
}

.bet-input-card, .preview-card {
  background: #fff; margin: 10px 8px; border-radius: 8px;
  padding: 12px; box-shadow: var(--shadow);
}
.bet-input-card__title, .preview-card__title { font-weight: 600; font-size: 14px; }
.bet-input-card__hint { font-size: 11px; color: var(--muted); margin-top: 6px; }

.bet-input-card textarea {
  width: 100%; margin-top: 8px;
  border: 1px solid var(--line); border-radius: 6px;
  padding: 10px; resize: vertical; min-height: 96px;
  background: var(--surface-2);
  font-size: 14px; line-height: 1.6;
}
.bet-input-card textarea:focus { outline: none; border-color: var(--primary); background: #fff; }

.preview-card__head { display: flex; justify-content: space-between; align-items: center; }
.preview-card__total { font-size: 12px; color: var(--text-2); }
.preview-card__body { margin-top: 8px; min-height: 40px; }

/* Preview area shell should mimic target site:
 * - square cyan outer border
 * - flatter panel (no card shadow)
 * - compact heading row
 */
.preview-card {
  background: #f7fcff;
  border: 2px solid #38a3e8;
  border-radius: 0;
  box-shadow: none;
  padding: 8px 10px 10px;
}
.preview-card__head {
  min-height: 24px;
  padding: 0 2px;
}
.preview-card__title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}
.preview-card__total {
  font-size: 12px;
  font-weight: 600;
  color: #4a5a69;
}
.preview-card__body {
  margin-top: 6px;
}

/* Empty state */
.preview-empty {
  color: var(--muted); padding: 16px 0; text-align: center;
  border: 1px dashed var(--line); border-radius: 4px;
}

/* Group panels — replicating the original mobile site exactly:
 *   - success rows are stacked into one mint-green block, ended by a
 *     stats footer (笔数 / 金额 / 玩法 / 赔)
 *   - failure rows are each their own peach-coloured block with a
 *     red error message under them
 *   - panels have NO rounded corners, NO outer margin (flush stacking)
 */

.preview-panel {
  border-top: 1px solid transparent;          /* hairline gap between panels */
  font-size: 13px;
  color: var(--text);
}
.preview-panel:first-child { border-top: none; }

.preview-panel--ok  { background: #c2e8ca; }
.preview-panel--err { background: #fbdcb9; }

/* --- ROW LAYOUT ---------------------------------------------------------
 *   ┌──┬──┬──┬───┬──┬─────────┐
 *   │−n│  │+ │详 │福│  text   │
 *   └──┴──┴──┴───┴──┴─────────┘
 *   col widths: 22 / 14 / 22 / 36 / 32 / 1fr
 */

.preview-row {
  display: grid;
  grid-template-columns: 22px 14px 22px 38px auto 1fr;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  min-height: 24px;
}
.preview-panel__rows .preview-row + .preview-row {
  border-top: 1px dashed rgba(0,0,0,0.18);
}

/* Round buttons (− / +) and the pill-shaped detail / rate buttons -------- */

.row-btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; padding: 0; line-height: 1;
  font-weight: 700; cursor: default;
  color: #fff;
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
}

.row-btn--del,
.row-btn--add {
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 14px;
}
.row-btn--del { background: #e74c3c; }
.row-btn--add { background: #27ae60; }

.row-btn--detail {
  width: auto; height: 18px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 2px;
  background: #ecf0f1;
  color: #2c3e50;
  border: 1px solid #b8c0c4;
  cursor: pointer;
}

.row-btn--rate {
  width: auto; height: 18px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 2px;
  background: #c0392b;
  color: #fff;
  border: 1px solid #a73225;
  cursor: pointer;
}

/* Sequence number sits in column 2, right of the − button ---------------- */

.row-seq {
  font-size: 12px; color: #1f2933;
  text-align: center;
}

/* The detail-button slot — empty cell for rows that have no detail btn --- */

.row-detail { display: inline-flex; align-items: center; justify-content: center; }

/* Status pills ----------------------------------------------------------- */

.pill {
  display: inline-block;
  min-width: 30px; height: 18px;
  padding: 0 6px;
  text-align: center;
  font-size: 12px; line-height: 18px;
  color: #fff;
  border-radius: 2px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0;
  box-sizing: content-box;
}
.pill--fu  { background: #5e3b8a; }   /* dark purple — 福彩 */
.pill--ti  { background: #2f7a3a; }   /* deep green — 体彩 */
.pill--err { background: #c0392b; }   /* red — 失败 */

/* Original-text column --------------------------------------------------- */

.row-text {
  color: #1f2933;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* OK panel footer — ¥ counters in red, dashed top separator -------------- */

.preview-panel__foot {
  display: flex; align-items: center;
  padding: 2px 8px 3px 38px;
  background: #b6dfbf;
  font-size: 12px;
  border-top: 1px dashed rgba(0,0,0,0.18);
  min-height: 22px;
}
.foot-stat       { color: #1f2933; margin-right: 16px; }
.foot-stat:last-of-type { margin-right: 6px; }
.foot-stat b     { color: #c0392b; font-weight: 700; margin-left: 2px; }
.foot-stat em    { color: #c0392b; font-style: normal; font-weight: 600; margin-left: 2px; }

/* Failure error message -------------------------------------------------- */

.preview-panel__error {
  padding: 2px 8px 4px 38px;
  background: #fbdcb9;
  border-top: 1px dashed rgba(0,0,0,0.18);
  color: #c0392b;
  font-size: 12px;
  font-weight: 600;
}

.preview-card__errors { display: none; }     /* legacy block, no longer used */

.bet-footer {
  margin-top: auto; background: #fff; padding: 12px 16px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
}
.bet-footer .primary-btn { width: 100%; }

.status-msg { margin: 0; min-height: 18px; font-size: 13px; }
.status-msg.is-error { color: var(--danger); }
.status-msg.is-ok    { color: var(--accent); }

/* Bet-input action bar ------------------------------------------------- */
.bet-input-card__actions {
  display: flex; gap: 12px; margin-top: 12px;
}
.bet-input-card__actions .ghost-btn { flex: 0; }

.empty-tip {
  padding: 28px 12px; color: var(--muted); text-align: center;
}

/* === Target-site preview replica ================================== */

.tg-list {
  background: #edf6fb;
  border: 1px solid #b8cad3;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
}

.tg-row {
  background: #d8f3e6;
  padding: 2px 6px 3px;
  border-bottom: 1px dashed #86af9a;
}
.tg-row:last-child { border-bottom: none; }
.tg-row--err   { background: #fde7e9; }
.tg-row--warn  { background: #ffe0c0; }
.tg-row--blank { background: #e8f1f6; }
.tg-row--blank .tg-row__head { color: #5a6675; font-weight: 500; }
.tg-row--edit  { background: #eef4ff; }
.tg-edit-input {
  flex: 1;
  height: 22px;
  padding: 0 8px;
  border: 1px solid #94b3ed;
  border-radius: 3px;
  background: #fff;
  font-size: 13px;
  color: #1d2129;
  outline: none;
}
.tg-edit-input:focus { border-color: #4f8df7; box-shadow: 0 0 0 2px #4f8df733; }
.tg-cbtn[disabled] { opacity: 0.4; cursor: not-allowed; }

.tg-row__head {
  display: flex; align-items: center; gap: 4px;
  font-size: 14px; color: #1d2129;
  overflow: hidden;
  min-height: 21px;
}

.tg-cbtn {
  width: 18px; height: 18px;
  border: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; line-height: 1;
  padding: 0; cursor: pointer;
  flex: 0 0 18px;
}
.tg-cbtn--del { background: #d9534f; }
.tg-cbtn--add { background: #3aa757; }

.tg-seq {
  min-width: 15px;
  text-align: center;
  font-size: 14px; color: #1d2129; font-weight: 700;
  flex: 0 0 15px;
}

.tg-detail {
  height: 18px; padding: 0 7px;
  background: #4f8df7; color: #fff;
  border: none; border-radius: 3px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; line-height: 18px;
  width: 26px;
  flex: 0 0 26px;
  text-align: center;
  padding: 0;
}
.tg-detail-spacer {
  display: inline-block;
  width: 26px;       /* same width as 详 button to keep columns aligned */
  height: 18px;
  flex: 0 0 26px;
}

.tg-pill {
  display: inline-block;
  width: 28px; height: 18px;
  padding: 0;
  text-align: center; line-height: 18px;
  color: #fff; font-size: 12px; font-weight: 700;
  border-radius: 3px;
  flex: 0 0 28px;
  overflow: hidden;
  white-space: nowrap;
}
.tg-pill--fu    { background: #7e57c2; }
.tg-pill--ti    { background: #43a047; }
.tg-pill--both  { background: #455a64; }
.tg-pill--blank { background: #b0bec5; color: #2a2a2a; }
.tg-pill--err   { background: #c0392b; }

.tg-text {
  flex: 1 1 auto;
  min-width: 0;
  color: #1d2129;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-row__stat {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
  padding-left: 25px;
  font-size: 12px; color: #5a6675;
}
.tg-stat b { color: #2e8b3a; font-weight: 700; margin-left: 3px; font-size: 13px; }
.tg-row--warn .tg-stat b,
.tg-row--err  .tg-stat b { color: #c0392b; }

.tg-play {
  color: #d9342b; font-weight: 700;
  background: #fff; border: 1px solid #e4afa9;
  padding: 0 7px; border-radius: 2px; line-height: 17px;
  display: inline-block; margin-left: 2px;
  font-size: 12px;
}
.tg-play--err {
  color: #fff; background: #c0392b; border-color: #a73225;
}

.tg-rate {
  height: 16px; padding: 0 5px;
  background: #4f8df7; color: #fff;
  border: none; border-radius: 2px;
  font-size: 11px; font-weight: 600; line-height: 16px;
  margin-left: 4px; cursor: pointer;
}

.tg-row__err {
  margin-top: 3px;
  padding-left: 26px;
  font-size: 12px; color: #c0392b; font-weight: 600;
}
.tg-row__warn {
  margin-top: 2px;
  padding-left: 28px;
  font-size: 12px; color: #c0392b; font-weight: 700;
  letter-spacing: 0.2px;
}


/* 盘口选择 (member 下注 + admin 编辑) */
.plate-picker { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; font-size: 12px; color: #7c8da1; }
.plate-btn {
  border: 1px solid #c7d2dd; background: #fff; color: #33424f;
  border-radius: 4px; padding: 2px 10px; cursor: pointer; font-size: 12px;
}
.plate-btn.is-active { background: #3a6; border-color: #3a6; color: #fff; }
