:root {
  --bg: #0A0612;
  --panel: #120A1F;
  --panel-2: #170C28;
  --line: #3A2A5C;
  --text: #F4EFFF;
  --muted: #B9AEDB;
  --pink: #FF2BD6;
  --yellow: #FFE600;
  --cyan: #29F3FF;
  --red: #FF5C7A;
  --green: #7CFF6B;
  --pixel: "Press Start 2P", monospace;
  --body: "VT323", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: var(--body); font-size: 22px; line-height: 1.25; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--cyan); }
a:hover { color: var(--yellow); }
img { image-rendering: auto; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; flex: 1; }
.muted { color: var(--muted); }
.pixel { font-family: var(--pixel); }
[hidden] { display: none !important; }

.scan { position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.25) 0 2px, transparent 2px 4px); }

@keyframes blink { 0%,49% { opacity: 1 } 50%,100% { opacity: 0 } }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }
@keyframes flick { 0%,92%,100% { opacity: 1 } 93% { opacity: .6 } }
@keyframes coin { 0%,100% { transform: scaleX(1) } 50% { transform: scaleX(.1) } }
@keyframes hp { from { width: 100% } to { width: 0 } }
.blink { animation: blink 1s steps(1) infinite; }
.bob { animation: bob 1.2s steps(3) infinite; }
.flick { animation: flick 4s linear infinite; }
.spin-coin { animation: coin 1.2s steps(6) infinite; }
@media (prefers-reduced-motion: reduce) { .blink, .bob, .flick, .spin-coin { animation: none; } }

/* Header */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; padding: 18px 20px; max-width: 1240px; margin: 0 auto; width: 100%; font-family: var(--pixel); font-size: 12px; }
.logo { font-family: var(--pixel); font-size: 16px; color: var(--pink); text-decoration: none; text-shadow: 3px 3px 0 var(--cyan); }
.logo span { color: var(--yellow); margin-left: 8px; }
.nav { display: flex; gap: 4px; flex: 1 1 auto; flex-wrap: wrap; }
.nav a { color: var(--text); text-decoration: none; padding: 12px 10px; }
.nav a.on { color: var(--cyan); }
.net { color: var(--muted); border: 2px solid var(--line); padding: 10px; font-size: 10px; }
.net.ok { color: var(--green); border-color: var(--green); }
.net.bad { color: var(--red); border-color: var(--red); }

.banner { max-width: 1200px; margin: 0 auto 12px; padding: 12px 16px; border: 3px solid var(--yellow); background: #2A2200; color: var(--yellow); font-size: 20px; width: calc(100% - 40px); }

/* Buttons & inputs */
.btn { font-family: var(--pixel); font-size: 11px; min-height: 44px; padding: 0 16px; border: 3px solid var(--text); background: transparent; color: var(--text); cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--cyan); color: var(--cyan); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-yellow { background: var(--yellow); color: var(--bg); border-color: var(--yellow); box-shadow: 4px 4px 0 var(--pink); }
.btn-yellow:hover:not(:disabled) { background: var(--yellow); color: var(--bg); transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--pink); }
.btn-cyan { background: var(--cyan); color: var(--bg); border-color: var(--cyan); box-shadow: 4px 4px 0 var(--pink); }
.btn-cyan:hover:not(:disabled) { color: var(--bg); }
.btn-pink { background: var(--pink); color: var(--text); border-color: var(--pink); box-shadow: 4px 4px 0 var(--cyan); }
.btn-pink:hover:not(:disabled) { color: var(--text); }
.btn-big { font-size: 15px; min-height: 60px; width: 100%; }

label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 20px; }
input, textarea, select { font-family: var(--body); font-size: 24px; color: var(--text); background: var(--bg); border: 3px solid var(--line); padding: 8px 10px; min-height: 46px; width: 100%; }
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--cyan); }
input[type=range] { padding: 0; border: 0; accent-color: var(--pink); min-height: 30px; }
input[type=checkbox] { width: 22px; min-height: 22px; accent-color: var(--pink); }
.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); cursor: pointer; }
.err { color: var(--red); font-size: 20px; }

