:root {
  --bg: #f4fbe8;
  --card: #ffffff;
  --ink: #17300c;
  --muted: #4d6744;
  --green: #61cb02;
  --green-dark: #3d8c02;
  --green-deep: #1f4d04;
  --red: #d10a0a;
  --pink: #f40a93;
  --cyan: #12bce0;
  --yellow: #ffe60b;
  --shadow: 0 14px 28px rgba(31, 77, 4, 0.12);
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100svh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: "Nunito", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 2px solid var(--green-dark);
  outline-offset: 3px;
}

img {
  max-width: 100%;
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 8% 12%, rgba(244, 10, 147, 0.16), transparent 28%),
    radial-gradient(circle at 96% 8%, rgba(18, 188, 224, 0.2), transparent 26%),
    radial-gradient(circle at 90% 88%, rgba(97, 203, 2, 0.22), transparent 32%),
    radial-gradient(circle at 6% 86%, rgba(255, 230, 11, 0.2), transparent 24%),
    var(--bg);
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.app {
  position: relative;
  z-index: 2;
  width: min(520px, 100%);
  max-width: 100vw;
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(18px + var(--safe-top)) 16px calc(20px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.view {
  flex: 1 1 auto;
  animation: rise 0.28s ease;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.install-bar {
  display: none;
  position: fixed;
  top: calc(10px + var(--safe-top));
  right: 10px;
  z-index: 40;
  align-items: center;
  gap: 8px;
}

html.is-android:not(.is-installed) .install-bar:not(.is-hidden) {
  display: flex;
}

html.is-installed .install-bar,
html.is-installed .ios-install,
html.is-installed .android-install {
  display: none !important;
}

.install-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--green-deep);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(31, 77, 4, 0.28);
}

.install-btn svg {
  width: 16px;
  height: 16px;
}

.install-btn:active {
  transform: scale(0.98);
}

.install-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  color: var(--green-deep);
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(31, 77, 4, 0.18);
}

.ios-install,
.android-install {
  display: none;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff;
  border: 2px solid var(--green-dark);
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.5;
}

.android-install {
  position: fixed;
  top: calc(52px + var(--safe-top));
  right: 10px;
  z-index: 30;
  margin: 0;
  max-width: 240px;
  text-align: center;
}

html.is-ios:not(.is-installed) .ios-install:not(.is-hidden) {
  display: block;
}

.ios-install {
  text-align: left;
}

.ios-install-title {
  margin-bottom: 10px;
  color: var(--green-dark);
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
}

.ios-install ol {
  margin: 0;
  padding-left: 1.2em;
}

.ios-install li + li {
  margin-top: 6px;
}

.ios-install strong,
.android-install strong {
  color: var(--pink);
}

.home-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.logo-stage {
  width: min(460px, 100%);
  margin: 2px 0 8px;
  display: grid;
  place-items: center;
}

.logo-wrap:not(.is-ready),
.logo-wrap.is-missing {
  display: none;
}

.logo-wrap {
  width: 100%;
}

.logo-wrap img {
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(31, 77, 4, 0.18));
}

.kicker {
  margin-top: 2px;
  max-width: 34ch;
  color: var(--red);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.35;
}

.divider {
  width: 84px;
  height: 5px;
  margin: 14px auto 22px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--pink), var(--cyan));
}

.category-grid,
.dish-list {
  display: grid;
  gap: 16px;
  width: 100%;
}

