/* =========================================================
   CRYPTO-BASE — design tokens
   ========================================================= */
:root {
  --bg:            #06090a;
  --surface:       rgba(13, 21, 19, 0.50);
  --surface-2:     rgba(0, 0, 0, 0.25);
  --border:        #1c2b25;
  --border-soft:   #142019;

  --text:          #dfeae4;
  --text-dim:      #7f958c;
  --text-faint:    #4c625a;

  --green:         #39ff8c;
  --green-dim:     #1f8f56;
  --green-glow:    rgba(57, 255, 140, 0.35);
  --green-wash:    rgba(57, 255, 140, 0.08);

  --red:           #ff2e55;
  --red-dim:       #99223a;
  --red-glow:      rgba(255, 46, 85, 0.35);
  --red-wash:      rgba(255, 46, 85, 0.08);

  --font-display:  'Sora', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;

  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

* {
scrollbar-width: thin;
scrollbar-color: #444 #1a1a1a;
}

.scrollbar {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    scrollbar-gutter: stable;
    overflow-y: scroll;
}

.scrollbar:hover {
    scrollbar-color: #666 #1a1a1a;
}

/* Chrome/Edge/Safari */
.scrollbar::-webkit-scrollbar {
    width: 10px;
}

.scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.scrollbar::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 5px;
}

.scrollbar:hover::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.scrollbar:hover::-webkit-scrollbar-thumb {
    background: #666;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(circle at 12% 8%, var(--green-wash), transparent 40%),
    radial-gradient(circle at 88% 20%, var(--red-wash), transparent 45%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); }
ul { list-style: none; margin: 0; padding: 0; }
code { font-family: var(--font-mono); }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* =========================================================
   TICKER TAPE — signature element
   ========================================================= */
.ticker-tape {
  width: 100%;
  overflow: hidden;
  background: #050807;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.ticker-track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: scroll-ticker 100s linear infinite;
}

.ticker-tape:hover .ticker-track {
  animation-play-state: paused;
}

@keyframes scroll-ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  border-right: 1px solid var(--border-soft);
  color: var(--text-dim);
}

.ticker-item strong { color: var(--text); font-weight: 600; }

.ticker-item.up .t-change    { color: var(--green); }
.ticker-item.down .t-change  { color: var(--red); }
.t-price { color: var(--text-dim); }

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(9, 14, 12, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 16px 28px;
  max-width: 1400px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.brand-mark {
  color: var(--green);
  text-shadow: 0 0 12px var(--green-glow);
}

.search-form {
  display: flex;
  flex: 1 1 320px;
  min-width: 220px;
  gap: 0;
}

.search-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: none;
  color: var(--text);
  padding: 11px 16px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  transition: border-color 0.2s ease;
}

.search-input::placeholder { color: var(--text-faint); }

.search-input:focus {
  outline: none;
  border-color: var(--green-dim);
}

.search-btn {
  background: var(--green);
  color: #04140b;
  border: none;
  padding: 0 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.search-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 18px var(--green-glow);
}

/* =========================================================
   SEARCH RESULT PANEL
   ========================================================= */
.search-result {
  max-width: 1400px;
  margin: 20px auto 0;
  padding: 0 28px;
  width: 100%;
}

.search-result-inner {
  background: var(--surface);
  border: 1px solid var(--green-dim);
  box-shadow: 0 0 24px var(--green-wash);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

.search-result-inner.err {
  border-color: var(--red-dim);
  box-shadow: 0 0 24px var(--red-wash);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* =========================================================
   LAYOUT — flexbox
   ========================================================= */
.layout {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 24px auto;
  padding: 0 28px;
  align-items: flex-start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.market-panel {
  flex: 3 1 640px;
}

.news-panel {
  flex: 1 1 320px;
  position: sticky;
  top: 96px;
}

/* =========================================================
   COIN GRID
   ========================================================= */
.coin-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.coin-card {
  flex: 1 1 260px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.coin-card:hover {
  transform: translateY(-3px);
}

.coin-card.up:hover   { border-color: var(--green-dim); box-shadow: 0 8px 24px var(--green-wash); }
.coin-card.down:hover { border-color: var(--red-dim);   box-shadow: 0 8px 24px var(--red-wash); }

.coin-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.coin-id {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coin-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--surface);
}

.coin-id-text { display: flex; flex-direction: column; gap: 2px; }

.coin-symbol {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.03em;
}

.coin-name {
  font-size: 12px;
  color: var(--text-dim);
}

.pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.pill-up   { color: var(--green); background: var(--green-wash); border: 1px solid var(--green-dim); }
.pill-down { color: var(--red);   background: var(--red-wash);   border: 1px solid var(--red-dim); }

.coin-price {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
}

.coin-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border-soft);
  overflow: hidden;
}

.coin-card.up .coin-bar-fill   { background: linear-gradient(90deg, var(--green-dim), var(--green)); box-shadow: 0 0 8px var(--green-glow); }
.coin-card.down .coin-bar-fill { background: linear-gradient(90deg, var(--red-dim), var(--red));   box-shadow: 0 0 8px var(--red-glow); }

.coin-bar-fill { height: 100%; border-radius: 2px; }

.coin-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
}

.coin-meta > div { display: flex; flex-direction: column; gap: 2px; }

.meta-label { color: var(--text-faint); font-family: var(--font-mono); }
.meta-val   { color: var(--text-dim); font-family: var(--font-mono); font-weight: 500; }

/* =========================================================
   NEWS FEED
   ========================================================= */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 640px;
  overflow-y: auto;
  padding-right: 4px;
}

.news-list::-webkit-scrollbar { width: 6px; }
.news-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.news-item {
  display: flex;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}

.news-item:last-child { border-bottom: none; padding-bottom: 0; }

.news-empty {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-faint);
}

.news-thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  display: block;
}

.news-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.85);
  transition: filter 0.2s ease;
}

.news-thumb:hover img { filter: saturate(1.1); }

.news-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.news-tag {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
  background: var(--red-wash);
  border: 1px solid var(--red-dim);
  padding: 2px 8px;
  border-radius: 999px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-title {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-title:hover { color: var(--green); }

.news-foot {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 28px 32px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
}

.footer-dim code {
  color: var(--text-dim);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .news-panel { position: static; order: -1; }
  .header-inner { padding: 14px 18px; }
  .layout, .search-result { padding: 0 18px; }
}

@media (max-width: 480px) {
  .coin-price { font-size: 19px; }
}
