:root {
  --ink: #1d2025; --muted: #5d6470; --line: #e3e6ea; --bg: #f7f7f5; --card: #fff;
  --yes: #1f7a4d; --no: #b2452f; --accent: #24527a; --warn-bg: #fff4d6;
  font-family: "IBM Plex Sans Thai", "Noto Sans Thai", "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
.banner { background: var(--warn-bg); border-bottom: 1px solid #ecd9a0; text-align: center; padding: .5rem 1rem; font-weight: 600; font-size: .9rem; }
main { max-width: 860px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
h1 { margin: .5rem 0 .25rem; font-size: 1.6rem; }
h2 { margin: 0; font-size: 1.15rem; }
h3 { margin: 0; font-size: 1rem; }
.lede { margin: 0 0 1rem; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: .1rem .7rem; font-size: .85rem; font-weight: 600; }
.pill.open { color: var(--accent); border-color: var(--accent); }
.pill.yes { color: var(--yes); border-color: var(--yes); }
.pill.no { color: var(--no); border-color: var(--no); }
.times { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: .9rem 0; }
.times div { margin: 0; }
.times dt { font-size: .8rem; color: var(--muted); }
.times dd { margin: 0; font-size: .92rem; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.panel { border: 1px solid var(--line); border-radius: 8px; padding: .8rem .9rem; }
.hint { margin: 0 0 .4rem; font-size: .8rem; color: var(--muted); }
.big { font-size: 2rem; font-weight: 700; }
.bar { position: relative; height: 10px; border-radius: 5px; background: #eceff2; overflow: visible; margin: .35rem 0 .5rem; }
.bar > div { height: 100%; border-radius: 5px; width: 0; transition: width .4s; position: relative; }
.bar-yes { background: var(--yes); }
.bar-turnout { background: var(--accent); }
.threshold { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--ink); }
.small { font-size: .88rem; margin: .25rem 0; }
.muted { color: var(--muted); }
.note { background: #f1f4f7; border-radius: 6px; padding: .45rem .7rem; font-size: .88rem; }
.context ul { padding-left: 1.2rem; margin: .5rem 0; }
code { font-size: .85em; background: #f1f2f4; padding: 0 .25rem; border-radius: 3px; }
.buttons { display: flex; gap: .5rem; flex-wrap: wrap; margin: .6rem 0; }
button { font: inherit; border-radius: 7px; border: 1px solid var(--line); background: #fff; padding: .5rem .9rem; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button.yes { background: var(--yes); color: #fff; border-color: var(--yes); }
button.no { background: var(--no); color: #fff; border-color: var(--no); }
button.plain:hover, .buttons button:hover { border-color: var(--accent); }
.bet-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .6rem 0; }
.bet-row input { width: 7rem; font: inherit; padding: .45rem .5rem; border: 1px solid var(--line); border-radius: 7px; }
#tx-log { word-break: break-all; }
#tx-log .err { color: var(--no); }
footer { margin-top: 1.5rem; word-break: break-all; }
a { color: var(--accent); }
@media (max-width: 560px) {
  .compare, .times { grid-template-columns: 1fr; }
}

/* Phase strip: where the market is, and the one action that fits. */
[hidden] { display: none !important; }
.phases { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: .8rem 0 .3rem; }
.phases li { font-size: .82rem; padding: .2rem .6rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted, #667); }
.phases li.done { color: var(--muted, #667); text-decoration: line-through; text-decoration-color: var(--line); }
.phases li.now { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.phase-line { margin: .2rem 0 .8rem; font-weight: 600; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

.stake-summary { margin: .4rem 0; }
.history { list-style: none; padding: 0; margin: .2rem 0 .8rem; font-size: .9rem; }
.history li { padding: .15rem 0; border-bottom: 1px dashed var(--line); }
.muted { color: var(--muted); }
#tx-log .older { color: var(--muted); font-size: .85em; }