.category-card,
.dish {
  --tilt: -0.45deg;
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 3px solid var(--green-deep);
  background: var(--card);
  box-shadow: 6px 6px 0 var(--accent, var(--green));
  transform: rotate(var(--tilt));
  transform-origin: 50% 8px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.category-card:nth-child(2),
.dish:nth-child(2) { --tilt: 0.55deg; }
.category-card:nth-child(3),
.dish:nth-child(3) { --tilt: -0.7deg; }
.category-card:nth-child(4),
.dish:nth-child(4) { --tilt: 0.4deg; }
.category-card:nth-child(5),
.dish:nth-child(5) { --tilt: -0.5deg; }
.category-card:nth-child(6),
.dish:nth-child(6) { --tilt: 0.65deg; }
.category-card:nth-child(7),
.dish:nth-child(7) { --tilt: -0.35deg; }
.category-card:nth-child(8),
.dish:nth-child(8) { --tilt: 0.5deg; }
.category-card:nth-child(9),
.dish:nth-child(9) { --tilt: -0.6deg; }
.category-card:nth-child(10) { --tilt: 0.35deg; }

.stripe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 7px;
  background: linear-gradient(90deg, var(--green), var(--yellow) 35%, var(--pink) 68%, var(--cyan));
}

.category-card {
  min-height: 92px;
  padding: 22px 18px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.category-card:active {
  transform: rotate(var(--tilt)) translateY(3px);
  box-shadow: 2px 2px 0 var(--accent, var(--green));
}

.category-card .icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--accent, var(--green-dark));
}

.category-card .icon svg {
  width: 30px;
  height: 30px;
}

.category-card h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--green-deep);
}

.category-header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 4px 0 12px;
  background: linear-gradient(180deg, rgba(244, 251, 232, 0.97) 72%, rgba(244, 251, 232, 0.72));
  backdrop-filter: blur(10px);
}

.category-header h1 {
  font-size: clamp(1.25rem, 5.4vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--green-deep);
}

.back-btn {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--green-deep);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 0 #143306;
}

.back-btn:active {
  transform: scale(0.96);
}

.dish {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 14px 14px;
}

.dish-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  background: #f3f7ea;
}

.dish-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  text-align: left;
  padding: 0 2px 2px;
}

.dish h3 {
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--green-deep);
}

.dish-desc {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
}

.price {
  margin-top: 2px;
  color: var(--red);
  font-size: 1.12rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.place {
  margin-top: 28px;
  text-align: center;
}

.place h2 {
  font-size: 1.15rem;
  color: var(--green-deep);
}

.place-link {
  display: inline-block;
  margin-top: 8px;
  color: #1a73e8;
  font-weight: 800;
  line-height: 1.45;
  text-decoration: underline;
}

.place-link:active {
  color: #174ea6;
}

.footer {
  margin-top: auto;
  padding-top: 22px;
  text-align: center;
  color: rgba(23, 48, 12, 0.72);
  font-size: 0.92rem;
  line-height: 1.45;
  flex-shrink: 0;
}

.footer-credit {
  margin-top: 6px;
  font-weight: 700;
}

.note {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff;
  border: 2px solid var(--green-dark);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
}

.action-btn {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  background: var(--green-deep);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 4px 0 #143306;
}

.action-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #143306;
}

.action-btn.is-blocked {
  background: #d7e8c4;
  color: var(--green-deep);
  box-shadow: none;
}

.in-order {
  color: var(--green-dark);
  font-size: 0.88rem;
  font-weight: 800;
}

.builder-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 18px;
  background: #fff;
  border: 3px solid var(--green-deep);
}

.builder-photo {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 14px;
  flex-shrink: 0;
  background: #f3f7ea;
}

.builder-base {
  font-weight: 800;
  color: var(--red);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 5px;
  display: inline-block;
}

.swatch.is-on { background: var(--green-deep); }
.swatch.is-extra { background: var(--pink); }

.step {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  border: 3px solid var(--green-deep);
}

.step.is-needed {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(244, 10, 147, 0.18);
}

.step-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green);
  color: var(--green-deep);
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.step-head h2 {
  font-size: 1.12rem;
  line-height: 1.2;
  color: var(--green-deep);
}

.step-head p,
.step-status,
.choice-label,
.order-lead,
.empty-order,
.line-extra {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
}

.step-status {
  margin: 10px 0;
  color: var(--green-deep);
}

