:root {
  --bg: #07090d;
  --bg-2: #0b1016;
  --panel: #0e151c;
  --panel-2: #121b24;
  --line: rgba(70, 210, 255, 0.16);
  --line-strong: rgba(70, 210, 255, 0.38);
  --cyan: #3cefff;
  --cyan-dim: #1a8ea3;
  --green: #46ff9a;
  --green-2: #14c86a;
  --magenta: #ff3d86;
  --amber: #ffc45a;
  --red: #ff4d6d;
  --text: #d7e4ee;
  --muted: #7d8f9e;
  --dim: #546473;
  --black: #05070a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --display: "Chakra Petch", "Noto Sans SC", sans-serif;
  --logo: "DotGothic16", "Noto Sans SC", sans-serif;
  --sans: "Noto Sans SC", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow: hidden;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

#bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.crt {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0 2px,
      rgba(0, 0, 0, 0.08) 2px 3px
    );
  mix-blend-mode: multiply;
  opacity: 0.35;
}

.app {
  position: relative;
  z-index: 2;
  height: 100%;
  display: grid;
  grid-template-rows: 64px 1fr;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(10, 18, 24, 0.92), rgba(14, 10, 18, 0.88));
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-text h1 {
  font-family: var(--logo);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.18em;
  line-height: 1;
  transform: skewX(-8deg);
  text-shadow: 0 0 10px rgba(215, 228, 238, 0.2);
}

.brand-text h1 span {
  color: var(--cyan);
  text-shadow:
    0 0 8px rgba(60, 239, 255, 0.95),
    0 0 18px rgba(60, 239, 255, 0.45);
}

.brand-text small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.sys-clock {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--cyan);
  letter-spacing: 0.12em;
}

.sys-clock .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.who-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  margin-right: 4px;
  line-height: 1.25;
}

.who-box #who-label {
  color: var(--muted);
  font-size: 13px;
}

.who-box #who-expire {
  color: var(--dim);
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.ver-badge {
  display: inline-block;
  flex-shrink: 0;
  color: var(--amber);
  border: 1px solid rgba(255, 196, 90, 0.45);
  background: rgba(255, 196, 90, 0.08);
  font-size: 12px;
  line-height: 1;
  padding: 5px 8px;
  letter-spacing: 0.04em;
}

.btn {
  border: 1px solid var(--line-strong);
  background: rgba(18, 28, 36, 0.8);
  color: var(--text);
  height: 36px;
  padding: 0 14px;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 0.06em;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: 0.15s ease;
}

.btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 16px rgba(60, 239, 255, 0.18);
}

.btn-primary {
  border-color: rgba(70, 255, 154, 0.5);
  color: var(--green);
}

.btn-primary:hover {
  background: rgba(70, 255, 154, 0.12);
  color: #d8ffe9;
  border-color: var(--green);
}

.workspace {
  display: grid;
  grid-template-columns: 1.15fr 1.05fr 0.95fr;
  gap: 10px;
  padding: 10px;
  min-height: 0;
}

.col {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 52px 1fr;
  background: linear-gradient(180deg, rgba(14, 21, 28, 0.92), rgba(10, 14, 18, 0.9));
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), var(--shadow);
  position: relative;
}

.col::before,
.col::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--cyan);
  pointer-events: none;
}

.col::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.col::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 16, 22, 0.7);
}

.col-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.col-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.col-title h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.col-title p {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fold-count,
.fold-chevron {
  display: none;
}

.col-body {
  overflow: auto;
  min-height: 0;
}

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

.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #101820;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.table td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(70, 210, 255, 0.07);
  vertical-align: middle;
}

.table tbody tr {
  transition: background 0.15s;
}

.table tbody tr:hover {
  background: rgba(60, 239, 255, 0.05);
}

#watch-body tr {
  cursor: pointer;
}

#watch-body tr.on {
  background: rgba(60, 239, 255, 0.1);
}

#watch-body tr.on:hover {
  background: rgba(60, 239, 255, 0.14);
}

.time {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
}

.time:has(.time-stack) {
  white-space: normal;
}

.time-stack {
  display: block;
}

