:root {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --border: #334155;
  --hardness-low: #f87171;
  --hardness-mid: #fbbf24;
  --hardness-high: #34d399;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(1200px 800px at 10% -10%, #1e293b 0%, #0b1020 60%, #050810 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 24px 16px 64px;
}

header {
  max-width: 1100px;
  margin: 0 auto 28px;
  text-align: center;
}
h1 {
  font-size: clamp(28px, 5vw, 42px);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 10px;
}
.subtitle {
  color: var(--muted);
  font-size: 15px;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.5;
}

.controls {
  max-width: 1100px;
  margin: 18px auto 26px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}
.search-input {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 15px;
  min-width: 220px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.card {
  background: linear-gradient(180deg, rgba(30,41,59,0.9), rgba(15,23,42,0.95));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.6);
  border-color: #475569;
}
.card::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 140px;
  background: radial-gradient(600px 120px at 50% 0%, rgba(56,189,248,0.12), transparent 60%);
  pointer-events: none;
}

.card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #1f2a40;
  background: #0b1220;
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.card-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.card-formula {
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, "Fira Code", monospace;
  background: rgba(2,6,23,0.6);
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid #1f2a40;
}

.hardness-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.hardness-bar {
  flex: 1;
  height: 8px;
  background: #0b1220;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #1f2a40;
  position: relative;
}
.hardness-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hardness-low), var(--hardness-mid), var(--hardness-high));
  width: 0%;
  transition: width 0.4s ease;
}

.props {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
  color: #cbd5e1;
}
.prop {
  background: rgba(2, 6, 23, 0.5);
  border: 1px solid #1f2a40;
  border-radius: 10px;
  padding: 8px;
}
.prop-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.prop-value {
  font-size: 13px;
  line-height: 1.35;
}

.uses {
  font-size: 13px;
  color: #cbd5e1;
  background: rgba(2, 6, 23, 0.5);
  border: 1px solid #1f2a40;
  border-radius: 10px;
  padding: 8px;
  margin-top: 2px;
}
.uses-title {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}

.no-results {
  max-width: 1100px;
  margin: 40px auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

footer {
  max-width: 1100px;
  margin: 40px auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding-top: 16px;
  border-top: 1px solid #1f2a40;
}

@media (max-width: 480px) {
  .props { grid-template-columns: 1fr; }
  .card-image { height: 160px; }
}