:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --text: #111318;
  --muted: #3d4553;
  --border: #c5ccd6;
  --primary: #0b6e4f;
  --primary-text: #ffffff;
  --keep: #0a6c8f;
  --skip: #4a5568;
  --danger: #b42318;
  --focus: #1d4ed8;
  --shadow: 0 2px 8px rgba(17, 19, 24, 0.12);
  --radius: 14px;
  --tap: 56px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
}

body {
  background:
    linear-gradient(180deg, #f7f9fb 0%, #e8edf2 100%);
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 12px 12px 96px;
}

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

.vendor-chip {
  font-weight: 700;
  font-size: 1rem;
  color: var(--muted);
}

.brand {
  margin: 48px 0 8px;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 1.1rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input {
  width: 100%;
  min-height: var(--tap);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
}

.input-lg {
  min-height: 60px;
  font-size: 1.35rem;
}

.input:focus {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

.btn {
  min-height: var(--tap);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.btn:active {
  transform: translateY(1px);
}

.btn-lg {
  min-height: 64px;
  font-size: 1.35rem;
}

.btn-small {
  min-height: 44px;
  font-size: 0.95rem;
  box-shadow: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
}

.btn-keep {
  background: var(--keep);
  color: #fff;
}

.btn-skip {
  background: #d7dde6;
  color: var(--skip);
}

.btn-send {
  background: #12805a;
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  border-color: var(--border);
}

.btn-clear {
  background: #ffe8a3;
  color: #5c4300;
  min-width: 88px;
}

.btn-toast {
  background: #111318;
  color: #fff;
  min-height: 44px;
  box-shadow: none;
}

.hint {
  color: var(--danger);
  font-weight: 700;
}

.search-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  margin-bottom: 12px;
}

.recent {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.recent button {
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 92px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.result-row img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  background: #f0f2f5;
  flex-shrink: 0;
}

.result-title {
  font-weight: 800;
  font-size: 1.05rem;
}

.result-sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.wheel-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.thumb-wrap {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}

.thumb {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  background: #f0f2f5;
  display: block;
}

.wa {
  font-size: 1.5rem;
  font-weight: 900;
}

.price {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary);
  margin: 4px 0;
}

.size, .make-model {
  font-weight: 700;
  color: var(--muted);
}

.message {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fff3cd;
  border: 2px solid #e6c200;
  border-radius: 10px;
  font-weight: 800;
}

.kept-note {
  margin-top: 8px;
  font-weight: 700;
  color: var(--keep);
}

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

.store-grid .btn {
  min-height: 72px;
}

.action-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.not-needed {
  grid-column: 1 / -1;
  text-align: center;
  padding: 18px;
  background: #e5e9ef;
  border-radius: var(--radius);
  font-weight: 800;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 16px;
  max-width: 536px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #1b2330;
  color: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 40;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 2.5rem;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
}

.osk {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 12px;
}

.osk-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 6px;
}

.osk-key {
  min-width: 34px;
  min-height: 48px;
  flex: 1;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #f7f8fa;
  font-weight: 800;
  font-size: 1.05rem;
}

.osk-key.wide {
  flex: 2.2;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 420px) {
  .wheel-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .search-bar {
    grid-template-columns: 1fr 1fr;
  }
  .search-bar .input {
    grid-column: 1 / -1;
  }
}