.time-line {
  display: block;
  white-space: nowrap;
  line-height: 1.35;
}

.time-line i {
  font-style: normal;
  color: var(--dim);
  margin-right: 2px;
}

.event .league {
  display: inline-block;
  color: var(--green);
  border: 1px solid rgba(70, 255, 154, 0.35);
  padding: 0 7px;
  height: 22px;
  line-height: 20px;
  font-size: 13px;
  margin-bottom: 4px;
  background: rgba(70, 255, 154, 0.06);
}

.event .teams {
  color: var(--text);
  line-height: 1.35;
}

.market-cell {
  color: #c9d7e2;
  white-space: nowrap;
}

.odds {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--cyan);
  font-size: 15px;
}

.odds.flash-up { animation: flashUp 0.7s ease; }
.odds.flash-down { animation: flashDown 0.7s ease; }

@keyframes flashUp {
  0% { background: rgba(255, 77, 109, 0.35); color: #fff; }
  100% { background: transparent; }
}

@keyframes flashDown {
  0% { background: rgba(70, 255, 154, 0.35); color: #fff; }
  100% { background: transparent; }
}

.mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.buy {
  height: 30px;
  padding: 0 12px;
  border: 0;
  background: var(--green-2);
  color: #04140c;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  box-shadow: 0 0 12px rgba(70, 255, 154, 0.25);
}

.buy:hover { background: var(--green); }
.buy:disabled {
  background: #2a3a32;
  color: #6d7c74;
  box-shadow: none;
  cursor: not-allowed;
}

.radar {
  width: 14px;
  height: 14px;
  border: 1px solid var(--cyan-dim);
  border-radius: 50%;
  position: relative;
  pointer-events: none;
}

.radar::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: pulse 1.8s infinite;
}

.roi-chip {
  display: block;
  width: fit-content;
  margin: 0 0 4px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 13px;
  background: rgba(255, 196, 90, 0.12);
  color: var(--amber);
  border: 1px solid rgba(255, 196, 90, 0.3);
}

.roi-chip.good {
  background: rgba(70, 255, 154, 0.12);
  color: var(--green);
  border-color: rgba(70, 255, 154, 0.35);
}

.roi-chip.bad {
  background: rgba(255, 61, 134, 0.12);
  color: var(--magenta);
  border-color: rgba(255, 61, 134, 0.35);
}

.roi-chip.started,
.roi-box.started {
  background: rgba(125, 143, 158, 0.12);
  color: var(--muted);
  border-color: rgba(125, 143, 158, 0.35);
}

.roi-box.started b {
  font-size: 15px;
  letter-spacing: 0.12em;
}

.stake-input {
  width: 96px;
  height: 30px;
  background: #0a1117;
  border: 1px solid var(--line);
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 14px;
}

.stake-input:focus {
  outline: none;
  border-color: var(--cyan);
}

.icon-btn {
  width: 28px;
  height: 28px;
  font-size: 16px;
  border: 1px solid rgba(255, 61, 134, 0.35);
  background: transparent;
  color: var(--magenta);
  cursor: pointer;
}

.icon-btn:hover { background: rgba(255, 61, 134, 0.12); }

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 10px 10px;
}

.card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #121c25, #0d141b);
  padding: 10px;
  position: relative;
  cursor: pointer;
}

.struck-badge {
  position: absolute;
  top: -8px;
  left: -1px;
  z-index: 2;
  background: #f5d000;
  color: #111;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  border-radius: 3px;
  line-height: 1.3;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #121c25, #0d141b);
  padding: 10px;
  position: relative;
  cursor: pointer;
}

.card:hover {
  border-color: var(--line-strong);
}

.card.lockable {
  border-color: rgba(70, 255, 154, 0.45);
  box-shadow: 0 0 18px rgba(70, 255, 154, 0.08);
}

.card-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
}

.roi-box {
  min-width: 96px;
  padding: 8px 10px;
  background: rgba(255, 61, 134, 0.16);
  border: 1px solid rgba(255, 61, 134, 0.45);
  color: #ff9fbd;
  font-family: var(--mono);
  text-align: center;
}

