:root {
  --brand-red: #d1121b;
  --brand-yellow: #f4c737;
  --brand-charcoal: #1f2329;
  --brand-ink: #121418;
  --brand-paper: #fff7db;
  --muted: #697180;
  --card: #ffffff;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  background: radial-gradient(circle at top right, #fff1b8 0%, #fff9e7 35%, #f4f5f7 100%);
  color: var(--brand-ink);
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 2px solid #efefef;
  backdrop-filter: blur(6px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 10px;
}

.logo {
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.logo-mark {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  color: var(--brand-red);
}

.logo-sub {
  font-size: 0.73rem;
  color: #2c2f34;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.main-nav {
  display: flex;
  gap: 16px;
}

.main-nav a {
  text-decoration: none;
  color: #2f3136;
  font-weight: 600;
  padding: 8px 2px;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.main-nav a.active {
  border-bottom-color: var(--brand-red);
}

.hero {
  padding: 52px 0;
}

.hero-simple {
  max-width: 860px;
}

.eyebrow {
  color: var(--brand-red);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin: 0;
}

h1,
.page-title {
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 0.98;
  margin: 10px 0 12px;
  text-wrap: balance;
}

h2,
h3,
h4 {
  margin: 0 0 8px;
  font-family: "Barlow Condensed", sans-serif;
}

.hero-copy,
.section-head p {
  max-width: 68ch;
  line-height: 1.6;
  color: #404651;
}

.section {
  padding: 28px 0 40px;
}

.section-alt {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(250, 251, 253, 0.8));
}

/* Tighten home page vertical rhythm on laptop/desktop so key content fits in one view. */
body[data-page="home"] .hero {
  padding: 34px 0 28px;
}

body[data-page="home"] .hero h1 {
  font-size: clamp(1.9rem, 4.3vw, 3rem);
  margin-bottom: 10px;
}

body[data-page="home"] .hero-copy {
  margin-bottom: 14px;
}

body[data-page="home"] .section-alt {
  padding: 18px 0 22px;
}

body[data-page="home"] .section {
  padding: 20px 0 28px;
}

body[data-page="home"] .cards-3 .card {
  padding: 16px;
}

.home-feature-thumb {
  margin-bottom: 10px;
}

.cards-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--brand-red);
  color: #fff;
}

.btn-secondary {
  background: var(--brand-yellow);
  color: #1f2329;
}

.btn-outline {
  background: transparent;
  border: 2px solid #d6dae0;
  color: #20252d;
}

.locale-toggle {
  min-width: 64px;
  padding-inline: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
}

.auth-chip img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #ced6e2;
  background: #f1f4f9;
  flex: 0 0 24px;
}

#authButton {
  padding: 8px 12px;
}

.auth-chip span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--brand-red);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 5px;
  line-height: 1;
}

.hero-actions,
.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.auth-primary-actions .btn {
  width: 100%;
}

.auth-local-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #e1e7f0;
  border-radius: 12px;
  background: #fafcff;
}

.auth-local-title {
  margin: 0 0 8px;
  font-weight: 700;
  color: #2a3343;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid #e2e5ea;
  box-shadow: 0 8px 26px rgba(17, 20, 24, 0.07);
}

.manual-grid,
.gallery-grid,
.kit-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.kit-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.about-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 16px;
}

.about-nips {
  margin-top: 16px;
}

.about-list {
  margin: 0;
  padding-left: 20px;
  color: #404651;
  line-height: 1.55;
}

.about-list li + li {
  margin-top: 8px;
}

.thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  background: #eceef2;
}

.form-card {
  display: grid;
  gap: 12px;
}

label {
  display: block;
  font-weight: 600;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #cfd5df;
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  margin-top: 6px;
}

textarea {
  min-height: 108px;
  resize: vertical;
}

.submit-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
}

