:root {
  --bg: #fdfbfb;
  --brand: #cf1b2b;
  --brand-strong: #a91120;
  --brand-bg: #fdeaec;
  --brand-bg-hover: #fad6da;
  --panel: #ffffff;
  --ink: #101d27;
  --ink-soft: #55656f;
  --ink-faint: #8b9aa4;
  --line: #e6ebee;
  --line-soft: #eff3f5;
  --yes: #00934f;
  --yes-strong: #007a42;
  --yes-bg: #e8f7ef;
  --yes-bg-hover: #d2f0e0;
  --no: #d63c48;
  --no-strong: #bb2f3a;
  --no-bg: #fceded;
  --no-bg-hover: #f8d9da;
  --gold: #8a6d1a;
  --gold-bg: #f6efdb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 29, 39, .04);
  --shadow-hover: 0 6px 20px rgba(16, 29, 39, .10);
}

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

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- chrome ---------- */

.topbar {
  display: flex; align-items: center; gap: 30px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 0 26px; height: 60px;
  position: sticky; top: 0; z-index: 20;
}
.logo {
  height: 50px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-radius: 4px;
}
.logo img { display: block; width: 121px; height: auto; }
.topbar nav { display: flex; gap: 4px; height: 100%; }
.topbar nav a {
  font-size: 14.5px; font-weight: 600; color: var(--ink-soft);
  display: flex; align-items: center; padding: 0 12px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.topbar nav a:hover { color: var(--ink); }
.topbar nav a.on { color: var(--ink); border-bottom-color: var(--brand); }
.topright { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; }
.wallet-pill {
  background: var(--brand-bg); color: var(--brand-strong);
  font-weight: 700; padding: 7px 14px; border-radius: 999px; font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 30px 72px; }

.foot {
  border-top: 1px solid var(--line); background: var(--panel);
  display: flex; justify-content: space-between; padding: 16px 26px;
  font-size: 12.5px; color: var(--ink-faint);
}
.foot a { color: var(--ink-faint); }
.foot a:hover { color: var(--ink-soft); }

/* ---------- buttons & forms ---------- */

.btn {
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  border-radius: 9px; padding: 10px 18px; font-weight: 600; font-size: 14px;
  transition: transform .06s, box-shadow .12s, background .12s;
}
.btn:hover { box-shadow: var(--shadow-hover); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink-faint); box-shadow: none; background: var(--line-soft); }
.btn.brand { background: var(--brand); border-color: var(--brand); }
.btn.brand:hover { background: var(--brand-strong); }
.btn.yes { background: var(--yes); border-color: var(--yes); }
.btn.yes:hover { background: var(--yes-strong); }
.btn.no { background: var(--no); border-color: var(--no); }
.btn.no:hover { background: var(--no-strong); }
.btn.small { padding: 6px 13px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: default; }

input, select, textarea {
  font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #f3bcc2; border-color: var(--brand); }
label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); display: block; margin-bottom: 6px; }
.field { margin-bottom: 15px; }
.field-help { color: var(--ink-faint); font-size: 11.5px; line-height: 1.4; margin: -2px 0 7px; }

/* ---------- home ---------- */

.hero {
  margin: 6px 0 22px;
}
.hero h1 { font-size: 26px; letter-spacing: -0.6px; }
.hero p { color: var(--ink-soft); font-size: 14.5px; margin-top: 4px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 20px; }
.chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft);
  border-radius: 999px; padding: 7px 15px; font-size: 13.5px; font-weight: 600;
  transition: all .1s;
}
.chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow .14s, transform .14s, border-color .14s;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: #d5dde2; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; }
.card .cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }
.card .clock { font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.card-mid { display: flex; gap: 14px; align-items: flex-start; flex: 1; }
.card h3 { font-size: 15.5px; line-height: 1.4; font-weight: 700; letter-spacing: -0.1px; flex: 1; }
.chance { text-align: right; min-width: 62px; }
.chance b { font-size: 26px; font-weight: 800; letter-spacing: -0.8px; color: var(--ink); font-variant-numeric: tabular-nums; }
.chance span { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); margin-top: -2px; }
.chance.up b { color: var(--yes); }
.chance.down b { color: var(--no); }

.prices { display: flex; gap: 8px; }
.pbtn {
  flex: 1; border: none; border-radius: 9px; padding: 10px 8px;
  font-weight: 700; font-size: 13.5px; text-align: center;
  font-variant-numeric: tabular-nums; transition: background .1s;
}
.pbtn.yes { background: var(--yes-bg); color: var(--yes-strong); }
.pbtn.no { background: var(--no-bg); color: var(--no-strong); }
.card:hover .pbtn.yes { background: var(--yes-bg-hover); }
.card:hover .pbtn.no { background: var(--no-bg-hover); }

