:root {
  --bg:         #fbf4ea;
  --bg-2:       #f6ecdd;
  --surface:    #ffffff;
  --ink:        #3d332c;
  --ink-2:      #6b5d51;
  --muted:      #94867a;
  --line:       #ede1d1;
  --line-strong:#e0d0ba;

  --brand:      #ef8f3c;
  --brand-d:    #db7a26;
  --brand-soft: #fdeeda;

  --mint:       #3faa73;
  --mint-soft:  #e5f4ec;
  --berry:      #dd6a44;
  --berry-soft: #fbe9e3;
  --sky:        #4a86e8;
  --sky-soft:   #e9f1fb;

  --r-lg: 22px;
  --r-md: 15px;
  --r-sm: 10px;

  --shadow-sm: 0 2px 8px rgba(120,84,44,.08);
  --shadow-md: 0 14px 34px -16px rgba(120,84,44,.30);
  --shadow-pop: 0 0 0 4px var(--brand-soft), 0 14px 34px -16px rgba(120,84,44,.30);

  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 400px at 50% -180px, #fff7ec 0%, rgba(255,247,236,0) 70%),
    var(--bg);
  color: var(--ink);
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 940px; margin: 0 auto; padding: 0 18px; }
.wrap.wide { max-width: 1280px; }
.wrap.admin-wide { max-width: 1600px; } /* 管理画面のみ広く */

a { color: var(--brand-d); }

