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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
}

body {
  animation: pageFadeIn 0.45s ease both;
}

html.page-leaving body {
  opacity: 0;
  transition: opacity 0.2s ease;
}

@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.corner-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(74, 110, 45, 0.82);
  color: #fff;
  font-family: "Nunito", "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
  transition: background 0.15s ease, transform 0.15s ease;
}

.corner-link:hover {
  background: rgba(90, 130, 55, 0.95);
  transform: translateY(-1px);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
}

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #1a3d1a;
}

.bg-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#logo-wrap {
  position: fixed;
  z-index: 10;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  will-change: top;
  opacity: 0;
}

#logo {
  width: min(36vw, 170px);
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.45));
}

#logo-wrap.visible {
  opacity: 1;
}

#content {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  pointer-events: none;
}

#content.visible {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.hidden {
  visibility: hidden;
  opacity: 0;
}

.view.hidden {
  display: none;
}

#home-view {
  width: 100%;
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: var(--content-top-offset, 200px);
  padding-bottom: clamp(24px, 6vh, 48px);
  padding-left: 16px;
  padding-right: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

#sub-page-view {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: calc(var(--logo-bottom, 120px) + 6px);
  padding-bottom: clamp(24px, 6vh, 48px);
  padding-left: 16px;
  padding-right: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  overflow-anchor: none;
  scroll-behavior: auto;
}

@property --offset {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

@property --abs-offset {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

@property --scale-extra {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

.sub-page-stack {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

.category-carousel-slot {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  height: 112px;
  margin-top: 0;
  margin-bottom: 6px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
}

.category-carousel {
  position: relative;
  z-index: 8;
  width: min(96vw, 620px);
  max-width: 100%;
  height: 112px;
  margin: 0;
  perspective: 760px;
  isolation: isolate;
  overflow: hidden;
}

.menu-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(94vw, 420px);
  margin: 0 auto;
}

.menu-btn {
  --btn-bg: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  border: none;
  background-color: #111;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.32)),
    var(--btn-bg);
  background-size: cover;
  background-position: center;
  color: #fff;
  font-family: "Nunito", "Segoe UI", sans-serif;
  font-size: clamp(1.18rem, 5vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.25;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  padding: 0 22px;
  min-height: 68px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  text-align: center;
  overflow: hidden;
}

.menu-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.22)),
    var(--btn-bg);
}

.menu-btn:active {
  transform: translateY(0);
}

.menu-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.back-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 20;
  appearance: none;
  border: 2px solid #fff;
  background: rgba(26, 61, 110, 0.88);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
  transition: background 0.15s ease;
}

.back-btn:hover {
  background: #f58220;
}

.category-carousel::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(245, 130, 32, 0.25), rgba(255, 255, 255, 0.9), rgba(245, 130, 32, 0.25));
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.22);
  transform: translateY(-50%);
  z-index: 0;
}

.category-carousel-track {
  position: absolute;
  inset: 0 24px;
  touch-action: none;
  user-select: none;
  transform: translateX(var(--drag-x, 0px));
  transition: transform 0.28s ease-out;
  cursor: grab;
  overflow: visible;
}

.category-carousel-track.is-dragging {
  transition: none;
  cursor: grabbing;
}

.category-carousel-track.is-settling {
  transition: transform 0.82s cubic-bezier(0.16, 1, 0.3, 1);
}

.carousel-card {
  --offset: 0;
  --abs-offset: 0;
  --z: 20;
  --scale-extra: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: var(--z);
  width: clamp(108px, 26vw, 148px);
  height: 82px;
  appearance: none;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  background-color: #123f1f;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.38), rgba(0, 0, 0, 0.38)),
    var(--card-bg);
  background-size: cover;
  background-position: center;
  color: #fff;
  cursor: pointer;
  font-family: "Nunito", "Segoe UI", sans-serif;
  font-size: clamp(0.84rem, 3.4vw, 1.05rem);
  font-weight: 800;
  line-height: 1.18;
  padding: 8px 10px;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.82);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  opacity: 1;
  filter: brightness(1.1);
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
  word-break: break-word;
  hyphens: auto;
  transform:
    translate(-50%, -50%)
    translateX(calc(var(--offset) * clamp(80px, 17.5vw, 108px)))
    translateZ(calc((4 - var(--abs-offset)) * 3px))
    rotateY(calc(var(--offset) * -8deg))
    scale(calc((1 - (var(--abs-offset) * 0.09)) + var(--scale-extra)));
  transition:
    transform 0.72s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.58s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.48s ease,
    border-color 0.4s ease,
    box-shadow 0.48s ease;
  pointer-events: auto;
  will-change: transform, opacity;
}

