:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --border: #e1e3e5;
  --border-strong: #c9cccf;
  --text: #202223;
  --text-muted: #6d7175;
  --primary: #008060;
  --primary-hover: #006e52;
  --primary-subtle: #f1f8f5;
  --link: #2c6ecb;
  --danger: #d82c0d;
  --radius: 8px;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --touch: 48px;
  --input-h: 44px;
  --btn-h: 44px;
  --btn-h-lg: 44px;
  --space-field: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --bottom-nav-height: 56px;
}

@media (max-width: 768px) {
  :root {
    --touch: 40px;
    --input-h: 40px;
    --btn-h: 40px;
    --btn-h-lg: 44px;
    --space-field: 14px;
    --radius: 6px;
    --bottom-nav-height: 50px;
  }

  html {
    scroll-padding-top: calc(48px + var(--safe-top));
  }
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(64px + var(--safe-top));
  overflow-x: hidden;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100vw;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

.page-main {
  flex: 1;
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
}

.container {
  max-width: 960px;
  width: 100%;
  min-width: 0;
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: max(16px, env(safe-area-inset-right, 16px));
  margin: 0 auto;
}

.container-narrow { max-width: 720px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding-top: var(--safe-top);
}

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  position: relative;
}

.site-nav-brand {
  flex-shrink: 0;
  line-height: 0;
}

.site-logo {
  height: 40px;
  display: block;
}

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-links a {
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  padding: 4px 0;
}

.nav-links a:hover { color: var(--link); }
.nav-links a.active { font-weight: 600; }

.nav-cta {
  background: var(--primary) !important;
  color: #fff !important;
  padding: 10px 16px !important;
  border-radius: var(--radius) !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  white-space: nowrap;
}

.nav-cta:hover {
  background: var(--primary-hover) !important;
  color: #fff !important;
}

/* Bottom navigation (mobile) */
.bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  body {
    font-size: 0.875rem;
    line-height: 1.45;
  }

  .container {
    padding-left: max(12px, env(safe-area-inset-left, 12px));
    padding-right: max(12px, env(safe-area-inset-right, 12px));
  }

  .site-logo { height: 32px; }

  .site-nav {
    padding: 6px 0;
  }

  .site-nav .nav-links {
    display: none !important;
  }

  .site-nav {
    justify-content: center;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 300;
    align-items: stretch;
    justify-content: space-around;
    gap: 0;
    min-height: var(--bottom-nav-height);
    padding: 6px max(8px, env(safe-area-inset-left, 8px)) calc(6px + var(--safe-bottom)) max(8px, env(safe-area-inset-right, 8px));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    max-width: 80px;
    padding: 4px 2px;
    color: var(--text-muted);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    border-radius: 8px;
    transition: color 0.15s;
  }

  .bottom-nav-item:active {
    background: var(--bg);
  }

  .bottom-nav-item.active {
    color: var(--primary);
  }

  .bottom-nav-item.active .bottom-nav-label {
    font-weight: 600;
  }

  .bottom-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }

  .bottom-nav-icon svg {
    width: 22px;
    height: 22px;
    display: block;
  }

  .bottom-nav-label {
    font-size: 0.625rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .bottom-nav-item--cta {
    position: relative;
    justify-content: flex-end;
    padding-bottom: 2px;
  }

  .bottom-nav-item--cta .bottom-nav-icon {
    position: absolute;
    top: -14px;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 128, 96, 0.35);
    border: 3px solid var(--surface);
  }

  .bottom-nav-item--cta .bottom-nav-icon svg {
    width: 22px;
    height: 22px;
  }

  .bottom-nav-item--cta.active .bottom-nav-icon {
    background: var(--primary-hover);
  }

  .bottom-nav-item--cta .bottom-nav-label {
    margin-top: 20px;
    color: var(--primary);
    font-weight: 600;
  }

  .bottom-nav-item--cta.active .bottom-nav-label {
    color: var(--primary-hover);
  }

  body {
    padding-bottom: calc(var(--bottom-nav-height) + 12px + var(--safe-bottom));
  }

  .float-actions {
    display: none;
  }
}

/* Page layout */
.page-head {
  padding: 28px 0 24px;
  max-width: 640px;
}

.page-head h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.page-head-lead {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
  margin: 0;
  max-width: 560px;
}