.roi-box.good {
  background: rgba(70, 255, 154, 0.14);
  border-color: rgba(70, 255, 154, 0.5);
  color: var(--green);
}

.roi-box b {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.card-match .league {
  color: var(--green);
  font-size: 14px;
}

.card-match .teams {
  font-size: 15px;
  margin-top: 2px;
}

.card-match .vs-line {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--cyan);
}

.card-time {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.mini {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 13px;
}

.mini th {
  color: var(--dim);
  font-weight: 500;
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.mini td {
  padding: 8px;
  border-bottom: 1px solid rgba(70, 210, 255, 0.07);
}

.mini .num { font-family: var(--mono); color: var(--cyan); }

.calc-bar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}

.calc-bar strong {
  color: var(--text);
  font-family: var(--mono);
  font-weight: 600;
}

.scen {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  cursor: default;
}

.btn-ghost, .btn-solid {
  height: 38px;
  cursor: pointer;
  font-size: 15px;
  letter-spacing: 0.12em;
  border: 1px solid transparent;
}

.btn-ghost {
  background: transparent;
  border-color: rgba(255, 61, 134, 0.45);
  color: var(--magenta);
}

.btn-ghost:hover { background: rgba(255, 61, 134, 0.1); }

button.btn-record {
  height: 38px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.12em;
  background: #f5d000;
  border: 1px solid #f5d000;
  color: #111;
  -webkit-text-fill-color: #111;
}

button.btn-record:hover {
  background: #ffe44d;
  border-color: #ffe44d;
  color: #111;
  -webkit-text-fill-color: #111;
}

.btn-solid {
  background: var(--green-2);
  color: #04140c;
  font-weight: 700;
}

.btn-solid:hover { background: var(--green); }

.empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-align: center;
  padding: 24px;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(3, 6, 10, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-mask.show { display: flex; }

.modal {
  width: min(760px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
  background: #0d141b;
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 0 1px rgba(255, 61, 134, 0.08), 0 30px 80px rgba(0, 0, 0, 0.55);
}

.modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.modal header h3 {
  font-size: 16px;
  letter-spacing: 0.12em;
}

.modal .body { padding: 16px; }

.modal-orders {
  width: min(880px, 100%);
}

.order-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 8px;
}

.order-card {
  position: relative;
  padding: 14px 14px 10px;
  background: linear-gradient(180deg, #121c25, #0d141b);
  border: 1px solid var(--line);
}

.order-card .struck-badge {
  top: -8px;
  left: 12px;
}

.order-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding-right: 32px;
}

.order-del {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
}

.order-mini {
  margin-top: 12px;
}

.order-mini th {
  background: rgba(70, 255, 154, 0.1);
  color: var(--green);
  border-bottom: none;
  text-align: center;
}

.order-mini td {
  text-align: center;
}

.order-pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-family: var(--mono);
  color: var(--muted);
  font-size: 14px;
}

.order-pager button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--cyan);
  cursor: pointer;
}

.order-pager button:hover:not(:disabled) {
  border-color: var(--cyan);
  background: rgba(60, 239, 255, 0.08);
}

.order-pager button:disabled {
  opacity: 0.35;
  cursor: default;
}

.profit-log-meta {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 14px;
  line-height: 1.5;
}

.profit-log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profit-log-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #121c25, #0d141b);
}

.profit-log-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 4px;
}

.profit-log-main {
  font-size: 14px;
  line-height: 1.45;
}

.profit-log-main .num {
  font-family: var(--mono);
  color: var(--cyan);
}

.profit-dir {
  margin-left: 6px;
  font-size: 12px;
  color: var(--muted);
}

.profit-dir.up { color: var(--green); }
.profit-dir.down { color: var(--magenta); }

