/* Kalshi-style browse UI — dark theme. */

:root {
  --bg:          #0a0b0d;
  --bg-elev:     #12141a;
  --bg-elev-2:   #171a21;
  --border:      #232833;
  --border-soft: #1b1f27;
  --text:        #e8eaf0;
  --text-mid:    #a7adbb;
  --text-dim:    #6f7686;
  --accent:      #00d68f;
  --yes:         #00c853;
  --no:          #ff5c5c;
  --focus:       #3b82f6;
  --radius:      14px;
  --radius-sm:   10px;
  --shadow:      0 12px 32px rgba(0, 0, 0, .45);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; }

.shell {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.subtle { color: var(--text-dim); font-size: 12.5px; }

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 11, 13, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), #00a3ff);
  color: #05140f;
  font-weight: 700;
  font-size: 16px;
}

.brand-name { font-weight: 700; letter-spacing: -.02em; font-size: 16px; }
.brand-dim { color: var(--text-dim); font-weight: 500; }

.search {
  position: relative;
  flex: 1;
  max-width: 520px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  fill: var(--text-dim);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  outline: none;
}

.search input::placeholder { color: var(--text-dim); }
.search input:focus { border-color: var(--focus); background: var(--bg-elev-2); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-mid);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { color: var(--text); border-color: #303747; }
.btn .icon { width: 15px; height: 15px; fill: currentColor; }
.btn.is-busy .icon { animation: spin .8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(0, 214, 143, .6);
  animation: pulse 2.4s infinite;
}

.live-pill.is-paused .live-dot { background: var(--text-dim); animation: none; box-shadow: none; }
.live-pill.is-error  .live-dot { background: var(--no); animation: none; box-shadow: none; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 214, 143, .55); }
  70%  { box-shadow: 0 0 0 8px rgba(0, 214, 143, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 214, 143, 0); }
}

/* ------------------------------------------------------------ categories */

.cats {
  position: sticky;
  top: 62px;
  z-index: 30;
  background: rgba(10, 11, 13, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.cats-inner {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-top: 10px;
  padding-bottom: 10px;
  scrollbar-width: none;
}

.cats-inner::-webkit-scrollbar { display: none; }

.cat {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-mid);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.cat:hover { background: var(--bg-elev); color: var(--text); }

.cat.is-active {
  background: var(--text);
  border-color: var(--text);
  color: #0a0b0d;
  font-weight: 600;
}

/* ------------------------------------------------------------------- main */

.main { padding-top: 26px; padding-bottom: 72px; }

.main-head { margin-bottom: 18px; }
.main-head h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }
#meta-line { margin: 0; }

.notice {
  margin-bottom: 18px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #4a3a1a;
  background: #1e1a10;
  color: #f0c674;
  font-size: 13px;
}

.notice.is-error { border-color: #5a2626; background: #201112; color: #ff9a9a; }

/* ------------------------------------------------------------------- grid */

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

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--bg-elev);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}

.card:hover { border-color: #2f3646; background: var(--bg-elev-2); transform: translateY(-1px); }
.card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.01em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pill {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 12px;
}

.card-meta .dot { opacity: .5; }

.bars { display: flex; flex-direction: column; gap: 8px; }

.bar-row { display: flex; flex-direction: column; gap: 5px; }

.bar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
}

.bar-label {
  color: var(--text-mid);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-price { font-weight: 600; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.bar-price .unit { color: var(--text-dim); font-weight: 500; font-size: 11px; }

.bar-track {
  height: 6px;
  border-radius: 999px;
  background: #1e222b;
  overflow: hidden;
}

.bar-fill { height: 100%; border-radius: 999px; transition: width .3s ease; }
.bar-fill.yes { background: var(--yes); }
.bar-fill.no  { background: var(--no); }

.quote-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.quote {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: #14171d;
  font-size: 12.5px;
}

.quote .side { font-weight: 600; letter-spacing: .01em; }
.quote.yes .side { color: var(--yes); }
.quote.no  .side { color: var(--no); }
.quote .val { font-variant-numeric: tabular-nums; font-weight: 600; }
.quote .sub { color: var(--text-dim); font-weight: 500; font-size: 11px; }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-dim);
  font-size: 12px;
}

.card-foot b { color: var(--text-mid); font-weight: 600; }

/* --------------------------------------------------------------- skeleton */

.skeleton {
  height: 196px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: linear-gradient(100deg, #12141a 30%, #191d25 50%, #12141a 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}

@keyframes shimmer { from { background-position: 180% 0; } to { background-position: -60% 0; } }

.empty {
  grid-column: 1 / -1;
  padding: 56px 20px;
  text-align: center;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ----------------------------------------------------------------- drawer */

.drawer { position: fixed; inset: 0; z-index: 60; }

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(2px);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(680px, 100%);
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow-y: auto;
  animation: slide-in .22s ease;
}

@keyframes slide-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }

.drawer-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text-mid);
  cursor: pointer;
  font-size: 13px;
}

.drawer-close:hover { color: var(--text); }

.drawer-head { padding: 22px 24px 16px; border-bottom: 1px solid var(--border-soft); }
.drawer-head h2 { margin: 0 0 8px; font-size: 19px; line-height: 1.3; letter-spacing: -.01em; padding-right: 36px; }
.drawer-head .subtle { margin: 0; }

.drawer-section { padding: 18px 24px; border-bottom: 1px solid var(--border-soft); }
.drawer-section h3 {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
}

.market-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}

.market-row:last-child { border-bottom: none; }
.market-row .label { font-weight: 500; min-width: 0; }
.market-row .label small { display: block; color: var(--text-dim); font-weight: 400; font-size: 11.5px; }

.market-quotes { display: flex; gap: 8px; flex: 0 0 auto; }

.chip {
  min-width: 74px;
  padding: 6px 10px;
  border-radius: 9px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
}

.chip small { display: block; font-size: 10px; font-weight: 600; letter-spacing: .04em; color: var(--text-dim); }
.chip b { font-size: 13px; }
.chip.yes { border-color: rgba(0, 200, 83, .35); }
.chip.yes small, .chip.yes b { color: var(--yes); }
.chip.no { border-color: rgba(255, 92, 92, .3); }
.chip.no small, .chip.no b { color: var(--no); }

.rules { margin: 0; color: var(--text-mid); font-size: 13px; line-height: 1.6; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-soft); background: #14171d; }
.stat small { display: block; color: var(--text-dim); font-size: 11px; margin-bottom: 3px; }
.stat b { font-size: 14px; font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 26px 0 34px;
  color: var(--text-dim);
  font-size: 12.5px;
}

.site-footer p { margin: 0 0 6px; }
.site-footer a { color: var(--text-mid); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 760px) {
  .shell { padding: 0 16px; }
  .header-inner { height: auto; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; gap: 12px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .header-actions { margin-left: auto; }
  .cats { top: 0; position: static; }
  .grid { grid-template-columns: 1fr; }
  .live-pill span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
