:root {
  color-scheme: light;
  --ink: #231f20;
  --muted: #6d6667;
  --line: #ddd6d2;
  --paper: #f8f5f2;
  --panel: #ffffff;
  --plum: #583142;
  --rose: #a8495d;
  --green: #356b5a;
  --blue: #345f7a;
  --amber: #986b2f;
  --shadow: 0 16px 38px rgba(35, 31, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 20px 16px 96px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 20px;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.7rem;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff;
  color: var(--plum);
  font-size: 0.78rem;
  font-weight: 800;
}

.howto-pill {
  background: var(--ink);
  color: #fff;
}

.share-pill {
  background: var(--rose);
  color: #fff;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

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

.action-card {
  min-height: 140px;
  border: 0;
  border-radius: 8px;
  padding: 16px;
  color: #fff;
  text-align: left;
  box-shadow: var(--shadow);
}

.action-card span {
  display: block;
  margin-bottom: 34px;
  font-size: 0.86rem;
  opacity: 0.86;
}

.action-card strong {
  display: block;
  max-width: 9rem;
  font-size: 1.35rem;
  line-height: 1.08;
}

.before-card {
  background: var(--plum);
}

.bridge-card {
  background: var(--blue);
}

.after-card {
  grid-column: 1 / -1;
  background: var(--green);
}

.principle,
.recent-card,
.flow-panel,
.bridge-panel,
.bridge-card-display,
.auth-panel,
.about-panel,
.timeline-item,
.insight-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.principle {
  margin: 14px 0;
  padding: 18px;
}

.principle p {
  margin-bottom: 6px;
  font-size: 1.22rem;
  font-weight: 800;
}

.principle span,
.empty-state,
.timeline-meta,
.insight-card p,
.about-panel p {
  color: var(--muted);
}

.recent-card,
.flow-panel,
.auth-panel,
.bridge-panel,
.about-panel {
  padding: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--rose);
  font-weight: 800;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  font-size: 0.86rem;
  font-weight: 800;
}

.choice-grid,
.choice-list {
  display: grid;
  gap: 8px;
}

.choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice,
.segmented label,
.safety-panel label,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfaf8;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.choice input,
.segmented input,
.safety-panel input,
.toggle-row input {
  accent-color: var(--rose);
}

.safety-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.safety-panel h2 {
  margin-bottom: 2px;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}

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

.range-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

output {
  display: block;
  margin-top: 6px;
  color: var(--plum);
  font-weight: 800;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 850;
}

.primary-button {
  width: 100%;
  margin-top: 18px;
  border: 0;
  background: var(--ink);
  color: #fff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--plum);
}

.bridge-card-display {
  min-height: 180px;
  display: grid;
  align-items: center;
  padding: 22px;
  background: #fbfaf8;
}

.bridge-card-display p {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 850;
  line-height: 1.15;
}

.bridge-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.timeline-list,
.insight-grid {
  display: grid;
  gap: 10px;
}

.timeline-item,
.insight-card {
  padding: 14px;
}

.timeline-item h2,
.insight-card h2 {
  margin-bottom: 6px;
}

.timeline-meta {
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.insight-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--rose);
  font-size: 1.6rem;
}

.auth-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.auth-panel[hidden] {
  display: none;
}

.auth-panel form {
  display: grid;
  gap: 8px;
}

.auth-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.about-kicker {
  color: var(--rose);
  font-weight: 850;
}

blockquote {
  margin: 18px 0;
  border-left: 4px solid var(--rose);
  padding-left: 12px;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 850;
}

.about-section {
  margin-top: 18px;
}

.share-overlay[hidden] {
  display: none;
}

.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.share-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 31, 32, 0.46);
}

.share-sheet {
  position: absolute;
  right: 16px;
  bottom: 84px;
  left: 16px;
  width: min(440px, calc(100% - 32px));
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.share-qr {
  display: block;
  width: min(260px, 100%);
  aspect-ratio: 1;
  margin: 8px auto 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.share-url {
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfaf8;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.share-actions .primary-button {
  margin-top: 0;
}

.share-message {
  min-height: 20px;
  margin-top: 10px;
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.nav-button {
  min-height: 64px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.nav-button.active {
  color: var(--rose);
}

@media (max-width: 540px) {
  .topbar {
    display: block;
  }

  .topbar-actions {
    margin-top: 12px;
  }

  .choice-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bridge-card-display p {
    font-size: 1.35rem;
  }
}
