:root {
  color-scheme: light;
  --ink: #18201d;
  --paper: #f2efe5;
  --card: #fffdf6;
  --line: #cbc6b8;
  --orange: #eb5e36;
  --teal: #0c6d68;
  --yellow: #e8bf45;
  --muted: #6e746e;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(rgba(24,32,29,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(24,32,29,.035) 1px, transparent 1px);
  background-size: 24px 24px;
  font-family: "Avenir Next", "Trebuchet MS", "Microsoft YaHei", sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }

.masthead {
  min-height: 280px;
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  align-items: center;
  gap: 32px;
  padding: 44px max(5vw, 24px);
  color: #fffdf6;
  background: var(--ink);
  border-bottom: 9px solid var(--yellow);
}
.brand-mark { width: 76px; height: 76px; border: 2px solid #fffdf6; border-radius: 50%; position: relative; transform: rotate(45deg); }
.brand-mark i { position: absolute; background: var(--orange); left: 34px; top: 9px; width: 6px; height: 54px; border-radius: 4px; }
.brand-mark i:nth-child(2) { transform: rotate(45deg); }
.brand-mark i:nth-child(3) { transform: rotate(90deg); }
.brand-mark i:nth-child(4) { transform: rotate(135deg); }
.eyebrow { margin: 0 0 12px; color: #9ed4cd; font-size: 12px; letter-spacing: .18em; font-weight: 800; }
h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(42px, 7vw, 82px); line-height: .95; letter-spacing: -.05em; }
.lede { max-width: 630px; margin: 18px 0 0; font-size: clamp(16px, 2vw, 21px); line-height: 1.6; color: #d8d7cf; }
.favorites-toggle { align-self: start; display: flex; gap: 8px; align-items: center; border: 1px solid #6f7672; padding: 12px 15px; background: transparent; color: #fff; cursor: pointer; }
.favorites-toggle span { color: var(--yellow); }
.favorites-toggle b { min-width: 24px; padding: 2px 6px; color: var(--ink); background: var(--yellow); }
.favorites-toggle.active { color: var(--ink); background: var(--yellow); border-color: var(--yellow); }
.favorites-toggle.active span { color: var(--ink); }
.favorites-toggle.active b { background: var(--ink); color: #fff; }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.workbench { margin-top: -34px; background: var(--card); border: 1px solid var(--line); box-shadow: 9px 9px 0 rgba(24,32,29,.14); padding: 28px; position: relative; }
.section-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.section-heading.compact { margin-bottom: 18px; }
.step { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; background: var(--orange); color: white; font-weight: 900; font-family: ui-monospace, monospace; }
h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.text-button { margin-left: auto; border: 0; border-bottom: 1px solid currentColor; background: none; cursor: pointer; padding: 5px 0; color: var(--teal); font-weight: 700; }
.controls { display: grid; grid-template-columns: 1fr 1.25fr; gap: 28px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend, .search-box > span { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.chip-row, .shape-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip, .shape-chip { min-height: 39px; border: 1px solid var(--line); background: transparent; cursor: pointer; transition: .15s ease; }
.chip { min-width: 42px; padding: 6px 11px; }
.shape-chip { padding: 5px 11px 5px 7px; display: inline-flex; align-items: center; gap: 7px; }
.shape-chip span { display: grid; place-items: center; width: 28px; height: 28px; background: #e7e4d9; font-weight: 900; }
.chip:hover, .shape-chip:hover { border-color: var(--teal); transform: translateY(-1px); }
.chip.active, .shape-chip.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.shape-chip.active span { background: #fff; color: var(--teal); }
.search-box { display: block; margin-top: 22px; }
.search-box input { width: 100%; height: 47px; border: 0; border-bottom: 3px solid var(--ink); background: #ece9df; padding: 0 14px; outline: none; }
.search-box input:focus { border-color: var(--orange); background: #fff; }

.silhouette-section { padding: 55px 0 10px; }
.silhouette-strip { display: grid; grid-template-columns: repeat(12, 1fr); gap: 7px; }
.silhouette-button { aspect-ratio: 1; min-width: 0; display: grid; place-items: center; padding: 7px; border: 1px solid var(--line); background: #e8e4d8; cursor: pointer; position: relative; }
.silhouette-button::after { content: attr(data-number); position: absolute; left: 5px; top: 3px; color: #8a8e87; font: 9px ui-monospace, monospace; }
.silhouette-button:hover { background: var(--card); border-color: var(--orange); }
.silhouette-button.active { background: var(--orange); color: white; border-color: var(--orange); }
.silhouette-button.active::after { color: #fff5; }
.silhouette-button svg { width: 82%; height: 82%; }

.results-section { padding: 42px 0 70px; }
.results-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.caution { max-width: 370px; display: flex; gap: 10px; padding: 10px 13px; border: 1px solid #c9903b; background: #fff4cd; font-size: 12px; line-height: 1.5; }
.caution strong { display: grid; place-items: center; flex: 0 0 21px; height: 21px; border-radius: 50%; background: var(--yellow); }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.result-card { min-width: 0; background: var(--card); border: 1px solid var(--line); position: relative; overflow: hidden; transition: .18s ease; }
.result-card:hover { transform: translateY(-3px); box-shadow: 6px 6px 0 rgba(12,109,104,.18); border-color: var(--teal); }
.card-top { display: grid; grid-template-columns: 108px 1fr; min-height: 134px; }
.outline-box { display: grid; place-items: center; background: var(--ink); color: var(--card); position: relative; }
.outline-box::after { content: attr(data-code); position: absolute; bottom: 7px; left: 8px; color: #8c9690; font: 9px ui-monospace, monospace; }
.outline-box svg { width: 68px; height: 68px; }
.card-title { padding: 18px 42px 12px 16px; }
.card-title h3 { margin: 0 0 5px; font-family: Georgia, "Songti SC", serif; font-size: 21px; }
.alias { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.bit { display: inline-block; margin-top: 13px; padding: 4px 7px; background: #d7eee9; color: #095752; font: 700 11px ui-monospace, monospace; }
.favorite-button { position: absolute; right: 10px; top: 10px; width: 32px; height: 32px; border: 0; background: #e8e4d8; color: #888b84; cursor: pointer; font-size: 18px; }
.favorite-button.saved { background: var(--yellow); color: var(--ink); }
.card-detail { padding: 14px 16px 17px; border-top: 1px dashed var(--line); }
.card-detail strong { display: block; margin-bottom: 5px; color: var(--orange); font-size: 11px; letter-spacing: .1em; }
.card-detail p { margin: 0; min-height: 42px; font-size: 13px; line-height: 1.6; }
.empty-state { padding: 70px 20px; text-align: center; border: 1px dashed var(--line); background: var(--card); }
.empty-screw { width: 70px; height: 70px; display: grid; place-items: center; margin: 0 auto 18px; border: 4px solid var(--ink); border-radius: 50%; font-size: 42px; transform: rotate(45deg); }
.empty-state h3 { margin: 0 0 8px; font-size: 22px; }
.empty-state p { color: var(--muted); }
.empty-state button { padding: 10px 15px; border: 0; background: var(--teal); color: white; cursor: pointer; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 25px max(5vw, 24px); color: #b9bcb8; background: var(--ink); font-size: 11px; letter-spacing: .04em; }

@media (max-width: 900px) {
  .masthead { grid-template-columns: 65px 1fr; min-height: 250px; }
  .brand-mark { width: 58px; height: 58px; }
  .brand-mark i { left: 26px; top: 7px; height: 40px; }
  .favorites-toggle { position: absolute; right: 20px; top: 20px; }
  .controls { grid-template-columns: 1fr; }
  .silhouette-strip { grid-template-columns: repeat(8, 1fr); }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .masthead { display: block; padding: 86px 20px 54px; min-height: 0; }
  .brand-mark { display: none; }
  .lede { font-size: 16px; }
  main { width: min(100% - 24px, 1180px); }
  .workbench { margin-top: -20px; padding: 20px 15px; box-shadow: 5px 5px 0 rgba(24,32,29,.14); }
  .section-heading { align-items: flex-start; }
  .text-button { font-size: 12px; white-space: nowrap; }
  .silhouette-section { padding-top: 42px; }
  .silhouette-strip { grid-template-columns: repeat(6, 1fr); }
  .results-top { display: block; }
  .caution { max-width: none; margin-bottom: 16px; }
  .result-grid { grid-template-columns: 1fr; }
  .card-top { grid-template-columns: 96px 1fr; }
  footer { display: block; line-height: 1.8; }
  footer span { display: block; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
