:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --panel: #151516;
  --panel-2: #1d1d1f;
  --panel-3: #262629;
  --line: #36363a;
  --line-strong: #56565e;
  --text: #f7f7f4;
  --muted: #aaaab0;
  --subtle: #77777f;
  --accent: #ff7818;
  --accent-2: #ff9b54;
  --danger: #ff5757;
  --success: #52d890;
  --shadow: 0 18px 50px rgba(0, 0, 0, .32);
  --radius: 18px;
  --radius-sm: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", "Noto Sans JP", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 84% 0%, rgba(255, 120, 24, .12), transparent 28rem),
    linear-gradient(180deg, #101011, var(--bg) 34rem);
  color: var(--text);
}
button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px max(16px, env(safe-area-inset-left)) 12px max(16px, env(safe-area-inset-right));
  background: rgba(11, 11, 12, .88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand-button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 34px;
  background: var(--accent);
  color: #101010;
  font-weight: 1000;
  letter-spacing: -.06em;
  transform: skewX(-8deg);
}
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 13px; letter-spacing: .08em; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .18em; }
.icon-button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .12em;
  cursor: pointer;
}

.progress-nav {
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px 16px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.progress-step {
  position: relative;
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--subtle);
  background: rgba(21, 21, 22, .72);
  text-align: center;
  font-size: 10px;
  letter-spacing: .06em;
}
.progress-step.is-current { color: var(--text); border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.progress-step.is-done { color: var(--success); border-color: rgba(82, 216, 144, .38); }

.main-content { width: min(1160px, 100%); margin: 0 auto; padding: 20px 16px 80px; }
.site-footer {
  padding: 24px 16px calc(28px + var(--safe-bottom));
  border-top: 1px solid rgba(255, 255, 255, .06);
  color: var(--subtle);
  text-align: center;
  font-size: 10px;
  letter-spacing: .04em;
}
.site-footer p { margin: 4px 0; }
.loading-panel { min-height: 54vh; display: grid; place-items: center; align-content: center; color: var(--muted); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, .7fr);
  gap: 18px;
  padding: clamp(22px, 5vw, 48px);
  background:
    linear-gradient(135deg, rgba(255, 120, 24, .15), transparent 48%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.hero-panel h1 { margin: 0; max-width: 760px; font-size: clamp(30px, 7vw, 66px); line-height: .98; letter-spacing: -.05em; }
.hero-panel h1 span { color: var(--accent); }
.hero-panel .lead { max-width: 760px; margin: 18px 0 0; color: #d0d0d2; line-height: 1.8; font-size: 14px; }
.hero-spec {
  align-self: stretch;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 16px;
  background: rgba(0, 0, 0, .22);
}
.hero-spec div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.hero-spec div:last-child { border-bottom: 0; }
.hero-spec dt { color: var(--muted); font-size: 11px; }
.hero-spec dd { margin: 0; font-weight: 800; font-size: 12px; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 34px 0 14px; }
.section-head h2 { margin: 0; font-size: clamp(21px, 4vw, 30px); letter-spacing: -.03em; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.catalog-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.search-box { min-width: min(360px, 100%); flex: 1; }
.field, .search-box input, .select-field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  padding: 11px 13px;
  outline: none;
}
.field:focus, .search-box input:focus, .select-field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 120, 24, .12); }
.category-chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.category-chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 11px;
  cursor: pointer;
}
.chip.is-active { border-color: var(--accent); background: rgba(255, 120, 24, .13); color: var(--text); }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-card {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  transition: transform .16s ease, border-color .16s ease;
}
.product-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.product-preview {
  position: relative;
  min-height: 190px;
  display: grid;
  place-items: center;
  padding: 30px 22px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    #202023;
  background-size: 18px 18px;
}
.product-preview::after { content: "TRANSPARENT DATA"; position: absolute; right: 10px; bottom: 8px; color: var(--subtle); font-size: 8px; letter-spacing: .12em; }
.product-preview img { width: min(90%, 390px); max-height: 95px; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }
.product-card-body { display: grid; align-content: start; gap: 11px; padding: 16px; }
.product-series { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.product-card h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.product-description { margin: 0; min-height: 3.3em; color: var(--muted); font-size: 11px; line-height: 1.65; }
.product-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #d0d0d2; font-size: 11px; }
.variant-dots { display: flex; gap: 6px; }
.variant-dot { width: 15px; height: 15px; border: 1px solid #777; border-radius: 50%; background: linear-gradient(135deg, #f6f6f6 50%, #1a1a1a 50%); }
.empty-state { grid-column: 1 / -1; padding: 48px 20px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }

.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 16px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 750;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--line-strong); }
.btn:disabled { cursor: not-allowed; opacity: .42; }
.btn-primary { background: var(--accent); color: #111; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(255,87,87,.45); color: #ff9999; }
.btn-small { min-height: 36px; padding: 8px 11px; font-size: 10px; }
.btn-block { width: 100%; }

.workflow-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, .55fr); gap: 18px; align-items: start; }
.workflow-card, .control-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.workflow-card { overflow: hidden; }
.workflow-card-head { padding: 20px 20px 14px; border-bottom: 1px solid var(--line); }
.workflow-card-head h1, .workflow-card-head h2 { margin: 0; font-size: clamp(21px, 4vw, 32px); letter-spacing: -.03em; }
.workflow-card-head p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.workflow-card-body { padding: 20px; }
.control-card { position: sticky; top: 82px; padding: 18px; }
.control-card h3 { margin: 0 0 13px; font-size: 14px; }
.control-card + .control-card { margin-top: 12px; }
.selected-product-mini { display: grid; grid-template-columns: 78px 1fr; gap: 12px; align-items: center; }
.selected-product-mini .thumb { display: grid; place-items: center; min-height: 70px; border-radius: 10px; background: #262629; padding: 10px; }
.selected-product-mini .thumb img { max-height: 45px; }
.selected-product-mini strong { display: block; font-size: 12px; line-height: 1.35; }
.selected-product-mini small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }

