:root {
  --header: #103B31;
  --page: #F8F3E9;
  --card: #FFFDF9;
  --line: #DDD7C9;
  --ink: #16221E;
  --primary: #164036;
  --focus: #D96533;
  --theme: #143E3C;
  --bar: #FFFDF9;
  --tab-active: #103B31;
  --tab-idle: #4D5C56;
  --label: #FBF8F1;
  --radius: 0.85rem;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  min-height: 100dvh;
}

.app {
  min-height: 100dvh;
  background: var(--page);
  color: var(--ink);
}

.header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 56px;
  background: var(--header);
  color: #fff;
}

.header-inner {
  display: flex;
  align-items: center;
  height: 56px;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

.wordmark {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  color: #fff;
}

.main {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 1rem 1rem 7.5rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

.search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search {
  display: block;
  width: 100%;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

.search:focus-visible,
.card:focus-visible,
.tab:focus-visible {
  box-shadow: 0 0 0 3px var(--focus);
}

.cards {
  display: grid;
  gap: 0.75rem;
}

.card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 5.25rem;
  padding: 1rem 1.1rem;
  color: inherit;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-tap-highlight-color: transparent;
}

.card:hover {
  border-color: var(--primary);
}

.card:active {
  background: #F8F3E9;
}

.card-text {
  min-width: 0;
  flex: 1;
}

.card-name {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.25;
  color: var(--primary);
}

.card-desc {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--ink);
}

.card-arrow {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--primary);
}

.empty {
  margin: 1.5rem 0 0;
  text-align: center;
  color: var(--tab-idle);
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 100%;
  background: color-mix(in srgb, var(--bar) 95%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-bar::before {
  content: none;
}

.tab {
  height: 64px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--tab-idle);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.tab.is-active {
  color: var(--tab-active);
}

@media (min-width: 64rem) {
  .bottom-bar {
    /* Keep the bar full-bleed like the CO2 app, with tabs centered visually by equal columns. */
  }
}
