:root {
  color-scheme: light;
  --bg: #ead7a8;
  --surface: #fff4d5;
  --surface-strong: #f6dfaa;
  --surface-soft: #ead1a0;
  --ink: #25170d;
  --ink-soft: #5e3b1e;
  --muted: #756149;
  --line: #c7a15a;
  --line-dark: #7b4b22;
  --brand: #2f5845;
  --brand-2: #7c2d24;
  --brass: #b98534;
  --night: #171f21;
  --ok: #2f7548;
  --warn: #9b650f;
  --danger: #a33c34;
  --shadow: 0 18px 48px rgba(54, 35, 18, 0.18);
  --paper-shadow: 0 22px 62px rgba(49, 31, 16, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.36);
  font-family: "Trebuchet MS", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(37, 23, 13, 0.12), transparent 20%, transparent 80%, rgba(37, 23, 13, 0.1)),
    radial-gradient(circle at 14% 18%, rgba(123, 75, 34, 0.14), transparent 24%),
    radial-gradient(circle at 86% 12%, rgba(47, 88, 69, 0.13), transparent 26%),
    url("/assets/images/app-background.webp"),
    linear-gradient(135deg, #efd9a7 0%, #fff1c9 48%, #d4ad65 100%);
  background-attachment: fixed;
  background-size: cover;
  color: var(--ink);
}

