/* Genesis Lab Foundation MiniApp — stripped landing.
   Clean canvas: dark navy paper, cream ink, separation by typography.
   Big readable text — Matthew has bad eyesight (feedback_bad_eyesight_big_text). */

:root {
  --paper: #0a2342;
  --ink: #f5e9c8;
  --ink-soft: #e6d9b3;
  --graphite: #95a8c5;
  --accent: #f5e9c8;
  --accent-warm: #c1532a;

  --font-mono: 'JetBrains Mono', 'SF Mono', 'Menlo', 'Consolas', ui-monospace, monospace;
  --font-body: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  --radius: 6px;

  /* Larger defaults — body 17, headings 26, buttons 17. */
  --fs-body: 17px;
  --fs-note: 15px;
  --fs-h1: 26px;
  --fs-h2: 26px;
  --fs-btn: 17px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  /* Telegram sets `--tg-viewport-height` on first ready; honour it. */
  min-height: var(--tg-viewport-height, 100vh);
}

#app {
  max-width: 460px;
  margin: 0 auto;
  /* Safe-area insets so iPhone notch / home-bar don't clip content. */
  padding:
    max(36px, env(safe-area-inset-top))
    max(22px, env(safe-area-inset-right))
    max(48px, env(safe-area-inset-bottom))
    max(22px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  text-align: center;
}

/* ---------- brand ---------- */

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.logo {
  display: block;
  width: 92px;
  height: 92px;
  object-fit: contain;
}

.brand-title {
  margin: 0;
  font-size: var(--fs-h1);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}

/* ---------- views ---------- */

.view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  width: 100%;
}

.view[hidden] {
  display: none;
}

.lead {
  margin: 0;
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--ink);
  max-width: 36ch;
}

.note {
  margin: 0;
  font-size: var(--fs-note);
  line-height: 1.55;
  color: var(--ink-soft);
  opacity: 0.85;
  max-width: 40ch;
}

/* ---------- CTA ---------- */

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 24px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs-btn);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, transform 80ms ease;
}

.cta:hover,
.cta:active {
  background: var(--ink);
  color: var(--paper);
}
.cta:active { transform: scale(0.98); }

.cta-primary {
  background: var(--ink);
  color: var(--paper);
}
.cta-primary:hover,
.cta-primary:active {
  background: var(--ink-soft);
  color: var(--paper);
}

/* Visible keyboard focus on every interactive element. Apple HIG + a11y. */
.cta:focus-visible,
.room:focus-visible,
.form-input:focus-visible,
.radio-toggle:focus-visible,
.radio-select:focus-visible,
.create-task-head:focus-visible {
  outline: 2px solid var(--accent-warm);
  outline-offset: 2px;
}

/* Disabled state — graceful, no «click anyway» mistakes. */
.cta:disabled,
.cta[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- footer link ---------- */

.footer-link {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--graphite);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 120ms ease, border-color 120ms ease;
}

.footer-link:hover,
.footer-link:active {
  color: var(--ink-soft);
  border-bottom-color: var(--graphite);
}

/* TON Connect + Stars donate (added 2026-05-23) */
.donate-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 10px;
  margin: 12px 0;
  width: 100%;
}
.cta-donate {
  background: var(--accent-warm);
  color: var(--ink);
  font-size: 18px;
  min-height: 52px;
  width: 100%;
}
.cta-secondary {
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
  padding: 12px 14px;
  font-size: var(--fs-btn);
  min-height: 48px;
}
.cta-ghost {
  background: transparent;
  border: 1px solid rgba(245, 233, 200, 0.35);
  color: rgba(245, 233, 200, 0.85);
  margin-top: 12px;
}
.wallet-block {
  width: 100%;
  margin: 12px 0 4px;
  padding: 20px;
  border: 1px solid rgba(245, 233, 200, 0.18);
  border-radius: 14px;
  background: rgba(245, 233, 200, 0.04);
}
.wallet-status {
  font-size: var(--fs-body);
  margin: 0 0 14px;
  color: rgba(245, 233, 200, 0.9);
}
.wallet-status .mono {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 15px;
}

/* ---------- Create-task block (collapsible) ---------- */

.create-task-block {
  width: 100%;
  border: 1px solid rgba(245, 233, 200, 0.18);
  border-radius: 14px;
  background: rgba(245, 233, 200, 0.04);
  overflow: hidden;
}
.create-task-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-body);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.create-task-head.open { border-bottom: 1px solid rgba(245, 233, 200, 0.12); }
.create-task-title { letter-spacing: 0.02em; }
.create-task-chev {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(245, 233, 200, 0.4);
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
}
.create-task-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  text-align: left;
}
.create-task-form[hidden] { display: none; }

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-label {
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(245, 233, 200, 0.65);
}
.form-input {
  width: 100%;
  padding: 14px 14px;
  background: rgba(10, 35, 66, 0.55);
  border: 1px solid rgba(245, 233, 200, 0.2);
  border-radius: 10px;
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-body);
  line-height: 1.4;
  outline: none;
  transition: border-color 120ms ease, background 120ms ease;
}
.form-input:focus {
  border-color: var(--ink);
  background: rgba(10, 35, 66, 0.85);
}
.form-textarea {
  resize: vertical;
  min-height: 110px;
}
.form-select {
  appearance: none;
  -webkit-appearance: none;
}
.form-submit {
  margin-top: 6px;
}
.form-status {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}
.form-status-ok { color: var(--ink); }
.form-status-err { color: var(--accent-warm); }

