/* ================================================
   FlowerOS Scanner — scanner.css
   Standalone page, inherits site aesthetic
   ================================================ */

:root {
  --orange: #c96f4a;
  --orange-light: #d98a68;
  --orange-dark: #8f4a30;
  --orange-glow: rgba(201, 111, 74, 0.22);
  --cream: #fff8f3;
  --ink: #17100e;
  --ink-soft: #2a211d;
  --ink-card: #1a1410;
  --tear: #4ecdc4;
  --glass: rgba(255, 248, 243, 0.055);
  --glass-strong: rgba(255, 248, 243, 0.095);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --font-serif: "DM Serif Display", Georgia, serif;
  --font-sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Fira Code", monospace;
  --radius: 16px;
  --radius-sm: 12px;
  --transition: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--ink);
  color: var(--cream);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.7;
}

/* ── Ambient noise ── */
.noise {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.sc-radial-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(201,111,74,0.04) 0%, transparent 55%);
}

/* ── Decorative watermark ── */
.sc-watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-serif);
  font-size: clamp(5rem, 13vw, 11rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--cream);
  opacity: 0.04;
  pointer-events: none;
  white-space: nowrap;
  z-index: 0;
  user-select: none;
}

/* ── Page shell ── */
.sc-page {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.sc-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(23, 16, 14, 0.88);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}

.sc-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 248, 243, 0.6);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.2s var(--transition), transform 0.2s var(--transition);
  touch-action: manipulation;
  min-height: 44px;
  padding-right: 8px;
}

.sc-back:hover {
  color: var(--cream);
  transform: translateX(-2px);
}

.sc-header-center {
  display: flex;
  justify-content: center;
}

.sc-header-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cream);
  white-space: nowrap;
}

/* Scanning pulse dot */
.sc-scan-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange-light);
  box-shadow: 0 0 0 0 rgba(217, 138, 104, 0.5);
  animation: scanPulse 1.8s ease infinite;
  flex-shrink: 0;
}

@keyframes scanPulse {
  0%   { box-shadow: 0 0 0 0 rgba(217, 138, 104, 0.55); opacity: 0.9; }
  50%  { box-shadow: 0 0 0 7px rgba(217, 138, 104, 0); opacity: 1; }
  100% { box-shadow: 0 0 0 0 rgba(217, 138, 104, 0); opacity: 0.8; }
}

.sc-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

#scUpdatedLabel {
  font-size: 0.72rem;
  color: rgba(255, 248, 243, 0.4);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.sc-refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--glass);
  color: rgba(255, 248, 243, 0.5);
  cursor: pointer;
  transition: all 0.2s var(--transition);
  touch-action: manipulation;
}

.sc-refresh-btn:hover {
  color: var(--cream);
  background: var(--glass-strong);
  border-color: rgba(255, 255, 255, 0.2);
}

.sc-refresh-btn.spinning svg {
  animation: spinOnce 0.6s ease;
}

.sc-refresh-btn.cooldown {
  opacity: 0.4;
  cursor: not-allowed;
}

@keyframes spinOnce {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Main content ── */
.sc-main {
  flex: 1;
  padding: clamp(24px, 5vw, 48px) clamp(16px, 4vw, 48px);
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

/* ── Coin grid ── */
.sc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ── Loading state ── */
.sc-loading-text {
  text-align: center;
  color: rgba(255, 248, 243, 0.38);
  font-size: 0.87rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 8px 0 32px;
  animation: breathe 2s ease infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.8; }
}

/* ── Skeleton cards ── */
.sc-skeleton-card {
  background: var(--ink-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 160px;
}

.sc-sk-top {
  height: 56px;
  background: rgba(255, 248, 243, 0.05);
  position: relative;
  overflow: hidden;
}

.sc-sk-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sc-sk-line {
  height: 12px;
  border-radius: 6px;
  background: rgba(255, 248, 243, 0.07);
  position: relative;
  overflow: hidden;
}

.sc-sk-line--wide  { width: 65%; }
.sc-sk-line--narrow { width: 38%; }

.sc-sk-row {
  display: flex;
  gap: 10px;
}

.sc-sk-block {
  flex: 1;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 248, 243, 0.06);
  position: relative;
  overflow: hidden;
}

/* Shimmer animation */
.sc-sk-top::after,
.sc-sk-line::after,
.sc-sk-block::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,248,243,0.08) 50%, transparent 100%);
  animation: shimmer 1.5s ease infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Coin card ── */