body {
  min-height: 100vh;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

a {
  color: inherit;
}

.app-shell {
  isolation: isolate;
  min-height: 100vh;
  overflow-x: hidden;
  padding: calc(16px + env(safe-area-inset-top)) 14px calc(104px + env(safe-area-inset-bottom));
  position: relative;
}

.app-shell::before {
  background:
    linear-gradient(90deg, rgba(36, 23, 15, 0.1), transparent 18%, transparent 82%, rgba(36, 23, 15, 0.1)),
    repeating-linear-gradient(0deg, rgba(143, 46, 37, 0.045) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(90deg, rgba(82, 50, 22, 0.035) 0 1px, transparent 1px 22px);
  content: "";
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: -2;
}

.app-shell::after {
  background:
    radial-gradient(circle at 20% 25%, rgba(255, 248, 218, 0.42), transparent 20%),
    radial-gradient(circle at 80% 75%, rgba(83, 48, 22, 0.18), transparent 28%);
  content: "";
  inset: 0;
  mix-blend-mode: multiply;
  pointer-events: none;
  position: fixed;
  z-index: -1;
}

.topbar {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(29, 38, 48, 0.98), rgba(36, 23, 15, 0.96) 58%, rgba(47, 88, 69, 0.92));
  border: 1px solid rgba(208, 163, 78, 0.45);
  border-radius: 8px;
  box-shadow: 0 14px 44px rgba(54, 35, 18, 0.18);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 0 auto 12px;
  max-width: 1120px;
  overflow: hidden;
  padding: 13px 14px;
  position: relative;
  z-index: 1;
}

.topbar::before {
  background:
    linear-gradient(90deg, transparent, rgba(255, 232, 166, 0.16), transparent),
    repeating-linear-gradient(90deg, transparent 0 70px, rgba(208, 163, 78, 0.12) 70px 72px);
  content: "";
  inset: 0;
  opacity: 0.8;
  pointer-events: none;
  position: absolute;
}

.topbar > * {
  position: relative;
}

.eyebrow {
  color: var(--brass);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

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

h1 {
  color: #fff8e9;
  font-size: clamp(1.45rem, 1.1rem + 1vw, 2.15rem);
  line-height: 1.05;
  margin-bottom: 0;
}

h2 {
  font-size: 1.15rem;
  line-height: 1.2;
  margin-bottom: 12px;
}

h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.icon-button,
.primary,
.secondary,
.danger,
.ghost {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  font-weight: 850;
  gap: 8px;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, opacity 150ms ease;
}

.icon-button:hover,
.primary:hover,
.secondary:hover,
.danger:hover,
.ghost:hover {
  transform: translateY(-1px);
}

.icon-button {
  aspect-ratio: 1;
  background: linear-gradient(160deg, var(--brand), #1f3b30);
  box-shadow: var(--shadow);
  color: #fff8e9;
  font-size: 1.35rem;
  padding: 0;
  width: 48px;
}

.primary {
  background: linear-gradient(160deg, var(--brand), #253f33);
  box-shadow: 0 10px 24px rgba(49, 88, 68, 0.22);
  color: #fff8e9;
}

.secondary {
  background: linear-gradient(180deg, #f6e3b4, #e3c27d);
  border: 1px solid rgba(123, 75, 34, 0.26);
  color: #4d3218;
}

.ghost {
  background: rgba(255, 248, 233, 0.42);
  color: var(--brand);
}

.danger {
  background: #f4dfd7;
  color: var(--danger);
}

.icon-only {
  min-height: 36px;
  padding: 0;
  width: 40px;
}

.status-strip {
  display: flex;
  gap: 8px;
  margin: 0 auto 14px;
  max-width: 1120px;
  overflow-x: auto;
  position: relative;
  scrollbar-width: none;
  z-index: 1;
}

.status-strip span {
  background: rgba(255, 248, 233, 0.9);
  border: 1px solid rgba(123, 75, 34, 0.18);
  border-radius: 999px;
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 750;
  padding: 7px 10px;
}

.status-strip .offline {
  background: #fff0df;
  color: var(--warn);
}

.status-strip .dirty {
  background: #e9f1f5;
  color: #235c91;
}

.status-strip .synced {
  background: #e8f5ed;
  color: var(--ok);
}

.view {
  margin: 0 auto;
  max-width: 1120px;
  position: relative;
  transform: translateY(4px);
  z-index: 1;
}

.view-enter {
  animation: viewIn 340ms ease both;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two,
.grid.three {
  grid-template-columns: 1fr;
}

.card,
.toolbar-card,
.map-panel,
.shopping-card,
.recipe-card,
.share-card,
.empty-state {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), transparent 42%),
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.28), transparent 28%),
    var(--surface);
  border: 1px solid rgba(123, 75, 34, 0.24);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(54, 35, 18, 0.11);
  position: relative;
}

.card,
.toolbar-card,
.empty-state {
  padding: 14px;
}

.card::after,
.shopping-card::after,
.recipe-card::after {
  background:
    repeating-linear-gradient(90deg, rgba(82, 50, 22, 0.035) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(0deg, rgba(82, 50, 22, 0.025) 0 1px, transparent 1px 16px);
  border-radius: inherit;
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.tool-surface {
  overflow: hidden;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 112px;
}

.metric strong {
  color: #2f5845;
  font-size: 1.8rem;
  line-height: 1;
}

.muted {
  color: var(--muted);
}

.form-row,
.composer-grid,
.recipe-form {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  margin-bottom: 10px;
}

.form-row.compact {
  grid-template-columns: minmax(0, 1fr) 112px;
}

label {
  color: var(--ink-soft);
  display: block;
  font-size: 0.76rem;
  font-weight: 900;
  margin-bottom: 5px;
  text-transform: uppercase;
}

input,
select,
textarea {
  background: rgba(255, 250, 240, 0.92);
  border: 1px solid rgba(123, 75, 34, 0.3);
  border-radius: 8px;
  color: var(--ink);
  min-height: 44px;
  outline: 0;
  padding: 10px 12px;
  transition: box-shadow 150ms ease, border-color 150ms ease, background-color 150ms ease;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  background: #fffaf0;
  border-color: rgba(47, 88, 69, 0.64);
  box-shadow: 0 0 0 4px rgba(47, 88, 69, 0.12);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.field {
  min-width: 0;
}

.search-field {
  grid-column: 1 / -1;
}

.item-list,
.card-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.receipt-review-list {
  display: grid;
  gap: 10px;
}

.receipt-review-card {
  display: grid;
  gap: 12px;
}

.receipt-review-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.receipt-review-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 2fr) repeat(3, minmax(88px, 1fr));
}

.receipt-review-grid label {
  color: var(--muted);
  display: grid;
  font-size: 0.86rem;
  gap: 4px;
}

.receipt-review-grid .inline-toggle {
  align-content: end;
  align-items: center;
  color: var(--ink);
  grid-template-columns: auto 1fr;
}

@media (max-width: 760px) {
  .receipt-review-header,
  .receipt-review-card .card-button-row {
    align-items: stretch;
    flex-direction: column;
  }

  .receipt-review-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.list-item,
.parchment-row {
  align-items: center;
  background: rgba(255, 248, 233, 0.86);
  border: 1px solid rgba(123, 75, 34, 0.22);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 60px;
  padding: 10px;
}

.item-title {
  font-weight: 850;
  overflow-wrap: anywhere;
}

.item-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 3px;
}

.note-line {
  color: var(--ink-soft);
  font-size: 0.86rem;
  margin: 8px 0 0;
}

.pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 8px;
  white-space: nowrap;
}

.pill.local {
  background: #fff0df;
  color: var(--warn);
}

.pill.synced {
  background: #e8f5ed;
  color: var(--ok);
}

.pill.error {
  background: #f7e8e8;
  color: var(--danger);
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tabs button {
  background: rgba(255, 248, 233, 0.88);
  border: 1px solid rgba(123, 75, 34, 0.24);
  border-radius: 8px;
  color: var(--muted);
  flex: 0 0 auto;
  font-weight: 850;
  min-height: 40px;
  padding: 0 12px;
}

.tabs button.active {
  background: var(--brand);
  color: #fff;
}

.segmented {
  flex: 1;
}

.bottom-nav {
  background: rgba(36, 23, 15, 0.96);
  border-top: 1px solid rgba(208, 163, 78, 0.36);
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  left: 0;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  position: fixed;
  right: 0;
  z-index: 10;
}

.bottom-nav button {
  align-items: center;
  background: transparent;
  border-radius: 8px;
  color: #e8d5a7;
  display: flex;
  flex-direction: column;
  font-size: 1.08rem;
  gap: 2px;
  min-height: 50px;
}

.bottom-nav span {
  font-size: 0.64rem;
  font-weight: 800;
}

.bottom-nav button.active {
  background: #d0a34e;
  color: #24170f;
}

.map-dashboard {
  margin-bottom: 14px;
}

.map-panel {
  box-shadow: var(--paper-shadow);
  min-height: 290px;
  overflow: hidden;
  padding: clamp(20px, 4vw, 34px);
}

.map-panel h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 6vw, 4.4rem);
  line-height: 0.95;
  margin-bottom: 14px;
  max-width: 760px;
}

.opening-card {
  animation: paperOpen 780ms cubic-bezier(0.2, 0.78, 0.22, 1) both;
  transform-origin: center top;
}

.animated-routes {
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.route-line {
  border-top: 2px dashed rgba(94, 52, 22, 0.38);
  height: 1px;
  position: absolute;
  transform-origin: left center;
  width: 34%;
}

.route-line.one {
  left: 10%;
  top: 34%;
  transform: rotate(13deg);
}

.route-line.two {
  right: 11%;
  top: 22%;
  transform: rotate(-18deg);
}

.route-line.three {
  bottom: 18%;
  left: 34%;
  transform: rotate(-8deg);
}

.footprints {
  background: #5b3117;
  border-radius: 50%;
  box-shadow: 16px 10px 0 rgba(91, 49, 23, 0.68), 34px 4px 0 rgba(91, 49, 23, 0.46), 52px 12px 0 rgba(91, 49, 23, 0.32);
  height: 5px;
  position: absolute;
  width: 5px;
}

.footprints.one {
  left: 24%;
  top: 58%;
}

.footprints.two {
  right: 24%;
  top: 48%;
}

.card-grid,
.quick-actions,
.category-grid,
.shopping-card-grid,
.recipe-grid {
  display: grid;
  gap: 10px;
}

.card-grid.compact,
.quick-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 20px;
  max-width: 720px;
}

.action-card,
.mini-card,
.category-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent),
    rgba(255, 246, 218, 0.86);
  border: 1px solid rgba(123, 75, 34, 0.24);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 5px;
  min-height: 84px;
  padding: 12px;
  text-align: left;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.action-card:hover,