/* ---------- PR / アフィリエイト表示 ---------- */
.pr-bar {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  background: var(--bg-2); color: var(--muted);
  font-size: 11.5px; font-weight: 600; text-align: center;
  padding: 6px 14px; border-bottom: 1px solid var(--line);
}
.pr-badge {
  flex: none; font-size: 10px; font-weight: 800; letter-spacing: .06em;
  color: #fff; background: var(--muted); border-radius: 4px; padding: 1px 6px;
}
.assoc-note { margin-top: 10px; font-size: 11.5px; line-height: 1.7; opacity: .9; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(251,244,234,.86); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { font-size: 26px; line-height: 1; }
.brand-name { font-weight: 800; font-size: 21px; letter-spacing: .02em; }
.brand-name small { font-size: 11px; color: var(--muted); margin-left: 5px; font-weight: 700; letter-spacing: .12em; }
.site-header nav { display: flex; gap: 2px; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 700; padding: 8px 11px; border-radius: 999px; transition: .15s; white-space: nowrap; }
.site-header nav a:hover { color: var(--brand-d); background: var(--brand-soft); }
.site-header nav a[aria-current="page"] { color: var(--ink); background: var(--bg-2); }
@media (max-width: 620px) {
  .site-header .wrap { height: auto; padding-top: 9px; padding-bottom: 7px; flex-wrap: wrap; gap: 4px 6px; }
  .site-header .site-nav { width: 100%; }
  .site-header nav a { font-size: 12.5px; padding: 6px 9px; }
}

/* ---------- footer ---------- */
.site-footer { margin-top: 56px; padding: 28px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; text-align: center; }
.footer-social { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.footer-social a {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 15px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 12px;
}
.footer-social a:hover { border-color: var(--brand); color: var(--brand-d); }
.footer-social svg { width: 15px; height: 15px; flex: none; }
.footer-links { display: flex; gap: 8px 18px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--brand-d); text-decoration: underline; }
.footer-copy { margin-top: 16px; opacity: .75; }

/* ---------- legal / terms ---------- */
.legal { max-width: 720px; margin: 32px auto 0; font-size: 14px; line-height: 1.9; color: var(--ink); }
.legal h1 { font-size: 22px; margin: 0 0 4px; }
.legal h2 { font-size: 16px; margin: 30px 0 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.legal p { margin: 8px 0; }
.legal ul { margin: 8px 0; padding-left: 1.3em; }
.legal li { margin: 4px 0; }
.legal-updated { color: var(--muted); font-size: 12px; }
.legal-social { display: flex; gap: 14px; flex-wrap: wrap; }
.legal-back { margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--line); }
.legal a { color: var(--brand-d); }

/* ---------- guide (使い方ページ) ---------- */
.guide { max-width: 720px; margin: 30px auto 0; color: var(--ink); font-size: 15px; line-height: 2.0; }
.guide h1 { font-size: 25px; margin: 0 0 6px; letter-spacing: .02em; }
.guide h2 {
  font-size: 19px; margin: 46px 0 16px; letter-spacing: .02em;
  display: flex; align-items: center; gap: 10px;
}
.guide h2::before { content: ""; width: 5px; height: 22px; border-radius: 3px; background: var(--brand); flex: none; }
.guide p { margin: 12px 0; }
.guide b { font-weight: 800; }
.guide a:not(.btn-primary) { color: var(--brand-d); }
.guide .btn-primary { color: #fff; text-decoration: none; }

.guide-lead {
  font-size: 15.5px; line-height: 2.2; margin: 16px 0 4px;
  background: var(--brand-soft); border-radius: var(--r-md); padding: 20px 22px;
}
.guide-cta-row { display: flex; justify-content: center; margin: 22px 0 8px; }
.guide-cta-row .btn-primary { min-width: 300px; }

/* 図（イラスト） */
.guide-fig { margin: 18px 0; text-align: center; }
.guide-fig svg { width: 100%; max-width: 460px; height: auto; }
.guide-fig figcaption { margin-top: 6px; font-size: 12.5px; color: var(--ink-2); }
.guide-figs { display: grid; gap: 22px; margin: 16px 0; }
.guide-figs .guide-fig { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 16px; margin: 0; }
.guide-figs h3 { font-size: 14.5px; margin: 0 0 12px; font-weight: 800; }
.guide-figs .guide-fig svg { max-width: 340px; }
.guide-figs .guide-fig figcaption { margin-top: 12px; }

/* 3D の小ビュー（向きの図） */
.fig3d {
  position: relative; width: 100%; max-width: 340px; margin: 0 auto;
  aspect-ratio: 4 / 3; min-height: 230px;
  border-radius: var(--r-sm); overflow: hidden; background: #efe9df;
  cursor: grab;
}
.fig3d:active { cursor: grabbing; }
.fig3d canvas { display: block; width: 100%; height: 100%; }
.fig3d-badge {
  position: absolute; left: 10px; top: 9px; z-index: 2;
  font-size: 11px; font-weight: 800; color: var(--ink-2);
  background: rgba(255,255,255,.85); border-radius: 999px; padding: 3px 10px;
}
.fig3d-hint {
  position: absolute; right: 10px; bottom: 9px; z-index: 2;
  font-size: 10.5px; color: var(--muted); background: rgba(255,255,255,.7);
  border-radius: 999px; padding: 2px 8px;
}
.fig3d-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; padding: 18px;
  font-size: 12px; color: var(--ink-2); text-align: center;
}
.fig3d-fallback svg { width: 84%; max-width: 300px; height: auto; }

/* こんな方におすすめ */
.guide-for { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 12px; }
.guide-for li {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: var(--r-md); padding: 15px 18px;
}
.guide-for b { display: block; font-size: 15px; line-height: 1.7; margin-bottom: 5px; }
.guide-for span { display: block; color: var(--ink-2); font-size: 13.5px; line-height: 1.9; }

/* 箱探でできること */
.guide-can { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 11px; }
.guide-can li { position: relative; padding-left: 30px; line-height: 1.9; font-size: 14.5px; }
.guide-can li::before {
  content: "✓"; position: absolute; left: 0; top: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--mint-soft); color: #2f7a54;
  display: grid; place-items: center; font-weight: 900; font-size: 12px;
}