.sc-coin-card {
  background: var(--ink-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: var(--cream);
  display: flex;
  flex-direction: column;
  transition:
    transform 0.22s var(--transition),
    border-color 0.22s var(--transition),
    box-shadow 0.22s var(--transition);
  position: relative;
  touch-action: manipulation;
  min-height: 44px;
}

.sc-coin-card:hover {
  transform: translateY(-2px);
  border-color: rgba(200, 133, 90, 0.45);
  box-shadow:
    0 0 0 1px rgba(200, 133, 90, 0.12),
    0 12px 32px rgba(0, 0, 0, 0.28),
    0 0 20px rgba(201, 111, 74, 0.08);
}

/* Pinned card — $MISANTHROPIC always first */
.sc-coin-card.sc-pinned {
  border-color: rgba(201, 111, 74, 0.5);
  box-shadow:
    0 0 0 1px rgba(201, 111, 74, 0.18),
    0 8px 24px rgba(0, 0, 0, 0.24),
    0 0 28px rgba(201, 111, 74, 0.07);
  background: linear-gradient(
    160deg,
    rgba(201, 111, 74, 0.06) 0%,
    var(--ink-card) 60%
  );
}

.sc-coin-card.sc-pinned:hover {
  border-color: var(--orange-light);
  box-shadow:
    0 0 0 1px rgba(201, 111, 74, 0.3),
    0 12px 36px rgba(0, 0, 0, 0.32),
    0 0 32px rgba(201, 111, 74, 0.14);
}

/* Pinned badge */
.sc-pinned-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-light);
  background: rgba(201, 111, 74, 0.14);
  border: 1px solid rgba(201, 111, 74, 0.3);
  border-radius: 4px;
  padding: 2px 6px;
  width: fit-content;
}

.sc-card-pinned-row {
  padding: 10px 16px 0;
}

.sc-coin-card:active {
  transform: translateY(0) scale(0.995);
}

/* Card top row: logo + name + badge */
.sc-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 12px;
}

.sc-coin-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 248, 243, 0.07);
  border: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sc-coin-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.sc-coin-info {
  flex: 1;
  min-width: 0;
}

.sc-coin-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--cream);
  letter-spacing: -0.01em;
}

.sc-coin-symbol {
  font-size: 0.76rem;
  color: rgba(217, 138, 104, 0.85);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* 24h change badge */
.sc-change-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.sc-change-badge.up {
  background: rgba(46, 204, 113, 0.15);
  color: #4ade80;
  border: 1px solid rgba(46, 204, 113, 0.2);
}

.sc-change-badge.down {
  background: rgba(231, 76, 60, 0.14);
  color: #f87171;
  border: 1px solid rgba(231, 76, 60, 0.2);
}

.sc-change-badge.neutral {
  background: rgba(255, 248, 243, 0.06);
  color: rgba(255, 248, 243, 0.4);
  border: 1px solid var(--border);
}

/* Card stats row */
.sc-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  border-top: 1px solid var(--border);
  background: var(--border);
  margin-top: auto;
}

/* Description subtitle */
.sc-card-desc-row {
  padding: 0 16px 10px;
  margin-top: -4px;
}

.sc-coin-desc {
  font-size: 0.72rem;
  color: rgba(255, 248, 243, 0.38);
  line-height: 1.4;
  font-style: italic;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sc-stat-block {
  background: var(--ink-card);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sc-stat-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 248, 243, 0.35);
  font-weight: 700;
}

.sc-stat-value {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--cream);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* DexScreener link row at bottom of card */
.sc-card-link-row {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.sc-dex-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(217, 138, 104, 0.7);
  text-transform: uppercase;
  transition: color 0.18s;
}

.sc-coin-card:hover .sc-dex-badge {
  color: var(--orange-light);
}

/* ── Error state ── */
.sc-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 40vh;
  text-align: center;
  padding: 40px 20px;
}

.sc-error-icon {
  font-size: 3rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.sc-error-msg {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: rgba(255, 248, 243, 0.65);
  max-width: 36ch;
  line-height: 1.5;
}

.sc-retry-btn {
  padding: 11px 28px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--glass);
  color: var(--cream);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s var(--transition);
  touch-action: manipulation;
  min-height: 44px;
}

.sc-retry-btn:hover {
  background: rgba(201, 111, 74, 0.15);
  border-color: var(--orange-light);
  color: var(--cream);
}

/* ── Footer ── */
.sc-footer {
  padding: 18px clamp(16px, 4vw, 48px);
  text-align: center;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: rgba(255, 248, 243, 0.22);
  letter-spacing: 0.02em;
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 620px) {
  .sc-watermark { display: none; }
  .sc-header {
    grid-template-columns: auto 1fr auto;
    padding: 12px 16px;
  }
  .sc-header-title {
    font-size: 0.78rem;
  }
  #scUpdatedLabel {
    display: none;
  }
  .sc-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
  }
  .sc-main {
    padding: 20px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sc-scan-dot,
  .sc-loading-text,
  .sc-error-icon,
  .sc-sk-top::after,
  .sc-sk-line::after,
  .sc-sk-block::after { animation: none !important; }
  .sc-coin-card { transition: none !important; }
}