.mini-card:hover,
.category-card:hover {
  box-shadow: 0 10px 26px rgba(54, 35, 18, 0.14);
  transform: translateY(-2px);
}

.action-card span,
.category-card span {
  align-items: center;
  background: var(--brand);
  border-radius: 999px;
  color: #fff8e9;
  display: inline-flex;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.action-card small,
.mini-card small,
.category-card small {
  color: var(--muted);
  font-weight: 750;
}

.quick-strip {
  display: flex;
  gap: 8px;
  margin: 12px -14px 0;
  overflow-x: auto;
  padding: 2px 14px 10px;
  scroll-snap-type: x proximity;
}

.simple-shopping {
  margin-bottom: 12px;
}

.shopping-list-head,
.shopping-done-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.shopping-list-head h2,
.shopping-done-head h2 {
  margin-bottom: 0;
}

.shopping-add-form,
.shopping-edit-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

.shopping-add-form {
  margin-top: 12px;
}

.shopping-edit-row {
  align-items: end;
  margin-top: 8px;
}

.shopping-edit-row input {
  min-height: 38px;
}

.shopping-card-grid.simple {
  grid-template-columns: 1fr;
}

.mini-card {
  flex: 0 0 132px;
  min-height: 76px;
  scroll-snap-align: start;
}

.category-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 8px;
}

