:root {
  --blue: #378ac3;
  --blue-dark: #287db8;
  --blue-pale: #dcecff;
  --row-blue: #d5e7fc;
  --text: #1e1e1e;
  --brown: #592000;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  font-family: "Microsoft YaHei", "SimSun", sans-serif;
  color: var(--text);
  background: var(--blue-pale);
}

body { overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
button, a, label, select { user-select: none; }

.desktop-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--blue-pale);
}
.desktop-login[hidden] { display: none; }
.login-box {
  width: min(430px, 100%);
  padding: 34px 42px 40px;
  background: #fff;
  border-top: 8px solid var(--blue);
  box-shadow: 0 4px 18px rgba(0,0,0,.14);
}
.login-logo { display: block; width: 92px; height: 68px; margin: 0 auto 8px; object-fit: contain; }
.login-box h1 { margin: 0 0 26px; text-align: center; font-size: 28px; font-weight: 700; color: var(--blue-dark); }
.login-box label { display: block; margin-top: 14px; font-size: 16px; color: #333; }
.login-box label .field { display: block; width: 100%; margin-top: 6px; }
.captcha-row { display: grid !important; grid-template-columns: 1fr 120px; column-gap: 10px; align-items: end; }
.captcha-row .field { grid-column: 1; }
.captcha-row img { grid-column: 2; grid-row: 1 / span 2; width: 120px; height: 40px; border: 1px solid #aaa; cursor: pointer; object-fit: cover; }
.login-submit { width: 100%; height: 43px; margin-top: 24px; font-size: 18px; }
.login-error { min-height: 22px; margin: 12px 0 0; color: #c00000; text-align: center; }

#scale-shell {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.app-frame {
  width: 1860px;
  min-height: 790px;
  transform-origin: left top;
  background: var(--blue-pale);
}

.top-line { height: 28px; background: var(--blue); }

.site-header {
  height: 121px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 30px 0 62px;
  background: #fff;
  white-space: nowrap;
}

.brand {
  width: 142px;
  color: var(--blue-dark);
  text-align: center;
}

.brand img {
  display: block;
  width: 116px;
  height: 88px;
  margin: 0 auto;
  object-fit: contain;
}

.account-grid {
  width: 290px;
  display: grid;
  grid-template-columns: 130px 130px;
  gap: 10px 28px;
}

.info-box {
  height: 43px;
  position: relative;
  padding-top: 14px;
  border: 1px solid #999;
  border-radius: 5px;
  text-align: center;
  font-size: 20px;
  background: #fff;
}

.info-box .label {
  position: absolute;
  top: -10px;
  left: 12px;
  padding: 0 5px;
  background: #fff;
  font-size: 17px;
}

.orange { color: #e76400; }
.red { color: red; }
.green { color: green; }
.blue { color: #153cff; }
.record-win-amount { color: #c00000; font-weight: 700; }

.draw-status {
  width: 340px;
  height: 112px;
  border: 2px solid #338be0;
  background: #fff;
}

.draw-row {
  height: 55px;
  display: grid;
  grid-template-columns: 125px 105px 105px;
  align-items: center;
  padding: 0 6px;
  color: #257ac1;
  font-size: 20px;
}

.draw-row:first-child { background: var(--blue); color: #fff; }
.draw-row + .draw-row { border-top: 1px solid #ddd; }
.draw-center { text-align: center; line-height: 19px; }
.draw-time { font-weight: 700; font-size: 21px; }

.main-nav {
  height: 112px;
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
}

.nav-item {
  min-width: 86px;
  padding: 7px 7px 5px;
  color: #1877bd;
  text-decoration: none;
  text-align: center;
  font-size: 19px;
  cursor: pointer;
  border: 0;
  background: transparent;
}

.nav-item.active { color: #fff; background: var(--blue); }
.nav-item.route { color: #00690b; }
.nav-item.exit { color: #a40000; }

.nav-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 8px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font: 700 27px/1 Arial, sans-serif;
}

.page-content {
  min-height: 791px;
  padding: 12px 48px 40px;
  background: var(--blue-pale);
}
.empty-state { padding: 28px 12px; color: #777; text-align: center; }
.parse-result-panel { max-height: 360px; margin-top: 10px; overflow: auto; background: #fff; }
.parse-result-panel .parse-table { font-size: 16px; }
.parse-error, .parse-warning { margin: 10px 16px; color: #b00000; }
.parse-warning { color: #a65c00; }

/* Mobile quick-entry result template, used by the desktop generator too. */
.parse-result-panel .quick-result-cards { display: block; padding: 8px; }
.parse-result-panel .quick-result-card { margin: 0 0 7px; border: 1px solid #cfd8df; border-radius: 7px; overflow: hidden; background: #fff; }
.parse-result-panel .quick-result-card:last-child { margin-bottom: 0; }
.parse-result-panel .quick-result-head { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 5px 10px; }
.parse-result-panel .quick-result-card.valid.lot-fu .quick-result-head { background: #aee5d5; }
.parse-result-panel .quick-result-card.valid.lot-ti .quick-result-head { background: #b9ead1; }
.parse-result-panel .quick-result-card.valid.lot-ft .quick-result-head { background: #c7e4e0; }
.parse-result-panel .quick-result-card.invalid .quick-result-head { background: #ffc56e; }
.parse-result-panel .quick-result-card.invalid { border-color: #d63031; }
.parse-result-panel .quick-result-card.blank { border-color: #d8d8d8; background: #f7f7f7; }
.parse-result-panel .quick-result-card.blank .quick-result-head { background: #eeeeee; }
.parse-result-panel .quick-result-card.blank .quick-result-status { color: #666; }
.parse-result-panel .quick-result-index { min-width: 24px; color: #111; font-size: 16px; font-weight: 700; text-align: center; }
.parse-result-panel .quick-result-lottery { min-width: 34px; padding: 3px 8px; color: #fff; font-size: 16px; font-weight: 800; line-height: 1.2; text-align: center; }
.parse-result-panel .quick-result-lottery.fu { background: #6a32be; }
.parse-result-panel .quick-result-lottery.ti { background: #2ea04a; }
.parse-result-panel .quick-result-lottery.ft { background: #222; }
.parse-result-panel .quick-result-lottery.unknown { background: #8a8f99; }
.parse-result-panel .quick-result-status { margin-left: auto; color: #16733a; font-size: 14px; font-weight: 700; }
.parse-result-panel .quick-result-card.invalid .quick-result-status { color: #b00020; }
.parse-result-panel .quick-result-numbers { padding: 8px 10px 6px; color: #111; font-size: 16px; line-height: 1.45; word-break: break-word; overflow-wrap: anywhere; }
.parse-result-panel .quick-result-numbers .ellipsis { color: #777; }
.parse-result-panel .quick-result-source { color: #555; background: #fffdf5; }
.parse-result-panel .quick-result-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 22px; padding: 6px 10px 7px; border-top: 1px dashed #747474; color: #222; font-size: 14px; line-height: 1.35; }
.parse-result-panel .quick-result-meta strong { color: #16733a; font-size: 15px; }
.parse-result-panel .quick-result-meta em { color: #d63b37; font-size: 15px; font-style: normal; font-weight: 700; }
.parse-result-panel .quick-result-error { padding: 6px 10px 8px; border-top: 1px dashed #777; color: #d63031; font-size: 14px; font-weight: 700; line-height: 1.45; word-break: break-word; }
.parse-result-panel .quick-result-empty { padding: 20px 8px; color: #8a8f99; font-size: 14px; text-align: center; }
.parse-result-panel .result-summary { padding: 8px 10px 10px; font-size: 15px; }
.parse-result-panel .result-summary > strong { color: #111; }
.parse-result-panel .result-summary .result-ok { color: #16733a; }
.parse-result-panel .result-summary .result-error { color: #b00020; }
.parse-result-panel .result-summary .result-warning { color: #9a6700; }
.profile-meta { width: 960px; margin: 0 auto 12px; padding: 10px 16px; color: #555; background: #fff; font-size: 16px; }
.odds-line { display: grid; grid-template-columns: 1fr 120px 130px; align-items: center; padding: 8px 12px; border-bottom: 1px solid #ddd; }
.odds-line b { color: #153cff; text-align: center; }
.odds-line small { color: #777; text-align: right; }
.draw-tabs { width: 768px; margin: 0 auto 10px; padding: 8px 18px; background: #fff; }

.white-panel { background: #fff; }
.section-blue { color: #fff; background: var(--blue); }

.btn {
  height: 35px;
  padding: 0 13px;
  min-width: 60px;
  white-space: nowrap;
  border: 1px solid #777;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.45);
  color: #fff;
  background: var(--blue);
  cursor: pointer;
}

.btn:hover { filter: brightness(.96); }
.btn:active { transform: translateY(1px); }
.btn-gold { background: #b97908; }
.btn-green { background: #5b9e55; }
.btn-small { height: 32px; padding: 0 10px; }

.field {
  height: 40px;
  padding: 5px 12px;
  border: 1px solid #999;
  border-radius: 5px;
  background: #fff;
  outline: none;
}
.field:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.field-blue { background: #deebfa; }

fieldset {
  margin: 0;
  border: 1px solid #999;
  border-radius: 6px;
}
legend { padding: 0 6px; }

table { border-collapse: collapse; }
.data-table { width: 100%; font-size: 19px; }
.data-table th { height: 35px; border-bottom: 1px solid #555; color: #000; }
.data-table td { height: 44px; padding: 5px 10px; text-align: center; }
.data-table tbody tr:nth-child(odd) { background: var(--row-blue); }
.scroll-box { overflow-y: auto; scrollbar-color: #888 #eee; scrollbar-width: auto; }

.toast {
  position: fixed;
  left: 50%;
  top: 24px;
  z-index: 60;
  transform: translate(-50%, -20px);
  padding: 11px 25px;
  border-radius: 3px;
  color: #fff;
  background: rgba(30,30,30,.86);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.schedule-switch {
  top: 50%;
  color: #684800;
  background: #fff4cc;
  border: 1px solid #e0bd62;
  box-shadow: 0 6px 20px rgba(86,65,20,.2);
  font-weight: 700;
  transform: translate(-50%, -50%);
}
.toast.schedule-switch.show { transform: translate(-50%, -50%); }

/* quick entry */
.quick-layout { display: grid; grid-template-columns: 306px 1fr; gap: 7px; width: 1710px; min-height: 720px; margin: 0 auto; align-items: stretch; }
.quick-sidebar { min-height: 720px; height: auto; display: flex; flex-direction: column; background: #fff; }
.quick-summary { height: 56px; display: flex; align-items: center; justify-content: center; gap: 10px; border-bottom: 1px dashed #666; font-size: 16px; }
.side-list { height: auto; min-height: 0; flex: 1 1 auto; padding: 4px 7px; font: 19px/20px Arial, sans-serif; white-space: pre-line; }
.quick-layout > section { min-height: 720px; display: flex; flex-direction: column; }
.entry-tabs { height: 48px; display: flex; align-items: flex-end; padding-left: 12px; background: var(--blue); }
.entry-tab { height: 40px; padding: 0 13px; border: 0; color: #fff; background: transparent; font-size: 17px; cursor: pointer; }
.entry-tab.is-hidden { display: none; }
.entry-tab.active { border-bottom: 3px solid #fff; font-weight: 700; }
.replace-row { height: 114px; padding: 10px 8px; border-bottom: 1px dashed #777; background: #fff; }
.replace-controls { display: flex; align-items: center; gap: 6px; font-size: 18px; }
.replace-controls input { width: 240px; }
.new-tag { float: right; margin-top: 10px; }
.entry-area { position: relative; height: 253px; border: 1px solid #777; background: #f3f3f6; }
.entry-area textarea { width: 100%; height: 210px; resize: none; border: 0; padding: 8px 12px; background: transparent; font-size: 17px; outline: none; }
.desktop-input-error { display: none; position: absolute; right: 1px; bottom: 49px; left: 1px; z-index: 2; padding: 0 12px; color: #c62828; font-size: 15px; font-weight: 700; line-height: 22px; text-align: center; pointer-events: none; }
.desktop-input-error.show { display: block; }
.entry-area.has-input-error textarea { padding-bottom: 45px; box-shadow: inset 0 0 0 1px #d32f2f; }
.entry-footer { height: 42px; display: flex; align-items: center; padding: 0 12px; border-top: 1px solid #eee; background: #fff; font-size: 19px; }
.clear-btn { margin-right: 8px; border: 1px dashed #aaa; color: #888; background: #fff; cursor: pointer; font-size: 22px; }
.quick-actions { height: 85px; margin-top: 9px; display: flex; align-items: center; gap: 22px; padding: 8px 16px; background: #fff; }
.action-buttons { display: flex; gap: 22px; align-items: center; }
.action-buttons .btn:nth-child(1), .action-buttons .btn:nth-child(2) { width: 62px; }
.action-buttons .btn:nth-child(3) { width: 90px; }
.code-counts { line-height: 18px; text-align: right; }
.switch-field { width: 150px; height: 64px; text-align: center; }
.switch { width: 54px; height: 26px; margin: 4px auto 0; border-radius: 14px; position: relative; background: #bbb; color: #fff; cursor: pointer; font-size: 13px; line-height: 26px; text-align: right; padding-right: 7px; }
.switch::before { content: ""; position: absolute; width: 22px; height: 22px; left: 2px; top: 2px; border-radius: 50%; background: #fff; }
.switch.on { background: #2d8bcb; text-align: left; padding: 0 0 0 8px; }
.switch.on::before { left: 30px; }
.lottery-field { width: 178px; height: 64px; text-align: center; }
.segmented { display: flex; justify-content: center; gap: 7px; margin-top: 4px; }
.segment { padding: 4px 14px; border: 1px solid #6d09ad; color: #6d09ad; background: #fff; cursor: pointer; }
.segment.active { color: #fff; background: #8f22c2; font-weight: 700; }
.segment.alt { border-color: green; color: green; background: #fff; }
.segment.alt.active { color: #fff; background: green; }
.entry-area textarea.default-fu { background: #e9edff; }
.entry-area textarea.default-ti { background: #e5f4e9; }
.limit-field { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.limit-field input { width: 95px; text-align: center; }
.quick-layout > section .parse-result-panel {
  flex: 0 1 360px;
  min-height: 113px;
  height: 360px;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* filters and records */
.filter-panel { height: 84px; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; }
.filter-panel fieldset { height: 60px; display: flex; align-items: center; gap: 6px; padding: 7px 10px; }
.filter-panel select, .filter-panel input { height: 31px; }
.bet-wrap { height: 485px; margin-top: 10px; padding: 17px 18px 12px; background: #fff; }
.bet-toolbar { height: 36px; display: flex; align-items: center; padding-left: 18px; background: var(--blue); color: #fff; font-size: 17px; }
.bet-toolbar .period-select { margin-left: auto; margin-right: 7px; height: 29px; font-size: 18px; }
.bet-table-wrap { height: 407px; overflow-y: auto; }
.bet-table { color: var(--brown); }
.mobile-bill-table th, .mobile-bill-table td { vertical-align: middle; text-align: center; }
.mobile-bill-table th:nth-child(1), .mobile-bill-table td:nth-child(1) { width: 16%; }
.mobile-bill-table th:nth-child(2), .mobile-bill-table td:nth-child(2) { width: 13%; color: #9b0000; font-weight: 700; }
.mobile-bill-table th:nth-child(3), .mobile-bill-table td:nth-child(3) { width: 18%; color: #9b0000; font-weight: 700; }
.mobile-bill-table th:nth-child(4), .mobile-bill-table td:nth-child(4) { width: 37%; color: green; font-weight: 700; text-align: left; }
.mobile-bill-table th:nth-child(5), .mobile-bill-table td:nth-child(5) { width: 16%; }
.record-period-lot { display: block; white-space: nowrap; line-height: 1.55; }
.record-stack-cell { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; max-width: 100%; vertical-align: middle; }
.record-order-time { white-space: normal; line-height: 1.35; font-variant-numeric: tabular-nums; }
.record-order-time span { display: block; }
.tag-fu, .tag-ti { display: inline-block; color: #fff; border-radius: 4px; padding: 1px 6px; font-size: 14px; line-height: 1.2; }
.tag-fu { background: #00008b; }
.tag-ti { background: #2e8b45; }
.refund-badge { display: inline-block; margin-left: 4px; padding: 1px 5px; color: #fff; background: #d63b3b; border-radius: 999px; font-size: 11px; font-weight: 800; }
.refunded-row { background: #fff5f5; }
.rec-btn { border: 0; border-radius: 4px; padding: 3px 8px; color: #fff; background: #2b6fd6; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.rec-btn.gray { background: #8a8f99; }
.receipt { display: inline-grid; place-items: center; width: 35px; height: 29px; color: #fff; background: #5c9d52; border: 1px solid #4e784a; cursor: pointer; }
.pagination { height: 48px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-right: 70px; font-size: 18px; }
.page-btn { min-width: 28px; height: 31px; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; }
.page-btn.active { color: #1684ee; border-color: #1684ee; }
.page-btn:disabled { color: #bbb; }

/* history */
.history-filter { height: 84px; display: flex; align-items: center; justify-content: center; gap: 12px; background: #fff; }
.history-filter fieldset { height: 61px; display: flex; align-items: center; gap: 8px; padding: 7px 14px; }
.history-filter input[type=date] { width: 215px; height: 38px; padding: 0 12px; font-size: 18px; }
.history-content { height: 474px; margin-top: 9px; padding: 0 18px; background: #fff; }
.history-bar { height: 36px; margin: 0 -18px 8px; padding: 6px 35px; color: #fff; background: var(--blue); font-size: 18px; }
.history-link { border: 0; border-right: 1px solid #fff; color: #fff; background: transparent; cursor: pointer; font-size: 17px; }
.history-link.active { color: #1684ee; background: #fff; }
.history-table tbody tr:last-child { background: #cdf2f3; }
.history-table td { font-weight: 700; }
.history-table td:first-child { color: var(--brown); font-weight: 400; }

/* profile */
.profile-summary { width: 960px; height: 108px; margin: 0 auto 12px; display: grid; grid-template-columns: repeat(3,1fr); align-items: center; background: #fff; }
.profile-stat { height: 72px; display: grid; place-items: center; border-right: 1px dashed #168fee; text-align: center; font-size: 22px; }
.profile-stat:last-child { border: 0; }
.profile-stat strong { display: block; color: #337fc0; font-size: 26px; }
.profile-table-box { height: 451px; padding: 8px 12px; background: #fff; overflow-y: auto; }
.profile-table tbody tr:nth-child(odd) { background: #eee; }
.profile-table .group-row { color: #fff; background: var(--blue) !important; }
.profile-table .group-row td { height: 48px; text-align: left; padding-left: 105px; }

/* draw list */
.draw-list-panel { width: 768px; height: 680px; margin: 0 auto; padding: 20px 18px; background: #fff; overflow-y: auto; }
.draw-table { font-size: 18px; }
.draw-table th { font-size: 21px; }
.draw-table td { height: 58px; }
.draw-table tbody tr:nth-child(odd) { background: #d3e6fb; }
.draw-table tbody tr:nth-child(5) { background: #dff0e8; }
.draw-table tbody tr:nth-child(6) { background: #fffca7; }
.issue { color: #00089e; font-weight: 700; }
.ball { width: 37px; height: 37px; display: inline-grid; place-items: center; margin: 0 3px; border-radius: 50%; color: #fff; font-weight: 700; background: radial-gradient(circle at 35% 25%, #a9b6ff 0, #5765ec 38%, #0806b7 100%); }
.sum { font-weight: 700; color: #333; }
.sep { margin: 0 8px; color: #999; }

/* rules */
.rules-panel { width: 1566px; min-height: 650px; margin: 0 auto; padding: 40px 275px; background: #fff; color: var(--brown); font-family: "SimSun", serif; font-size: 19px; line-height: 1.4; }
.rules-title { margin: 0 0 26px; text-align: center; font-weight: 700; }
.rules-section { margin: 22px 0 4px; color: #111; font-size: 20px; }
.rules-panel p { margin: 2px 0; }
.rules-example { margin: 12px 0 16px 25px; color: #3b54d7; }
.mini-result { margin-left: 25px; color: var(--brown); }
.mini-result td { width: 60px; height: 48px; border: 1px solid #8ea0f4; text-align: center; }

/* password */
.password-panel { width: 1674px; height: 181px; margin: 0 auto; display: grid; grid-template-columns: repeat(3,1fr); padding: 18px 0; background: #fff; }
.password-col { display: flex; flex-direction: column; align-items: center; gap: 7px; border-right: 1px dashed #1793ef; font-size: 22px; }
.password-col:last-child { border: 0; }
.password-col input { width: 335px; }
.password-help { width: 335px; color: #d26200; font-size: 16px; line-height: 24px; }
.password-save { display: block; width: 110px; margin: 44px auto; }

/* modal */
.modal-overlay { position: fixed; inset: 0; z-index: 50; display: none; background: rgba(0,0,0,.48); }
.modal-overlay.open { display: block; }
.password-success-overlay { z-index: 100; padding: 24px; }
.password-success-dialog { width: min(380px, 100%); margin: 24vh auto 0; padding: 24px 24px 20px; background: #fff; box-shadow: 0 12px 38px rgba(0,0,0,.32); text-align: center; }
.password-success-dialog h2 { margin: 0 0 8px; color: var(--blue-dark); font-size: 22px; }
.password-success-dialog p { margin: 0 0 20px; color: #4b5563; font-size: 15px; }
.password-success-dialog .btn { width: 100%; height: 42px; font-size: 16px; font-weight: 700; }
.recent-detail-overlay { z-index: 80; padding: 32px; }
.recent-detail-modal { position: relative; width: min(820px, 100%); max-height: min(760px, 100%); margin: 5vh auto 0; display: flex; flex-direction: column; background: #fff; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.recent-detail-head { min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; color: #fff; background: var(--blue); font-size: 18px; }
.recent-detail-head .modal-close { margin-left: auto; }
.recent-detail-body { min-height: 0; overflow-y: auto; padding: 16px 20px 22px; color: #333; font-size: 15px; }
.recent-detail-loading, .recent-detail-empty { padding: 30px 8px; color: #777; text-align: center; }
.recent-detail-original { margin-bottom: 14px; padding: 9px 11px; background: #f7f7f7; border: 1px solid #ddd; }
.recent-detail-original pre { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.5; }
.recent-detail-group { margin-top: 12px; border: 1px solid #d7dfe7; }
.recent-detail-group h3 { min-height: 38px; display: flex; align-items: center; gap: 8px; margin: 0; padding: 5px 10px; color: #333; background: #f1f5f8; font-size: 16px; }
.recent-detail-group h3 strong { margin-left: auto; color: #9b0000; font-size: 14px; }
.recent-detail-count { color: #777; font-size: 13px; font-weight: 400; }
.recent-detail-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; padding: 10px; }
.recent-detail-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; background: #fafafa; border: 1px solid #e2e2e2; }
.recent-detail-item code { color: #153cff; font: 700 15px/1.3 "Microsoft YaHei", sans-serif; overflow-wrap: anywhere; }
.recent-detail-item span { color: #9b0000; white-space: nowrap; }
.recent-detail-total { margin-top: 14px; padding-top: 10px; border-top: 1px dashed #999; text-align: right; }
.recent-detail-total strong { color: #9b0000; font-size: 17px; }

/* Text rules quick-entry dialog. Keep this dialog outside the scaled app frame
   so it fills the actual browser viewport while retaining the mobile wording. */
.rules-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,.48);
}
.rules-modal-overlay.open { display: flex; }
.text-rules-modal {
  width: min(550px, calc(100% - 40px));
  height: min(380px, calc(100% - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  color: #111;
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.text-rules-modal .rm-head {
  position: relative;
  flex: 0 0 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 52px;
  border-bottom: 1px solid #d6d6d6;
  background: #fff;
  font-size: 25px;
  font-weight: 700;
}
.text-rules-modal .rm-close {
  position: absolute;
  top: 5px;
  right: 14px;
  width: 42px;
  height: 48px;
  padding: 0;
  border: 0;
  color: #000;
  background: transparent;
  cursor: pointer;
  font-size: 40px;
  font-weight: 300;
  line-height: 44px;
}
.text-rules-modal .rm-close:hover { color: #087c76; }
.text-rules-modal .rm-tabs {
  flex: 0 0 54px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fff;
}
.text-rules-modal .rm-tab {
  padding: 0 8px;
  border: 1px solid #777;
  border-top: 0;
  border-right: 0;
  color: #111;
  background: #f5f5f5;
  cursor: pointer;
  font: 700 18px/1.1 inherit;
  white-space: nowrap;
}
.text-rules-modal .rm-tab:last-child { border-right: 1px solid #777; }
.text-rules-modal .rm-tab:hover { background: #e5f3f1; }
.text-rules-modal .rm-tab.on { color: #fff; background: #087c76; }
.text-rules-modal .rm-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 24px 30px;
  -webkit-overflow-scrolling: touch;
}
.text-rules-modal .rm-pane { display: none; color: #111; font-size: 17px; line-height: 1.7; }
.text-rules-modal .rm-pane.on { display: block; }
.text-rules-modal .rm-pane h3 {
  margin: 4px 0 10px;
  color: #101bb0;
  font-size: 23px;
  line-height: 1.35;
}
.text-rules-modal .rm-pane h4 {
  margin: 12px 0 2px;
  color: #111;
  font-size: 18px;
  line-height: 1.4;
}
.text-rules-modal .rm-pane p { margin: 0 0 8px; }
.text-rules-modal .rm-example {
  margin: 2px 0 9px;
  color: #111;
  white-space: pre-wrap;
  word-break: break-word;
}

.route-modal { position: absolute; left: 50%; top: 162px; width: 770px; height: 530px; transform: translateX(-50%); padding: 25px 36px; background: #fff; box-shadow: 0 2px 7px rgba(0,0,0,.35); }
.modal-head { height: 60px; display: flex; align-items: center; border-bottom: 1px solid #999; font-size: 20px; font-weight: 700; }
.modal-close { margin-left: auto; width: 28px; height: 28px; border: 1px solid #777; border-radius: 50%; background: #fff; color: #555; cursor: pointer; font-size: 20px; }
.route-note { height: 39px; margin-top: 24px; padding: 6px 24px; border: 1px solid #333; font-size: 18px; }
.route-note + .route-note { margin-top: 5px; }
.route-table-wrap { height: 308px; margin-top: 5px; overflow-y: auto; }
.route-table { width: 100%; font-size: 18px; }
.route-table th, .route-table td { height: 50px; border: 1px solid #777; text-align: center; }
.route-table th { height: 37px; background: #eee; font-weight: 400; }
.route-url { color: blue; cursor: pointer; }
.speed { color: green; font-weight: 700; }
.fastest { margin-left: 10px; color: red; }

.recent-title { position: sticky; top: 0; z-index: 2; padding: 7px 6px; color: var(--blue-dark); background: #fff; border-bottom: 1px solid #ddd; font-size: 15px; font-weight: 700; }
.recent-order { margin: 7px 2px; padding: 8px 9px; border: 1px solid #aaa; font-size: 15px; line-height: 1.35; cursor: pointer; outline: none; }
.recent-order:hover, .recent-order:focus-visible { box-shadow: 0 0 0 2px rgba(30, 92, 162, .16); }
.recent-order.lot-fu { border-color: #00008b; background: #f3f6ff; }
.recent-order.lot-ti { border-color: #2e8b45; background: #f3fbf5; }
.recent-order.lot-ft { border-color: #333; background: #f7f7f7; }
.recent-order.refunded { border-color: #d63b3b; background: #fff5f5; }
.recent-order-head, .recent-order-foot { display: flex; align-items: center; gap: 5px; }
.recent-order-head time { margin-left: auto; color: #666; font-size: 13px; }
.recent-lottery-badge, .recent-refund-badge { display: inline-block; min-width: 22px; padding: 1px 5px; color: #fff; text-align: center; font-size: 11px; font-weight: 700; }
.recent-lottery-badge.fu { background: #00008b; }
.recent-lottery-badge.ti { background: #2e8b45; }
.recent-lottery-badge.ft { background: #222; }
.recent-refund-badge { background: #d63b3b; }
.recent-order-body { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 5px; margin-top: 6px; }
.recent-seq { color: #777; font-weight: 700; }
.recent-order-body small { color: #444; white-space: pre-line; overflow-wrap: anywhere; }
.recent-order-foot { justify-content: flex-end; margin-top: 6px; color: #666; }
.recent-order-foot strong { margin-left: 5px; color: #9b0000; }
.recent-order-foot .btn-small { min-width: 28px; height: 23px; padding: 0 6px; line-height: 21px; }
.recent-order-foot .recent-detail { margin-left: auto; }
.recent-order-foot .recent-refund { border-color: #c52f2f; background: #d63b3b; }
.bet-toolbar label { margin-left: 10px; }
.bet-table td:last-child { white-space: nowrap; }
.bet-table .btn-small { margin-left: 4px; }

@media (max-width: 900px) {
  .login-box { padding: 28px 24px 32px; }
  .profile-summary, .profile-meta, .draw-tabs, .draw-list-panel { width: 100%; }
  .rules-panel { padding-left: 30px; padding-right: 30px; }
  .rules-modal-overlay { padding: 12px; }
  .text-rules-modal { width: min(550px, calc(100% - 24px)); height: min(380px, calc(100% - 24px)); }
  .text-rules-modal .rm-body { padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 560px) {
  .rules-modal-overlay { padding: 8px; }
  .text-rules-modal { border-radius: 8px; }
  .text-rules-modal .rm-head { flex-basis: 54px; padding: 8px 42px; font-size: 20px; }
  .text-rules-modal .rm-close { top: 1px; right: 7px; width: 34px; height: 44px; font-size: 34px; line-height: 40px; }
  .text-rules-modal .rm-tabs { flex-basis: 46px; }
  .text-rules-modal .rm-tab { padding: 0 2px; font-size: 15px; white-space: normal; }
  .text-rules-modal .rm-body { padding: 10px 11px 22px; }
  .text-rules-modal .rm-pane { font-size: 15px; line-height: 1.6; }
  .text-rules-modal .rm-pane h3 { font-size: 19px; }
  .text-rules-modal .rm-pane h4 { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
