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

:root {
  --bg:        #0d0d0f;
  --surface:   #18181c;
  --surface2:  #222228;
  --border:    #2a2a32;
  --text:      #f0f0f4;
  --muted:     #8888a0;
  --accent:    #7b61ff;
  --pos:       #00c896;
  --neg:       #ff4f6a;
  --twitter:   #1d9bf0;
  --discord:   #5865f2;
  --telegram:  #26a5e4;
  --reddit:    #ff4500;
  --radius:    12px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif; min-height: 100vh; }

a { color: inherit; text-decoration: none; }

/* ── Header ── */
header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(13,13,15,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem; height: 54px;
}
.logo { font-size: 1.2rem; font-weight: 800; color: #c8a400; letter-spacing: -.02em; flex-shrink: 0; }
nav   { display: flex; gap: .2rem; }
.tab  { color: var(--muted); font-size: .88rem; font-weight: 500; padding: .35rem .8rem; border-radius: 8px; transition: background .15s, color .15s; }
.tab:hover, .tab.active { background: var(--surface2); color: var(--text); }

/* ── Main ── */
main { padding: 1rem; max-width: 1100px; margin: 0 auto; }

/* ── Hero ── */
.hero { text-align: center; padding: 4rem 0; }
.hero h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: .6rem; }
.hero p  { color: var(--muted); margin-bottom: 1.5rem; }
.hero-links { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

.btn         { display: inline-block; background: var(--accent); color: #fff; font-size: .9rem; font-weight: 600; padding: .55rem 1.3rem; border-radius: 9px; border: none; cursor: pointer; transition: opacity .15s; }
.btn:hover   { opacity: .85; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface2); }

/* ── Page section ── */
.page-section { padding-top: .75rem; }
.section-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; }

/* ── Toolbar ── */
.toolbar { display: flex; gap: .6rem; margin-bottom: .75rem; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: .88rem;
  padding: .48rem .85rem; outline: none; transition: border-color .15s;
}
.toolbar input { flex: 1; min-width: 180px; }
.toolbar input::placeholder { color: var(--muted); }
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent); }

/* ── Coin grid ── */
.coin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .65rem; }
.coin-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .8rem;
  display: flex; flex-direction: column; gap: .55rem;
  cursor: pointer; transition: border-color .15s, transform .12s, box-shadow .15s;
}
.coin-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(123,97,255,.12); }
.coin-card.hidden { display: none; }

.coin-top { display: flex; align-items: center; gap: .55rem; }
.coin-top img { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; }
.coin-img-placeholder { width: 30px; height: 30px; border-radius: 50%; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 700; color: var(--muted); flex-shrink: 0; }

.coin-identity { display: flex; flex-direction: column; overflow: hidden; flex: 1; }
.coin-name   { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-symbol { font-size: .72rem; color: var(--muted); }
.coin-rank   { font-size: .68rem; color: var(--muted); background: var(--surface2); border-radius: 5px; padding: .1rem .3rem; flex-shrink: 0; }

.coin-price-row { display: flex; justify-content: space-between; align-items: center; }
.coin-price  { font-size: .88rem; font-weight: 600; }

.coin-change     { font-size: .76rem; font-weight: 600; padding: .12rem .38rem; border-radius: 5px; }
.coin-change.pos { color: var(--pos); background: rgba(0,200,150,.1); }
.coin-change.neg { color: var(--neg); background: rgba(255,79,106,.1); }

.coin-news-count { font-size: .72rem; color: var(--muted); }
.coin-disabled { opacity: .45; }

.btn-disable { background: var(--surface2); color: var(--neg); border: 1px solid var(--neg); font-size:.8rem; padding:.3rem .8rem; }
.btn-disable:hover { background: rgba(255,79,106,.1); opacity:1; }
.btn-enable { background: var(--surface2); color: var(--pos); border: 1px solid var(--pos); font-size:.8rem; padding:.3rem .8rem; }
.btn-enable:hover { background: rgba(0,200,150,.1); opacity:1; }
.disabled-banner { background: rgba(255,79,106,.08); border: 1px solid rgba(255,79,106,.25); border-radius: 8px; color: var(--neg); font-size:.83rem; padding:.45rem .9rem; margin-bottom:.75rem; }

/* ── Social icons (grid card) ── */
.coin-socials { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .1rem; }
.social-icon { width: 26px; height: 26px; border-radius: 6px; background: var(--surface2); display: flex; align-items: center; justify-content: center; color: var(--muted); transition: background .15s, color .15s; flex-shrink: 0; }
.social-icon svg { width: 13px; height: 13px; }
.social-icon:hover         { background: rgba(29,155,240,.15); color: var(--twitter); }
.social-icon.discord:hover { background: rgba(88,101,242,.15); color: var(--discord); }
.social-icon.telegram:hover{ background: rgba(38,165,228,.15); color: var(--telegram); }
.social-icon.reddit:hover  { background: rgba(255,69,0,.15);   color: var(--reddit); }

/* ── Coin detail ── */
.back-link { color: var(--muted); font-size: .88rem; display: inline-block; margin-bottom: 1rem; }
.back-link:hover { color: var(--text); }

.coin-detail-header { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }

.coin-detail-info { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.coin-detail-img  { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; }
.coin-detail-info h2 { font-size: 1.2rem; font-weight: 700; }
.coin-detail-info h2 .coin-symbol { color: var(--muted); font-size: .9rem; font-weight: 500; margin-left: .3rem; }
.coin-detail-price { display: flex; align-items: center; gap: .5rem; margin-top: .25rem; }
.big-price { font-size: 1.4rem; font-weight: 700; }

.coin-detail-socials { display: flex; gap: .5rem; flex-wrap: wrap; }
.social-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .75rem; border-radius: 20px; font-size: .8rem; font-weight: 500; background: var(--surface2); border: 1px solid var(--border); transition: background .15s, border-color .15s; }
.social-pill:hover         { background: var(--surface); border-color: var(--muted); }
.twitter-pill:hover  { color: var(--twitter); border-color: var(--twitter); }
.telegram-pill:hover { color: var(--telegram); border-color: var(--telegram); }
.discord-pill:hover  { color: var(--discord); border-color: var(--discord); }
.reddit-pill:hover   { color: var(--reddit); border-color: var(--reddit); }

/* ── Detail tabs ── */
.detail-tabs { display: flex; gap: .35rem; margin-bottom: 1rem; }
.detail-tab { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--muted); font-size: .88rem; font-weight: 500; padding: .4rem 1rem; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.detail-tab:hover { color: var(--text); border-color: var(--muted); }
.detail-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.tab-panel { }
.tab-panel.hidden { display: none; }

.chart-loading { color: var(--muted); font-size: .88rem; margin-top: 1rem; }

/* ── News dialog ── */
.news-dialog-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 999; padding: 1rem; }
.news-dialog-overlay.hidden { display: none; }
.news-dialog { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; max-width: 560px; width: 100%; max-height: 80vh; overflow-y: auto; }
.news-dialog-header { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.news-dialog-close { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: .2rem .4rem; border-radius: 4px; }
.news-dialog-close:hover { color: var(--text); background: var(--surface2); }
.news-dialog-text { font-size: .92rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

/* ── News ── */
.news-section h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.news-source      { color: var(--muted); font-size: .85rem; font-weight: 400; margin-left: .4rem; }

.news-list { display: flex; flex-direction: column; gap: .6rem; }
.news-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .85rem 1rem;
  display: block; transition: border-color .15s;
}
.news-item:hover { border-color: var(--accent); }

.news-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; gap: .5rem; flex-wrap: wrap; }
.news-source-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--twitter); font-weight: 500; }
.news-time  { font-size: .72rem; color: var(--muted); flex-shrink: 0; }
.news-text  { font-size: .88rem; line-height: 1.5; color: var(--text); white-space: pre-wrap; word-break: break-word; }

