:root {
  --bg: #0a111f;
  --bg2: #0e1729;
  --panel: #121c31;
  --panel2: #17233d;
  --border: #23314f;
  --border2: #2e3f63;
  --text: #e8f0fb;
  --muted: #8a9cba;
  --faint: #5b6c8a;
  --ice: #5cc8ff;
  --ice-d: #2a9de0;
  --orange: #ffb13b;
  --up: #22c55e;
  --up-bg: rgba(34, 197, 94, .12);
  --down: #f4505a;
  --down-bg: rgba(244, 80, 90, .12);
  --radius: 14px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
* { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #13284a 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.up { color: var(--up); }
.down { color: var(--down); }
h1, h2, h3 { margin: 0; }
h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
h3 { font-size: 14px; font-weight: 700; }

/* ---------- brand ---------- */
.brand { font-family: 'Permanent Marker', cursive; font-weight: 400; letter-spacing: .5px; }
.logo { display: inline-grid; place-items: center; width: 40px; height: 40px; }
.logo img { width: 100%; height: 100%; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .4)); }
.logo-xl { width: 96px; height: 96px; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }

/* ---------- buttons & inputs ---------- */
.btn {
  border: 1px solid var(--border2); background: var(--panel2); border-radius: 10px;
  padding: 9px 14px; font-weight: 700; transition: transform .08s, background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: var(--ice); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(180deg, var(--ice), var(--ice-d)); border-color: transparent; color: #04121f; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-buy { background: var(--up); border-color: transparent; color: #03140a; }
.btn-sell { background: var(--down); border-color: transparent; color: #1c0306; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }
.btn-claim {
  background: linear-gradient(180deg, #ffc65c, var(--orange)); color: #2b1600; border: 0;
  box-shadow: 0 0 0 0 rgba(255, 177, 59, .6); animation: pulse 2s infinite;
}
.btn-claim.wait { background: var(--panel2); color: var(--muted); animation: none; border: 1px solid var(--border); font-family: var(--mono); font-weight: 500; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(255, 177, 59, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 177, 59, 0); } }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
input, select, textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--ice); box-shadow: 0 0 0 3px rgba(92, 200, 255, .15); }
.form-error { color: var(--down); min-height: 18px; margin: 0 0 8px; font-size: 13px; }