.page-title {
  font-size: clamp(1.625rem, 4vw, 2.125rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.page-intro {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 560px;
}

.page-content {
  padding-bottom: 48px;
}

.section-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 10px 16px;
  min-height: var(--btn-h-lg);
  border-radius: var(--radius);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

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

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  color: var(--link);
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.btn-secondary:hover { text-decoration: underline; }

.btn-block { width: 100%; justify-content: center; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.card + .card { margin-top: 16px; }

.card h2,
.card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.card p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.card p + p { margin-top: 12px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .card-grid { grid-template-columns: 1fr; }
}

.card-list {
  list-style: disc;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

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

/* Forms */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 48px;
  box-shadow: var(--shadow-md);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.form-card-flush { margin-bottom: 0; }

@media (max-width: 768px) {
  .form-card {
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
  }

  .form-input {
    font-size: 16px; /* prevents iOS zoom while keeping compact height */
    padding: 8px 12px;
    min-height: var(--input-h);
  }

  textarea.form-input {
    min-height: 80px;
  }

  .form-label {
    font-size: 0.8125rem;
    margin-bottom: 4px;
  }

  .submit-btn,
  .btn-primary {
    font-size: 0.875rem;
    padding: 9px 14px;
    min-height: var(--btn-h-lg);
  }

  .card {
    padding: 16px;
  }

  .card h2,
  .card h3 {
    font-size: 0.9375rem;
    margin-bottom: 8px;
  }

  .card p {
    font-size: 0.8125rem;
    line-height: 1.5;
  }

  .site-footer {
    padding: 16px 0;
  }

  .footer-inner {
    font-size: 0.8125rem;
    gap: 12px;
  }
}

.form-group + .form-group { margin-top: var(--space-field); }

.form-label {
  display: block;
  font-weight: 500;
  color: var(--text);
  font-size: 0.8125rem;
  margin-bottom: 4px;
}

.form-input {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  padding: 10px 12px;
  min-height: var(--input-h);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

textarea.form-input {
  min-height: 96px;
  resize: vertical;
}

.form-input::placeholder { color: #8c9196; }

.form-input:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 1px var(--link);
}

.form-input-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  word-break: break-all;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.field-error {
  display: block;
  color: var(--danger);
  font-size: 0.8125rem;
  margin-top: 6px;
}

.submit-btn {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 10px 16px;
  min-height: var(--btn-h-lg);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
}

.submit-btn:hover { background: var(--primary-hover); }

@media (min-width: 769px) {
  .submit-btn { width: auto; }
  .submit-btn.btn-block { width: 100%; }
}

/* FAQ */
.faq-list { margin-bottom: 48px; }

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.faq-question:hover { background: var(--bg); }

.faq-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.faq-item.open .faq-icon { transform: rotate(45deg); }

.faq-answer {
  display: none;
  padding: 0 20px 16px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.faq-item.open .faq-answer { display: block; }

/* QR */
.qr-panel {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  min-width: 0;
}

.qr-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  min-width: 0;
  overflow: hidden;
}

.qr-box h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.qr-code-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: min(256px, 100%);
  margin: 0 auto;
  overflow: hidden;
}

.qr-code-wrap img,
.qr-code-wrap canvas,
.qr-code-wrap table {
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
}

.qr-code-wrap table {
  margin: 0 auto;
  border-collapse: collapse;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 24px 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}

.footer-links {
  display: flex;
  gap: 24px;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover { color: var(--link); }

/* Float actions */
.float-actions {
  position: fixed;
  bottom: calc(16px + var(--safe-bottom));
  right: max(16px, env(safe-area-inset-right, 16px));
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 768px) {
  .site-nav {
    flex-wrap: nowrap;
  }

  .page-head {
    padding: 12px 0 16px;
  }

  .page-head h1 {
    font-size: 1.25rem;
    margin-bottom: 6px;
  }

  .page-head-lead {
    font-size: 0.8125rem;
    line-height: 1.45;
  }

  .page-content,
  .create-token-section {
    padding-bottom: 24px;
  }

  .section-title {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  .card,
  .form-card {
    padding: 16px;
  }

  .card-grid {
    gap: 10px;
  }

  .footer-links {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
  }

  .faq-list {
    margin-bottom: 24px;
  }

  .faq-item {
    margin-bottom: 6px;
  }

  .faq-question {
    padding: 12px 14px;
    font-size: 0.8125rem;
    gap: 10px;
  }

  .faq-icon {
    width: 18px;
    height: 18px;
  }

  .faq-answer {
    padding: 0 14px 12px;
    font-size: 0.8125rem;
    line-height: 1.5;
  }

  .final-cta {
    padding: 24px 16px;
    margin-bottom: 24px;
  }

  .final-cta h2 {
    font-size: 1.125rem;
  }

  .final-cta p {
    font-size: 0.8125rem;
    margin-bottom: 14px;
  }

  .final-cta .btn-primary {
    width: 100%;
    margin-bottom: 8px;
  }

  .final-cta .btn-secondary {
    width: 100%;
    justify-content: center;
    padding: 10px;
    font-size: 0.8125rem;
  }

  .qr-panel {
    margin-top: 16px;
    padding-top: 16px;
  }

  .qr-box {
    padding: 14px 12px;
  }

  .qr-box h3 {
    font-size: 0.875rem;
    margin-bottom: 12px;
  }

  .qr-code-wrap {
    max-width: 100%;
  }

  .alert-info {
    padding: 12px;
    font-size: 0.8125rem;
  }
}

.float-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.float-btn-primary {
  background: var(--text);
  color: #fff;
}

.float-btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Utilities */
.text-link { color: var(--link); }
.required { color: var(--danger); }

.alert-info {
  background: #f0f5ff;
  border: 1px solid #b4c6e7;
  color: var(--text-muted);
  padding: 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.alert-info p:first-child {
  color: var(--text);
  font-weight: 600;
  margin-bottom: 8px;
}