.option-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.option-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.option-card { position: relative; }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card label {
  min-height: 88px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}
.option-card label strong { color: var(--text); font-size: 12px; }
.option-card label small { font-size: 9px; line-height: 1.4; }
.option-card input:checked + label { border-color: var(--accent); background: rgba(255, 120, 24, .12); color: #f0c5a4; box-shadow: inset 0 -2px 0 var(--accent); }
.form-section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.form-section:first-child { padding-top: 0; }
.form-section:last-child { border-bottom: 0; padding-bottom: 0; }
.form-section > label, .field-label { display: block; margin-bottom: 9px; color: #d7d7da; font-size: 11px; font-weight: 700; }
.help-text { margin: 7px 0 0; color: var(--subtle); font-size: 10px; line-height: 1.55; }
.tire-inputs { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 7px; align-items: center; }
.tire-inputs span { color: var(--muted); font-size: 12px; }

.camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 280px;
  overflow: hidden;
  background: #050505;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.camera-stage.is-side { aspect-ratio: 16 / 10; }
.camera-stage video { width: 100%; height: 100%; object-fit: cover; }
.camera-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; text-align: center; color: var(--muted); }
.camera-guide { position: absolute; inset: 0; pointer-events: none; }
.plate-guide {
  position: absolute;
  left: 50%;
  top: 58%;
  width: 48%;
  aspect-ratio: 2 / 1;
  transform: translate(-50%, -50%);
  border: 2px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(0,0,0,.22), 0 0 24px rgba(255,120,24,.35);
}
.plate-guide::before, .wheel-guide::before { content: attr(data-label); position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); white-space: nowrap; padding: 6px 9px; border-radius: 999px; background: rgba(0,0,0,.7); color: #fff; font-size: 10px; }
.plate-guide::after { content: ""; position: absolute; left: 4%; right: 4%; top: 50%; border-top: 1px dashed rgba(255,255,255,.7); }
.wheel-guide {
  position: absolute;
  left: 29%;
  top: 58%;
  width: 35%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(0,0,0,.22), 0 0 24px rgba(255,120,24,.35);
}
.wheel-guide::after { content: ""; position: absolute; left: 4%; right: 4%; top: 50%; border-top: 1px dashed rgba(255,255,255,.7); }
.camera-actions { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin-top: 14px; }
.shutter {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: var(--accent);
  box-shadow: inset 0 0 0 4px #111;
  cursor: pointer;
}
.file-button { position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.camera-message { min-height: 1.5em; margin: 10px 0 0; color: var(--muted); font-size: 10px; text-align: center; }

.canvas-wrap {
  position: relative;
  width: 100%;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(45deg, #1d1d20 25%, transparent 25%),
    linear-gradient(-45deg, #1d1d20 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1d1d20 75%),
    linear-gradient(-45deg, transparent 75%, #1d1d20 75%),
    #161618;
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  touch-action: none;
}
.canvas-wrap canvas { display: block; width: 100%; height: auto; margin: 0 auto; touch-action: none; }
.canvas-caption { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.calibration-readout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.readout-box { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.readout-box span { display: block; color: var(--muted); font-size: 9px; }
.readout-box strong { display: block; margin-top: 5px; font-size: 13px; }

.editor-toolbar { display: grid; gap: 14px; }
.range-row { display: grid; grid-template-columns: 90px 1fr 48px; gap: 8px; align-items: center; }
.range-row label { color: var(--muted); font-size: 10px; }
.range-row output { text-align: right; font-size: 10px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.variant-list { display: flex; flex-wrap: wrap; gap: 8px; }
.variant-button { border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); padding: 8px 11px; color: var(--muted); font-size: 10px; cursor: pointer; }
.variant-button.is-active { border-color: var(--accent); color: var(--text); background: rgba(255,120,24,.12); }
.instruction-box { margin: 0; padding: 12px 13px; border-left: 3px solid var(--accent); background: rgba(255,120,24,.08); color: #e6d3c5; font-size: 10px; line-height: 1.65; }
.sticky-checkout {
  position: sticky;
  bottom: max(10px, var(--safe-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: rgba(20,20,21,.94);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 35px rgba(0,0,0,.4);
}
.sticky-checkout p { margin: 0; font-size: 10px; color: var(--muted); }
.sticky-checkout strong { display: block; margin-bottom: 3px; color: var(--text); font-size: 12px; }

.warning-box, .success-box { padding: 13px; border-radius: 12px; font-size: 10px; line-height: 1.65; }
.warning-box { border: 1px solid rgba(255,120,24,.35); background: rgba(255,120,24,.08); color: #efc5a6; }
.success-box { border: 1px solid rgba(82,216,144,.35); background: rgba(82,216,144,.08); color: #b7f2d0; }

.app-dialog { width: min(560px, calc(100% - 30px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.app-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 17px 18px; border-bottom: 1px solid var(--line); }
.dialog-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: var(--panel-2); cursor: pointer; }
.dialog-body { padding: 18px; color: #d0d0d2; font-size: 12px; line-height: 1.8; }
.dialog-body p { margin: 0 0 12px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + var(--safe-bottom)); z-index: 100; max-width: calc(100% - 30px); transform: translate(-50%, 20px); padding: 11px 15px; border: 1px solid var(--line-strong); border-radius: 999px; background: #232326; color: var(--text); font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; box-shadow: var(--shadow); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .hero-panel, .workflow-layout { grid-template-columns: 1fr; }
  .hero-spec { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-spec div { display: grid; justify-content: initial; }
  .control-card { position: static; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .main-content { padding-inline: 12px; }
  .progress-nav { padding-inline: 12px; }
  .progress-step { padding: 8px 3px; font-size: 8px; }
  .hero-panel { padding: 23px 18px; border-radius: 18px; }
  .hero-panel h1 { font-size: 37px; }
  .hero-spec { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr; }
  .product-preview { min-height: 170px; }
  .section-head { display: block; }
  .catalog-tools { margin-top: 12px; }
  .search-box { min-width: 100%; }
  .option-grid { grid-template-columns: 1fr; }
  .option-grid.two { grid-template-columns: 1fr 1fr; }
  .workflow-card-body, .workflow-card-head { padding-inline: 15px; }
  .calibration-readout { grid-template-columns: 1fr; }
  .camera-actions { grid-template-columns: 1fr auto 1fr; }
  .camera-actions .btn { padding-inline: 8px; font-size: 10px; }
  .sticky-checkout { grid-template-columns: 1fr; }
  .sticky-checkout .btn { width: 100%; }
  .range-row { grid-template-columns: 72px 1fr 42px; }
}