/* Rooms + Kanban (added 2026-05-23) */
.rooms-title {
  margin: 24px 0 8px;
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.6;
}
.rooms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}
.room {
  background: rgba(245, 233, 200, 0.04);
  border: 1px solid rgba(245, 233, 200, 0.14);
  border-radius: 14px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  font-family: inherit;
  min-height: 96px;
  transition: border-color 150ms, transform 150ms, background 150ms;
}
.room:hover { border-color: var(--accent-warm); transform: translateY(-1px); }
.room-title { font-size: 17px; font-weight: 600; }
.room-sub { font-size: 13px; opacity: 0.65; line-height: 1.35; }

/* Room host: animate height when content lands. */
.room-host {
  width: 100%;
  margin-top: 12px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 320ms ease, margin-top 320ms ease;
}
.room-host:not(:empty) {
  max-height: 4000px;
  margin-top: 24px;
}
.room-h2 { font-size: var(--fs-h2); font-weight: 500; margin: 0 0 14px; }

.kanban {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
@media (max-width: 600px) {
  .kanban { grid-template-columns: 1fr; }
}
.kanban-col {
  background: rgba(245, 233, 200, 0.04);
  border: 1px solid rgba(245, 233, 200, 0.12);
  border-radius: 12px;
  padding: 14px;
  min-height: 140px;
}
.kanban-h3 {
  font-size: 12px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0.6;
  margin: 0 0 12px;
}
.kanban-card {
  background: rgba(10, 35, 66, 0.6);
  border: 1px solid rgba(245, 233, 200, 0.12);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.kanban-card-title { font-size: 15px; margin-bottom: 6px; line-height: 1.35; }
.kanban-card-meta { font-size: 12px; opacity: 0.6; }
.kanban-empty { font-size: 13px; opacity: 0.45; padding: 12px 0; text-align: center; }

/* Radio strip — sticky top, ~44px, independent of mode. */
.radio-strip {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px max(8px, env(safe-area-inset-top)) 14px;
  background: rgba(10, 35, 66, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(245, 233, 200, 0.1);
  font-size: 12px;
  color: var(--ink);
  min-height: 60px;
}
.radio-toggle {
  background: transparent;
  border: 1px solid rgba(245, 233, 200, 0.45);
  color: var(--ink);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  flex-shrink: 0;
}
.radio-select {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 4px 6px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-overflow: ellipsis;
  min-width: 0;
}
.radio-select option {
  background: var(--paper);
  color: var(--ink);
}
.radio-status {
  margin-left: auto;
  opacity: 0.6;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Drum card (added 2026-05-23) */
.drum-card { background: rgba(245,233,200,0.04); border: 1px solid rgba(245,233,200,0.1); border-radius: 12px; padding: 18px; }
.drum-meta { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.5; margin-bottom: 8px; }
.drum-title { font-size: 22px; font-weight: 500; margin-bottom: 8px; }
.drum-prompt { font-size: 15px; opacity: 0.78; line-height: 1.5; margin-bottom: 14px; }
.drum-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.drum-actions .cta { flex: 1 1 80px; min-width: 70px; padding: 12px 8px; font-size: 14px; min-height: 44px; }

/* Roster (added 2026-05-23) */
.roster-block { margin: 20px 0 8px; }
.roster { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.roster-col { background: rgba(245,233,200,0.04); border: 1px solid rgba(245,233,200,0.1); border-radius: 12px; padding: 12px; }
.roster-section { padding: 12px 0; border-bottom: 1px solid rgba(245,233,200,0.08); }
.roster-section:last-child { border-bottom: 0; }
.roster-h3 { font-size: 11px; letter-spacing: 0.25em; text-transform: uppercase; opacity: 0.55; margin: 0 0 8px; }
.roster-row { padding: 6px 0; border-bottom: 1px solid rgba(245,233,200,0.06); }
.roster-row:last-child { border-bottom: 0; }
.roster-name { display: block; font-size: 15px; }
.roster-sub { display: block; font-size: 11px; opacity: 0.55; letter-spacing: 0.05em; }
.roster-wallet { color: #7ec8ff; font-size: 12px; }

/* Showcase iframe (added 2026-05-23) */
.showcase-frame-wrap { background: var(--ink, #0a2342); border-radius: 12px; overflow: hidden; border: 1px solid rgba(245,233,200,0.1); aspect-ratio: 9/16; max-height: 70vh; }
.showcase-frame { width: 100%; height: 100%; border: 0; }

/* Mode toggle (added 2026-05-23) */
.mode-toggle { margin-top: 20px; opacity: 0.7; }
.form-hint { display: block; font-size: 12px; opacity: 0.5; margin-top: 4px; }

/* Accessibility — honour OS-level «reduce motion». Strips transitions,
   transforms, and animation; height tweens too. iOS Telegram respects it. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
  .cta:active { transform: none; }
  .room:hover { transform: none; }
  .room-host { transition: none; }
}