/* 使い方 3ステップ */
.guide-steps { list-style: none; counter-reset: gs; padding: 0; margin: 14px 0; display: grid; gap: 12px; }
.guide-steps li { position: relative; padding: 16px 18px 16px 58px; background: var(--bg-2); border-radius: var(--r-md); }
.guide-steps li::before {
  counter-increment: gs; content: counter(gs);
  position: absolute; left: 16px; top: 15px;
  width: 30px; height: 30px; border-radius: 999px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.guide-steps b { display: block; font-size: 15px; margin-bottom: 4px; }
.guide-steps span { display: block; color: var(--ink-2); font-size: 13.5px; line-height: 1.9; }

.guide-note { font-size: 13px; color: var(--ink-2); background: var(--bg-2); border-radius: var(--r-sm); padding: 14px 16px; line-height: 2.0; margin: 12px 0; }

/* よくある質問 */
.guide-faq { margin: 14px 0; }
.guide-faq dt { font-weight: 800; font-size: 15px; margin-top: 22px; }
.guide-faq dt::before { content: "Q  "; color: var(--brand-d); }
.guide-faq dd { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; line-height: 2.0; }
.guide-faq dd::before { content: "A  "; font-weight: 800; color: var(--ink); }

/* 詳しい仕様 */
.spec-dl { margin: 14px 0; display: grid; gap: 0; }
.spec-dl > div { display: grid; grid-template-columns: 168px 1fr; gap: 12px 18px; padding: 13px 0; border-top: 1px solid var(--line); }
.spec-dl > div:last-child { border-bottom: 1px solid var(--line); }
.spec-dl dt { font-weight: 800; font-size: 14px; color: var(--ink); }
.spec-dl dd { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.9; }

@media (max-width: 480px) {
  .guide { font-size: 14.5px; }
  .guide h2 { font-size: 17px; margin-top: 36px; }
  .guide-cta-row .btn-primary { min-width: 0; width: 100%; }
  .spec-dl > div { grid-template-columns: 1fr; gap: 4px; padding: 12px 0; }
}

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; padding: 34px 0 10px; }
.hero h1 { font-size: 27px; margin: 0 0 6px; letter-spacing: .01em; }
.hero p { margin: 0; color: var(--muted); font-size: 14.5px; }
.mascot { width: 104px; height: auto; flex: none; filter: drop-shadow(0 10px 14px rgba(200,140,70,.28)); }
.mascot.mini { width: 64px; }
.state-card .mascot.mini { margin: 0 auto 4px; }

.steps { list-style: none; display: flex; gap: 10px; padding: 0; margin: 18px 0 0; }
.steps li { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 700; color: var(--muted); box-shadow: var(--shadow-sm); }
.steps li span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; flex: none; }

