:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2a2f3a;
  --text: #eef0f3;
  --text-dim: #9aa3b2;
  --accent: #2fbf71;
  --accent-2: #4f8cff;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  flex-shrink: 0;
  display: block;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
}

.arrow {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 0.88rem;
}

.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 7px 11px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
  font-weight: 600;
}

.logo {
  font-size: 1.8rem;
  margin: 0;
  font-weight: 700;
}

.tagline {
  color: var(--text-dim);
  margin: 6px 0 0;
  font-size: 0.95rem;
  text-align: center;
}

.page-header {
  text-align: center;
  padding: 28px 0 4px;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: 1.6rem;
}

.page-header p {
  color: var(--text-dim);
  margin: 0;
}

main.wrap {
  padding-top: 28px;
  padding-bottom: 60px;
}

.rate-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}

.card-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.card-rate {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

#card-sell .card-rate {
  color: var(--accent-2);
}

.card-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.card-updated {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 10px;
  opacity: 0.7;
}

.converter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 28px;
}

.rate-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px;
}

.toggle-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.toggle-btn.active {
  background: var(--accent);
  color: #06210f;
  font-weight: 600;
}

.converter-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.field input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1.15rem;
  color: var(--text);
  width: 100%;
}

.field input:focus {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
}

#swap-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  margin-bottom: 4px;
}

#swap-btn:hover {
  background: var(--border);
}

.history {
  margin-bottom: 28px;
}

.history h2 {
  font-size: 1.05rem;
  margin: 0 0 4px;
  color: var(--text);
}

.history-note {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0 0 10px;
}

.history-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.history-filter-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
}

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

.history-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #06210f;
  font-weight: 600;
}

.history-chart {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 6px;
}

.history-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.history-chart .hc-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.history-chart .hc-grid {
  stroke: var(--border);
  stroke-width: 1;
}

.history-chart .hc-axis-label {
  fill: var(--text-dim);
  font-size: 10px;
}

.history-chart .hc-end-dot {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
}

.history-chart .hc-end-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.history-chart .hc-crosshair {
  stroke: var(--text-dim);
  stroke-width: 1;
  opacity: 0;
  pointer-events: none;
}

.history-chart .hc-hover-dot {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
  opacity: 0;
  pointer-events: none;
}

.history-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity 0.1s;
}

.history-tooltip strong {
  color: var(--text);
  font-weight: 600;
}

.history-empty {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.history-table-wrap {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.history-table-wrap summary {
  cursor: pointer;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.history-table th, .history-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.about {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.6;
}

.about h2 {
  color: var(--text);
  font-size: 1.1rem;
}

.disclaimer {
  font-size: 0.8rem;
  opacity: 0.75;
}

/* Breadcrumbs */

.breadcrumbs {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin: 18px 0 0;
}

.breadcrumbs a {
  color: var(--text-dim);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs .sep {
  margin: 0 6px;
  opacity: 0.6;
}

/* Ad slots */

.ad-slot {
  margin: 26px 0;
  text-align: center;
}

.ad-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  opacity: 0.6;
  margin-bottom: 6px;
}

/* Blog index */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 22px 0 32px;
}

.post-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}

.post-card:hover {
  border-color: var(--accent-2);
}

.post-card h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.post-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

.post-card .post-date {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  opacity: 0.7;
  margin-top: 8px;
}

/* Article page */

.post {
  padding-bottom: 20px;
}

.post .post-meta {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin: 4px 0 24px;
}

.post h1 {
  font-size: 1.7rem;
  margin: 14px 0 6px;
}

.post h2 {
  font-size: 1.25rem;
  margin: 30px 0 10px;
  color: var(--text);
}

.post p, .post li {
  line-height: 1.7;
  color: var(--text-dim);
  font-size: 0.98rem;
}

.post strong {
  color: var(--text);
}

.post ul, .post ol {
  padding-left: 22px;
}

.post a {
  color: var(--accent-2);
}

.related {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.related h2 {
  font-size: 1rem;
  margin: 0 0 12px;
  color: var(--text);
}

.related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.related a {
  color: var(--accent-2);
  text-decoration: none;
  font-size: 0.92rem;
}

.related a:hover {
  text-decoration: underline;
}

/* Simple content pages (about/contact/policy) */

.page {
  color: var(--text-dim);
  line-height: 1.7;
  font-size: 0.96rem;
  padding-bottom: 20px;
}

.page h1 {
  color: var(--text);
  font-size: 1.6rem;
}

.page h2 {
  color: var(--text);
  font-size: 1.15rem;
  margin-top: 28px;
}

.page a {
  color: var(--accent-2);
}

.contact-email {
  display: inline-block;
  margin-top: 6px;
  font-size: 1.05rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 40px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.subscribe-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 28px;
}

.subscribe-box h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  color: var(--text);
}

.subscribe-box p {
  margin: 0 0 12px;
  font-size: 0.82rem;
}

.subscribe-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.subscribe-form input[type="email"] {
  flex: 1;
  min-width: 180px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.92rem;
  color: var(--text);
}

.subscribe-form button {
  background: var(--accent);
  color: #06210f;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.footer-col h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  opacity: 0.8;
  margin: 0 0 10px;
}

.footer-col a {
  display: block;
  color: var(--text-dim);
  text-decoration: none;
  padding: 3px 0;
  font-size: 0.85rem;
}

.footer-col a:hover {
  color: var(--text);
  text-decoration: underline;
}

.footer-bottom {
  text-align: center;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  margin: 0;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f0f1f4;
    --border: #e2e4ea;
    --text: #14161a;
    --text-dim: #676e7a;
  }
  .toggle-btn.active { color: #06210f; }
}

@media (max-width: 480px) {
  .converter-grid {
    grid-template-columns: 1fr;
  }
  #swap-btn {
    justify-self: center;
    transform: rotate(90deg);
  }
  .card-rate { font-size: 1.3rem; }
  .footer-links {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .header-inner {
    justify-content: center;
    text-align: center;
  }
  .site-nav {
    justify-content: center;
  }
}