.card .meta { font-size: 12.5px; color: var(--ink-faint); display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 4px 10px;
  letter-spacing: .02em;
}
.badge.closed { background: var(--line-soft); color: var(--ink-soft); }
.badge.yes { background: var(--yes-bg); color: var(--yes-strong); }
.badge.no { background: var(--no-bg); color: var(--no-strong); }
.badge.void { background: var(--gold-bg); color: var(--gold); }
.badge.pending { background: #edf3fa; color: #3d6591; }

/* ---------- market page ---------- */

.crumb { font-size: 13px; color: var(--ink-faint); margin-bottom: 14px; display: inline-block; }
.crumb:hover { color: var(--ink-soft); }

.mkt-head { margin-bottom: 20px; }
.mkt-head .cat { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }
.mkt-head h1 { font-size: 27px; line-height: 1.25; margin: 8px 0 10px; letter-spacing: -0.6px; }
.mkt-head .meta { font-size: 13.5px; color: var(--ink-soft); display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; }

.mkt-grid { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 22px; align-items: start; }
@media (min-width: 1024px) { .mkt-grid > div:last-child { position: sticky; top: 78px; } }
@media (max-width: 980px) { .mkt-grid { grid-template-columns: 1fr; } .mkt-grid > div:last-child { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; } .mkt-grid > div:last-child .panel + .panel { margin-top: 0; } }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.panel h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); margin-bottom: 14px; }
.panel + .panel { margin-top: 16px; }

