:root {
  color-scheme: light;
  --bg: #f7f5f0;
  --surface: #fffdf8;
  --surface-2: #f0eee8;
  --text: #25231f;
  --muted: #6f6a61;
  --line: #ded8cc;
  --accent: #2f6f73;
  --accent-2: #a84d3f;
  --shadow: 0 12px 30px rgba(49, 43, 34, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root.dark {
  color-scheme: dark;
  --bg: #171817;
  --surface: #22231f;
  --surface-2: #2c2d28;
  --text: #f3efe6;
  --muted: #b8b0a2;
  --line: #403d36;
  --accent: #77b8b3;
  --accent-2: #e0a08d;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

p,
strong,
span,
button,
li,
code {
  overflow-wrap: anywhere;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px 96px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
  line-height: 1.15;
}

h3 {
  margin-bottom: 10px;
  font-size: 16px;
  line-height: 1.2;
}

p {
  line-height: 1.6;
}

code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 0.92em;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.theme-mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  box-shadow: inset 7px 0 0 var(--accent);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-band {
  overflow: hidden;
  width: min(100%, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center top;
}

.hero-copy {
  padding: 18px;
}

.hero-copy p:last-child {
  margin-bottom: 0;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.status-row span,
.filter-chip,
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, calc(100vw - 32px));
  margin: 14px 0;
}

.metric-tile {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 10px;
}

.metric-tile span,
.metric-tile small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-tile strong {
  display: block;
  margin: 5px 0;
  font-size: 15px;
}

.section-block {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.section-heading {
  margin: 8px 0 14px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.sticky-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -16px 12px;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
}

.action-list,
.checklist-groups,
.calendar-list,
.copy-stack,
.milestone-list,
.kpi-grid {
  display: grid;
  gap: 10px;
}

.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
  text-align: left;
}

.action-row span {
  color: var(--muted);
  font-size: 13px;
}

.action-row strong {
  font-size: 14px;
}

.rule-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.progress-wrap {
  margin-bottom: 14px;
}

.progress-line {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress-line span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 160ms ease;
}

#checkSummary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.check-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.check-group h3 {
  margin: 0;
  padding: 14px 14px 0;
}

.check-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.check-item:first-of-type {
  border-top: 0;
}

.check-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.check-item span {
  color: var(--muted);
  line-height: 1.5;
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 10px;
}

.filter-chip {
  white-space: nowrap;
}

.filter-chip.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

.day-item,
.copy-block,
.milestone,
.kpi-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

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

.day-head h3 {
  margin: 0;
}

.day-body {
  display: grid;
  gap: 10px;
}

.platform-row {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.platform-row strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.platform-row p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.copy-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.copy-head h3 {
  margin: 0;
}

.copy-button {
  flex: 0 0 auto;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.copy-text {
  overflow-x: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.milestone {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
}

.milestone strong {
  display: block;
  margin-bottom: 3px;
}

.milestone span {
  color: var(--accent-2);
  font-weight: 800;
}

.milestone p,
.kpi-tile p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.kpi-grid {
  grid-template-columns: 1fr;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
}

.nav-item {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  padding: 8px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.nav-item.active {
  background: var(--surface-2);
  color: var(--text);
}

.nav-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
}

.home-icon {
  border: 2px solid currentColor;
  border-radius: 3px;
}

.check-icon {
  border: 2px solid currentColor;
  border-radius: 999px;
}

.check-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 3px;
  width: 7px;
  height: 4px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.cal-icon {
  border: 2px solid currentColor;
  border-radius: 3px;
}

.cal-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 5px;
  border-top: 2px solid currentColor;
}

.copy-icon {
  border: 2px solid currentColor;
  border-radius: 3px;
  transform: translate(2px, 2px);
}

.copy-icon::before {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 3px;
  background: var(--surface);
}

.kpi-icon {
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
}

.kpi-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 3px;
  width: 11px;
  height: 8px;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
  transform: skew(-18deg);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 86px;
  left: 16px;
  z-index: 20;
  max-width: 420px;
  margin: 0 auto;
  transform: translateY(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  padding: 12px 14px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.gallery-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: opacity 0.15s;
}

.gallery-item img:hover {
  opacity: 0.88;
}

.gallery-caption {
  padding: 8px 10px;
}

.gallery-caption strong {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 2px;
}

.gallery-caption .tag {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

.gallery-caption p {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
}

/* Lightbox */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.88);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px;
  cursor: pointer;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-overlay img {
  max-width: 100%;
  max-height: 80dvh;
  object-fit: contain;
  border-radius: var(--radius);
}

.lightbox-overlay p {
  color: #fff;
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  opacity: 0.8;
}

/* gallery-icon in nav */
.gallery-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='2' width='7' height='7' rx='1'/%3E%3Crect x='11' y='2' width='7' height='7' rx='1'/%3E%3Crect x='2' y='11' width='7' height='7' rx='1'/%3E%3Crect x='11' y='11' width='7' height='7' rx='1'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px;
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 28px;
  }

  .hero-band {
    display: grid;
    grid-template-columns: 42% 1fr;
  }

  .hero-image {
    height: 100%;
    aspect-ratio: auto;
  }

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

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