/* Panels */
.panel { border: 4px solid var(--cyan); background: var(--panel); padding: 22px; }
.panel.pink { border-color: var(--pink); }
.panel.yellow { border-color: var(--yellow); }
.panel h2, .h2 { font-family: var(--pixel); font-size: 15px; margin: 0 0 14px; line-height: 1.5; }
.panel h3 { font-family: var(--pixel); font-size: 12px; margin: 0 0 10px; color: var(--yellow); }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 2px dotted var(--line); }
.kv span:first-child { color: var(--muted); }

/* Home */
.hero { text-align: center; padding: 30px 0 40px; }
.hero h1 { font-family: var(--pixel); font-size: clamp(36px, 8vw, 76px); line-height: 1.1; margin: 0; color: var(--pink); text-shadow: 6px 6px 0 var(--cyan); }
.hero p { max-width: 760px; margin: 24px auto 0; font-size: 28px; color: #D6CCF0; }
.press { display: inline-block; margin-top: 26px; font-family: var(--pixel); font-size: 18px; color: var(--yellow); text-decoration: none; }
.coin-svg { width: 52px; height: 52px; image-rendering: pixelated; }
.hero-title { display: inline-flex; align-items: center; gap: 18px; }
.stats { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-top: 30px; font-family: var(--pixel); font-size: 11px; }
.stats b { display: block; color: var(--yellow); font-size: 18px; margin-top: 8px; }

/* Coin cards */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { display: block; text-decoration: none; color: var(--text); background: var(--panel-2); border: 4px solid var(--line); padding: 14px; transition: transform .1s steps(2); }
.card:hover { transform: translateY(-4px); border-color: var(--pink); color: var(--text); }
.card-top { display: flex; gap: 12px; align-items: center; }
.avatar { width: 56px; height: 56px; flex: none; background: var(--line); object-fit: cover; display: flex; align-items: center; justify-content: center; font-family: var(--pixel); font-size: 18px; color: var(--bg); }
.card .sym { font-family: var(--pixel); font-size: 13px; }
.card .nm { color: var(--muted); font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.tag { font-family: var(--pixel); font-size: 9px; padding: 5px 6px; background: var(--cyan); color: var(--bg); }
.tag.pink { background: var(--pink); color: var(--text); }
.tag.yellow { background: var(--yellow); color: var(--bg); }

/* Scores table */
.table-box { overflow-x: auto; }
table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 24px; }
th { font-family: var(--pixel); font-size: 10px; color: var(--muted); text-align: left; padding: 10px; }
td { padding: 8px 10px; border-top: 2px dotted var(--line); }
tr.link { cursor: pointer; }
tr.link:hover td { color: var(--yellow); }
.right { text-align: right; }

/* Create */
.pairs { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); max-height: 440px; overflow-y: auto; padding: 16px 4px 4px; }
.pair { position: relative; min-height: 120px; background: var(--panel-2); border: 4px solid var(--line); color: var(--text); font-family: var(--pixel); font-size: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 10px 6px; }
.pair:hover { border-color: var(--cyan); }
.pair.on { border-color: var(--pink); }
.pair .ini { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--bg); box-shadow: 4px 4px 0 rgba(0,0,0,.45); }
.logo { overflow: hidden; }
.logo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; display: block; }
.pair:hover .logo, .pair.on .logo { animation: bob 1.2s steps(3) infinite; }
.pair-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 7px 3px 3px; }
.mini { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex: none; font-size: 9px; color: var(--bg); }
.mini img { padding: 2px; }
.pair .px { font-family: var(--body); font-size: 18px; color: var(--muted); }
.pair .p1 { position: absolute; top: -12px; left: 50%; margin-left: -16px; background: var(--pink); padding: 3px 5px; font-size: 9px; }
.diff { display: flex; flex-direction: column; gap: 10px; font-family: var(--pixel); font-size: 12px; }
.diff button { display: flex; justify-content: space-between; padding: 14px 12px; border: 3px solid var(--line); background: transparent; color: var(--text); font-family: var(--pixel); font-size: 12px; cursor: pointer; min-height: 48px; }
.diff button.on { border-color: var(--yellow); background: #2A2200; color: var(--yellow); }
.img-drop { width: 130px; height: 130px; flex: none; border: 3px dashed var(--line); display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); cursor: pointer; overflow: hidden; font-size: 18px; }
.img-drop img { width: 100%; height: 100%; object-fit: cover; }
.slider-val { font-family: var(--pixel); font-size: 12px; color: var(--yellow); min-width: 70px; text-align: right; }
.hpbar { height: 22px; border: 3px solid var(--text); padding: 2px; }
.hpbar i { display: block; height: 100%; background: var(--pink); }
.summary .kv span:last-child { text-align: right; }