.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 2px; }
.seg-btn { background: none; border: 0; padding: 7px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.seg-btn.active { background: var(--panel2); color: var(--text); box-shadow: 0 1px 0 var(--border2) inset; }
.seg-btn.buy.active { background: var(--up); color: #03140a; }
.seg-btn.sell.active { background: var(--down); color: #1c0306; }
.seg-sm .seg-btn { padding: 5px 10px; font-size: 12px; }

.chip { border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 13px; color: var(--muted); }
.chip.active, .chip:hover { color: var(--text); border-color: var(--ice); }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.pad { padding: 16px; }

/* ---------- auth ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 32px 28px; text-align: center; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 40px; margin: 10px 0 8px; background: linear-gradient(180deg, #fff, #a9dcff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--muted); margin: 0 0 22px; }
.auth-tabs { width: 100%; margin-bottom: 18px; }
.auth-tabs .seg-btn { flex: 1; }
#auth-form { text-align: left; }

/* ---------- app shell ---------- */
.app {
  height: 100vh; display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 330px;
  grid-template-rows: 64px 34px minmax(0, 1fr);
  grid-template-areas: "top top top" "tick tick tick" "nav main side";
}
.topbar { grid-area: top; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--border); background: rgba(10, 17, 31, .8); backdrop-filter: blur(8px); gap: 12px; }
.brand-link { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-link .brand { font-size: 24px; white-space: nowrap; }
.top-stats { display: flex; align-items: center; gap: 10px; }
.stat-pill { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 5px 12px 5px 6px; }
.stat-pill small { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; line-height: 1.1; }
.stat-pill b { font-family: var(--mono); font-size: 15px; }
.pc-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #ffe08a, var(--orange) 60%, #c27300); font-size: 16px; box-shadow: 0 0 0 2px rgba(255, 177, 59, .25); }
.pc-icon.nw { background: radial-gradient(circle at 35% 30%, #b9e8ff, var(--ice-d)); box-shadow: 0 0 0 2px rgba(92, 200, 255, .25); }
.user-menu { position: relative; }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border2); background: var(--panel2); font-weight: 800; }
.pop { position: absolute; right: 0; top: 46px; background: var(--panel2); border: 1px solid var(--border2); border-radius: 12px; padding: 6px; min-width: 170px; box-shadow: var(--shadow); z-index: 50; }
.pop-name { padding: 8px 10px; font-weight: 700; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.pop-item { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; }
.pop-item:hover { background: var(--panel); }

.ticker { grid-area: tick; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--bg2); display: flex; align-items: center; }
.ticker-track { display: flex; gap: 28px; white-space: nowrap; animation: scroll 60s linear infinite; padding-left: 16px; font-size: 13px; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.ticker-item b { font-weight: 700; }
@keyframes scroll { to { transform: translateX(-50%); } }

.sidenav { grid-area: nav; padding: 14px 10px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.sidenav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; transition: background .15s, color .15s; }
.sidenav a span { font-size: 18px; width: 22px; text-align: center; }
.sidenav a em { font-style: normal; }
.sidenav a:hover { background: var(--panel); color: var(--text); }
.sidenav a.active { background: linear-gradient(90deg, rgba(92, 200, 255, .16), rgba(92, 200, 255, .02)); color: var(--text); box-shadow: inset 3px 0 0 var(--ice); }

.main { grid-area: main; overflow-y: auto; padding: 18px; min-width: 0; scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
.side { grid-area: side; border-left: 1px solid var(--border); padding: 14px; display: flex; flex-direction: column; gap: 14px; overflow: hidden; min-height: 0; }
.side-card { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow: hidden; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); gap: 8px; }
.live-dot { font-size: 10px; font-weight: 800; letter-spacing: .1em; color: var(--down); display: inline-flex; align-items: center; gap: 6px; }
.live-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--down); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }

.feed, .chat { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; min-height: 0; }
.feed li { padding: 8px; border-radius: 8px; font-size: 13px; display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; animation: flash .8s; }
.feed li:hover { background: var(--panel2); }
.feed .tag { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 6px; text-transform: uppercase; }
.tag.buy { background: var(--up-bg); color: var(--up); }
.tag.sell { background: var(--down-bg); color: var(--down); }
.tag.create { background: rgba(255, 177, 59, .15); color: var(--orange); }
.tag.news-up { background: var(--up-bg); color: var(--up); }
.tag.news-down { background: var(--down-bg); color: var(--down); }
.feed .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .amt { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.feed li.news { grid-template-columns: auto 1fr; }
.feed li.news .t { grid-column: 2; font-size: 11px; color: var(--faint); }
@keyframes flash { from { background: rgba(92, 200, 255, .12); } }

.chat li { padding: 6px 8px; font-size: 13px; word-wrap: break-word; }
.chat li b { color: var(--ice); margin-right: 6px; }
.chat li.mine b { color: var(--orange); }
.chat li time { color: var(--faint); font-size: 11px; margin-left: 6px; }
.chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); }
.chat-form input { padding: 8px 10px; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--muted); }