/* ---------- panel / form ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 26px;
  margin-top: 20px;
}

.form-panel form { display: grid; gap: 22px; }
.form-block { display: grid; gap: 12px; }
.form-block > .block-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; margin: 0; }
.form-block > .block-title .emoji { font-size: 18px; }
.block-hint { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 4px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* よく使うグッズのプリセット */
.presets { display: grid; gap: 8px; margin-top: 2px; }
.presets-label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.presets-row { display: flex; flex-wrap: wrap; gap: 7px; }
.preset {
  width: auto; padding: 7px 12px; border: 1.5px solid var(--line-strong);
  border-radius: 999px; background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
  transition: .12s; line-height: 1.2; white-space: nowrap;
}
.preset small { font-weight: 600; color: var(--muted); margin-left: 4px; font-size: 11px; }
.preset:hover { border-color: var(--brand); color: var(--brand-d); background: var(--brand-soft); }
.preset.on { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.preset.on small { color: rgba(255,255,255,.85); }
.presets-note { margin: 0; font-size: 11px; color: var(--muted); }

.field { display: grid; gap: 6px; }
.field > .field-label { font-size: 12.5px; font-weight: 700; color: var(--muted); }

.input-affix { position: relative; display: flex; align-items: center; }
.input-affix input { padding-right: 46px; }
.input-affix .affix { position: absolute; right: 14px; font-size: 12px; font-weight: 700; color: var(--muted); pointer-events: none; }

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: #fffdfa;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394867a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }

.unit-row { display: flex; justify-content: flex-end; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.unit-row select { width: auto; }

.submit-row { display: flex; justify-content: center; padding-top: 4px; }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 260px; padding: 16px 28px;
  font-family: inherit; font-size: 17px; font-weight: 800;
  color: #fff; background: linear-gradient(180deg, #f39a4b, var(--brand));
  border: none; border-radius: 999px; cursor: pointer;
  box-shadow: 0 10px 22px -8px rgba(223,122,38,.65);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn-primary:hover { filter: brightness(1.03); transform: translateY(-1px); box-shadow: 0 14px 26px -8px rgba(223,122,38,.7); }
.btn-primary:active { transform: translateY(1px); }

/* ---------- results ---------- */
.summary-bar {
  display: flex; align-items: center; gap: 12px;
  margin: 24px auto 0; padding: 14px 20px; max-width: 720px;
  background: var(--mint-soft); border: 1px solid #cfe9da; border-radius: 999px;
  font-size: 14px; font-weight: 700; color: #2f7a54;
  scroll-margin-top: 82px; /* 固定ヘッダー(66px)ぶん + 余白 */
}
.summary-bar.plain { background: var(--bg-2); border-color: var(--line); color: var(--muted); }
.summary-bar .big { font-size: 20px; }
.low-note { display: block; text-align: center; margin: 8px auto 0; font-size: 12px; color: var(--muted); font-weight: 700; }

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.result-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 18px 18px;
  display: grid; gap: 13px;
}
.result-card.top { border-color: var(--brand); box-shadow: var(--shadow-pop); }

.ribbon {
  position: absolute; top: -11px; left: 16px;
  background: linear-gradient(180deg, #f39a4b, var(--brand)); color: #fff;
  font-size: 11.5px; font-weight: 800; letter-spacing: .03em;
  padding: 4px 12px; border-radius: 999px;
  box-shadow: 0 8px 16px -6px rgba(223,122,38,.7);
}
.ribbon.second { background: var(--bg-2); color: var(--muted); box-shadow: var(--shadow-sm); }

.card-headline { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.result-name {
  font-size: 16px; font-weight: 800; margin: 0; line-height: 1.4;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}
.result-shop { font-size: 12px; color: var(--muted); font-weight: 700; }

.card-thumb {
  width: 100%; aspect-ratio: 1 / 1; height: auto;
  object-fit: contain; background: #fff;
  border-radius: var(--r-md); border: 1px solid var(--line);
}
@supports not (aspect-ratio: 1 / 1) { .card-thumb { height: 240px; } }

.verdict {
  display: flex; align-items: center; gap: 8px;
  margin: 0; padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 700; line-height: 1.4;
}
.verdict .v-icon { font-size: 16px; flex: none; }
.verdict .v-sub { font-weight: 700; opacity: .75; }
/* ちょうど入る（必要数＝最大収納数）＝ 緑 */
.verdict.exact { background: #d5efdf; color: #237a4c; box-shadow: inset 0 0 0 1.5px #a9dcbf; }
/* 入るが隙間あり ＝ 青 */
.verdict.roomy { background: var(--sky-soft); color: #2f5c9e; box-shadow: inset 0 0 0 1.5px #c7dcf5; }
.verdict b { font-weight: 800; }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { text-align: center; background: var(--bg-2); border-radius: var(--r-sm); padding: 9px 6px; }
.stat-num { display: block; font-size: 16px; font-weight: 800; color: var(--ink); }
.stat-num .per { font-size: 10.5px; font-weight: 700; color: var(--muted); margin-left: 2px; }
.stat-label { display: block; font-size: 10.5px; color: var(--muted); font-weight: 700; margin-top: 1px; }

.fill-block { display: grid; gap: 5px; }
.fill-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.fill-row b { color: var(--ink); font-size: 13px; }
.fill-row.alt b { color: var(--brand-d); }
.gauge { position: relative; height: 10px; background: #efe6d7; border-radius: 999px; overflow: hidden; }
.gauge.sm { height: 7px; }
.gauge-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f5b06a, var(--brand)); transition: width .5s ease; }
.gauge-fill.alt { background: linear-gradient(90deg, #7fc79f, var(--mint)); }

.dims-line { margin: 0; display: flex; flex-direction: column; gap: 1px; font-size: 11.5px; color: var(--muted); font-weight: 600; line-height: 1.55; }
.dims-line b { color: var(--ink); font-weight: 700; }
.ship-size { display: flex; align-items: center; gap: 7px; margin: -2px 0 0; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.ship-badge { flex: none; background: var(--mint-soft); color: #2f7a54; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }

.card-actions { display: grid; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 16px; border-radius: 999px;
  font-family: inherit; font-size: 13.5px; font-weight: 800;
  text-decoration: none; cursor: pointer; border: 1.5px solid var(--line-strong);
  background: #fff; color: var(--ink); transition: .12s;
}
.btn:hover { border-color: var(--brand); color: var(--brand-d); background: var(--brand-soft); }
.btn-buy { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-buy:hover { background: var(--brand-d); border-color: var(--brand-d); color: #fff; }

.calc-details { border-top: 1px dashed var(--line-strong); padding-top: 8px; }
.calc-details summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--muted); list-style: none; padding: 4px 0; }
.calc-details summary::-webkit-details-marker { display: none; }
.calc-details summary::before { content: "▸ "; color: var(--brand); }
.calc-details[open] summary::before { content: "▾ "; }
.spec-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.spec-table th, .spec-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.spec-table th { color: var(--muted); font-weight: 700; width: 46%; }

/* empty / loading / error cards */
.state-card { text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 34px 24px; margin: 18px auto 0; max-width: 640px; scroll-margin-top: 82px; }
.state-card h3 { margin: 12px 0 6px; font-size: 17px; }
.state-card p { margin: 0 auto; color: var(--muted); font-size: 14px; max-width: 420px; }
.state-card ul { display: inline-block; text-align: left; margin: 14px 0 0; padding-left: 20px; color: var(--muted); font-size: 13.5px; }
.state-card.error h3 { color: var(--berry); }
.spinner { width: 34px; height: 34px; border: 4px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; margin: 0 auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(61,51,44,.55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal-box { background: var(--surface); border-radius: var(--r-lg); width: min(980px, 100%); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 40px 80px -20px rgba(0,0,0,.4); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; margin: 0; font-weight: 800; }
.modal-close { background: var(--bg-2); border: none; width: 34px; height: 34px; border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-close:hover { background: var(--brand-soft); color: var(--brand-d); }
.modal-body { display: grid; grid-template-columns: 1fr 300px; min-height: 0; }
.viewer { background: #efe9df; min-height: 440px; }
.viewer canvas { display: block; width: 100%; height: 100%; }
.viewer-side { padding: 18px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.viewer-mode { display: flex; gap: 0; background: var(--bg-2); border-radius: 999px; padding: 3px; }
.viewer-mode button {
  flex: 1; padding: 7px 8px; border: 0; border-radius: 999px; background: transparent;
  cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 800; color: var(--muted);
  white-space: nowrap;
}
.viewer-mode button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.viewer-mode button:disabled { opacity: .4; cursor: not-allowed; }

.viewer-info { margin: 0; font-size: 13px; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.viewer-info dt { color: var(--muted); font-weight: 600; }
.viewer-info dd { margin: 0; font-weight: 800; text-align: right; }
.viewer-controls { display: flex; flex-direction: column; gap: 10px; font-size: 13px; border-top: 1px solid var(--line); padding-top: 14px; }
.viewer-controls button { align-self: flex-start; padding: 8px 16px; border: 1.5px solid var(--line-strong); border-radius: 999px; background: #fff; cursor: pointer; font-family: inherit; font-weight: 700; }
.viewer-controls button:hover { border-color: var(--brand); color: var(--brand-d); }
.viewer-controls label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; }
.viewer-controls input[type=checkbox] { width: auto; margin: 0; accent-color: var(--brand); }
.viewer-controls input[type=range] { width: 100%; accent-color: var(--brand); }
.btn-buy.block { justify-content: center; }

/* ---------- admin ---------- */
.admin-login { max-width: 380px; margin: 48px auto; }
.admin-login h1 { font-size: 19px; margin: 0 0 16px; display: flex; align-items: center; gap: 8px; }
.admin-hd { display: flex; align-items: center; gap: 12px; margin: 8px 0 4px; }
.admin-hd h1 { font-size: 20px; margin: 0; }

/* admin sidebar layout */
.admin-shell { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 22px; margin-top: 22px; align-items: start; }
.admin-main { min-width: 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-md); }
.admin-nav { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 82px; }
.admin-nav button, .admin-nav .nav-logout {
  text-align: left; font-family: inherit; font-size: 13.5px; font-weight: 700;
  padding: 10px 14px; border-radius: 10px; border: 1px solid transparent;
  background: none; color: var(--muted); cursor: pointer; text-decoration: none;
}
.admin-nav button:hover, .admin-nav .nav-logout:hover { background: var(--brand-soft); color: var(--brand-d); }
.admin-nav button.active { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow-sm); }
.admin-nav .nav-logout { margin-top: 12px; border-top: 1px solid var(--line); border-radius: 0; padding-top: 16px; }

.settings-form { display: grid; gap: 16px; }
.settings-form .field { max-width: 520px; }
.settings-form .check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.settings-form .check input { width: auto; accent-color: var(--brand); }
.settings-form fieldset.chk-set { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 14px; display: grid; gap: 8px; }
.settings-form fieldset.chk-set legend { font-size: 12px; color: var(--muted); font-weight: 700; padding: 0 6px; }
.settings-form .prov-fields { display: grid; gap: 12px; padding: 12px 14px; background: var(--bg-2); border-radius: var(--r-sm); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 0; }
.hint-box { font-size: 12.5px; font-weight: 700; color: var(--ink); background: var(--bg-2); border-radius: var(--r-sm); padding: 10px 14px; margin: 0; }
hr.soft { border: none; border-top: 1px dashed var(--line-strong); margin: 22px 0; }
.admin-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 16px 0; }
.admin-toolbar .spacer { flex: 1; }
.admin-toolbar .btn { padding: 10px 16px; font-size: 13.5px; }

table.boxes { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; font-size: 13px; background: var(--surface); box-shadow: var(--shadow-sm); }
table.boxes th, table.boxes td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.boxes th { background: var(--bg-2); color: var(--muted); font-weight: 700; }
table.boxes td.name { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
table.boxes tr:last-child td { border-bottom: none; }
table.boxes tr.disabled { opacity: .5; }
.est-tag { display: inline-block; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-d); margin-left: 6px; vertical-align: middle; }
.row-actions { display: flex; gap: 6px; }
.row-actions button { font-size: 12px; padding: 6px 10px; border: 1.5px solid var(--line-strong); border-radius: 999px; background: #fff; cursor: pointer; font-family: inherit; font-weight: 700; }
.row-actions button:hover { border-color: var(--brand); color: var(--brand-d); }

.editor { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.editor label { display: grid; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.editor label.full { grid-column: 1 / -1; }
.editor label.check { flex-direction: row; align-items: center; display: flex; gap: 8px; }
.editor label.check input { width: auto; }

/* 楽天で検索して登録 */
.rk-search-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rk-search-bar input { flex: 1; min-width: 180px; }
.rk-search-bar input, .rk-search-bar select { padding: 9px 12px; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); font-family: inherit; font-size: 13.5px; background: #fff; }
.rk-results { display: grid; gap: 10px; margin-top: 14px; }
.rk-card { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: start; padding: 12px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: #fff; }
.rk-thumb { width: 72px; height: 72px; object-fit: contain; border-radius: var(--r-sm); background: var(--bg-2); }
.rk-body { min-width: 0; display: grid; gap: 4px; }
.rk-name { font-weight: 700; font-size: 13.5px; color: var(--ink); text-decoration: none; line-height: 1.4; }
.rk-name:hover { color: var(--brand-d); text-decoration: underline; }
.rk-meta { font-size: 12.5px; color: var(--ink-2); }
.rk-dim { display: inline-block; font-size: 12px; font-weight: 700; color: var(--brand-d); background: var(--brand-soft); padding: 2px 8px; border-radius: 999px; }
.rk-dim-none { color: var(--muted); background: var(--bg-2); font-weight: 600; }
.rk-cap { font-size: 12px; }
.rk-cap p { margin: 4px 0 0; white-space: pre-wrap; max-height: 160px; overflow-y: auto; }
.rk-card-actions { display: flex; flex-direction: column; gap: 6px; align-self: center; white-space: nowrap; }
.rk-pick { white-space: nowrap; }
.rk-ban { font-size: 12px; padding: 6px 10px; color: var(--muted); }
.rk-ban:hover { color: #b4442f; border-color: #b4442f; }
@media (max-width: 620px) {
  .rk-card { grid-template-columns: 56px 1fr; }
  .rk-thumb { width: 56px; height: 56px; }
  .rk-card-actions { grid-column: 1 / -1; flex-direction: row; }
  .rk-pick { flex: 1; }
}

.msg { padding: 12px 16px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 700; margin: 12px 0; }
.msg.ok { background: var(--mint-soft); color: #2f7a54; }
.msg.err { background: var(--berry-soft); color: var(--berry); }

code { background: var(--bg-2); padding: 2px 6px; border-radius: 6px; font-size: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero .mascot { justify-self: center; order: -1; }
  .steps { flex-direction: column; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .panel { padding: 20px; }
  .modal-body { grid-template-columns: 1fr; }
  .viewer { min-height: 320px; }
  .viewer-side { border-left: none; border-top: 1px solid var(--line); }
  .editor { grid-template-columns: 1fr 1fr; }
  .btn-primary { width: 100%; min-width: 0; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .admin-nav .nav-logout { margin-top: 0; border-top: none; padding-top: 10px; }
}