.choice-label {
  margin: 8px 0 6px;
  color: var(--pink);
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice {
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 2px solid #d7e8c4;
  background: #f7fbf1;
  color: var(--ink);
  font-weight: 800;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
}

.choice.has-color {
  background: var(--choice-fill, var(--choice));
  border-color: var(--choice);
  color: var(--choice-ink, var(--ink));
}

.choice small {
  font-size: 0.75rem;
  font-weight: 800;
}

.choice.has-color small {
  border-radius: 999px;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.38);
}

.choice.is-large {
  flex: 1 1 140px;
  min-height: 62px;
  font-size: 1.05rem;
}

.choice.is-on {
  background: var(--green-deep);
  border-color: var(--green-deep);
  color: #fff;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--green-deep);
}

.choice.has-color.is-on,
.choice.has-color.is-extra {
  background: var(--choice-fill, var(--choice));
  border-color: var(--choice);
  color: var(--choice-ink, #fff);
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--choice);
}

.choice.is-extra {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--pink);
}

.choice.has-color.is-extra {
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--pink);
}

.choice.has-color.is-extra small {
  background: var(--pink);
  color: #fff;
}

.builder-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(520px, 100%);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: #fff;
  border-top: 3px solid var(--green-deep);
  box-shadow: 0 -10px 24px rgba(31, 77, 4, 0.12);
}

.builder-bar > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.builder-bar strong {
  color: var(--red);
  font-size: 1.25rem;
  line-height: 1.1;
}

.builder-bar span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.builder-bar .action-btn {
  width: auto;
  flex: 1;
  padding: 0 14px;
}

.cart-fab {
  position: fixed;
  left: 50%;
  bottom: calc(14px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(488px, calc(100% - 24px));
  z-index: 25;
  min-height: 54px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--green-deep);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 10px 24px rgba(31, 77, 4, 0.28);
}

.cart-fab span {
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  color: var(--green-deep);
  display: grid;
  place-items: center;
}

.cart-fab strong {
  color: #fff;
}

html.has-fab .app {
  padding-bottom: calc(92px + var(--safe-bottom));
}

html.is-builder .app,
html.is-cart .app {
  padding-bottom: calc(118px + var(--safe-bottom));
}

.order-lead,
.empty-order {
  margin-bottom: 14px;
}

.cart-list {
  display: grid;
  gap: 12px;
}

.cart-line {
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  border: 3px solid var(--green-deep);
}

.cart-top,
.cart-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cart-line h2 {
  font-size: 1.05rem;
  color: var(--green-deep);
}

.line-detail {
  margin: 8px 0;
  padding-left: 1.1em;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.4;
}

.text-btn {
  color: var(--pink);
  font-weight: 800;
  min-height: 36px;
}

.clear-order {
  margin-top: 14px;
}

.qty {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.qty button {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--green);
  color: var(--green-deep);
  font-size: 1.3rem;
  font-weight: 800;
}

.qty span {
  min-width: 1.2em;
  text-align: center;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  top: calc(16px + var(--safe-top));
  transform: translateX(-50%) translateY(-16px);
  z-index: 50;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--green-deep);
  color: #fff;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 720px) {
  .builder-bar,
  .cart-fab {
    width: min(728px, calc(100% - 32px));
  }

  .builder-bar {
    width: min(760px, 100%);
    border-radius: 18px 18px 0 0;
  }
}

@media (hover: hover) and (pointer: fine) {
  .category-card:hover {
    transform: rotate(var(--tilt)) translateY(-3px);
    box-shadow: 8px 8px 0 var(--accent, var(--green));
  }
}

@media (min-width: 720px) {
  .app {
    width: min(760px, 100%);
    padding-top: 28px;
  }

  .category-grid {
    grid-template-columns: 1fr 1fr;
  }

  .category-card:nth-child(odd) { --tilt: -0.4deg; }
  .category-card:nth-child(even) { --tilt: 0.4deg; }
}

@media (prefers-reduced-motion: reduce) {
  .view,
  .category-card,
  .dish,
  .back-btn {
    animation: none;
    transition: none;
  }
}