.share-section {
  background:
    radial-gradient(circle at 92% 8%, rgba(244, 199, 55, 0.26), transparent 38%),
    linear-gradient(180deg, #f6f3df 0%, #f7f4e7 100%);
}

.share-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 0 auto 18px;
  max-width: 980px;
  padding: 22px 22px;
  background: linear-gradient(135deg, #fffef8 0%, #ffffff 44%, #fff4cb 100%);
  border-color: #e8dcc0;
}

.share-copy .page-title {
  margin-top: 8px;
  margin-bottom: 12px;
  letter-spacing: 0.01em;
}

.share-lead {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.45;
  color: #2f3541;
  max-width: 58ch;
}

.share-flow {
  margin: 12px 0 0;
  color: #404958;
  font-size: 0.98rem;
  line-height: 1.42;
  max-width: 72ch;
}

.share-gate {
  text-align: center;
  margin-top: 16px;
  margin-bottom: 0;
  border: 2px dashed #cfd7e5;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  padding: 26px 20px;
  border-radius: 14px;
}

.share-gate h2 {
  font-size: clamp(2rem, 4vw, 2.5rem);
  margin-bottom: 10px;
}

.share-gate .small {
  font-size: 1rem;
  max-width: 58ch;
  margin: 0 auto 16px;
  line-height: 1.45;
}

.share-form-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  max-width: 860px;
  margin: 0 auto;
  border-color: #dde4ef;
}

#shareFormShell {
  margin-top: 6px;
}

.share-form-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.kit-card {
  display: flex;
  flex-direction: column;
}

.kit-card h3 {
  margin-top: 10px;
  margin-bottom: 8px;
  line-height: 1.12;
}

.kit-meta {
  margin: 0 0 8px;
  font-weight: 700;
  color: #1f2a3a;
}

.kit-summary {
  margin: 0;
  line-height: 1.42;
  color: #303744;
  text-wrap: pretty;
}

.kit-card .hero-actions {
  margin-top: auto;
  padding-top: 14px;
}

.gallery-clickable {
  cursor: pointer;
}

.gallery-clickable:focus-visible {
  outline: 3px solid #5f9eea;
  outline-offset: 2px;
}

.moderation-item {
  border-top: 1px solid #eceff3;
  padding-top: 10px;
  margin-top: 10px;
}

.skeleton-card .skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, #eef1f5 25%, #f6f8fb 40%, #eef1f5 55%);
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.2s linear infinite;
}

.skeleton-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: 12px;
  border-radius: 12px;
}

.skeleton-line {
  height: 12px;
  margin-bottom: 10px;
}

.skeleton-line-lg {
  width: 72%;
  height: 16px;
}

.skeleton-line-sm {
  width: 46%;
}

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

.small {
  font-size: 0.86rem;
  color: #5c6471;
}

.status {
  margin-top: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #2f3f5a;
}

.relay-sync {
  margin: 6px 0 12px;
  color: #4c5566;
  font-weight: 600;
}

.relay-sync.error {
  color: #9a1f26;
}

.debug-panel {
  margin-top: 14px;
  border-top: 1px solid #e6ebf2;
  padding-top: 10px;
}

.debug-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: #2a3343;
}

.debug-content {
  margin-top: 10px;
  font-size: 0.82rem;
  color: #3f4756;
  display: grid;
  gap: 8px;
}

.debug-table {
  width: 100%;
  border-collapse: collapse;
}

.debug-table th,
.debug-table td {
  border: 1px solid #e4e9f0;
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(16, 20, 30, 0.5);
  padding: 16px;
}

.modal-card {
  position: relative;
  width: min(640px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #d8dde5;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.backup-modal-card {
  width: min(760px, 100%);
}

.profile-modal-card {
  width: min(980px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  padding: 16px;
}

.creation-modal-card {
  width: min(820px, 100%);
}

.restore-modal-card {
  width: min(760px, 100%);
}

.backup-block {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #dde4ef;
  border-radius: 12px;
  background: #fbfcff;
}

#downloadBackupBtn {
  position: static;
  top: auto;
}

.backup-recovery-details {
  margin-top: 12px;
}

.backup-recovery-details > summary {
  cursor: pointer;
  font-weight: 700;
  color: #1e2735;
  list-style: none;
}

.backup-recovery-details > summary::-webkit-details-marker {
  display: none;
}

.backup-recovery-details > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.15s ease;
}

.backup-recovery-details[open] > summary::before {
  transform: rotate(90deg);
}