.profit-log-roi {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.profit-log-roi.good {
  color: var(--green);
}

.profit-log-roi.bad {
  color: var(--red);
}

.profit-log-roi b {
  font-family: var(--mono);
  color: var(--text);
}

.stats-date {
  max-width: 240px;
  margin-bottom: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.stats-chip {
  border: 1px solid var(--line);
  background: rgba(10, 17, 23, 0.8);
  padding: 10px 12px;
}

.stats-chip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.stats-chip b {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 20px;
  color: var(--cyan);
}

.stats-chip.good b { color: var(--green); }
.stats-chip.bad b { color: var(--magenta); }

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid .span2 { grid-column: span 2; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field span {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.field input, .field select {
  height: 38px;
  background: #0a1117;
  border: 1px solid var(--line);
  padding: 0 10px;
  font-size: 14px;
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--cyan);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 46px;
  z-index: 30;
  background: #102018;
  border: 1px solid rgba(70, 255, 154, 0.4);
  color: var(--green);
  padding: 10px 14px;
  font-size: 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.calc-dock {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0 20px 28px;
  background: rgba(3, 6, 10, 0.72);
}

.calc-dock.show { display: flex; }

.calc-panel {
  width: min(1080px, 100%);
  background: linear-gradient(180deg, rgba(14, 21, 28, 0.98), rgba(10, 14, 18, 0.98));
  color: var(--text);
  font-family: var(--sans);
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 0 1px rgba(255, 61, 134, 0.08), 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 40px rgba(60, 239, 255, 0.06);
  overflow: hidden;
  position: relative;
}

.calc-panel::before,
.calc-panel::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--cyan);
  pointer-events: none;
}

.calc-panel::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.calc-panel::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.calc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 16, 22, 0.7);
}

.calc-head h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.12em;
}

.calc-x {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 61, 134, 0.35);
  background: transparent;
  color: var(--magenta);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.calc-x:hover { background: rgba(255, 61, 134, 0.12); }

.calc-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 10px;
}

.calc-league {
  display: inline-block;
  color: var(--green);
  border: 1px solid rgba(70, 255, 154, 0.35);
  background: rgba(70, 255, 154, 0.06);
  border-radius: 0;
  padding: 1px 8px;
  font-size: 14px;
  margin-right: 8px;
}

.calc-kick {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 14px;
}

