:root {
  --bg: var(--cc-theme-bg-color, #ffffff);
  --text: var(--cc-theme-text-color, #000000);
  --hint: var(--cc-theme-hint-color, #8e8e93);
  --link: var(--cc-theme-link-color, #2481cc);
  --button: var(--cc-theme-button-color, #2481cc);
  --button-text: var(--cc-theme-button-text-color, #ffffff);
  --secondary: var(--cc-theme-secondary-bg-color, #f1f1f4);
  --section: var(--cc-theme-section-bg-color, var(--bg));
  --accent: var(--cc-theme-accent-text-color, var(--link));
  --destructive: var(--cc-theme-destructive-text-color, #e53935);
  --separator: var(--cc-theme-section-separator-color, rgba(128, 128, 128, 0.2));
  color-scheme: light dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--secondary);
  color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding: var(--cc-content-safe-area-inset-top, 0) 0 calc(24px + var(--cc-safe-area-inset-bottom, 0px));
}

button {
  font: inherit;
  cursor: pointer;
}

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 16px 8px;
  background: var(--secondary);
}

.greeting {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: var(--separator);
}

.tab {
  flex: 1;
  padding: 7px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
}

.tab--active {
  background: var(--section);
}

.page {
  display: none;
  padding: 8px 16px;
}

.page--active {
  display: block;
}

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

.product {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px 10px;
  border-radius: 14px;
  background: var(--section);
  text-align: center;
}

.product--focus {
  outline: 2px solid var(--button);
}

.product__emoji {
  font-size: 44px;
  line-height: 1.1;
}

.product__badge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--button);
  color: var(--button-text);
  font-size: 13px;
  font-weight: 700;
  line-height: 22px;
  visibility: hidden;
}

.product__badge--on {
  visibility: visible;
}

.product__title {
  font-weight: 600;
}

.product__price {
  color: var(--hint);
  font-size: 13px;
}

.stepper {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
}

.stepper button {
  flex: 1;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: var(--button);
  color: var(--button-text);
  font-size: 18px;
  font-weight: 700;
}

.stepper .minus {
  background: var(--destructive);
}

.hint {
  color: var(--hint);
  font-size: 13px;
  text-align: center;
}

.section-title {
  margin: 18px 4px 8px;
  color: var(--hint);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.cart {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: 12px;
  background: var(--section);
  overflow: hidden;
}

.cart li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--separator);
}

.cart li:last-child {
  border-bottom: 0;
}

.cart__emoji {
  font-size: 28px;
}

.cart__name {
  flex: 1;
}

.cart__sum {
  font-weight: 600;
}

.total {
  display: flex;
  justify-content: space-between;
  margin: 12px 4px;
  font-size: 17px;
  font-weight: 700;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--hint);
  font-size: 13px;
}

.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--section);
  color: var(--text);
  font: inherit;
  resize: none;
}

.card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--section);
  font-size: 13px;
}

.card div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
}

.card span:first-child {
  color: var(--hint);
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border: 1px solid var(--separator);
  border-radius: 3px;
  vertical-align: -1px;
}

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

.buttons button {
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: var(--section);
  color: var(--accent);
  font-weight: 600;
}

.buttons button:active,
.tab:active,
.stepper button:active {
  opacity: 0.6;
}

.buttons .danger {
  color: var(--destructive);
}

.buttons--last {
  margin-top: 24px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--cc-safe-area-inset-bottom, 0px));
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast--on {
  opacity: 1;
  transform: translate(-50%, 0);
}
