:root {
  --gold: #d4af37;
  --gold-light: #f2d675;
  --bg: var(--tg-theme-bg-color, #0e0e10);
  --bg-secondary: var(--tg-theme-secondary-bg-color, #1a1a1d);
  --text: var(--tg-theme-text-color, #f5f5f5);
  --hint: var(--tg-theme-hint-color, #9a9a9f);
  --card: #17171a;
  --card-border: #2a2a2e;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  min-height: 100vh;
}

.topbar {
  padding: 18px 20px 14px;
  text-align: center;
  border-bottom: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(212,175,55,0.08), transparent);
}

.brand-name {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(90deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  display: block;
  font-size: 12px;
  color: var(--hint);
  margin-top: 2px;
}

.app {
  padding: 16px;
  padding-bottom: 100px;
}

.breadcrumb {
  font-size: 13px;
  color: var(--hint);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb .back {
  color: var(--gold);
  cursor: pointer;
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.card:active {
  transform: scale(0.97);
  border-color: var(--gold);
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 4px 0 14px;
  color: var(--gold-light);
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.sample {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--card-border);
  aspect-ratio: 1;
  cursor: pointer;
}

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

.sample.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold);
}

.sample .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.6);
  color: var(--gold-light);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--hint);
  margin-bottom: 6px;
}

.field select, .field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}

.field select:focus, .field input:focus {
  outline: none;
  border-color: var(--gold);
}

.summary-box {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  line-height: 1.9;
  font-size: 14px;
  white-space: pre-line;
}

.price-box {
  background: linear-gradient(135deg, rgba(212,175,55,0.15), rgba(212,175,55,0.03));
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  font-size: 14px;
  white-space: pre-line;
  color: var(--gold-light);
}

.empty-state {
  text-align: center;
  color: var(--hint);
  padding: 40px 20px;
  font-size: 14px;
  line-height: 1.8;
}

.success {
  text-align: center;
  padding: 60px 20px;
}

.success .icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.success h2 {
  color: var(--gold-light);
  margin-bottom: 8px;
}

.success p {
  color: var(--hint);
  font-size: 14px;
  line-height: 1.8;
}

.spinner {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.spinner::after {
  content: "";
  width: 32px;
  height: 32px;
  border: 3px solid var(--card-border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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