* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #0a0a0a;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.app {
  width: 100%;
  max-width: 520px;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #1f1f1f;
  border-radius: 18px;
  background: rgba(26, 26, 26, 0.75);
  backdrop-filter: blur(4px);
}

.app.has-result .hero,
.app.has-result .form {
  display: none;
}

.app.has-result .seo-copy {
  display: none;
}

.app.has-result .result {
  order: 0;
}

.hero {
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 6px;
}

.hero h1 {
  margin: 2px 0 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.hero p {
  margin: 0;
  max-width: 440px;
  color: #a3a3a3;
  font-size: 12px;
  line-height: 1.3;
}

.logo {
  display: block;
  margin: 0 auto;
  width: 72px;
  height: 72px;
}

.form {
  display: grid;
  gap: 10px;
}

.form input {
  width: 100%;
  border: 1px solid #262626;
  background: #171717;
  color: #fff;
  border-radius: 11px;
  padding: 13px 14px;
  font-size: 15px;
  outline: none;
}

.form input:focus {
  border-color: #ef4444;
}

.form button {
  border: 0;
  border-radius: 11px;
  padding: 13px 14px;
  background: #fff;
  color: #000;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error {
  margin: 0;
  border: 1px solid rgba(127, 29, 29, 0.5);
  background: rgba(127, 29, 29, 0.2);
  color: #fecaca;
  border-radius: 11px;
  padding: 10px;
  text-align: center;
  font-size: 13px;
}

.result {
  display: grid;
  gap: 10px;
}

.theme-switch {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  border: 1px solid #262626;
  background: #171717;
  border-radius: 11px;
  padding: 3px;
}

.theme-switch button {
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  background: transparent;
  color: #a3a3a3;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.theme-switch button.active {
  background: #404040;
  color: #fff;
}

.theme-switch button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.preview {
  position: relative;
  justify-self: center;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #262626;
  max-height: 56vh;
  aspect-ratio: 9 / 16;
  background: #171717;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app.has-result .preview {
  max-height: 70vh;
  border-color: #3f3f46;
}

.preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
  transition: opacity 0.2s ease;
}

.preview.generating img {
  opacity: 0.35;
}

.preview-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(10, 10, 10, 0.25);
  color: #f1f1f1;
  font-size: 14px;
  font-weight: 600;
  z-index: 1;
}

.download-btn {
  border: 1px solid #404040;
  border-radius: 11px;
  padding: 11px;
  background: #262626;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.back-btn {
  border-color: #52525b;
  background: #1f1f23;
}

.icon {
  font-size: 18px;
  line-height: 1;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  font-variation-settings: "FILL" 1;
}

.btn-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.spin {
  animation: spin 0.9s linear infinite;
}

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

.hidden {
  display: none;
}

.seo-copy {
  border-top: 1px solid #1f1f1f;
  padding-top: 10px;
  color: #a3a3a3;
}

.seo-copy h2 {
  margin: 8px 0 4px;
  font-size: 16px;
  color: #e5e5e5;
}

.seo-copy p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.45;
}

.seo-link {
  color: #f1f1f1;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.deeplink-box {
  border: 1px solid #262626;
  border-radius: 11px;
  padding: 12px;
  background: #171717;
  display: grid;
  gap: 8px;
}

.action-row {
  display: flex;
  gap: 10px;
}

.action-row .download-btn {
  flex: 1;
}

.deeplink-label {
  margin: 0;
  font-size: 12px;
  color: #a3a3a3;
}

.deeplink-row {
  display: flex;
  gap: 6px;
}

.deeplink-href {
  flex: 1;
  min-width: 0;
  border: 1px solid #262626;
  background: #0f0f0f;
  color: #d4d4d4;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  line-height: 1.4;
}

.copy-link-btn {
  flex-shrink: 0;
  border: 1px solid #404040;
  border-radius: 8px;
  padding: 8px 10px;
  background: #262626;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.noscript-msg {
  margin: 12px auto;
  width: min(520px, calc(100% - 24px));
  border: 1px solid rgba(127, 29, 29, 0.5);
  background: rgba(127, 29, 29, 0.2);
  color: #fecaca;
  border-radius: 11px;
  padding: 10px;
  text-align: center;
  font-size: 13px;
}
