:root {
  --bg: #fbfaf6;
  --surface: #ffffff;
  --ink: #23301f;
  --muted: #6b7a63;
  --line: #e2e5da;
  --accent: #4b7a3f;
  --accent-ink: #ffffff;
  --danger: #a8382c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(35, 48, 31, 0.06), 0 8px 24px rgba(35, 48, 31, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.7;
}

a { color: var(--accent); }

header.site {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

header.site .inner,
main,
footer.site .inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

header.site .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

header.site h1 { font-size: 1.15rem; margin: 0; }
header.site nav { display: flex; gap: 16px; font-size: 0.9rem; }

main { padding: 24px 16px 96px; }

h2 { font-size: 1.05rem; margin: 32px 0 12px; }

.lede { color: var(--muted); margin: 0 0 24px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; font-size: 1rem; }
.card .desc { color: var(--muted); font-size: 0.88rem; margin: 0; white-space: pre-wrap; }
.card .price { font-size: 1.15rem; font-weight: 700; }
.card .price small { font-weight: 400; color: var(--muted); font-size: 0.8rem; }

.slider { position: relative; aspect-ratio: 4 / 3; background: #eef0e8; }
.slider img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slider .noimage {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--muted); font-size: 0.85rem;
}
.slider button.nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  border: none; background: rgba(255, 255, 255, 0.86); color: var(--ink);
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 1rem;
}
.slider button.nav[data-dir="prev"] { left: 8px; }
.slider button.nav[data-dir="next"] { right: 8px; }
.slider .dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.slider .dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.7); }
.slider .dots span.on { background: var(--accent); }

.badge {
  display: inline-block; font-size: 0.75rem; padding: 2px 8px; border-radius: 999px;
  background: #eef0e8; color: var(--muted);
}
.badge.sold { background: #f4e3e1; color: var(--danger); }

button, .btn {
  font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: 8px 14px;
}
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--danger); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--ink); width: 100%;
}
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 0.9rem; color: var(--ink); }
label.inline input { width: auto; }

.cart {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface);
  border-top: 1px solid var(--line); box-shadow: var(--shadow); z-index: 20;
  /* 時間帯・備考の欄が入って背が高くなったので、画面を覆い切らないようにする。 */
  max-height: 75vh; overflow-y: auto;
}
.cart .inner { max-width: 1040px; margin: 0 auto; padding: 12px 16px; }
.cart table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.cart td { padding: 4px 0; }
.cart td.num { text-align: right; white-space: nowrap; }
.cart .total { font-weight: 700; }
.order-options { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.order-options .field { min-width: 160px; }
.order-options .field.grow { flex: 1; min-width: 240px; }
.order-options textarea { resize: vertical; }
.order-options small { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 4px; }

.notice { padding: 10px 14px; border-radius: 8px; background: #eef3ea; border: 1px solid var(--line); font-size: 0.9rem; }
.notice.error { background: #f9ecea; border-color: #e6cdc9; color: var(--danger); }

footer.site { border-top: 1px solid var(--line); background: var(--surface); }
footer.site .inner { padding: 20px 16px; font-size: 0.85rem; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; }

table.list { width: 100%; border-collapse: collapse; background: var(--surface); }
table.list th, table.list td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; font-size: 0.9rem; vertical-align: top; }
table.list th { color: var(--muted); font-weight: 600; }
/* 要対応の注文（決済は進んだが在庫を確保できなかった）は見落とすと損失に直結する。 */
table.list tr.attention td { background: #fdf1ef; box-shadow: inset 3px 0 0 var(--danger); }
table.list tr.attention td:first-child { font-weight: 700; }
.panel.attention { background: #fdf1ef; border-color: #e6cdc9; box-shadow: inset 3px 0 0 var(--danger); }

.stack { display: flex; flex-direction: column; gap: 12px; }
/* 管理画面の確認ダイアログ（返金済みにする）。 */
.confirm-dialog {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; width: min(480px, calc(100% - 32px));
}
.confirm-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { width: 84px; }
.thumb img { width: 84px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.thumb .row { gap: 4px; margin-top: 4px; }
.thumb button { padding: 2px 6px; font-size: 0.75rem; }

dl.tokusho { display: grid; grid-template-columns: 200px 1fr; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
dl.tokusho dt { padding: 12px 16px; background: #f4f5ef; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 0.9rem; }
dl.tokusho dd { padding: 12px 16px; margin: 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; white-space: pre-wrap; }

@media (max-width: 640px) {
  dl.tokusho { grid-template-columns: 1fr; }
  dl.tokusho dt { border-bottom: none; }
}

/*
 * レイアウトの小物。CSP が style-src 'self' なので、HTML の style 属性は使えない
 * （インラインのスタイルはブロックされる）。代わりにここのクラスを付ける。
 * JS から element.style.xxx に代入するのは CSP の対象外なので、admin.js はそのままでよい。
 */
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.m-0 { margin: 0; }
.m-0.mb-12 { margin: 0 0 12px; }
.max-420 { max-width: 420px; }
.max-520 { max-width: 520px; }
.grow-1 { flex: 1; }
.grow-2 { flex: 2; }
.min-100 { min-width: 100px; }
.min-120 { min-width: 120px; }
.min-140 { min-width: 140px; }
.min-160 { min-width: 160px; }
.min-200 { min-width: 200px; }
/* label.inline { margin: 0 } の方が詳細度が高いので、ここだけ合わせて上書きする。 */
label.inline.mt-20 { margin-top: 20px; }

/*
 * ショップの客向けページ（index.html・success.html・cancel.html の body.has-bg）に付ける背景。満月の夜の田んぼ。
 * 特商法のページは文章が長く読みやすさを優先して付けない。管理画面にも付けない。
 * 画像は /assets/ 配下（同一オリジン）なので CSP の img-src 'self' のままでよい。
 * background-attachment: fixed は iOS Safari で効かないので、固定した疑似要素に敷く。
 * 上に薄い紺のグラデーションを重ねて、背景の上に直接載る文字（送料の案内など）を読みやすくする。
 */
body.has-bg { background: #0e1a33; }
/* 商品が少ないとフッタが画面の途中に浮いて、その下にも背景が見えるので、フッタを画面の下に寄せる。 */
body.has-bg { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body.has-bg main { flex: 1; width: 100%; }
body.has-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(10, 18, 40, 0.15), rgba(10, 18, 40, 0.5)),
    url("/assets/bg-night-paddy.webp") 56% 30% / cover no-repeat;
}
@media (max-width: 900px) {
  body.has-bg::before {
    background:
      linear-gradient(rgba(10, 18, 40, 0.15), rgba(10, 18, 40, 0.5)),
      url("/assets/bg-night-paddy-sm.webp") 56% 30% / cover no-repeat;
  }
}
/* 背景の上に直接出る文字は明るく。カードの中は従来どおり濃い文字。 */
body.has-bg .lede,
body.has-bg .grid,
body.has-bg main > h2,
body.has-bg main > p:not(.notice) { color: #f3f1e4; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
/* success / cancel の「買い物を続ける」など。濃い緑のリンクは背景に沈むので明るい色にする。 */
body.has-bg main > p:not(.notice) a { color: #e8f0c8; }
body.has-bg .lede { font-weight: 500; }
body.has-bg .card { color: var(--ink); text-shadow: none; box-shadow: var(--shadow); border-color: transparent; }
/* ヘッダとフッタは少し透かして、背景とつながって見えるようにする。 */
body.has-bg header.site,
body.has-bg footer.site {
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