/* ---------- trade layout ---------- */
.trade-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.trade-grid.no-list { grid-template-columns: minmax(0, 1fr) 300px; }
.asset-list { padding: 6px; max-height: calc(100vh - 190px); overflow-y: auto; position: relative; }
.asset-row { width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 8px; border-radius: 10px; border: 0; background: none; text-align: left; }
.asset-row:hover { background: var(--panel2); }
.asset-row.active { background: var(--panel2); box-shadow: inset 0 0 0 1px var(--border2); }
.emo { width: 34px; height: 34px; border-radius: 10px; background: var(--bg2); display: grid; place-items: center; font-size: 19px; }
.emo-lg { width: 48px; height: 48px; font-size: 28px; border-radius: 14px; }
.asset-row .sym { font-weight: 800; }
.asset-row .nm { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-row .px { text-align: right; font-family: var(--mono); font-size: 13px; }
.asset-row .ch { font-size: 12px; text-align: right; font-family: var(--mono); }

.chart-card { padding: 16px; min-width: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-title { display: flex; gap: 12px; align-items: center; min-width: 0; }
.chart-title > div { min-width: 0; }
.chart-title h2 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.chart-title h2 small { color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-tools { display: flex; gap: 8px; align-items: center; }
.big-price { font-family: var(--mono); font-size: 28px; font-weight: 700; line-height: 1.1; transition: color .3s; }
.big-price.flash-up { color: var(--up); }
.big-price.flash-down { color: var(--down); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-family: var(--mono); font-size: 13px; font-weight: 700; }
.badge.up { background: var(--up-bg); }
.badge.down { background: var(--down-bg); }
/* Height tracks the viewport so short laptop screens (e.g. 1366x768) still fit the chart, price and ticket. */
.chart { height: clamp(240px, calc(100vh - 370px), 460px); width: 100%; position: relative; }
.chart-sm { height: clamp(200px, calc(100vh - 430px), 300px); }
.desc { color: var(--muted); margin: 12px 0 0; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 14px; }
.mini-stat { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.mini-stat small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.mini-stat b { font-family: var(--mono); font-size: 15px; }

.ticket { padding: 16px; position: sticky; top: 0; min-width: 0; }
.ticket .seg { width: 100%; margin-bottom: 14px; }
.ticket .seg-btn { flex: 1; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 70px; font-family: var(--mono); font-size: 18px; font-weight: 700; }
.input-wrap .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; font-size: 13px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 14px; }
.quick button { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 0; font-size: 12px; font-weight: 700; color: var(--muted); }
.quick button:hover { color: var(--text); border-color: var(--ice); }
.kv { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; color: var(--muted); gap: 10px; }
.kv b { color: var(--text); font-family: var(--mono); font-weight: 600; text-align: right; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }
.position-box { margin-top: 14px; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.position-box h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; }

/* ---------- meme ---------- */
.meme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.meme-card { padding: 14px; text-align: left; display: grid; gap: 10px; transition: transform .12s, border-color .15s; cursor: pointer; }
.meme-card:hover { transform: translateY(-2px); border-color: var(--border2); }
.meme-top { display: flex; gap: 12px; align-items: center; }
.meme-top .nm { font-weight: 800; font-size: 15px; }
.meme-top .tk { color: var(--muted); font-size: 12px; font-weight: 700; }
.meme-card .mdesc { color: var(--muted); font-size: 12px; min-height: 18px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meme-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.meme-bottom small { display: block; color: var(--muted); font-size: 11px; }
.meme-bottom b { font-family: var(--mono); }
.new-badge { font-size: 10px; font-weight: 800; background: var(--orange); color: #2b1600; padding: 1px 6px; border-radius: 5px; margin-left: 6px; vertical-align: middle; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 48px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input { max-width: 240px; padding: 7px 12px; }
.back { background: none; border: 0; color: var(--muted); font-weight: 600; padding: 0; margin-bottom: 12px; }
.back:hover { color: var(--text); }

.emoji-pick { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.emoji-pick button { aspect-ratio: 1; font-size: 20px; border: 1px solid transparent; background: var(--bg2); border-radius: 8px; padding: 0; }
.emoji-pick button.active { border-color: var(--ice); background: rgba(92, 200, 255, .12); }

/* ---------- options ---------- */
.opt-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.under-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chain { width: 100%; border-collapse: separate; border-spacing: 0; font-family: var(--mono); font-size: 13px; }
.chain th { font-family: Inter, sans-serif; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px; font-weight: 700; }
.chain td { padding: 0; border-top: 1px solid var(--border); text-align: center; }
.chain td.strike { font-weight: 700; background: var(--bg2); width: 26%; padding: 10px 6px; }
.chain td.atm { color: var(--ice); }
.chain .cell { width: 100%; background: none; border: 0; padding: 10px 6px; font-family: var(--mono); display: grid; gap: 1px; border-radius: 6px; }
.chain .cell small { color: var(--faint); font-size: 10px; }
.chain .cell:hover { background: var(--panel2); }
.chain .cell.sel { background: rgba(92, 200, 255, .14); box-shadow: inset 0 0 0 1px var(--ice); }
.chain td.itm-call:first-child, .chain td.itm-put:last-child { background: rgba(92, 200, 255, .05); }
.chain .call-h { color: var(--up); }
.chain .put-h { color: var(--down); }
.explain { background: var(--bg2); border: 1px dashed var(--border2); border-radius: 12px; padding: 12px; font-size: 13px; color: var(--muted); margin-top: 12px; }
.explain b { color: var(--text); }
.payoff { height: 90px; width: 100%; margin: 6px 0 4px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-family: var(--mono); }
table.data tr.me td { background: rgba(255, 177, 59, .08); }
.asset-cell { display: flex; align-items: center; gap: 10px; }
.asset-cell .emo { width: 30px; height: 30px; font-size: 16px; }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.summary .card { padding: 14px 16px; }
.summary small { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.summary b { display: block; font-family: var(--mono); font-size: 22px; margin-top: 4px; }
.section { margin-bottom: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; }

.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 12px; align-items: end; margin-bottom: 14px; }
.podium .card { text-align: center; padding: 18px 10px; }
.podium .medal { font-size: 34px; }
.podium .pn { font-weight: 800; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; }
.podium .pw { font-family: var(--mono); color: var(--muted); }
.podium .first { padding-top: 28px; border-color: rgba(255, 177, 59, .5); box-shadow: 0 0 30px rgba(255, 177, 59, .12); }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(3, 8, 16, .7); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 100; animation: fade .15s; }
.modal { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--border2); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); animation: pop .18s; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.x { background: none; border: 0; font-size: 22px; color: var(--muted); line-height: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 200; max-width: calc(100vw - 32px); }
.toast { background: var(--panel2); border: 1px solid var(--border2); border-left: 4px solid var(--ice); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); min-width: 240px; max-width: 360px; animation: slide .2s; font-weight: 500; }
.toast.good { border-left-color: var(--up); }
.toast.bad { border-left-color: var(--down); }
.toast.gold { border-left-color: var(--orange); }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } }

.confetti { position: fixed; top: -20px; font-size: 22px; pointer-events: none; z-index: 300; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

/* ---------- top bar extras ---------- */
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border2); background: var(--panel2); font-size: 16px; padding: 0; }
.icon-btn:hover { border-color: var(--ice); }
.rank-pill { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 5px 12px 5px 8px; font-size: 20px; }
.rank-pill:hover { border-color: var(--border2); }
.rank-pill small { display: block; font-size: 11px; font-weight: 800; color: var(--text); line-height: 1.2; white-space: nowrap; }
.rank-bar { display: block; width: 74px; height: 5px; border-radius: 3px; background: var(--bg2); margin-top: 3px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ice), #a78bfa); border-radius: 3px; transition: width .6s; }
.rank-pill.level-up { animation: levelup 1.2s; }
@keyframes levelup { 30% { transform: scale(1.15); box-shadow: 0 0 24px rgba(167, 139, 250, .6); } }
.nav-new { margin-left: auto; font-size: 9px; font-weight: 800; letter-spacing: .06em; background: linear-gradient(90deg, #a78bfa, var(--ice)); color: #0a111f; padding: 2px 6px; border-radius: 5px; }
.streak { font-size: 12px; margin-left: 4px; }

/* ---------- predictions ---------- */
:root { --yes: #22c55e; --no: #f4505a; --violet: #a78bfa; }
.pred-hero { display: flex; gap: 14px; align-items: center; padding: 14px 16px; margin-bottom: 14px; background: linear-gradient(110deg, rgba(167, 139, 250, .16), rgba(92, 200, 255, .08) 60%, transparent), var(--panel); border-color: rgba(167, 139, 250, .35); }
.pred-hero .big { font-size: 34px; animation: bob 3s ease-in-out infinite; }
.pred-hero p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.pred-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.pred-card { padding: 14px; display: grid; gap: 10px; cursor: pointer; transition: transform .12s, border-color .15s; position: relative; overflow: hidden; }
.pred-card:hover { transform: translateY(-2px); border-color: var(--border2); }
.pred-card.closing { border-color: rgba(255, 177, 59, .5); }
.pred-card.resolved { cursor: default; opacity: .8; }
.pred-card.resolved:hover { transform: none; }
.pred-top { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; }
.pred-top .emo { width: 40px; height: 40px; font-size: 22px; }
.pred-title { font-weight: 700; font-size: 14px; line-height: 1.3; }
.gauge { width: 58px; text-align: center; }
.gauge svg { width: 58px; height: 34px; display: block; }
.gauge b { display: block; font-family: var(--mono); font-size: 14px; margin-top: -10px; }
.gauge small { display: block; color: var(--muted); font-size: 10px; }
.spark { width: 100%; height: 44px; display: block; }
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.yn button { border: 0; border-radius: 10px; padding: 10px 6px; font-weight: 800; font-size: 14px; display: flex; justify-content: center; gap: 6px; align-items: baseline; transition: transform .08s, filter .15s; overflow: hidden; white-space: nowrap; }
.yn button:active { transform: scale(.97); }
.yn button span { font-family: var(--mono); font-weight: 700; font-size: 13px; opacity: .85; }
.yn .y { background: var(--up-bg); color: var(--yes); }
.yn .n { background: var(--down-bg); color: var(--no); }
.yn .y:hover, .yn .y.active { background: var(--yes); color: #03140a; }
.yn .n:hover, .yn .n.active { background: var(--no); color: #1c0306; }
.pred-foot { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; align-items: center; }
.pred-foot .mono { color: var(--text); }
.pred-foot .closing-soon { color: var(--orange); font-weight: 700; }
.mine-tag { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: rgba(167, 139, 250, .16); color: var(--violet); white-space: nowrap; }
.result-ribbon { position: absolute; top: 12px; right: -34px; transform: rotate(35deg); padding: 3px 40px; font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.result-ribbon.yes { background: var(--yes); color: #03140a; }
.result-ribbon.no { background: var(--no); color: #1c0306; }

.pred-detail { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 14px; align-items: start; }
.pred-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.pred-head .emo { width: 54px; height: 54px; font-size: 30px; border-radius: 16px; flex: none; }
.pred-head h2 { font-size: 19px; line-height: 1.25; }
.chance { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.chance b { font-family: var(--mono); font-size: 34px; line-height: 1; }
.chance span { color: var(--muted); font-weight: 600; }
.pchart { width: 100%; height: clamp(180px, calc(100vh - 470px), 320px); display: block; margin-top: 12px; position: relative; }
.under-live { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.countdown-big { font-family: var(--mono); font-size: 22px; font-weight: 700; }
.countdown-big.hot { color: var(--orange); animation: blink 1s infinite; }
.pred-pos { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.pred-pos .muted { font-size: 12px; }
.payout-box { background: linear-gradient(135deg, rgba(34, 197, 94, .14), rgba(34, 197, 94, .03)); border: 1px solid rgba(34, 197, 94, .3); border-radius: 12px; padding: 10px 12px; margin-top: 6px; display: flex; justify-content: space-between; align-items: center; }
.payout-box.no { background: linear-gradient(135deg, rgba(244, 80, 90, .14), rgba(244, 80, 90, .03)); border-color: rgba(244, 80, 90, .3); }
.payout-box small { color: var(--muted); font-size: 12px; }
.payout-box b { font-family: var(--mono); font-size: 20px; }
.ticket .yn { margin-bottom: 14px; }
.ticket .yn button { padding: 12px 6px; }

/* ---------- badges ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 6px 16px 16px; }
.badge-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.badge-card .be { font-size: 30px; }
.badge-card b { display: block; font-size: 13px; margin-top: 2px; }
.badge-card small { display: block; color: var(--muted); font-size: 11px; line-height: 1.3; margin-top: 2px; }
.badge-card.locked { opacity: .45; }
.badge-card.locked .be { filter: grayscale(1); }
.badge-card.got { border-color: rgba(255, 177, 59, .45); background: linear-gradient(180deg, rgba(255, 177, 59, .1), var(--bg2)); }
.lb-rank { color: var(--muted); font-size: 12px; margin-left: 6px; }
.tag.payout { background: rgba(167, 139, 250, .18); color: var(--violet); }
.toast.violet { border-left-color: var(--violet); }
.badge-toast { display: flex; gap: 12px; align-items: center; }
.badge-toast .be { font-size: 30px; animation: pop .4s; }
.badge-toast small { display: block; color: var(--orange); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- responsive ---------- */
/* Trade layouts follow the width of the main column, not the window, so the chart never gets squeezed. */
.main { container: main / inline-size; }
@container main (max-width: 1180px) {
  .trade-grid { grid-template-columns: minmax(0, 1fr) 290px; }
  .trade-grid .asset-list { grid-column: 1 / -1; max-height: none; display: flex; overflow-x: auto; overflow-y: hidden; gap: 4px; scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
  .trade-grid .asset-row { flex: 1 0 196px; width: auto; }
  .trade-grid.no-list { grid-template-columns: minmax(0, 1fr) 290px; }
}
@container main (max-width: 900px) {
  .opt-grid, .pred-detail { grid-template-columns: 1fr; }
  .ticket { position: static; }
}
@container main (max-width: 680px) {
  .trade-grid, .trade-grid.no-list { grid-template-columns: 1fr; }
}
@media (max-width: 1600px) {
  .hide-md { display: none !important; }
}
@media (max-width: 1500px) {
  .app { grid-template-columns: 68px minmax(0, 1fr) 290px; }
  .sidenav { padding: 14px 8px; align-items: stretch; }
  .sidenav a { justify-content: center; padding: 11px 0; position: relative; }
  .sidenav a em { display: none; }
  .nav-new { position: absolute; top: 3px; right: 2px; font-size: 7px; padding: 1px 3px; }
  .side { padding: 12px; gap: 12px; }
}
@media (max-width: 1150px) {
  .app { grid-template-columns: 68px minmax(0, 1fr); grid-template-rows: 64px 34px auto auto; grid-template-areas: "top top" "tick tick" "nav main" "nav side"; height: auto; min-height: 100vh; }
  .main { overflow: visible; }
  .side { border-left: 0; flex-direction: row; padding: 0 18px 18px; overflow: visible; }
  .side-card { height: 380px; }
  .sidenav { position: sticky; top: 0; align-self: start; height: calc(100vh - 98px); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "top" "tick" "main" "side"; padding-bottom: 66px; }
  .topbar { padding: 0 12px; }
  .brand-link .brand { font-size: 19px; }
  .hide-sm { display: none !important; }
  .btn-claim { padding: 8px 10px; font-size: 13px; }
  .sidenav { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: 62px; flex-direction: row; justify-content: space-around; padding: 6px; border-right: 0; border-top: 1px solid var(--border); background: rgba(10, 17, 31, .96); backdrop-filter: blur(10px); z-index: 40; }
  .sidenav a { flex-direction: column; gap: 2px; padding: 4px 6px; font-size: 10px; }
  .sidenav a em { display: inline; }
  .sidenav a.active { box-shadow: inset 0 -2px 0 var(--ice); }
  .nav-new { display: none; }
  .main { padding: 14px 16px; }
  .side { flex-direction: column; padding: 0 16px 16px; }
  .podium { gap: 6px; }
}
@media (max-width: 480px) {
  .brand-link .brand { display: none; }
  .stat-pill { padding-right: 8px; }
}
