:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --text: var(--tg-theme-text-color, #1c1c1e);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #007aff);
  --button: var(--tg-theme-button-color, #007aff);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --separator: rgba(142, 142, 147, 0.24);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.state {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--hint);
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--separator);
  border-top-color: var(--link);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.gallery {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--secondary-bg);
  overflow: hidden;
}

.gallery-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.gallery-track img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  scroll-snap-align: start;
  background: var(--secondary-bg);
}

.gallery-dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.gallery-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
}

.gallery-dots span.active {
  background: #ffffff;
}

.content {
  padding: 16px;
}

h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.3;
}

.price {
  font-size: 24px;
  font-weight: 700;
  color: var(--link);
  margin-bottom: 12px;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.facts .fact {
  background: var(--secondary-bg);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
}

.specs {
  border-top: 1px solid var(--separator);
}

.specs .row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--separator);
  font-size: 15px;
}

.specs .row .label {
  color: var(--hint);
}

.source-link {
  display: block;
  margin-top: 20px;
  text-align: center;
  color: var(--link);
  text-decoration: none;
  font-size: 14px;
  padding: 10px;
}

.send-button {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--button);
  color: var(--button-text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.send-button:disabled {
  opacity: 0.6;
}

.send-status {
  text-align: center;
  margin-top: 10px;
  font-size: 14px;
  color: var(--hint);
}

.send-status.error {
  color: #ff3b30;
}
