:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  color: #191919;
  background: #f5f3ed;
  --paper: #fffdf8;
  --ink: #191919;
  --muted: #716f69;
  --line: #dedbd2;
  --accent: #191919;
  --soft: #ebe8df;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 85% 5%, #fff 0, transparent 28%), #f5f3ed; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid rgba(25,25,25,.08);
  backdrop-filter: blur(18px);
  background: rgba(245,243,237,.82);
}
.brand { text-decoration: none; font-weight: 800; letter-spacing: -.03em; }
.text-button { border: 0; background: transparent; color: var(--muted); padding: 8px; }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 100px; }
.hero { padding: 34px 0 26px; max-width: 900px; }
.eyebrow { margin: 0 0 12px; color: #858279; font-size: 12px; font-weight: 800; letter-spacing: .17em; }
h1, h2 { margin: 0; letter-spacing: -.055em; }
h1 { font-size: clamp(44px, 8vw, 88px); line-height: .98; }
h2 { font-size: clamp(34px, 5vw, 58px); line-height: 1; }
.lead { max-width: 720px; margin: 24px 0 0; color: var(--muted); font-size: clamp(16px, 2vw, 20px); line-height: 1.8; }

.budget-picker { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.budget-option {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.68);
  padding: 12px 18px;
  font-weight: 750;
}
.budget-option.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.money-panel {
  position: sticky;
  top: 66px;
  z-index: 15;
  margin: 18px 0 24px;
  padding: 22px 24px 18px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255,253,248,.94);
  box-shadow: 0 18px 45px rgba(35,31,24,.08);
}
.money-label { display: block; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
#remainingMoney { display: block; margin-top: 3px; font-size: clamp(30px, 5vw, 56px); letter-spacing: -.055em; }
.money-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.progress-track { height: 5px; overflow: hidden; margin-top: 14px; border-radius: 999px; background: #e9e6dc; }
.progress-track > div { height: 100%; width: 0; background: var(--ink); transition: width .2s ease; }

.controls { display: grid; grid-template-columns: 1fr minmax(220px, 300px); gap: 18px; align-items: end; margin: 28px 0 14px; }
.category-list { display: flex; flex-wrap: wrap; gap: 8px; }
.category-button { border: 1px solid var(--line); background: #fffaf2; border-radius: 12px; padding: 9px 12px; color: #4d4a44; }
.category-button.active { color: #fff; background: var(--ink); border-color: var(--ink); }
.search-box { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.search-box input { width: 100%; border: 1px solid var(--line); border-radius: 13px; background: #fff; padding: 12px 14px; color: var(--ink); outline: none; }
.search-box input:focus { border-color: #88847c; box-shadow: 0 0 0 3px rgba(25,25,25,.06); }

.catalog-section, .cart-section, .result-section { padding-top: 46px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.muted { margin: 0; color: var(--muted); font-size: 13px; }
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.product-card {
  display: flex;
  flex-direction: column;
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  padding: 18px;
  transition: transform .16s ease, box-shadow .16s ease;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(33,29,23,.07); }
.product-icon { font-size: 34px; line-height: 1; }
.product-category { margin: 15px 0 5px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.product-name { font-size: 19px; font-weight: 800; line-height: 1.3; letter-spacing: -.025em; }
.product-note { min-height: 38px; margin: 7px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.product-price { margin-top: auto; font-size: 18px; font-weight: 850; }
.buy-button { width: 100%; margin-top: 13px; border: 0; border-radius: 12px; background: var(--ink); color: #fff; padding: 11px 12px; font-weight: 800; }
.buy-button:disabled { cursor: not-allowed; background: #d6d2c9; color: #858178; }
.empty-state, .cart-empty { border: 1px dashed #cfcac0; border-radius: 18px; padding: 24px; color: var(--muted); text-align: center; background: rgba(255,255,255,.4); }

.cart-list { display: grid; gap: 10px; }
.cart-item { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; border-bottom: 1px solid var(--line); padding: 14px 2px; }
.cart-item-name { font-weight: 800; }
.cart-item-meta { margin-top: 4px; color: var(--muted); font-size: 12px; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.qty-value { min-width: 28px; text-align: center; font-weight: 800; }
.cart-total { min-width: 126px; text-align: right; font-weight: 850; }
.secondary-button, .primary-button { border-radius: 13px; padding: 11px 16px; font-weight: 800; }
.secondary-button { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.primary-button { border: 1px solid var(--ink); background: var(--ink); color: #fff; }

.result-section { scroll-margin-top: 110px; }
.result-card { margin-top: 20px; border-radius: 30px; background: #181818; color: #fff; padding: clamp(24px, 5vw, 46px); }
.result-number { font-size: clamp(38px, 7vw, 76px); font-weight: 900; letter-spacing: -.06em; }
.result-copy { max-width: 760px; margin: 14px 0 28px; color: #d9d7d2; font-size: 17px; line-height: 1.7; }
.analysis-bars { display: grid; gap: 10px; }
.analysis-row { display: grid; grid-template-columns: 92px 1fr 58px; gap: 10px; align-items: center; font-size: 12px; }
.analysis-track { height: 8px; border-radius: 999px; background: #343434; overflow: hidden; }
.analysis-fill { height: 100%; border-radius: 999px; background: #f4f1e9; }
.analysis-percent { text-align: right; color: #ccc; }
.result-purchases { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.result-chip { border: 1px solid #3d3d3d; border-radius: 999px; padding: 8px 11px; color: #d8d6d0; font-size: 12px; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.small-note { color: var(--muted); font-size: 11px; line-height: 1.7; }

footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 26px max(20px, calc((100vw - 1180px)/2)); color: var(--muted); font-size: 12px; }
footer a { color: var(--ink); font-weight: 800; text-decoration: none; }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 40; border-radius: 999px; background: #191919; color: #fff; padding: 11px 16px; font-size: 13px; box-shadow: 0 10px 25px rgba(0,0,0,.16); }

@media (max-width: 900px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .controls { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  main { width: min(100% - 22px, 1180px); padding-top: 24px; }
  .topbar { padding: 12px 14px; }
  .money-panel { top: 54px; padding: 17px; border-radius: 20px; }
  .product-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .product-card { min-height: 230px; border-radius: 17px; padding: 14px; }
  .product-icon { font-size: 29px; }
  .product-name { font-size: 16px; }
  .product-price { font-size: 15px; }
  .buy-button { font-size: 13px; }
  .section-heading { align-items: flex-start; }
  .cart-item { grid-template-columns: 1fr auto; }
  .cart-total { grid-column: 1 / -1; text-align: left; }
  .analysis-row { grid-template-columns: 72px 1fr 46px; }
}