.category-card.active {
  background: linear-gradient(180deg, #f7e6bd, #dbb86b);
  border-color: rgba(47, 88, 69, 0.5);
  box-shadow: 0 0 0 3px rgba(47, 88, 69, 0.12);
}

.toolbar-card {
  align-items: center;
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

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

.shopping-groups {
  display: grid;
  gap: 14px;
}

.shopping-group h2 {
  align-items: center;
  color: var(--ink-soft);
  display: flex;
  font-family: Georgia, "Times New Roman", serif;
  gap: 10px;
  margin: 0 0 8px;
}

.shopping-group h2::after {
  background: linear-gradient(90deg, rgba(123, 75, 34, 0.36), transparent);
  content: "";
  flex: 1;
  height: 1px;
}

.shopping-card-grid,
.recipe-grid {
  grid-template-columns: 1fr;
}

.shopping-card {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 96px;
  overflow: hidden;
  padding: 13px;
  transform-origin: center;
  transition: opacity 180ms ease, transform 180ms ease, filter 180ms ease;
}

.shopping-card.done {
  filter: saturate(0.74);
  opacity: 0.72;
}

.shopping-card.done .item-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.shopping-card.done .done-stamp {
  opacity: 0.72;
  transform: rotate(-9deg) scale(1);
}

.check-toggle {
  margin: 0;
}

.check-toggle input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.check-toggle span {
  align-items: center;
  background: #fff4d5;
  border: 2px solid rgba(123, 75, 34, 0.48);
  border-radius: 50%;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.check-toggle input:checked + span {
  animation: checkPop 320ms ease both;
  background: var(--brand);
  border-color: var(--brand);
}

.check-toggle input:checked + span::before {
  color: #fff8e9;
  content: "✓";
  font-weight: 900;
}

.shopping-card-body {
  min-width: 0;
}

.card-actions {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.done-stamp {
  border: 2px solid rgba(124, 45, 36, 0.72);
  border-radius: 50%;
  color: rgba(124, 45, 36, 0.8);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.72rem;
  font-weight: 900;
  opacity: 0;
  padding: 12px 7px;
  position: absolute;
  right: 58px;
  text-transform: uppercase;
  top: 16px;
  transform: rotate(-9deg) scale(0.76);
  transition: opacity 180ms ease, transform 180ms ease;
}

.recipe-card,
.share-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.recipe-card-head,
.share-card {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.recipe-card h3 {
  margin: 0;
}

.seal-mark {
  background:
    radial-gradient(circle at 36% 32%, rgba(255, 255, 255, 0.28), transparent 16%),
    radial-gradient(circle, #9b3328 0 54%, #7c2d24 55% 100%);
  border-radius: 50%;
  box-shadow: inset 0 -5px 10px rgba(43, 18, 13, 0.28), 0 8px 18px rgba(76, 34, 19, 0.18);
  display: inline-block;
  height: 42px;
  width: 42px;
}

.seal-mark.small {
  height: 36px;
  width: 36px;
}

.tag-row,
.card-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-button-row.vertical {
  display: grid;
}

.inventory-add-card {
  margin-bottom: 12px;
}

.inventory-add-form {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

.inventory-product-field {
  position: relative;
}

.inventory-product-results {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.inventory-toolbar {
  grid-template-columns: 1fr;
}

.inventory-list {
  display: grid;
  gap: 10px;
}

.inventory-row {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.inventory-row-main {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
}

.inventory-controls {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.inventory-unit,
.inventory-stock {
  color: var(--ink-soft);
  font-weight: 900;
}

.inventory-unit {
  align-self: center;
  min-width: 32px;
}

.inventory-stock {
  background: rgba(232, 245, 237, 0.9);
  border: 1px solid rgba(47, 117, 72, 0.24);
  border-radius: 8px;
  justify-self: start;
  padding: 8px 10px;
}

.recipe-categories {
  margin: 12px 0;
}

.empty-state {
  display: grid;
  justify-items: start;
  min-height: 160px;
  padding: 18px;
}

.marker-dot {
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 10px 8px 0 rgba(47, 88, 69, 0.25);
  height: 9px;
  width: 9px;
}

.user-result-list {
  display: grid;
  gap: 6px;
}

.user-result {
  background: rgba(255, 248, 233, 0.86);
  border: 1px solid rgba(123, 75, 34, 0.22);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  min-height: 54px;
  padding: 9px 10px;
  text-align: left;
}

.legal-note {
  border-left: 3px solid var(--brass);
  margin: 12px 0 0;
  padding-left: 10px;
}

.camera-preview,
.image-preview {
  background: #111;
  border-radius: 8px;
  max-height: 300px;
  object-fit: contain;
  width: 100%;
}

.debug-list {
  background: #111b19;
  border-radius: 8px;
  color: #d7f5ed;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  max-height: 280px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.locked {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.locked-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 440px;
  padding: 24px;
}

.landing-body {
  background:
    linear-gradient(180deg, rgba(23, 14, 8, 0.2), rgba(23, 14, 8, 0.7)),
    url("/assets/images/authentik-login-background.webp"),
    linear-gradient(135deg, #171f21 0%, #24170f 58%, #4d241d 100%);
  background-size: cover;
  min-height: 100vh;
  overflow-x: hidden;
}

.landing-stage {
  align-items: center;
  display: flex;
  min-height: 100vh;
  overflow: hidden;
  padding: calc(24px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom));
  perspective: 1400px;
}

.map-gate {
  aspect-ratio: 4 / 3;
  background:
    repeating-linear-gradient(90deg, rgba(82, 50, 22, 0.06) 0 1px, transparent 1px 18px),
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.25), transparent 22%),
    linear-gradient(135deg, #f3dcaa, #fff1ca 36%, #d9b56c);
  border: 1px solid #c29d56;
  border-radius: 8px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.38);
  color: #2a170c;
  display: grid;
  isolation: isolate;
  margin: 0 auto;
  max-height: 720px;
  max-width: 960px;
  min-height: 360px;
  overflow: hidden;
  place-items: center;
  position: relative;
  text-align: center;
  text-decoration: none;
  transform: rotateX(0deg) rotateZ(-1deg);
  transform-origin: center;
  transition: transform 180ms ease, box-shadow 180ms ease;
  width: min(92vw, 960px);
}

.map-gate {
  animation: gateUnfold 980ms cubic-bezier(0.16, 0.82, 0.24, 1) 130ms both;
}

.map-gate:hover,
.map-gate:focus-visible {
  box-shadow: 0 32px 96px rgba(0, 0, 0, 0.48), 0 0 0 4px rgba(184, 131, 49, 0.3);
  outline: 0;
  transform: rotateX(0deg) rotateZ(0deg) translateY(-3px);
}

.map-gate::before,
.map-gate::after {
  border: 1px solid rgba(89, 52, 19, 0.26);
  content: "";
  inset: 18px;
  pointer-events: none;
  position: absolute;
}

.map-gate::after {
  border-style: dashed;
  inset: 34px;
}

.map-fold {
  background: linear-gradient(90deg, transparent, rgba(78, 48, 20, 0.18), transparent);
  height: 100%;
  position: absolute;
  top: 0;
  width: 1px;
  z-index: -1;
}

.map-fold.top { left: 31%; }
.map-fold.middle { left: 50%; }
.map-fold.bottom { left: 69%; }

.map-ink,
.map-route,
.map-dot {
  position: absolute;
}

.map-ink {
  border: 1px solid rgba(80, 45, 18, 0.22);
  border-radius: 50%;
}

.map-ink-one {
  height: 180px;
  left: 8%;
  top: 16%;
  transform: rotate(-22deg);
  width: 260px;
}

.map-ink-two {
  bottom: 12%;
  height: 180px;
  right: 7%;
  transform: rotate(18deg);
  width: 260px;
}

.map-ink-three {
  bottom: 16%;
  height: 120px;
  left: 20%;
  transform: rotate(28deg);
  width: 170px;
}

.map-route {
  border-top: 2px dashed rgba(94, 52, 22, 0.42);
  height: 80px;
  transform-origin: left center;
  width: 34%;
}

.route-one {
  animation: inkTrace 1.2s ease 0.5s both;
  left: 18%;
  top: 28%;
  transform: rotate(16deg);
}

.route-two {
  animation: inkTrace 1.2s ease 0.72s both;
  right: 16%;
  top: 62%;
  transform: rotate(-18deg);
}

.route-three {
  animation: inkTrace 1.2s ease 0.9s both;
  left: 28%;
  top: 74%;
  transform: rotate(-7deg);
}

.map-dot {
  background: #5b3117;
  border-radius: 50%;
  box-shadow: 18px 10px 0 rgba(91, 49, 23, 0.78), 36px 4px 0 rgba(91, 49, 23, 0.58);
  height: 5px;
  width: 5px;
}

.dot-one { left: 20%; top: 38%; }
.dot-two { right: 28%; top: 32%; }
.dot-three { bottom: 25%; left: 58%; }

.map-copy {
  animation: fadeUp 560ms ease 0.92s both;
  display: grid;
  gap: 12px;
  max-width: 620px;
  padding: 28px;
}

.landing-kicker {
  color: #7d4a1f;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.landing-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 10vw, 6.8rem);
  font-weight: 800;
  line-height: 0.92;
}

.landing-subtitle {
  color: #5c4328;
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  font-weight: 700;
}

.landing-cta {
  align-self: center;
  background: #2f4d3f;
  border: 1px solid rgba(255, 248, 233, 0.42);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(47, 77, 63, 0.24);
  color: #fff8e9;
  display: inline-flex;
  font-weight: 900;
  justify-self: center;
  min-height: 44px;
  padding: 12px 18px;
}

.toast-region {
  bottom: calc(92px + env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
  left: 14px;
  pointer-events: none;
  position: fixed;
  right: 14px;
  z-index: 30;
}

.toast {
  background: rgba(36, 23, 15, 0.94);
  border: 1px solid rgba(208, 163, 78, 0.34);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: #fff8e9;
  justify-self: center;
  max-width: 460px;
  opacity: 0;
  padding: 12px 14px;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.toast.error {
  background: rgba(113, 35, 28, 0.96);
}

.modal {
  align-items: end;
  background: rgba(24, 15, 8, 0.42);
  display: none;
  inset: 0;
  padding: 14px;
  position: fixed;
  z-index: 40;
}

.modal.visible {
  display: grid;
}

.modal-panel {
  background: var(--surface);
  border: 1px solid rgba(123, 75, 34, 0.28);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  margin: 0 auto;
  max-width: 520px;
  padding: 16px;
  position: relative;
  width: min(100%, 520px);
}

.modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
}

.skeleton-card {
  display: grid;
  gap: 10px;
}

.skeleton-card span {
  animation: shimmer 1.2s linear infinite;
  background: linear-gradient(90deg, rgba(123, 75, 34, 0.08), rgba(255, 255, 255, 0.4), rgba(123, 75, 34, 0.08));
  background-size: 200% 100%;
  border-radius: 999px;
  height: 14px;
}

.skeleton-card span:first-child {
  width: 52%;
}

.skeleton-card span:nth-child(2) {
  width: 78%;
}

.skeleton-card span:nth-child(3) {
  width: 34%;
}

@keyframes gateUnfold {
  0% {
    filter: brightness(0.84);
    opacity: 0;
    transform: rotateX(78deg) rotateZ(-2deg) scaleX(0.72);
  }
  52% {
    opacity: 1;
  }
  100% {
    filter: brightness(1);
    opacity: 1;
    transform: rotateX(0deg) rotateZ(-1deg) scaleX(1);
  }
}

@keyframes paperOpen {
  0% {
    opacity: 0;
    transform: rotateX(28deg) translateY(18px) scaleY(0.96);
  }
  100% {
    opacity: 1;
    transform: rotateX(0deg) translateY(0) scaleY(1);
  }
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes inkTrace {
  from {
    clip-path: inset(0 100% 0 0);
    opacity: 0;
  }
  to {
    clip-path: inset(0 0 0 0);
    opacity: 1;
  }
}

@keyframes checkPop {
  0% { transform: scale(0.82); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

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

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

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

  .form-row {
    grid-template-columns: 2fr 1fr auto;
  }

  .composer-grid {
    align-items: end;
    grid-template-columns: 1.4fr 0.6fr 0.6fr 0.9fr 1fr auto;
  }

  .shopping-add-form {
    align-items: end;
    grid-template-columns: minmax(220px, 1fr) 120px 120px 130px auto;
  }

  .shopping-edit-row {
    grid-template-columns: 110px 120px auto;
  }

  .inventory-add-form {
    grid-template-columns: minmax(220px, 2fr) 0.7fr 0.7fr 1fr 1fr auto;
  }

  .search-field {
    grid-column: auto;
  }

  .toolbar-card {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  }

  .inventory-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(160px, 220px) minmax(160px, 220px);
  }

  .toolbar-actions {
    grid-template-columns: minmax(0, 1fr) 160px;
  }

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

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

  .inventory-row {
    align-items: center;
    grid-template-columns: minmax(0, 1fr) minmax(440px, 0.95fr) auto;
  }

  .inventory-controls {
    grid-template-columns: minmax(88px, 1fr) auto auto minmax(88px, 1fr) auto;
  }

  .bottom-nav {
    border: 1px solid var(--line);
    border-radius: 8px;
    bottom: 18px;
    box-shadow: var(--shadow);
    left: 50%;
    max-width: 900px;
    transform: translateX(-50%);
  }

  .toast-region {
    bottom: 96px;
  }

  .modal {
    align-items: center;
  }
}

@media (min-width: 1020px) {
  .shopping-card-grid,
  .recipe-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .card-grid.compact,
  .quick-actions {
    grid-template-columns: 1fr;
  }

  .map-panel {
    min-height: 360px;
  }

  .shopping-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .card-actions {
    align-items: flex-start;
    flex-direction: row;
    grid-column: 2;
  }

  .done-stamp {
    right: 16px;
    top: 12px;
  }
}

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