:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --surface: #ffffff;
  --line: #e2e5df;
  --ink: #121514;
  --muted: #6e746f;
  --soft: #f1f4ef;
  --green: #2f8b4c;
  --green-deep: #166534;
  --green-soft: #e7f4ec;
  --red: #e51f27;
  --red-soft: #fff1f1;
  --purple: #7718b6;
  --blue: #1e70e8;
  --orange: #c76418;
  --shadow: 0 10px 28px rgba(31, 42, 34, 0.1);
  --card-shadow: 0 3px 12px rgba(31, 42, 34, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Yu Gothic", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #ffffff 0, var(--bg) 48rem);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100vw, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: none;
  overflow: hidden;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  padding: 18px 18px 12px;
  background: rgba(247, 248, 245, 0.94);
  backdrop-filter: blur(14px);
}

.screen-kicker {
  margin: 0 0 3px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  text-align: center;
  letter-spacing: 0;
}

h2,
h3,
p {
  margin-top: 0;
}

.screen {
  flex: 1;
  padding: 8px 16px 108px;
  overflow-x: hidden;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: #424742;
  cursor: pointer;
}

.icon-button svg,
.nav-item svg,
.chip-icon,
.inline-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button.ghost {
  border-color: transparent;
  background: transparent;
}

.icon-button.danger {
  color: var(--red);
}

.primary-action,
.secondary-action,
.text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.primary-action {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.secondary-action {
  background: var(--surface);
  color: var(--green);
}

.text-action {
  min-height: 36px;
  padding: 0 12px;
  color: var(--green);
}

.full-width {
  width: 100%;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin: 8px 0 16px;
}

.search-box {
  position: relative;
}

.search-box svg {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  color: #727872;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-box input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px 0 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 15px;
  outline: none;
}

.search-box input:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 139, 76, 0.14);
}

.chip-row {
  display: flex;
  gap: 10px;
  padding: 0 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 92px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: #2b2f2c;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.chip.active {
  border-color: transparent;
  background: var(--green);
  color: #fff;
  box-shadow: 0 6px 15px rgba(47, 139, 76, 0.22);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.section-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.list-stack {
  display: grid;
  gap: 12px;
}

.product-card,
.panel,
.store-row,
.summary-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.product-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  min-height: 188px;
  overflow: hidden;
}

.product-visual {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: #fbfcfa;
  border-right: 1px solid var(--line);
}

.product-visual img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(22, 28, 22, 0.14));
}

.fav-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #68706a;
  cursor: pointer;
}

.fav-button.active {
  border-color: #f3d78b;
  background: #fff8df;
  color: #bd7b00;
}

.fav-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
}

.product-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.product-title-row {
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 8px;
  padding: 16px 12px 10px;
}

