:root {
  --bg: #0b0e14;
  --bg-2: #10141c;
  --surface: #161b26;
  --surface-2: #1c2230;
  --line: #2a3244;
  --text: #e8edf5;
  --muted: #8b95a8;
  --gold: #e8b86d;
  --gold-dim: rgba(232, 184, 109, 0.14);
  --up: #3dd68c;
  --down: #f07178;
  --up-dim: rgba(61, 214, 140, 0.12);
  --down-dim: rgba(240, 113, 120, 0.12);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

[data-theme="light"] {
  --bg: #eef1f6;
  --bg-2: #e4e8f0;
  --surface: #ffffff;
  --surface-2: #f4f6fa;
  --line: #d5dbe6;
  --text: #151920;
  --muted: #5c6576;
  --gold: #b07a28;
  --gold-dim: rgba(176, 122, 40, 0.12);
  --shadow: 0 10px 28px rgba(20, 28, 45, 0.08);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(1200px 500px at 10% -10%, rgba(232, 184, 109, 0.06), transparent 50%),
    radial-gradient(800px 400px at 100% 0%, rgba(61, 214, 140, 0.04), transparent 45%);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(180px, 280px) 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: 0.01em;
}

.brand-text span {
  color: var(--muted);
  font-size: 11px;
}

.pair-wrap { position: relative; }

.pair-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.pair-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.pair-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(320px, 60vh);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 30;
}

.pair-item {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--text);
  padding: 9px 12px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.pair-item:hover,
.pair-item.active { background: var(--surface-2); }

.pair-item small { color: var(--muted); }

.tf-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tf-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}

.tf-btn:hover { color: var(--text); }

.tf-btn.active {
  color: #1a1408;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 600;
}

[data-theme="light"] .tf-btn.active { color: #fff; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.status .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #8b95a8;
}

.status.live .dot {
  background: var(--up);
  box-shadow: 0 0 0 4px var(--up-dim);
}

.status.off .dot { background: var(--down); }

.icon-btn {
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 10px;
  cursor: pointer;
}

.icon-btn:hover { color: var(--text); }

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 300px;
  gap: 14px;
  padding: 14px 18px 0;
}

.chart-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.price-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.price-strip h1 {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.last-price {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.last-price.up { color: var(--up); }
.last-price.down { color: var(--down); }

.price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 2px;
}

.chg-badge {
  font-family: var(--mono);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
}

.chg-badge.up { color: var(--up); background: var(--up-dim); }
.chg-badge.down { color: var(--down); background: var(--down-dim); }

.ohlc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

.ohlc b { color: var(--text); font-weight: 500; }

.strip-meta {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

.sep { opacity: 0.5; }

.chart-shell {
  position: relative;
  flex: 1;
  min-height: 420px;
}

.chart { position: absolute; inset: 0; }

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
}

.btn {
  border: 0;
  background: var(--gold);
  color: #1a1408;
  font-family: var(--font);
  font-weight: 600;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.card h2 {
  font-size: 13px;
  font-weight: 600;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pill {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-dim);
  border-radius: 999px;
  padding: 3px 8px;
}

.pill.muted {
  color: var(--muted);
  background: var(--surface-2);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 10px;
  margin-top: 12px;
}

.stats dt {
  font-size: 11px;
  color: var(--muted);
}

.stats dd {
  font-family: var(--mono);
  font-size: 13px;
  margin-top: 2px;
}

.mentor { background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 6%, var(--surface)), var(--surface)); }

.mentor-lead {
  font-size: 15px;
  line-height: 1.45;
  margin: 4px 0 10px;
}

.mentor-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mentor-list li {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  padding-left: 12px;
  position: relative;
}

.mentor-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
}

.hint {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.roadmap {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.roadmap li {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.news-panel {
  margin: 14px 18px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  box-shadow: var(--shadow);
}

.news-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.news-head h2 {
  font-size: 15px;
  font-weight: 600;
}

.news-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  flex: 1;
}

.news-filter {
  background: none;
  border: 0;
  color: var(--muted);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  padding: 7px 2px;
  border-bottom: 2px solid transparent;
}

.news-filter:hover { color: var(--text); }

.news-filter.active {
  color: var(--gold);
  font-weight: 600;
  border-bottom-color: var(--gold);
}

.news-meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

.news-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: row dense;
  gap: 10px;
}

.news-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.news-card:hover {
  border-color: color-mix(in srgb, var(--gold) 45%, var(--line));
  transform: translateY(-1px);
}

.news-thumb {
  aspect-ratio: 16 / 9;
  background: var(--surface);
  overflow: hidden;
}

.news-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.news-card.no-thumb .news-thumb { display: none; }

.news-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 13px;
  flex: 1;
  min-height: 108px;
}

.news-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.news-src {
  font-size: 12px;
  font-weight: 600;
}

.news-src.coindesk { color: #e8b86d; }
.news-src.cointelegraph { color: #6aa6ff; }
.news-src.bloomberg { color: #f07178; }
.news-src.theblock { color: #b9a6ff; }
.news-src.decrypt { color: #3dd68c; }

.news-title {
  font-size: 13.5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.news-age {
  margin-top: auto;
  padding-top: 2px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* Sentimen: titik warna + label kecil, bukan badge — lebih terminal, gak berisik. */
.news-sent {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.news-sent::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.news-sent.positif { color: var(--up); }
.news-sent.netral { color: var(--muted); }
.news-sent.waspada { color: var(--down); }

/* Kartu pertama (paling relevan/terbaru) dapat perlakuan "headline". */
.news-card.featured {
  grid-column: span 2;
  grid-row: span 2;
}

.news-card.featured .news-thumb { aspect-ratio: 16 / 8; }

.news-card.featured .news-body { min-height: 132px; }

.news-card.featured .news-src { font-size: 13px; }

.news-card.featured .news-title {
  font-size: 17px;
  line-height: 1.38;
  -webkit-line-clamp: 4;
}

.news-skel {
  height: 220px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--line) 35%, var(--surface-2)), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.2s ease infinite;
}

.news-skel.featured {
  grid-column: span 2;
  grid-row: span 2;
  height: auto;
}

.news-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  padding: 18px 6px;
}

.news-more {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: none;
  color: var(--muted);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.news-more:hover {
  border-color: var(--gold);
  color: var(--text);
}

.news-refresh svg { transition: transform 0.2s ease; }
.news-refresh.spinning svg { animation: spin 0.8s linear infinite; }

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

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

/* Fokus keyboard yang kelihatan jelas di semua kontrol interaktif. */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1100px) {
  .news-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .news-card.featured, .news-skel.featured { grid-row: span 1; }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }
  .pair-wrap, .tf-group { grid-column: 1 / -1; }
  .workspace { grid-template-columns: 1fr; }
  .chart-shell { min-height: 380px; }
  .news-track { grid-template-columns: 1fr; }
  .news-card.featured, .news-skel.featured { grid-column: span 1; }
  .news-card.featured .news-title { font-size: 14.5px; -webkit-line-clamp: 3; }
  .news-card.featured .news-thumb { aspect-ratio: 16 / 9; }
}

@media (max-width: 480px) {
  .topbar { padding: 10px 14px; gap: 10px; }
  .brand-text span { display: none; }
  .workspace { padding: 10px 14px 0; gap: 10px; }
  .price-strip { padding: 12px 14px 10px; }
  .last-price { font-size: 24px; }
  .news-panel { margin: 10px 14px 14px; padding: 12px 14px 14px; }
}