.category-carousel-track.is-settling .carousel-card {
  transition:
    transform 0.92s cubic-bezier(0.12, 1.05, 0.24, 1),
    opacity 0.72s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.55s ease,
    border-color 0.45s ease,
    box-shadow 0.45s ease;
}

.category-carousel-track.is-dragging .carousel-card {
  transition:
    transform 0.14s ease-out,
    opacity 0.14s ease,
    filter 0.14s ease;
  will-change: transform;
}

.carousel-card[aria-pressed="true"] {
  border-color: #f58220;
  filter: brightness(1.14);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.carousel-card:hover {
  filter: brightness(1.16);
}

.carousel-card.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.carousel-control {
  display: none;
}

.sub-page-panel {
  flex: 0 0 auto;
  width: min(96vw, 600px);
  max-width: 100%;
  height: clamp(560px, 62vh, 680px);
  min-height: clamp(560px, 62vh, 680px);
  max-height: clamp(560px, 62vh, 680px);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 20px;
  border: 3px solid #1a3d6e;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  padding: 22px 20px 26px;
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: pan-y;
  margin: 0 auto;
}

#sub-page-title {
  font-size: clamp(1.15rem, 4.5vw, 1.5rem);
  color: #1a3d6e;
  text-align: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(245, 130, 32, 0.45);
}

.product-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-anchor: none;
  max-width: 100%;
}

.product-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px;
  border-radius: 14px;
  background: rgba(26, 61, 110, 0.04);
  border: 1.5px solid rgba(26, 61, 110, 0.12);
  max-width: 100%;
  min-width: 0;
}

.product-item--clickable {
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.product-item--clickable:hover {
  background: rgba(26, 61, 110, 0.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.product-item--clickable:active {
  transform: translateY(0);
}

.product-item img,
.product-thumb {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid #1a3d6e;
  background: #e8ede8;
}

.product-item img.no-img {
  object-fit: contain;
  padding: 8px;
  opacity: 0.45;
}

.product-item-noimg {
  width: 96px;
  height: 72px;
  border-radius: 10px;
  border: 2px dashed rgba(26, 61, 110, 0.25);
  background: rgba(26, 61, 110, 0.06);
}

.product-item-body {
  min-width: 0;
}

.product-item-body h2 {
  font-size: clamp(0.95rem, 3.6vw, 1.05rem);
  color: #1a3d6e;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.product-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.product-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f58220;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(245, 130, 32, 0.3);
}

.product-item-body p {
  font-size: clamp(0.82rem, 3.2vw, 0.92rem);
  overflow-wrap: anywhere;
  word-break: break-word;
  color: #444;
  line-height: 1.5;
}

.product-price {
  margin-top: 8px;
  font-size: clamp(0.95rem, 3.5vw, 1.05rem);
  font-weight: 700;
  color: #f58220;
}

#content.transitioning {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
}

.image-lightbox.hidden {
  display: none;
}

.image-lightbox.visible {
  display: flex;
}

.lightbox-close {
  position: absolute;
  top: clamp(12px, 3vh, 24px);
  right: 16px;
  z-index: 101;
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.lightbox-figure {
  max-width: min(92vw, 640px);
  max-height: 85vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: calc(85vh - 160px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: lightboxZoomIn 0.28s ease;
}

.lightbox-info {
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lightbox-info h2 {
  color: #fff;
  font-size: clamp(1.05rem, 4.2vw, 1.25rem);
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.lightbox-price {
  color: #ffffff;
  font-size: clamp(1rem, 4vw, 1.15rem);
  font-weight: 700;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.lightbox-desc {
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(0.88rem, 3.4vw, 0.98rem);
  line-height: 1.55;
  max-width: 520px;
  margin: 0 auto;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
}

.lightbox-detail-img {
  width: min(100%, 520px);
  max-height: 30vh;
  object-fit: contain;
  margin: 8px auto 0;
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
}

@keyframes lightboxZoomIn {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