.news-item-reddit { border-left: 3px solid var(--reddit); }
.news-item-reddit:hover { border-color: var(--reddit); }
.news-source-reddit { color: var(--reddit); }

.empty-news { text-align: center; padding: 2.5rem; color: var(--muted); background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--border); }

/* ── Accounts ── */
.accounts-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.accounts-block h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; }

.accounts-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.accounts-table th { color: var(--muted); font-weight: 500; text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--border); }
.accounts-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.accounts-table tr:last-child td { border-bottom: none; }
.muted { color: var(--muted); }

.status-badge      { font-size: .78rem; font-weight: 600; padding: .15rem .45rem; border-radius: 5px; }
.status-badge.ok     { color: var(--pos); background: rgba(0,200,150,.1); }
.status-badge.banned { color: var(--neg); background: rgba(255,79,106,.1); }
.status-badge.error   { color: #f90; background: rgba(255,153,0,.1); }
.status-badge.missing { color: var(--muted); background: rgba(136,136,160,.08); }

.cookie-row td { padding-top: 0; border-top: none; }
.cookie-summary { cursor: pointer; color: var(--accent); font-size: .8rem; }
.cookie-form { margin-top: .5rem; display: flex; flex-direction: column; gap: .4rem; }
.cookie-form textarea { background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; color: var(--text); padding: .5rem .75rem; font-size: .8rem; font-family: monospace; resize: vertical; outline: none; }
.cookie-form textarea:focus { border-color: var(--accent); }

.btn-danger-sm { background: none; border: 1px solid var(--border); color: var(--neg); font-size: .78rem; padding: .2rem .55rem; border-radius: 5px; cursor: pointer; transition: background .15s; }
.btn-danger-sm:hover { background: rgba(255,79,106,.1); }

.add-form { margin-top: 1rem; }
.add-form summary { cursor: pointer; color: var(--accent); font-size: .88rem; font-weight: 500; }
.account-form { margin-top: .75rem; display: flex; flex-direction: column; gap: .6rem; }
.form-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.form-row label { display: flex; flex-direction: column; gap: .25rem; font-size: .82rem; color: var(--muted); flex: 1; min-width: 160px; }
.form-row input { background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; color: var(--text); padding: .45rem .75rem; font-size: .88rem; outline: none; }
.form-row input:focus { border-color: var(--accent); }

.empty { color: var(--muted); padding: 1rem 0; }

/* ── Mobile ── */
@media (max-width: 520px) {
  header { height: 50px; }
  .logo  { font-size: 1.1rem; }
  .tab   { font-size: .82rem; padding: .3rem .6rem; }
  .coin-grid { grid-template-columns: repeat(2, 1fr); gap: .45rem; }
  .coin-card { padding: .65rem; }
  .hero h2   { font-size: 1.3rem; }
  .accounts-table { font-size: .8rem; }
  .form-row { flex-direction: column; }
}
