:root {
  --bg: #f4f4f5;
  --card: #ffffff;
  --text: #111111;
  --muted: #6b7280;
  --line: #e4e4e7;
  --accent: #ffcc00;
  --accent-text: #111111;
  --danger: #e5231b;
  --danger-text: #ffffff;
  --ghost: #f4f4f5;
  --ghost-text: #111111;
  --success: #1a7f37;
  --success-bg: #e6f4ea;
  --demo-bg: #fff7db;
  --demo-text: #7a5a00;
  --radius: 18px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f10;
    --card: #1c1c1e;
    --text: #f5f5f5;
    --muted: #a1a1aa;
    --line: #2c2c2e;
    --ghost: #2a2a2c;
    --ghost-text: #f5f5f5;
    --success: #6ee7a0;
    --success-bg: #143524;
    --demo-bg: #3a2f00;
    --demo-text: #ffd76a;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
    Arial, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 440px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 16px
    calc(24px + env(safe-area-inset-bottom));
}

.head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  color: #111;
  font-weight: 800;
  font-size: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: var(--shadow);
}

.head-text {
  min-width: 0;
}

h1 {
  margin: 0 0 3px;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 14px;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  line-height: 1.3;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease, transform 0.08s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.99);
  opacity: 0.9;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: default;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-text);
  margin-top: 12px;
}

.btn.danger {
  background: var(--danger);
  color: var(--danger-text);
  margin-top: 12px;
}

.btn.ghost {
  background: var(--ghost);
  color: var(--ghost-text);
  width: auto;
  flex: 0 0 auto;
  padding: 11px 13px;
  font-size: 14px;
}

.error {
  margin: 12px 0 0;
  color: #c81e1e;
  font-size: 14px;
  line-height: 1.4;
}

@media (prefers-color-scheme: dark) {
  .error {
    color: #ff8f8a;
  }
}

.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.result-label {
  font-size: 14px;
  font-weight: 650;
}

.badge {
  background: var(--success-bg);
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.product {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--bg);
  border-radius: 14px;
  margin-bottom: 12px;
}

.photo {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--card);
  flex: 0 0 auto;
}

.product-meta {
  min-width: 0;
}

.title {
  font-size: 14px;
  line-height: 1.35;
  font-weight: 550;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
}

.price {
  font-size: 17px;
  font-weight: 750;
}

.old-price {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: line-through;
}

.link-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.link-input {
  font-size: 15px;
  padding: 11px 12px;
  color: var(--muted);
  background: var(--bg);
  min-width: 0;
}

.note {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.note.demo {
  background: var(--demo-bg);
  color: var(--demo-text);
  border-radius: 10px;
  padding: 9px 11px;
}

.denied {
  text-align: center;
}

.denied-badge {
  width: 40px;
  height: 40px;
  margin: 2px auto 10px;
  border-radius: 50%;
  background: var(--ghost);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
}

.denied-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
}

.denied-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--muted);
}

.denied-hint {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.disclaimer {
  margin: 18px 4px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-top-color: #111;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

@media (max-width: 360px) {
  .link-row {
    flex-direction: column;
  }

  .btn.ghost {
    width: 100%;
  }
}
