/* First paint — matches main theme so layout doesn’t jump before styles.css */
:root {
  --shell-bark: #64462c;
  --shell-ink: #14161a;
  --shell-muted: #5c6570;
  --shell-faint: #8b939e;
  --shell-surface: #ffffff;
  --shell-bg: #f4f6f9;
  --shell-border: rgba(20, 22, 26, 0.08);
  --shell-shadow: 0 8px 24px rgba(20, 22, 26, 0.06);
  --shell-radius: 6px;
}

html {
  box-sizing: border-box;
}
*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background: var(--shell-bg);
  color: var(--shell-muted);
  font-family: ui-monospace, "Segoe UI Mono", "Cascadia Code", monospace;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  opacity: 0.045;
  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.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.site-header {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  padding-top: max(1rem, env(safe-area-inset-top, 0px));
  padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand nav connect";
  align-items: center;
  gap: 0.65rem 1rem;
  border-bottom: 1px solid var(--shell-border);
  background: color-mix(in srgb, var(--shell-bg) 92%, transparent);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .brand {
  grid-area: brand;
}

.site-header .site-nav-dropdown {
  grid-area: nav;
}

.site-header .btn-connect {
  grid-area: connect;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--shell-ink);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}

.brand__img {
  display: block;
  border-radius: 8px;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.85rem;
  flex-wrap: wrap;
  min-width: 0;
}

.nav-link {
  color: var(--shell-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.15rem;
}

@media (max-width: 640px) {
  .site-header {
    grid-template-columns: 1fr auto auto;
    grid-template-rows: auto;
    grid-template-areas: "brand menu connect";
    gap: 0.5rem 0.45rem;
    align-items: center;
  }

  .site-header .site-nav-dropdown {
    grid-area: menu;
  }

  .staking-main {
    padding: 1.5rem 1rem 3.5rem;
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(3.5rem, env(safe-area-inset-bottom, 0px));
  }

  .card__row {
    flex-direction: column;
    align-items: stretch;
  }

  .card__row .btn {
    width: 100%;
  }
}

.nav-link--active {
  color: var(--shell-bark);
  font-weight: 700;
}

.btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.55rem 1rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--shell-radius);
  border: 1px solid transparent;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--shell-bark);
  color: #faf8f5;
}

.btn-ghost {
  background: var(--shell-surface);
  color: var(--shell-muted);
  border-color: var(--shell-border);
}

.btn-connect {
  background: var(--shell-surface);
  color: var(--shell-bark);
  border-color: color-mix(in srgb, var(--shell-bark) 28%, var(--shell-border));
  flex-shrink: 0;
}

.staking-main {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  padding-bottom: max(4rem, env(safe-area-inset-bottom, 0px));
}

.staking-hero {
  margin-bottom: 2.25rem;
}

.eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--shell-bark);
  margin: 0 0 0.75rem;
}

.staking-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.85rem, 5vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--shell-ink);
  line-height: 1.12;
}

.staking-lead {
  margin: 0;
  max-width: 52ch;
}

.staking-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 600px) {
  .staking-panels {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .staking-panels {
    grid-template-columns: repeat(4, 1fr);
  }
}

.panel {
  background: var(--shell-surface);
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shell-shadow);
}

.panel__label {
  margin: 0 0 0.35rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--shell-faint);
}

.panel__value {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--shell-ink);
  letter-spacing: -0.02em;
}

.panel__value--sm {
  font-size: 0.85rem;
  font-weight: 600;
  word-break: break-all;
}

.panel__hint {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: var(--shell-faint);
}

.card {
  background: var(--shell-surface);
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius);
  padding: 1.5rem 1.5rem 1.65rem;
  box-shadow: var(--shell-shadow);
  margin-bottom: 2rem;
}

.card__title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--shell-ink);
}

.card__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.app-page .card--spaced-top {
  margin-top: 0;
}

/* Placeholder tile grid (trait spin / marketplace) */
.placeholder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.placeholder-tile {
  aspect-ratio: 1;
  border-radius: var(--shell-radius);
  border: 1px dashed rgba(20, 22, 26, 0.15);
  background: rgba(20, 22, 26, 0.035);
  min-height: 100px;
}

/* Empty state + logo (staking grid) */
.nft-grid__empty--with-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 2rem 1rem;
}

.nft-grid__empty-logo {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: contain;
}

.nft-grid__empty-copy {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.site-footer {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 2.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
}

.footer-sep {
  color: var(--shell-faint);
  user-select: none;
}

.footer-link {
  font-size: 0.8rem;
  color: #9dabce;
  text-decoration: none;
  font-weight: 500;
}

/* Lamp — position stable on first paint */
.lamp-pull {
  position: fixed;
  bottom: max(1rem, env(safe-area-inset-bottom));
  right: max(1rem, env(safe-area-inset-right));
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem 0.5rem;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--shell-faint);
}

.lamp-pull__housing {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lamp-pull__socket {
  width: 1.6rem;
  height: 0.5rem;
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(180deg, #e8ecf2, #c5cad3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.12);
}

.lamp-pull__cord {
  width: 2px;
  height: 3.4rem;
  border-radius: 1px;
  background: linear-gradient(180deg, #9a9590, #4a4744 55%, #3a3836);
}

.lamp-pull__knob {
  width: 1rem;
  height: 1rem;
  margin-top: -2px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #f2ebe4, #c4b5a2 45%, #6b5d4c);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.28),
    inset 0 -2px 3px rgba(0, 0, 0, 0.15);
}

.lamp-pull__status {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1;
}

html[data-theme="night"] .lamp-pull__label--to-night {
  display: none;
}

html[data-theme="night"] .lamp-pull__label--to-day {
  display: inline;
}

.lamp-pull__label--to-day {
  display: none;
}