.calc-teams {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.calc-rate {
  flex-shrink: 0;
  border: 1px solid rgba(70, 255, 154, 0.5);
  color: var(--green);
  border-radius: 0;
  padding: 4px 12px;
  font-size: 15px;
  font-family: var(--mono);
  background: rgba(70, 255, 154, 0.1);
  white-space: nowrap;
}

.calc-rate.neg {
  border-color: rgba(255, 61, 134, 0.5);
  color: var(--magenta);
  background: rgba(255, 61, 134, 0.1);
}

.calc-table {
  width: calc(100% - 32px);
  margin: 0 16px;
  border-collapse: collapse;
  font-size: 15px;
}

.calc-table th {
  background: #101820;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  padding: 10px 8px;
  border: 1px solid var(--line);
  letter-spacing: 0.06em;
}

.calc-table td {
  padding: 10px 8px;
  border: 1px solid rgba(70, 210, 255, 0.1);
  background: rgba(10, 17, 23, 0.85);
  vertical-align: middle;
  color: var(--text);
}

.calc-table input[type="number"],
.calc-table select {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0 8px;
  background: #0a1117;
  color: var(--text);
  font-size: 14px;
  font-family: var(--mono);
}

.calc-table input[type="number"] { width: 108px; }
.calc-table .odds-in { width: 88px; }
.calc-table .reb { width: 72px; }
.calc-table select { width: 132px; font-family: var(--sans); }

.calc-table input:focus,
.calc-table select:focus {
  outline: none;
  border-color: var(--cyan);
}

.calc-f {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}

.calc-f input { accent-color: var(--green); }

.calc-profit {
  color: var(--magenta);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.calc-tools {
  display: flex;
  align-items: center;
  padding: 12px 16px;
}

.calc-run {
  height: 36px;
  padding: 0 24px;
  border: 0;
  border-radius: 0;
  background: var(--green-2);
  color: #04140c;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  box-shadow: 0 0 12px rgba(70, 255, 154, 0.25);
}

.calc-run:hover { background: var(--green); }

.calc-sum {
  background: rgba(255, 61, 134, 0.1);
  border-top: 1px solid rgba(255, 61, 134, 0.28);
  color: var(--muted);
  padding: 10px 16px;
  font-size: 15px;
}

.calc-sum b {
  color: var(--magenta);
  font-family: var(--mono);
  font-weight: 700;
  margin: 0 14px 0 4px;
}

.calc-sum-k {
  margin-right: 8px;
}

@media (max-width: 1200px) {
  .workspace { grid-template-columns: 1fr; overflow: auto; }
  .app { overflow: auto; }
  .col { min-height: 420px; }
}

.auth-body {
  overflow: auto;
  display: grid;
  place-items: center;
  min-height: 100%;
  background:
    radial-gradient(900px 400px at 20% 0%, rgba(60, 239, 255, 0.08), transparent 55%),
    var(--bg);
}

.auth-card {
  width: min(420px, calc(100% - 32px));
  padding: 36px 28px;
  background: linear-gradient(180deg, rgba(14, 21, 28, 0.96), rgba(10, 14, 18, 0.96));
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-family: var(--logo);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 0.18em;
  transform: skewX(-8deg);
  text-shadow: 0 0 12px rgba(215, 228, 238, 0.2);
}

.auth-card h1 span {
  color: var(--cyan);
  text-shadow:
    0 0 8px rgba(60, 239, 255, 0.95),
    0 0 18px rgba(60, 239, 255, 0.45);
}

.auth-card p {
  margin: 8px 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.auth-card .field { margin-bottom: 14px; }

.auth-submit {
  width: 100%;
  margin-top: 8px;
}

.auth-error {
  min-height: 22px;
  margin-top: 12px;
  color: var(--magenta);
  font-size: 13px;
}

.admin-body {
  overflow: hidden;
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100%;
}

.admin-side {
  border-right: 1px solid var(--line);
  background: rgba(8, 16, 22, 0.92);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-side nav { display: flex; flex-direction: column; gap: 8px; }

.side-btn {
  height: 40px;
  text-align: left;
  padding: 0 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}

.side-btn.on,
.side-btn:hover {
  color: var(--cyan);
  border-color: var(--line);
  background: rgba(60, 239, 255, 0.06);
}

.admin-main {
  min-width: 0;
  display: grid;
  grid-template-rows: 56px 1fr;
  overflow: hidden;
}

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.admin-view {
  display: none;
  overflow: auto;
  padding: 24px;
}

.admin-view.on { display: block; }

.admin-view h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

.admin-note {
  color: var(--muted);
  font-size: 13px;
  margin: -8px 0 16px;
}

.monitor-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.monitor-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.monitor-source .btn {
  height: 32px;
  font-size: 13px;
}

.monitor-chip {
  border: 1px solid var(--line);
  background: rgba(10, 17, 23, 0.7);
  color: var(--muted);
  font-size: 13px;
  padding: 6px 10px;
  font-family: var(--mono);
}

.monitor-chip.ok { color: var(--green); border-color: rgba(70, 255, 154, 0.35); }
.monitor-chip.bad { color: var(--magenta); border-color: rgba(255, 61, 134, 0.35); }
.monitor-chip.warn { color: var(--amber); border-color: rgba(255, 196, 90, 0.35); }

.monitor-wrap { overflow: auto; }

.monitor-table th, .monitor-table td {
  white-space: nowrap;
  vertical-align: top;
}

.monitor-fixed {
  color: var(--muted);
}

.monitor-live {
  color: var(--cyan);
  font-family: var(--mono);
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  letter-spacing: 0.06em;
  border: 1px solid var(--line);
  color: var(--muted);
}

.status-pill.ok {
  color: var(--green);
  border-color: rgba(70, 255, 154, 0.45);
  background: rgba(70, 255, 154, 0.1);
}

.status-pill.waiting {
  color: var(--cyan);
  border-color: var(--line);
}

.status-pill.stopped {
  color: var(--muted);
}

.status-pill.sealed {
  color: var(--amber);
  border-color: rgba(255, 196, 90, 0.4);
}

.status-pill.stale,
.status-pill.error,
.status-pill.noid {
  color: var(--magenta);
  border-color: rgba(255, 61, 134, 0.45);
  background: rgba(255, 61, 134, 0.08);
}

.monitor-ago {
  display: block;
  color: var(--dim);
  font-size: 12px;
  margin-top: 2px;
}

.publish-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: none;
  gap: 8px 12px;
}

.publish-form .span2 { grid-column: span 2; }

.publish-form .field {
  gap: 4px;
}

.publish-form .field input,
.publish-form .field select {
  height: 34px;
}

.market-submit {
  margin-top: 0;
  align-items: end;
}

#view-markets > h2 {
  margin-bottom: 10px;
}

.market-list-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0 8px;
}

.market-list-head .admin-sub {
  margin: 0;
}

.market-date {
  width: 200px;
}

.market-table {
  table-layout: fixed;
  width: 100%;
}

.market-table th,
.market-table td {
  padding: 8px 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-table th:nth-child(1) { width: 13%; }
.market-table th:nth-child(2) { width: 11%; }
.market-table th:nth-child(3) { width: 16%; }
.market-table th:nth-child(4) { width: 13%; }
.market-table th:nth-child(5) { width: 7%; }
.market-table th:nth-child(6) { width: 16%; }
.market-table th:nth-child(7) { width: 8%; }
.market-table th:nth-child(8) { width: 10%; }

.market-table th:last-child,
.market-table td:last-child {
  width: 48px;
  text-align: right;
  padding-right: 12px;
}

#view-markets .admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.cell-edit {
  cursor: pointer;
  color: var(--cyan);
}

.cell-edit:hover {
  background: rgba(60, 239, 255, 0.08);
}

.manual-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: var(--amber);
  letter-spacing: 0.06em;
}