.pricehead { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.bigprice { font-size: 42px; font-weight: 800; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; }
.bigprice.up { color: var(--yes); }
.pricehead small { font-size: 13px; color: var(--ink-faint); font-weight: 600; }

.chart { width: 100%; height: 210px; display: block; margin-top: 6px; }
.chart text { font-family: inherit; }
.chart-tabs { display: flex; gap: 5px; margin-left: auto; justify-content: flex-end; margin-top: -30px; }
.chart-tab {
  border: 1px solid var(--line); background: #fff; color: var(--ink-faint); border-radius: 6px;
  padding: 3px 7px; font-size: 10px; font-weight: 800; letter-spacing: .05em;
}
.chart-tab.on { color: var(--brand-strong); background: var(--brand-bg); border-color: #efc2c7; }
.chart-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; margin-top: 8px; }
.chart-grid .chart { height: 190px; }
.chart-title { margin: 0 !important; font-size: 10px !important; }
.volume-chart { opacity: .9; }
@media (max-width: 680px) { .chart-grid { grid-template-columns: 1fr; } }

.sidebtns { display: flex; gap: 8px; margin-bottom: 15px; }
.sidebtn {
  flex: 1; padding: 12px 6px; border-radius: 9px; border: 1.5px solid var(--line);
  background: #fff; font-weight: 700; font-size: 14px; color: var(--ink-soft);
  transition: all .1s; font-variant-numeric: tabular-nums;
}
.sidebtn:hover { border-color: var(--ink-faint); }
.sidebtn.yes.on { background: var(--yes); border-color: var(--yes); color: #fff; }
.sidebtn.no.on { background: var(--no); border-color: var(--no); color: #fff; }
.trade-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: -2px 0 10px; }
.ticket-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: -2px 0 14px; }
.trade-mode { border: 1px solid var(--line); background: #fff; color: var(--ink-soft); border-radius: 7px; padding: 7px; font-size: 12px; font-weight: 800; }
.trade-mode.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.money-input { align-items: center; border: 1px solid var(--line); border-radius: 10px; display: flex; padding: 0 13px; }
.money-input span { color: var(--ink-faint); font-size: 20px; font-weight: 700; }
.money-input input { border: 0; box-shadow: none; font-size: 24px; font-weight: 800; padding: 11px 7px; text-align: right; }
.money-input input:focus { outline: 0; }
.quick-amounts { display: flex; gap: 6px; margin-top: 8px; }
.quick-amounts button { background: var(--brand-bg); border: 1px solid #efc2c7; border-radius: 7px; color: var(--brand-strong); font-size: 12px; font-weight: 800; padding: 5px 10px; }
.quick-limit { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; color: var(--ink-faint); font-size: 12px; margin: 2px 0 12px; }
.quick-limit .field { flex: 1 0 100%; }

.qtyrow { display: flex; gap: 8px; }
.qtyrow input { text-align: center; }
.order-slider { accent-color: var(--brand); cursor: pointer; display: block; margin: 10px 2px 0; width: calc(100% - 4px); }
.stepbtn {
  border: 1px solid var(--line); background: #fff; border-radius: 9px;
  width: 42px; flex: none; font-weight: 700; color: var(--ink-soft); font-size: 16px;
}
.stepbtn:hover { border-color: var(--ink-faint); color: var(--ink); }

.costline { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--ink-soft); margin: 5px 0; font-variant-numeric: tabular-nums; }
.costline b { color: var(--ink); font-weight: 700; }
.costs { border-top: 1px solid var(--line-soft); margin-top: 14px; padding-top: 10px; }
.trade-result { background: var(--yes-bg); border: 1px solid #bee8cf; border-radius: 9px; color: var(--yes-strong); display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 10px; padding: 10px 11px; }
.trade-result span { font-size: 12px; font-weight: 700; }
.trade-result strong { font-size: 21px; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.fineprint { font-size: 11.5px; color: var(--ink-faint); margin-top: 12px; line-height: 1.5; }

.book { width: 100%; border-collapse: collapse; font-size: 13.5px; border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.book th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); padding: 5px 8px; }
.book th:nth-child(2), .book td:nth-child(2) { text-align: right; }
.book td { padding: 6px 8px; border-top: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; position: relative; }
.book .y { color: var(--yes-strong); font-weight: 700; }
.book .n { color: var(--no-strong); font-weight: 700; }
.book .depth { position: absolute; inset: 1px auto 1px 0; z-index: 0; border-radius: 3px; }
.book .depth.y { background: var(--yes-bg); }
.book .depth.n { background: var(--no-bg); }
.book td span { position: relative; z-index: 1; }
.book-user { color: var(--ink-soft); font-size: 11px; line-height: 1.2; max-width: 105px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-user small { color: var(--ink-faint); display: block; font-size: 10px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.book-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.book-note { font-size: 12px; color: var(--ink-faint); margin: -4px 0 14px; line-height: 1.45; }
.book-level { cursor: pointer; }
.book-level:hover td { background: var(--line-soft); }
@media (max-width: 620px) { .book-grid { grid-template-columns: 1fr; } }

.trades { list-style: none; }
.trades li { font-size: 13px; padding: 10px 0; border-top: 1px solid var(--line-soft); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.trades li:first-child { border-top: none; }
.trades .py { color: var(--yes-strong); font-weight: 700; }
.trade-main { display: flex; justify-content: space-between; gap: 12px; }
.trade-users { color: var(--ink-faint); font-size: 11.5px; line-height: 1.45; margin-top: 4px; overflow-wrap: anywhere; }

@media (max-width: 700px) {
  .topbar { gap: 10px; padding: 0 14px; }
  .logo { height: 42px; }
  .logo img { width: 104px; }
  .topbar nav a { padding: 0 7px; font-size: 13px; }
  .topright > span:not(.wallet-pill) { display: none; }
  main { padding: 18px 14px 56px; }
  .mkt-head h1 { font-size: 24px; }
  .panel { padding: 16px; }
  .chart-grid .chart { height: 165px; }
}

.rules { font-size: 14px; line-height: 1.6; color: var(--ink-soft); white-space: pre-wrap; }

/* ---------- tables & tiles ---------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.tile .n { font-size: 23px; font-weight: 800; letter-spacing: -0.6px; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 11px; color: var(--ink-faint); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.tile.hero-tile { background: linear-gradient(135deg, #fdeef0, #fbe2e5); border-color: #f0c2c8; }
.tile.hero-tile .n { color: var(--brand-strong); }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); padding: 7px 10px; }
.tbl td { padding: 10px; border-top: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.tbl a { text-decoration: none; font-weight: 600; }
.tbl a:hover { color: var(--brand); }

.empty { font-size: 14px; color: var(--ink-faint); font-style: italic; padding: 12px 0; }

.notice {
  background: #fffaf0; border: 1px solid #f0e2bb; border-radius: var(--radius);
  padding: 15px 17px; font-size: 13.5px; color: #6b5716; margin-bottom: 16px; line-height: 1.6;
}
.notice code { background: #fff; border: 1px solid #f0e2bb; border-radius: 5px; padding: 2px 7px; font-size: 13px; font-weight: 600; }

.verify-amount { font-size: 34px; font-weight: 800; color: var(--brand-strong); letter-spacing: -1px; font-variant-numeric: tabular-nums; }

.h2row { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 14px; }
.h2row h2 { font-size: 18px; letter-spacing: -0.3px; }
.proposal-panel { max-width: 760px; margin: 20px auto; }
.proposal-panel h2 { font-size: 24px; letter-spacing: -.5px; margin-bottom: 7px; }
.simple-copy { color: var(--ink-soft); line-height: 1.55; margin-bottom: 20px; }

/* ---------- toast ---------- */

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; border-radius: 10px; padding: 12px 22px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .18s; z-index: 100;
  max-width: 90vw; box-shadow: 0 10px 30px rgba(16, 29, 39, .25);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- admin ---------- */

.admin-login { max-width: 340px; margin: 70px auto; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.formgrid .wide { grid-column: 1 / -1; }
.rowbtns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
