:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--tg-theme-text-color, #f4f7fb);
  background: var(--tg-theme-bg-color, #111820);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  background: var(--tg-theme-bg-color, #111820);
}

button {
  font: inherit;
}

.picker-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.picker-header {
  padding: 2px 2px 18px;
}

.picker-header h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 720;
  letter-spacing: 0;
}

.message-preview {
  display: -webkit-box;
  margin: 9px 0 0;
  overflow: hidden;
  color: var(--tg-theme-hint-color, #8f9baa);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

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

.style-option {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  color: inherit;
  text-align: left;
  background: var(--tg-theme-secondary-bg-color, #19232e);
  border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #8f9baa) 20%, transparent);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
  -webkit-tap-highlight-color: transparent;
}

.style-option:active {
  transform: scale(0.985);
}

.style-option:focus-visible {
  outline: 2px solid var(--tg-theme-button-color, #3390ec);
  outline-offset: 2px;
}

.style-option[aria-busy="true"] {
  border-color: var(--tg-theme-button-color, #3390ec);
  background: color-mix(in srgb, var(--tg-theme-button-color, #3390ec) 12%, var(--tg-theme-secondary-bg-color, #19232e));
  pointer-events: none;
}

.style-image-wrap {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  background: #101010;
}

.style-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.style-copy {
  min-width: 0;
  padding: 11px 12px 13px;
}

.style-name {
  display: block;
  overflow: hidden;
  font-size: 15px;
  font-weight: 680;
  line-height: 1.25;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.style-description {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  color: var(--tg-theme-hint-color, #8f9baa);
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.status {
  margin: 16px 2px 0;
  color: var(--tg-theme-hint-color, #8f9baa);
  font-size: 13px;
  line-height: 1.35;
  letter-spacing: 0;
}

.status:empty {
  display: none;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 18px 16px;
  color: var(--tg-theme-text-color, #f4f7fb);
  background: var(--tg-theme-secondary-bg-color, #19232e);
  border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #8f9baa) 20%, transparent);
  border-radius: 8px;
}

.empty-state p {
  margin: 0 0 10px;
  color: var(--tg-theme-hint-color, #8f9baa);
  font-size: 14px;
  line-height: 1.4;
}

.empty-state p:last-child {
  margin-bottom: 0;
}

.empty-state code {
  display: block;
  margin: 0 0 12px;
  padding: 10px 11px;
  overflow-wrap: anywhere;
  color: var(--tg-theme-text-color, #f4f7fb);
  background: color-mix(in srgb, var(--tg-theme-bg-color, #111820) 70%, #000);
  border-radius: 6px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 390px) {
  .picker-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .style-grid {
    gap: 9px;
  }

  .style-copy {
    padding: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .style-option {
    transition: none;
  }
}
