:root {
  --paper: #f4f1e8;
  --paper-deep: #ebe7db;
  --card: rgba(255, 255, 255, 0.62);
  --ink: #18231f;
  --muted: #64716c;
  --sage: #bfd3c7;
  --sage-soft: #dde9e1;
  --sage-dark: #3d6555;
  --line: #d3dbd5;
  --white: #fff;
  --danger: #8b413c;
  --shadow: 0 18px 60px rgba(43, 66, 57, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 96% 2%, rgba(191, 211, 199, 0.52), transparent 28rem),
    linear-gradient(180deg, #f7f4ec 0, var(--paper) 40rem);
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: env(safe-area-inset-top) 22px calc(32px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  border-bottom: 1px solid rgba(61, 101, 85, 0.12);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--sage-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding-left: 2px;
  border-radius: 50%;
  color: var(--paper);
  background: var(--sage-dark);
  font-size: 0.68rem;
}

.connection {
  color: var(--muted);
  font-size: 0.73rem;
}

.connection::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #6d9d7f;
  content: "";
}

.connection.offline::before {
  background: #b36e65;
}

.hero {
  padding: 48px 2px 34px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--sage-dark);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

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

h1 {
  max-width: 620px;
  margin-bottom: 18px;
  font-size: clamp(2.05rem, 8vw, 3.6rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.28rem;
  letter-spacing: -0.02em;
}

.lead {
  max-width: 600px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.85;
}

.play-card,
.card {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.play-card {
  background: linear-gradient(145deg, rgba(61, 101, 85, 0.96), rgba(48, 84, 69, 0.96));
  color: var(--white);
}

.play-card .section-kicker,
.play-card-copy p {
  color: rgba(255, 255, 255, 0.72);
}

.play-card-copy p:last-child {
  margin-bottom: 20px;
  line-height: 1.6;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  font-weight: 750;
}

.primary-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--sage-dark);
  background: var(--white);
  box-shadow: 0 10px 30px rgba(20, 43, 34, 0.18);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.button-icon {
  font-size: 0.78rem;
}

.last-video {
  margin: 14px 2px 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  line-height: 1.5;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.saved-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--sage-dark);
  background: var(--sage-soft);
  font-size: 0.7rem;
  font-weight: 750;
}

label {
  display: block;
  margin: 10px 0 8px;
  color: var(--sage-dark);
  font-size: 0.8rem;
  font-weight: 750;
}

textarea {
  display: block;
  width: 100%;
  min-height: 126px;
  resize: vertical;
  padding: 14px;
  border: 1px solid #c8d2cc;
  border-radius: 15px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  line-height: 1.55;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea:focus {
  border-color: var(--sage-dark);
  box-shadow: 0 0 0 4px rgba(61, 101, 85, 0.12);
}

.field-help {
  margin: 9px 2px 15px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
}

.secondary-button {
  width: 100%;
  color: var(--sage-dark);
  background: var(--sage-soft);
}

.steps {
  display: grid;
  gap: 12px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: start;
  gap: 11px;
}

.steps span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--sage-dark);
  font-size: 0.7rem;
  font-weight: 800;
}

.steps p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.text-button {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--sage-dark);
  background: transparent;
}

.install-state {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.limits {
  margin: 24px 2px 0;
  padding: 0 2px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.65;
}

.limits summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
}

.limits p {
  margin: 10px 0 0;
}

footer {
  padding: 34px 5px 10px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.6;
  text-align: center;
}

.loading-layer {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 24px;
  background: rgba(244, 241, 232, 0.96);
  text-align: center;
}

.loading-layer[hidden],
.toast[hidden] {
  display: none;
}

.loader {
  width: 44px;
  height: 44px;
  border: 3px solid var(--sage);
  border-top-color: var(--sage-dark);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.loading-layer p {
  margin: 18px 0 12px;
  font-weight: 700;
}

.loading-layer button {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  color: var(--muted);
  background: transparent;
}

.toast {
  position: fixed;
  z-index: 30;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 18px;
  max-width: 540px;
  margin: auto;
  padding: 14px 16px;
  border-radius: 14px;
  color: var(--white);
  background: var(--ink);
  box-shadow: 0 14px 40px rgba(24, 35, 31, 0.24);
  font-size: 0.85rem;
  line-height: 1.45;
  text-align: center;
}

.toast.error {
  background: var(--danger);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 640px) {
  .app-shell {
    padding-right: 32px;
    padding-left: 32px;
  }

  .hero {
    padding-top: 72px;
  }

  .play-card,
  .card {
    padding: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