/* Coin page */
.coin-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; padding: 20px 0; }
.coin-head .avatar { width: 110px; height: 110px; font-size: 30px; }
.coin-head h1 { font-family: var(--pixel); font-size: clamp(20px, 4vw, 34px); margin: 0 0 8px; color: var(--pink); }
.big-num { font-family: var(--pixel); font-size: 22px; color: var(--yellow); }
.tabs { display: flex; gap: 0; margin-bottom: 14px; }
.tabs button { flex: 1; min-height: 46px; font-family: var(--pixel); font-size: 12px; border: 3px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.tabs button.on.buy { border-color: var(--green); color: var(--green); }
.tabs button.on.sell { border-color: var(--red); color: var(--red); }
.addr { font-size: 20px; word-break: break-all; }

/* Dialog / toast */
.dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: 460px; width: calc(100% - 32px); }
.dialog::backdrop { background: rgba(5, 2, 10, .8); }
.dialog-box { background: var(--panel); border: 4px solid var(--pink); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog-box h2 { font-family: var(--pixel); font-size: 13px; margin: 0; }
.wallet-list { display: flex; flex-direction: column; gap: 10px; max-height: min(62vh, 560px); overflow-y: auto; }
.wallet-list button, .wallet-list a { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border: 3px solid var(--line); background: var(--panel-2); color: var(--text); font-family: var(--body); font-size: 24px; cursor: pointer; text-decoration: none; flex-shrink: 0; }
.wallet-list button:hover, .wallet-list a:hover { border-color: var(--cyan); }
.wallet-list img, .wallet-tile { width: 28px; height: 28px; flex-shrink: 0; }
.wallet-tile { display: grid; place-items: center; font-family: var(--pixel); font-size: 12px; color: #0A0612; }
.wallet-list span:not(.wallet-tile) { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-list em { font-style: normal; font-family: var(--pixel); font-size: 8px; color: var(--muted); }
.wallet-list button em { color: var(--green, #39FF88); }
.wallet-list a em { color: var(--cyan); }
.wallet-sub { margin: 8px 0 0; font-family: var(--pixel); font-size: 9px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; max-width: min(640px, calc(100% - 32px)); padding: 14px 18px; background: var(--panel); border: 3px solid var(--cyan); font-size: 22px; box-shadow: 4px 4px 0 var(--pink); }
.toast.error { border-color: var(--red); }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 24px 20px; max-width: 1240px; margin: 30px auto 0; width: 100%; font-family: var(--pixel); font-size: 9px; color: var(--muted); }
.section { margin: 34px 0; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }

@media (max-width: 640px) {
  body { font-size: 20px; }
  .top { padding: 14px 16px; }
  .wrap { padding: 0 16px; }
  .panel { padding: 16px; }
  .net { display: none; }
}
