:root {
  --bg: var(--tg-theme-bg-color, #fbf7f2);
  --surface: var(--tg-theme-secondary-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #22201d);
  --hint: var(--tg-theme-hint-color, #7c746a);
  --accent: var(--tg-theme-button-color, #c2456a);
  --on-accent: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #c0392b);
  --seasonal-color: #d9622b;
  --radius: 14px;
  --gap: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hidden { display: none !important; }

.header { margin-bottom: 16px; }
.header h1 { margin: 0 0 2px; font-size: 1.5rem; line-height: 1.2; overflow-wrap: anywhere; }
.header-left { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.subtitle, .hint { margin: 0; color: var(--hint); font-size: 0.9rem; }
.hint { margin-top: 12px; }

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border-left: 4px solid var(--seasonal-color);
  font-size: 0.95rem;
}

.section { margin-bottom: 24px; }
.section-title { font-size: 1.1rem; margin: 0 0 12px; }
.seasonal-title { color: var(--seasonal-color); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--gap);
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}

.photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: rgba(127, 127, 127, 0.15);
}

.photo-empty {
  display: grid;
  place-items: center;
  color: var(--hint);
  font-size: 0.85rem;
}

.card-body { padding: 10px 12px 0; min-width: 0; }
.card-title {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--seasonal-color);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.price-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.price { font-weight: 700; font-variant-numeric: tabular-nums; }
.price-old { color: var(--hint); font-size: 0.85rem; text-decoration: line-through; }
.badge { padding: 1px 6px; border-radius: 6px; background: var(--danger); color: #fff; font-size: 0.75rem; font-weight: 700; }

.card-actions { margin-top: auto; padding: 10px 12px 12px; }

.add-btn, .primary-btn {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
.add-btn:active, .primary-btn:active { transform: scale(0.97); }
.add-btn:disabled, .primary-btn:disabled { opacity: 0.45; cursor: default; transform: none; }

.stepper {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  min-height: 44px;
  border-radius: 10px;
  background: rgba(127, 127, 127, 0.14);
}
.stepper button {
  height: 44px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 700;
}
.stepper output { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.skeleton { aspect-ratio: 3 / 4; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

.empty { text-align: center; color: var(--hint); padding: 40px 0; }
.link-btn { border: 0; background: none; color: var(--accent); text-decoration: underline; padding: 4px; }
.back-btn { border: 0; background: none; color: var(--accent); padding: 8px 0; min-height: 44px; }

.cart-list { display: flex; flex-direction: column; gap: var(--gap); }
.cart-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--surface);
  border-radius: var(--radius);
}
.cart-item .photo { width: 64px; border-radius: 10px; }
.cart-item-info { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cart-item-name { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.cart-item .stepper { max-width: 160px; }
.cart-total {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 1.05rem;
}

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: var(--bg);
  color: var(--text);
  overflow: auto;
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.45); }
.sheet[open] { animation: rise 0.22s ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.sheet-photo { display: block; width: 100%; max-height: 55dvh; object-fit: cover; }
.sheet-body { padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
.sheet-body h2 { margin: 0 0 8px; font-size: 1.25rem; overflow-wrap: anywhere; }
.sheet-desc { margin: 12px 0 16px; white-space: pre-line; overflow-wrap: anywhere; }
.sheet-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
}

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