.modal-sm {
  width: min(520px, 100%);
}

.modal-opp {
  width: min(560px, 100%);
  max-height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-opp .body {
  overflow: auto;
  padding: 16px 18px 20px;
}

.modal-opp .opp-form {
  grid-template-columns: 1fr;
}

.modal-opp .opp-form .span2,
.modal-opp .opp-form .modal-actions {
  grid-column: 1;
}

.modal-opp .modal-actions {
  position: sticky;
  bottom: 0;
  margin-top: 8px;
  padding: 12px 0 4px;
  background: #0d141b;
}

.modal-opp .modal-actions .btn {
  min-width: 96px;
  height: 40px;
}

.opp-modal-meta {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 14px;
  line-height: 1.5;
}

.market-table .time,
.market-table .odds {
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .publish-form {
    grid-template-columns: 1fr 1fr;
  }
}

.admin-form {
  max-width: 860px;
}

.admin-table-wrap {
  border: 1px solid var(--line);
  background: rgba(10, 17, 23, 0.7);
}

.admin-table-wrap .btn {
  height: 30px;
  font-size: 13px;
  margin-right: 6px;
}

.admin-table-wrap .btn-del {
  color: var(--red);
  border-color: rgba(255, 77, 109, 0.45);
}

.admin-table-wrap .btn-del:hover {
  color: #ffd0d8;
  border-color: var(--red);
  box-shadow: 0 0 16px rgba(255, 77, 109, 0.18);
}

.event-stack {
  display: contents;
}

/* 手机 / 折叠屏：不改动上方电脑端规则 */
@media (max-width: 980px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  html,
  body {
    height: auto;
    min-height: 100%;
    min-height: 100dvh;
    overflow: auto;
    overflow-x: hidden;
  }

  .app {
    height: auto;
    min-height: 100dvh;
    grid-template-rows: auto 1fr;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .topbar {
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 8px 12px;
    height: auto;
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  }

  .brand {
    min-width: 0;
  }

  .brand-text h1 {
    font-size: 18px;
    letter-spacing: 0.12em;
  }

  .brand-text small {
    font-size: 12px;
  }

  .sys-clock {
    grid-column: 1 / -1;
    font-size: 13px;
    order: 3;
  }

  .top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }

  .who-box {
    align-items: flex-end;
    max-width: 42vw;
  }

  .who-box #who-label,
  .who-box #who-expire {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  .btn,
  .buy,
  .side-btn,
  .btn-ghost,
  .btn-solid,
  .btn-record,
  .calc-run {
    min-height: 44px;
    touch-action: manipulation;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .workspace {
    grid-template-columns: 1fr;
    overflow: visible;
    padding: 8px max(8px, env(safe-area-inset-right)) 12px max(8px, env(safe-area-inset-left));
    gap: 8px;
  }

  .col {
    min-height: 0;
    grid-template-rows: auto 1fr;
  }

  .col-head {
    min-height: 48px;
    height: auto;
    padding: 8px 10px;
    flex-wrap: nowrap;
  }

  .col[data-fold] .col-head {
    cursor: pointer;
    user-select: none;
  }

  .fold-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border: 1px solid var(--line);
    background: rgba(60, 239, 255, 0.08);
    color: var(--cyan);
    font-family: var(--mono);
    font-size: 12px;
  }

  .fold-chevron {
    display: block;
    width: 8px;
    height: 8px;
    margin-left: auto;
    flex-shrink: 0;
    border-right: 2px solid var(--cyan);
    border-bottom: 2px solid var(--cyan);
    transform: rotate(45deg);
    transition: transform 0.15s ease;
  }

  .col[data-fold].is-folded .fold-chevron {
    transform: rotate(-45deg);
    margin-bottom: -4px;
  }

  .col[data-fold] {
    grid-template-rows: auto auto;
  }

  .col[data-fold] .col-body {
    max-height: min(42dvh, 420px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .col[data-fold].is-folded {
    grid-template-rows: auto;
  }

  .col[data-fold].is-folded .col-body {
    display: none;
  }

  .col[data-fold].is-folded .col-title p {
    display: none;
  }

  .col-title {
    flex-wrap: wrap;
  }

  .col-title h2 {
    white-space: normal;
  }

  .col-title p {
    white-space: normal;
    width: 100%;
  }

  .col-body {
    overflow: visible;
  }

  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr {
    display: block;
    width: 100%;
  }

  .table tbody tr {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }

  .table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 0;
    text-align: right;
    white-space: normal;
  }

  .table td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-align: left;
    flex: 0 0 5.2em;
  }

  .table td[data-label=""]::before,
  .table td:not([data-label])::before {
    content: none;
    display: none;
  }

  .table td[data-label=""] {
    justify-content: flex-end;
  }

  .table td[colspan] {
    display: block;
  }

  .table td[colspan]::before {
    display: none;
  }

  .event-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 0;
  }

  .time-stack {
    text-align: right;
  }

  .time-line {
    display: block;
  }

  .event .teams {
    text-align: right;
  }

  .mark {
    flex-direction: row;
    justify-content: flex-end;
  }

  .stake-input,
  .field input,
  .field select,
  .calc-table input[type="number"],
  .calc-table select {
    font-size: 16px;
  }

  .stake-input {
    width: 108px;
    height: 36px;
  }

  .cards {
    padding: 12px 8px 8px;
  }

  .card-top,
  .order-head {
    grid-template-columns: 1fr;
  }

  .roi-box {
    min-width: 0;
    width: fit-content;
  }

  .card-time {
    white-space: normal;
  }

  .mini,
  .order-mini {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .calc-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .modal-mask {
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    align-items: flex-end;
  }

  .modal,
  .modal-orders,
  .modal-sm,
  .modal-opp {
    width: 100%;
    max-height: min(88dvh, 820px);
  }

  .form-grid,
  .publish-form,
  .admin-form {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .form-grid .span2,
  .publish-form .span2 {
    grid-column: span 1;
  }

  .toast {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    max-width: none;
  }

  .calc-dock {
    padding: 0;
    align-items: stretch;
  }

  .calc-panel {
    width: 100%;
    max-height: 100dvh;
    overflow: auto;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .calc-head {
    padding: 8px 12px;
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .calc-head h3 {
    font-size: 15px;
  }

  .calc-x {
    width: 40px;
    height: 40px;
  }

  .calc-info {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }

  .calc-teams {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
  }

  .calc-kick {
    font-size: 12px;
  }

  .calc-rate {
    align-self: flex-start;
    font-size: 13px;
    padding: 3px 8px;
  }

  .calc-scroll {
    overflow: visible;
  }

  .calc-table {
    display: block;
    width: calc(100% - 16px);
    min-width: 0;
    margin: 0 8px 8px;
    font-size: 13px;
    border-collapse: separate;
    border-spacing: 0;
  }

  .calc-table thead {
    display: none;
  }

  .calc-table tbody,
  .calc-table tr {
    display: block;
    width: 100%;
  }

  .calc-table tr {
    margin-bottom: 8px;
    border: 1px solid var(--line);
    background: rgba(10, 17, 23, 0.9);
    padding: 6px 10px 8px;
  }

  .calc-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 5px 0;
    border: 0;
    background: transparent;
  }

  .calc-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.04em;
    flex: 0 0 4.8em;
    text-align: left;
  }

  .calc-table td.calc-mkt {
    display: block;
    font-weight: 700;
    font-size: 14px;
    padding: 4px 0 8px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--line);
    text-align: left;
  }

  .calc-table td.calc-mkt::before {
    display: none;
  }

  .calc-table input[type="number"],
  .calc-table select {
    width: min(58vw, 180px);
    max-width: 180px;
    height: 36px;
    font-size: 16px;
    padding: 0 8px;
  }

  .calc-table .odds-in,
  .calc-table .reb,
  .calc-table input[type="number"] {
    width: min(58vw, 180px);
  }

  .calc-table select {
    width: min(58vw, 180px);
    font-size: 15px;
  }

  .calc-tools {
    padding: 8px 12px;
  }

  .calc-run {
    width: 100%;
  }

  .calc-sum {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 10px;
    font-size: 12px;
    padding: 10px 12px;
    line-height: 1.45;
  }

  .calc-sum-k {
    grid-column: 1 / -1;
    margin: 0 0 2px;
    color: var(--muted);
  }

  .calc-sum b {
    margin: 0 0 0 4px;
    font-size: 13px;
  }

  .auth-body {
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .auth-card {
    width: 100%;
    max-width: 420px;
    padding: 28px 18px;
  }

  .admin-body {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  .admin-side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-side .brand-text small {
    display: none;
  }

  .admin-side nav {
    flex-direction: row;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .side-btn {
    flex-shrink: 0;
    text-align: center;
    padding: 0 14px;
  }

  .admin-main {
    overflow: visible;
    grid-template-rows: auto 1fr;
  }

  .admin-top {
    padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  }

  .admin-view {
    padding: 14px max(12px, env(safe-area-inset-right)) 24px max(12px, env(safe-area-inset-left));
  }

  .market-list-head {
    flex-direction: column;
    align-items: stretch;
  }

  .market-date {
    width: 100%;
  }

  .market-table,
  .market-table th,
  .market-table td {
    width: auto;
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    padding: 6px 0;
  }

  .market-table th:last-child,
  .market-table td:last-child {
    width: auto;
    text-align: right;
    padding-right: 0;
  }

  .monitor-table th,
  .monitor-table td {
    white-space: normal;
  }

  .admin-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .admin-table-wrap .table tbody tr {
    border: 1px solid var(--line);
    margin-bottom: 8px;
    background: rgba(10, 17, 23, 0.7);
  }

  .col .table tbody tr {
    background: transparent;
  }

  .admin-table-wrap .btn {
    min-height: 44px;
    height: 44px;
    margin: 0 0 6px 6px;
  }

  .table td[data-label="操作"] {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .table td[data-label="操作"]::before {
    flex-basis: 100%;
  }
}

@media (max-width: 980px) and (max-height: 500px) {
  .brand-text small,
  .col-title p {
    display: none;
  }

  .topbar {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .col-head {
    min-height: 40px;
    padding: 4px 10px;
  }
}

@media (max-width: 360px) {
  .ver-badge {
    font-size: 11px;
    padding: 4px 6px;
  }

  .brand-text h1 {
    font-size: 16px;
    letter-spacing: 0.08em;
  }

  .table td[data-label]::before {
    flex-basis: 4.6em;
  }
}

@media (horizontal-viewport-segments: 2) {
  .workspace {
    grid-template-columns: 1fr 1fr;
    column-gap: 8px;
  }

  .workspace .col:last-child {
    grid-column: 1 / -1;
  }
}