.product-name {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.product-meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.category {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(var(--store-count, 3), minmax(92px, 1fr));
  margin-top: auto;
  border-top: 1px solid var(--line);
  overflow-x: auto;
}

.price-cell {
  position: relative;
  min-height: 94px;
  padding: 10px 8px 9px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  text-align: center;
  cursor: pointer;
}

.price-cell:last-child {
  border-right: 0;
}

.price-cell.sale {
  background: linear-gradient(180deg, #fff, var(--red-soft));
}

.price-cell.sale .current-price {
  margin-top: 14px;
}

.store-name {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 900;
  color: var(--store-color, var(--green));
}

.current-price {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  color: #202422;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.price-cell.sale .current-price,
.price-red {
  color: var(--red);
}

.yen {
  font-size: 16px;
  font-weight: 900;
}

.date-label,
.old-price,
.small-muted {
  color: var(--muted);
  font-size: 12px;
}

.old-price {
  display: inline-block;
  margin-left: 4px;
  text-decoration: line-through;
}

.sale-badge,
.best-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 5px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.sale-badge {
  background: var(--red);
}

.best-badge {
  background: var(--green);
}

.cell-badges {
  position: absolute;
  top: 9px;
  right: 7px;
  display: grid;
  gap: 4px;
  justify-items: end;
}

.summary-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 12px 0;
  overflow: hidden;
}

.summary-strip div {
  padding: 10px;
  text-align: center;
}

.summary-strip div + div {
  border-left: 1px solid var(--line);
}

.summary-strip strong {
  color: var(--green);
  font-size: 22px;
}

.panel {
  padding: 14px;
}

.panel + .panel {
  margin-top: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-title h2,
.panel-title h3 {
  margin: 0;
  font-size: 18px;
}

.detail-hero {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 16px;
  align-items: center;
  padding: 12px 4px 18px;
}

.detail-hero img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  filter: drop-shadow(0 10px 13px rgba(22, 28, 22, 0.16));
}

.detail-hero h2 {
  margin: 0 0 4px;
  font-size: 30px;
  line-height: 1.15;
}

.unit-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #3d433e;
  font-size: 13px;
  font-weight: 700;
}

.featured-price {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid #ffc8c8;
  border-radius: 8px;
  background: var(--red-soft);
}

.featured-price .store-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.featured-price .store-line strong {
  color: var(--store-color, var(--green));
  font-size: 20px;
}

.featured-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.featured-main .big-price {
  color: var(--red);
  font-size: 58px;
  font-weight: 950;
  line-height: 0.95;
}

.discount-seal {
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 20px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
}

.saving {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border: 1px solid #ffc6c6;
  border-radius: 6px;
  background: #fff;
  color: #6d3636;
  font-size: 13px;
  font-weight: 800;
}

.saving strong {
  color: var(--red);
  font-size: 18px;
}

.compare-bars {
  display: grid;
  grid-template-columns: 44px repeat(var(--store-count, 3), minmax(74px, 1fr));
  align-items: end;
  min-height: 266px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(#eef0ec 1px, transparent 1px) 0 40px / 100% 40px,
    #fff;
}

.axis {
  align-self: stretch;
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  padding: 22px 5px 24px 8px;
  color: var(--muted);
  font-size: 11px;
  border-right: 1px solid var(--line);
}

.bar-slot {
  position: relative;
  display: grid;
  align-items: end;
  justify-items: center;
  min-height: 264px;
  padding: 36px 8px 28px;
  border-right: 1px solid var(--line);
}

.bar-slot:last-child {
  border-right: 0;
}

.bar {
  width: 54px;
  max-width: 80%;
  min-height: 6px;
  border-radius: 6px 6px 0 0;
  background: color-mix(in srgb, var(--store-color, var(--green)) 82%, #fff);
}

.bar-label {
  position: absolute;
  top: 14px;
  left: 6px;
  right: 6px;
  display: grid;
  gap: 2px;
  justify-items: center;
  text-align: center;
}

.bar-label .price {
  font-size: 21px;
  font-weight: 950;
}

.bar-label .old-price {
  margin: 0;
}

.bar-store {
  position: absolute;
  bottom: 8px;
  left: 4px;
  right: 4px;
  color: var(--store-color, var(--green));
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-wrap {
  width: 100%;
  overflow-x: auto;
}

.line-chart {
  min-width: 360px;
  width: 100%;
  height: 230px;
}

.line-chart text {
  fill: #606861;
  font-size: 11px;
}

.line-chart .grid {
  stroke: #e4e7e2;
  stroke-width: 1;
}

.line-chart .series-line {
  fill: none;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-chart .point {
  fill: #fff;
  stroke-width: 2.5;
}

.line-chart .point.active {
  fill: currentColor;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.mini-table th,
.mini-table td {
  padding: 10px 6px;
  border-top: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.mini-table th:first-child,
.mini-table td:first-child {
  text-align: left;
}

.mini-table th {
  color: #2a2f2b;
  font-weight: 900;
}

.mini-table .price {
  font-size: 18px;
  font-weight: 950;
}

.food-mini {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.food-mini img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.food-mini span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
}

button.history-row {
  cursor: pointer;
}

.history-row img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.history-row h3 {
  margin: 0 0 2px;
  font-size: 15px;
  line-height: 1.35;
}

.history-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.history-price {
  justify-self: end;
  text-align: right;
  font-weight: 950;
}

.store-row {
  display: grid;
  grid-template-columns: 50px 1fr auto 36px auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.store-logo {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: var(--store-color, var(--green));
  color: #fff;
  font-size: 13px;
  font-weight: 950;
}

.store-logo-img {
  display: block;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.store-row h3 {
  margin: 0 0 2px;
  font-size: 17px;
}

.store-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 31px;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #b7bbb7;
  cursor: pointer;
  transition: 0.18s ease;
}

.slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.24);
  transition: 0.18s ease;
}

.switch input:checked + .slider {
  background: var(--green);
}

.switch input:checked + .slider::before {
  transform: translateX(23px);
}

.reorder {
  display: grid;
  grid-template-columns: 28px;
  gap: 4px;
}

.reorder button {
  display: grid;
  width: 28px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #555b56;
  cursor: pointer;
}

.store-edit-button {
  width: 34px;
  height: 34px;
}

.info-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.info-row:first-child {
  border-top: 0;
}

.info-row span:first-child {
  color: var(--muted);
}

.empty {
  display: grid;
  gap: 12px;
  place-items: center;
  padding: 36px 24px;
  border: 1px dashed #cbd2ca;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.empty h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100vw, 430px);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.nav-item {
  display: grid;
  gap: 2px;
  place-items: center;
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7a807b;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.nav-item.active {
  color: var(--green);
  background: var(--green-soft);
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 18px;
  background: rgba(18, 21, 20, 0.36);
}

.modal-root.hidden,
.toast.hidden {
  display: none;
}

.modal {
  width: min(100%, 430px);
  max-height: min(88dvh, 760px);
  overflow: auto;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.modal-header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.modal-body {
  padding: 14px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field label {
  color: #343936;
  font-size: 13px;
  font-weight: 900;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.form-field textarea {
  min-height: 78px;
  resize: vertical;
}

.form-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 94px;
  z-index: 60;
  width: min(calc(100vw - 32px), 398px);
  padding: 12px 14px;
  transform: translateX(-50%);
  border-radius: 8px;
  background: #111714;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow);
}

@media (min-width: 700px) {
  body {
    padding: 28px 0;
  }

  .app-shell {
    min-height: calc(100dvh - 56px);
    border: 1px solid #d6dad4;
    border-radius: 26px;
    box-shadow: 0 18px 48px rgba(18, 21, 20, 0.16);
  }

  .top-bar {
    border-radius: 26px 26px 0 0;
  }

  .bottom-nav {
    bottom: 28px;
    border-radius: 0 0 26px 26px;
  }
}

@media (max-width: 380px) {
  .screen {
    padding-left: 12px;
    padding-right: 12px;
  }

  .product-card {
    grid-template-columns: 96px 1fr;
  }

  .product-visual img {
    width: 74px;
    height: 74px;
  }

  .product-name {
    font-size: 19px;
  }

  .current-price {
    font-size: 22px;
  }

  .featured-main .big-price {
    font-size: 48px;
  }

  .discount-seal {
    width: 74px;
    height: 74px;
    font-size: 17px;
  }

  .form-two {
    grid-template-columns: 1fr;
  }
}
