:root {
  color-scheme: light;
  --page: #f5f6f8;
  --surface: #fff;
  --ink: #202329;
  --muted: #555c66;
  --border: #e1e4e9;
  --red: #b8222a;
  --red-hover: #981b22;
  --red-light: #fff1f2;
  --dark: #242830;
  --radius: 19px;
  --panel-shadow: 0 2px 6px #20232906, 0 14px 42px #20232908;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
a, button, input, select { -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #d9473c; outline-offset: 4px; }

.shell { width: min(100% - 72px, 1230px); margin-inline: auto; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { min-height: 74px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; border-radius: 2px; }
.brand img { display: block; width: 174px; height: auto; max-width: 100%; }
.contact-link {
  padding: 9px 16px;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 650;
}
.contact-link:hover { border-color: #aeb5c0; background: var(--page); }

.intro { padding-block: 40px 26px; }
h1 {
  font-size: clamp(2.4rem, 5vw, 4.05rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.06em;
  margin: 0;
}
h1 span { color: #c82d28; }
.intro p { color: var(--muted); line-height: 1.55; margin: 13px 0 0; max-width: 72ch; }

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(350px, 435px);
  gap: 22px;
  align-items: start;
}
.configuration { display: grid; gap: 12px; }
.section {
  min-inline-size: 0;
  margin: 0;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
}
.section-title { margin-bottom: 14px; font-size: 1.25rem; font-weight: 750; letter-spacing: -0.026em; }

.products { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.product, .position, .method { display: block; position: relative; cursor: pointer; min-width: 0; }
.product input, .position input, .method input, .visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.product-card {
  display: block;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 120ms, background-color 120ms;
}
.product-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1.5;
  object-fit: cover;
  background-color: #eeeae8;
}
.product-label {
  padding: 11px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 5px;
  font-size: 0.875rem;
  font-weight: 700;
}
.radio-indicator, .check-indicator {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border: 1px solid #a1a8b3;
  border-radius: 100%;
  display: grid;
  place-items: center;
}
.product input:checked + .product-card,
.position input:checked + .position-card,
.method input:checked + .method-card {
  border-color: var(--red);
  background: var(--red-light);
  box-shadow: inset 0 0 0 1px var(--red);
}
.product input:checked + .product-card .radio-indicator { border-color: var(--red); }
.product input:checked + .product-card .radio-indicator::after {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 100%;
}
.product:hover .product-card, .position:hover .position-card,
.method:hover input:not(:disabled) + .method-card { border-color: var(--red); }
.product input:focus-visible + .product-card, .position input:focus-visible + .position-card,
.method input:focus-visible + .method-card {
  outline: 3px solid #d9473c;
  outline-offset: 3px;
}

.quantity-fields { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 15px; }
.quantity-control { width: 128px; }
.select-wrap, .quantity-control { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 17px;
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  pointer-events: none;
}
select, .quantity-control input {
  appearance: none;
  width: 100%;
  min-height: 46px;
  padding: 9px 50px 9px 13px;
  border: 1px solid #d6dbe2;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
.quantity-control input::-webkit-inner-spin-button, .quantity-control input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.quantity-control input[type=number] { appearance: textfield; }
.quantity-control input[aria-invalid="true"] { border-color: var(--red); }
.quantity-control > span {
  position: absolute;
  inset: 0 14px 0 auto;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.875rem;
  pointer-events: none;
}
.quantities { display: flex; flex-wrap: wrap; gap: 7px; }
.quantities button {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  min-width: 48px;
  min-height: 36px;
  padding: 5px 10px;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--muted);
}
.quantities button:hover { border-color: var(--red); }
.quantities button[aria-pressed="true"] { border-color: var(--red); color: #a5211d; background: var(--red-light); }
.field-help { margin: 9px 0 0; color: var(--muted); font-size: 0.875rem; line-height: 1.5; }

.methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.embroidery-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 14px;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--page);
  border-radius: 10px;
}
.embroidery-note p { flex: 1 1 240px; margin: 0; color: var(--muted); font-size: 0.875rem; line-height: 1.45; }
.logo-inquiry {
  padding: 7px 11px;
  border: 1px solid var(--red);
  border-radius: 8px;
  color: var(--red-hover);
  font-weight: 650;
  font-size: 0.875rem;
  text-decoration: none;
}
.logo-inquiry:hover { background: var(--red-light); }
.method-card {
  min-height: 62px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
}
.method-card strong { font-size: 0.9375rem; }
.method-card small { color: var(--muted); line-height: 1.35; font-size: 0.8125rem; }
.method input:disabled + .method-card {
  background: var(--page);
  color: var(--muted);
  cursor: default;
}
.position-heading { margin: 19px 0 9px; font-size: 0.9375rem; font-weight: 700; }
.spot { min-width: 0; }
.spot-detail { margin: 7px 0 3px; }
.spot-detail label { display: block; font-weight: 650; font-size: 0.875rem; margin-bottom: 5px; }
.spot-detail select { font-size: 0.9375rem; }
.positions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.position-card {
  height: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 13px 8px 9px;
  border: 1px solid var(--border);
  border-radius: 11px;
}
.placement-mark {
  position: relative;
  display: block;
  flex: 0 0 34px;
  height: 34px;
  border: 1px solid #e8e1dd;
  border-radius: 6px;
  background: #faf8f7;
}
.placement-mark::before {
  content: "";
  position: absolute;
  inset: 6px 8px;
  border: 1.25px solid #a39892;
  border-radius: 3px;
}
.placement-mark::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  top: 10px;
  left: 17px;
  border-radius: 1px;
  background: #c33b33;
}
.placement-front::after { width: 10px; height: 10px; top: 11px; left: 11px; }
.placement-back::after { width: 10px; height: 11px; top: 12px; left: 11px; }
.placement-sleeve::after { width: 6px; height: 7px; top: 9px; left: 6px; }
.position-label { flex: 1; min-width: 0; }
.position-label strong { display: block; font-size: 0.875rem; line-height: 1.25; }
.position-label small { display: block; color: var(--muted); font-size: 0.8125rem; line-height: 1.35; margin-top: 2px; }
.check-indicator { border-radius: 4px; }
.position input:checked + .position-card .check-indicator { background: var(--red); border-color: var(--red); }
.position input:checked + .position-card .check-indicator::after {
  content: "";
  width: 7px;
  height: 4px;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  transform: translateY(-1px) rotate(-45deg);
}

.summary {
  position: sticky;
  top: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--panel-shadow);
}
.summary-main { padding: 21px 21px 20px; }
.summary h2 { margin: 0; font-size: 1.375rem; font-weight: 740; letter-spacing: -0.035em; }
.summary-caption { color: var(--muted); margin: 4px 0 14px; font-size: 0.875rem; line-height: 1.4; }
.quality-prices { display: grid; gap: 9px; }
.quality-price { container-type: inline-size; padding: 11px 14px 9px; border: 1px solid var(--border); background: #f9fafb; border-radius: 12px; }
.quality-price h3 { color: var(--ink); margin: 0 0 7px; font-size: 0.9375rem; font-weight: 740; }
.quality-units, .quality-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.quality-units > div { display: flex; flex-direction: column; justify-content: space-between; }
.quality-units dt { color: var(--muted); font-size: 0.8125rem; }
.quality-unit {
  font-size: clamp(1.15rem, 7.3cqi, 1.875rem);
  font-weight: 780;
  line-height: 1.12;
  letter-spacing: -0.045em;
  margin: 3px 0 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.quality-units > div:nth-child(2), .quality-totals > div:nth-child(2) { padding-left: 12px; border-left: 1px solid var(--border); }
.quality-totals { border-top: 1px solid var(--border); padding-top: 7px; margin-top: 8px; font-size: 0.8125rem; }
.quality-totals dd { margin: 0; white-space: nowrap; font-weight: 650; font-variant-numeric: tabular-nums; }
.total-label { color: var(--muted); font-weight: 500; margin-right: 2px; }
@container (max-width: 325px) {
  .quality-totals:has(.is-range) .total-label { display: none; }
}
@container (max-width: 240px) {
  .quality-units, .quality-totals { gap: 4px; }
  .quality-units > div:nth-child(2) { padding-left: 3px; }
  .quality-totals > div:nth-child(2) { padding-left: 0; border-left: 0; }
  .quality-totals { font-size: 0.75rem; letter-spacing: -0.025em; }
  .quality-totals .is-range .total-currency { display: none; }
}
.breakdown {
  margin: 0;
  display: grid;
  gap: 4px;
  font-size: 0.8125rem;
  line-height: 1.35;
}
.breakdown > div { display: flex; justify-content: space-between; gap: 8px; }
.breakdown dt { color: var(--muted); }
.breakdown dd { margin: 0; text-align: right; font-weight: 610; font-variant-numeric: tabular-nums; }
.price-note { color: var(--muted); font-size: 0.8125rem; line-height: 1.5; margin: 11px 0 12px; }
.cost-details { margin: 0 0 13px; font-size: 0.8125rem; color: var(--muted); }
.cost-details summary { width: fit-content; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.breakdown { padding: 8px 0 0 13px; }
.summary-message { color: var(--muted); font-size: 1rem; line-height: 1.55; padding-block: 19px; }
.inquiry {
  display: block;
  text-align: center;
  background: var(--red);
  border: 1px solid var(--red);
  color: #fff;
  padding: 12px 10px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9375rem;
  text-decoration: none;
}
.inquiry:hover { background: var(--red-hover); }
.summary-footer { background: #f9fafb; padding: 13px 21px; border-top: 1px solid var(--border); font-size: 0.8125rem; color: var(--muted); }
.summary-footer a { text-underline-offset: 3px; }
.mobile-price { display: none; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.875rem;
  margin-block: 32px 0;
  border-top: 1px solid var(--border);
  padding-block: 20px;
}
.site-footer nav { display: flex; gap: 18px; }
.site-footer a { text-underline-offset: 3px; }

@media (max-width: 1040px) {
  .shell { width: calc(100% - 48px); }
  .calculator-layout { gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(328px, 365px); }
  .section, .summary-main { padding-inline: 16px; }
  .products { gap: 7px; }
  .product-label { padding-inline: 7px; }
}
@media (781px <= width <= 1010px) {
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .calculator-layout { grid-template-columns: minmax(0, 1fr); }
  .intro { padding-block: 31px 19px; }
  .intro p { margin-top: 10px; }
  .summary { position: static; scroll-margin-top: 12px; }
  .mobile-price {
    position: fixed;
    z-index: 2;
    inset: auto 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px max(14px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
    min-height: 54px;
    color: #fff;
    background: var(--dark);
    border-top: 2px solid #c82d28;
    font-size: 0.875rem;
    text-underline-offset: 3px;
  }
  .mobile-price:focus-visible { outline-offset: -5px; }
  .mobile-price strong { text-align: right; font-size: 0.875rem; }
}
@media (max-width: 490px) {
  .shell { width: calc(100% - 28px); }
  .header-inner { min-height: 62px; }
  .brand img { width: 146px; }
  .section { padding: 17px 12px; }
  .summary-main { padding-inline: 12px; }
  .quality-price { padding-inline: 10px; }
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .product-label { padding: 10px 9px; }
  .methods { gap: 6px; }
  .method-card { padding-inline: 7px; }
  .method-card strong { font-size: 0.875rem; }
  .spot-detail label { font-size: 0.8125rem; }
  .spot-detail select { font-size: 0.8125rem; }
  select { padding-right: 27px; }
  .select-wrap::after { right: 12px; }
  .position-card { padding: 7px 8px; gap: 6px; }
  .placement-mark { display: none; }
  .site-footer { margin-top: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