#restoreWords,
#backupWords {
  margin-top: 8px;
  min-height: 76px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.profile-banner {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 0;
  background: #eef2f8;
}

.profile-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 10px 0 10px;
  padding: 0 6px;
  position: relative;
  z-index: 1;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 999px;
  border: 4px solid #fff;
  object-fit: cover;
  background: #eef2f8;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.profile-modal-card.has-banner .profile-head {
  margin-top: 10px;
}

.profile-modal-card.has-banner .profile-avatar {
  margin-top: -40px;
}

.profile-modal-card.no-banner .profile-head {
  margin-top: 10px;
}

.profile-modal-card.no-banner .profile-avatar {
  width: 72px;
  height: 72px;
  margin-top: 0;
  border-width: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.profile-head h2 {
  margin: 0 0 4px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 10px;
}

.profile-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 14px;
  align-items: start;
}

.profile-side {
  display: grid;
  gap: 10px;
}

.profile-qr-wrap {
  padding: 10px;
  border: 1px solid #e0e6f0;
  border-radius: 12px;
  background: #fafcff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.profile-actions .btn {
  width: 100%;
}

.creation-main-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 12px;
  background: #eef2f8;
}

.creation-thumbs {
  margin: 10px 0 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.creation-modal-actions {
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 2px;
}

.creation-modal-actions .btn {
  font-family: "Montserrat", sans-serif;
  white-space: nowrap;
}

.creation-thumb-btn {
  border: 1px solid #d6dde8;
  background: #fff;
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
}

.creation-thumb-btn img {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
}

.zap-modal-card {
  width: min(680px, 100%);
}

.zap-modal-card.zap-result {
  width: min(420px, 100%);
}

.zap-amount-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.zap-amount-btn.selected {
  border-color: #d1121b;
  color: #d1121b;
  box-shadow: inset 0 0 0 1px #d1121b;
}

.zap-wallet-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.zap-qr-wrap {
  margin: 6px 0 12px;
  padding: 10px;
  border: 1px solid #e0e6f0;
  border-radius: 12px;
  background: #fafcff;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.zap-wallet-btn {
  width: 100%;
}

.modal-close {
  position: absolute;
  top: 6px;
  right: 10px;
  border: 0;
  background: transparent;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.remote-box {
  margin-top: 10px;
}

#remoteQrCanvas {
  border-radius: 10px;
  border: 1px solid #ddd;
  background: #fff;
}

#remoteUri {
  margin-top: 8px;
  min-height: 74px;
  font-size: 0.78rem;
}

.hidden {
  display: none !important;
}

.site-footer {
  background: var(--brand-charcoal);
  color: #eef3fb;
  padding: 24px 0;
  margin-top: 20px;
}

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

.site-footer a {
  color: #ffd95e;
}

.site-footer .footer-cta {
  color: #1f2329;
  min-width: 210px;
}

@media (max-width: 960px) {
  .cards-3,
  .share-hero,
  .submit-grid {
    grid-template-columns: 1fr;
  }

  .share-hero {
    padding: 18px 16px;
  }

  .share-lead {
    max-width: none;
  }

  .profile-modal-card {
    width: min(760px, 100%);
  }

  .profile-body {
    grid-template-columns: 1fr;
  }

  .profile-side {
    justify-items: start;
  }

  .zap-amount-grid,
  .zap-wallet-list {
    grid-template-columns: 1fr;
  }

  .auth-primary-actions {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 8px;
    row-gap: 8px;
    padding: 8px 0 10px;
  }

  .logo {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .logo-sub {
    letter-spacing: 0.1em;
    font-size: 0.68rem;
  }

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    overflow-x: auto;
    gap: 14px;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .locale-toggle {
    grid-column: 2;
    grid-row: 1;
    min-width: 52px;
    padding: 8px 10px;
  }

  #authButton {
    grid-column: 3;
    grid-row: 1;
    padding: 7px 10px;
  }

  .auth-chip {
    max-width: 118px;
  }

  .auth-chip span {
    max-width: 82px;
  }

  .main-nav a {
    white-space: nowrap;
    padding: 8px 0;
  }
}
