/* カバンの重さ計算：帆布のトートと、台所の丸いはかり。クラフト紙の荷札に持ち物を書き、合計は針で示す
   色は生成りの帆布・クラフト紙・こげ茶の糸・オリーブ・はかりの赤い針。端末の明暗によらず明るい紙の上で見せる */
:root {
  --canvas: #f4eee2; --kraft: #e6d5b8; --kraft-deep: #cdb48b; --ink: #2c2418; --ink-soft: #5e5039;
  --olive: #5c6b2f; --olive-deep: #44511f; --needle: #c8442b; --cream: #fffaf0; --stitch: #8a7556;
  --maru: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Kosugi Maru", "M PLUS Rounded 1c", system-ui, sans-serif;
  --narrow: "Archivo Narrow", "Arial Narrow", "Roboto Condensed", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; background: var(--canvas); }
body {
  margin: 0; color: var(--ink); font-family: var(--maru); font-weight: 500; line-height: 1.8; font-size: 16px;
  background-color: var(--canvas);
  /* 帆布の織り目 */
  background-image:
    repeating-linear-gradient(0deg, rgba(92, 72, 40, 0.035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(92, 72, 40, 0.035) 0 1px, transparent 1px 3px);
}
a { color: var(--olive-deep); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
strong { font-weight: 700; }

/* 頭：クラフト紙の帯と、ミシンの縫い目 */
.site-header { background: var(--kraft); padding: 12px 16px 14px; position: relative; box-shadow: 0 2px 0 var(--kraft-deep); }
.site-header::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 5px; border-bottom: 2px dashed var(--stitch); opacity: 0.7; }
.site-name { font-family: var(--maru); font-weight: 900; font-size: 1.12rem; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.site-name::before { content: "g"; font-family: var(--narrow); font-weight: 700; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--kraft); font-size: 1rem; line-height: 1; }
.pr-notice { margin: 4px 0 0; font-size: 0.8rem; color: var(--ink-soft); }
.site-main { max-width: 780px; margin: 0 auto; padding: 18px 16px 24px; }

h1 { font-weight: 900; font-size: 1.5rem; line-height: 1.4; margin: 8px 0 14px; letter-spacing: 0.01em; }
h2 { font-weight: 900; font-size: 1.22rem; line-height: 1.45; margin: 40px 0 12px; display: flex; align-items: center; gap: 10px; }
/* 見出しの頭に、荷札の小さなひも穴 */
h2::before { content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--olive); background: var(--canvas); box-shadow: 0 0 0 3px var(--kraft); }
h3 { font-weight: 700; font-size: 1.04rem; margin: 22px 0 6px; padding-bottom: 2px; border-bottom: 2px dotted var(--kraft-deep); }
.lead { font-size: 0.97rem; }
.lead strong { background: linear-gradient(transparent 62%, rgba(200, 68, 43, 0.22) 62%); }
.hint, .note { font-size: 0.94rem; color: var(--ink-soft); margin: 4px 0 0; }

/* はじめ：荷札の形の見出し */
.hero { position: relative; margin: 6px 0 8px; }
.hero-tag { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 3px 14px 3px 8px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em;
  background: var(--kraft); clip-path: polygon(10px 0, 100% 0, 100% 100%, 10px 100%, 0 50%); padding-left: 18px; }
.hero-tag span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--needle); color: var(--cream); font-family: var(--narrow); font-weight: 700; line-height: 1; }
.hero h1 { margin: 0 0 12px; }
.h1-a { display: block; font-size: 1.02rem; font-weight: 700; color: var(--ink-soft); }
.h1-b { display: inline-block; font-size: 2.35rem; line-height: 1.2; letter-spacing: 0.02em; position: relative; margin-right: 4px; }
.h1-b + .h1-a { display: inline; font-size: 1.5rem; color: var(--ink); font-weight: 900; }
.h1-b::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 6px; border-radius: 3px; background: var(--needle); transform-origin: left; }

/* 表・入力・ボタン */
table { border-collapse: collapse; width: 100%; font-size: 0.94rem; background: var(--cream); }
th, td { border-bottom: 1px solid var(--kraft-deep); padding: 8px 8px; text-align: left; }
thead th { background: var(--ink); color: var(--kraft); font-weight: 700; font-size: 0.82rem; border-bottom: 0; }
caption { text-align: left; font-size: 0.85rem; color: var(--ink-soft); padding: 4px 0; }
.table-wrap { overflow-x: auto; border-radius: 10px; border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--kraft-deep); background: var(--cream); margin: 12px 0; }
label { display: block; font-weight: 700; margin: 12px 0 4px; }
input, select, button { font: inherit; }
input[type="text"], select { width: 100%; min-height: 46px; padding: 9px 12px; border: 2px solid var(--ink); border-radius: 10px; background: var(--cream); color: var(--ink); }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--needle); outline-offset: 2px; }
button { min-height: 46px; padding: 8px 18px; border-radius: 999px; border: 2px solid var(--ink); background: var(--olive); color: var(--cream); font-weight: 700; cursor: pointer;
  box-shadow: 0 3px 0 var(--ink); transition: transform 0.08s, box-shadow 0.08s; }
button:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
button.secondary { background: var(--cream); color: var(--ink); }
input[aria-invalid="true"] { border-color: var(--needle); border-width: 3px; }
.err { color: var(--needle); font-size: 0.8rem; min-height: 1.1em; margin: 2px 0 0; font-weight: 700; }

/* 線画のアイコン（currentColor の線だけ） */
.icon { display: inline-block; width: 28px; height: 28px; flex: none; background: currentColor; vertical-align: middle;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.icon-laptop { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Crect x='6' y='7' width='20' height='13'/%3E%3Cpath d='M3 24h26l-2-4H5z'/%3E%3C/svg%3E"); }
.icon-tablet { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23000' stroke-width='1.6'%3E%3Crect x='7' y='4' width='18' height='24' rx='2'/%3E%3Ccircle cx='16' cy='24.5' r='1'/%3E%3C/svg%3E"); }
.icon-charger { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Crect x='8' y='10' width='16' height='16' rx='2'/%3E%3Cpath d='M12 10V4M20 10V4M14 18h4M16 15v6'/%3E%3C/svg%3E"); }
.icon-battery { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Crect x='9' y='5' width='14' height='23' rx='2'/%3E%3Cpath d='M17 10l-4 7h5l-3 6'/%3E%3C/svg%3E"); }
.icon-earbud { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Crect x='5' y='16' width='22' height='12' rx='5'/%3E%3Cpath d='M5 21h22'/%3E%3Ccircle cx='11' cy='9' r='3.5'/%3E%3Cpath d='M11 12.5V16M21 12.5V16'/%3E%3Ccircle cx='21' cy='9' r='3.5'/%3E%3C/svg%3E"); }
.icon-custom { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M6 12h20l-2 16H8z'/%3E%3Cpath d='M12 12V9a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E"); }

/* カバン：帆布のトート。2 本の持ち手と、ふちの縫い目 */
.bag { position: relative; margin: 66px 0 22px; padding: 18px 12px 16px; background: var(--olive); color: var(--cream); border-radius: 10px 10px 26px 26px;
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.12), 0 8px 0 -2px var(--kraft-deep); }
.bag::before, .bag::after { content: ""; position: absolute; top: -50px; width: 30%; height: 64px; border: 9px solid var(--olive-deep); border-bottom: 0; border-radius: 60px 60px 0 0; }
.bag::before { left: 14%; }
.bag::after { right: 14%; }
.bag > * { position: relative; z-index: 1; }
.bag-title { display: block; margin: 0 0 6px; text-align: center; font-size: 0.95rem; letter-spacing: 0.2em; color: #f4ead6; }
.bag-title::before { display: none; }
/* ふちの縫い目 */
.bag { outline: 2px dashed rgba(255, 250, 240, 0.45); outline-offset: -8px; }

/* はかり：クリーム色の文字盤。0 から 5kg まで、赤い針が回る */
.scale { display: flex; justify-content: center; height: 146px; overflow: hidden; margin: 2px 0 0; }
.dial { --deg: -120deg; position: relative; flex: none; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fffdf7, var(--cream) 60%, #efe3c9);
  border: 7px solid var(--ink); box-shadow: inset 0 0 0 4px var(--kraft); }
.ticks { position: absolute; inset: 6px; border-radius: 50%;
  background:
    repeating-conic-gradient(from -121deg, var(--ink) 0 2deg, transparent 2deg 24deg),
    repeating-conic-gradient(from -120.5deg, var(--ink-soft) 0 1deg, transparent 1deg 6deg);
  -webkit-mask: radial-gradient(circle, transparent 0 64px, #000 65px 80px, transparent 81px);
  mask: radial-gradient(circle, transparent 0 64px, #000 65px 80px, transparent 81px); }
.ticks::after { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 120deg, var(--cream) 0 120deg, transparent 120deg); }
.dial::before { content: "0"; position: absolute; left: 46px; top: 110px; font-family: var(--narrow); font-weight: 700; font-size: 0.85rem; color: var(--ink); }
.dial-max { position: absolute; right: 34px; top: 110px; font-family: var(--narrow); font-weight: 700; font-size: 0.85rem; color: var(--ink); line-height: 1; }
.dial::after { content: "2.5kg"; position: absolute; left: 0; right: 0; top: 30px; text-align: center; font-family: var(--narrow); font-weight: 700; font-size: 0.8rem; color: var(--ink-soft); }
.needle { position: absolute; left: calc(50% - 2px); top: 18px; width: 4px; height: 75px; border-radius: 2px; background: var(--needle); transform-origin: 50% 100%; transform: rotate(var(--deg)); }
.needle::before { content: ""; position: absolute; left: -4px; top: -2px; border: 6px solid transparent; border-bottom: 10px solid var(--needle); transform: translateY(-12px); }
.hub { position: absolute; left: calc(50% - 10px); top: calc(50% - 10px); width: 20px; height: 20px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 4px var(--needle); }

/* 合計：はかりの下の札 */
.total { text-align: center; margin: -6px auto 6px; padding: 8px 12px 10px; max-width: 330px; background: var(--cream); color: var(--ink); border-radius: 6px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2); }
.total .label { display: block; font-size: 0.8rem; letter-spacing: 0.08em; color: var(--ink-soft); font-weight: 700; }
.total .num { display: block; font-family: var(--narrow); font-size: 3.6rem; line-height: 1.02; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.total .sub { font-size: 0.94rem; font-weight: 700; }
.lighter { font-size: 0.94rem; text-align: center; margin: 8px 0 10px; min-height: 1.2em; color: var(--kraft); font-weight: 700; }

/* 入れた物：クラフト紙の荷札 */
.bag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bag-list li { position: relative; display: grid; grid-template-columns: 26px 1fr auto; grid-template-rows: auto 1fr; gap: 2px 8px; align-items: start; padding: 10px 8px 10px 26px; background: var(--kraft); color: var(--ink);
  clip-path: polygon(18px 0, 100% 0, 100% 100%, 18px 100%, 0 calc(100% - 18px), 0 18px); }
.bag-list li::before { content: ""; position: absolute; left: 8px; top: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--olive); box-shadow: inset 0 0 0 2px var(--kraft-deep); }
.bag-list .icon { color: var(--ink); margin-top: 2px; width: 26px; height: 26px; grid-row: 1 / 3; }
.bag-list .bag-info { grid-column: 2; grid-row: 1 / 3; }
.bag-list .bag-g { grid-column: 3; grid-row: 1; text-align: right; }
.bag-list .remove { grid-column: 3; grid-row: 2; justify-self: end; }
.bag-info { flex: 1; min-width: 0; }
.bag-name { display: block; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.bag-meta, .bag-best { display: block; font-size: 0.8rem; line-height: 1.5; color: var(--ink-soft); }
.bag-best { color: var(--olive-deep); font-weight: 700; }
.bag-swap { display: block; font-size: 0.94rem; line-height: 1.5; margin-top: 6px; padding: 6px 8px; background: var(--cream); border-radius: 6px; border-left: 4px solid var(--needle); }
.bag-swap .swap { min-height: 34px; padding: 2px 12px; margin-top: 6px; font-size: 0.94rem; box-shadow: 0 2px 0 var(--ink); }
.bag-g { font-family: var(--narrow); font-weight: 700; font-size: 1.3rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.remove { min-height: 38px; min-width: 38px; padding: 0; border-radius: 50%; background: transparent; color: var(--ink); border-color: var(--ink-soft); box-shadow: none; font-size: 1.1rem; line-height: 1; }
.bag-empty { text-align: center; font-size: 0.94rem; margin: 10px 0; color: #f4ead6; }
.bag-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.bag-actions button { border-color: var(--cream); box-shadow: 0 3px 0 var(--olive-deep); }
.share-msg { font-size: 0.94rem; overflow-wrap: anywhere; margin: 6px 0 0; text-align: center; color: var(--cream); }

/* 入れる物を選ぶ：部門ごとに荷札の欄 */
.pick { margin: 10px 0 0; padding: 4px 12px 12px; background: var(--cream); border: 2px solid var(--ink); border-radius: 12px; }
.pick label { display: flex; align-items: center; gap: 8px; margin: 8px 0 6px; }
.pick label .icon { color: var(--olive); }
.pick-row { display: flex; gap: 6px; }
.pick-row select { flex: 1; min-width: 0; }
.pick-row .add { flex: none; }
.add-msg { font-size: 0.94rem; font-weight: 700; min-height: 1.3em; margin: 10px 0 0; color: var(--olive-deep); }
.custom { margin-top: 18px; padding: 6px 12px 14px; border: 2px dashed var(--stitch); border-radius: 12px; background: rgba(230, 213, 184, 0.45); }
.custom label { display: flex; align-items: center; gap: 8px; }
.custom .row { display: grid; grid-template-columns: 1fr 8.5em; gap: 0 8px; }

/* ランキング：重さは右に大きく */
.rank td, .rank th { vertical-align: top; }
.rank td:first-child { min-width: 5.5em; font-weight: 700; }
.rank .g { font-family: var(--narrow); font-weight: 700; font-size: 1.25rem; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.rank .g .u { font-size: 0.7em; margin-left: 1px; color: var(--ink-soft); }
.table-wrap .rank td:nth-child(2) { white-space: normal; }
.rank td:nth-child(2) { min-width: 6.5em; }
.rank th, .rank td { padding: 8px 6px; }
.rank td:first-child { font-size: 0.86rem; }
.rank tbody tr:first-child td { background: rgba(92, 107, 47, 0.1); }
.pname { display: block; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.pmeta { display: inline-block; font-size: 0.8rem; line-height: 1.4; color: var(--ink-soft); }
.rank .src { font-size: 0.8rem; white-space: nowrap; }
.rank .date { font-size: 0.8rem; color: var(--ink-soft); }
.summary { padding: 10px 12px; background: var(--kraft); border-radius: 10px; font-size: 0.94rem; }
.sources { padding-left: 1.2em; font-size: 0.94rem; }
.sources li { margin-bottom: 10px; overflow-wrap: anywhere; }

/* 部門の入口：荷札を並べる */
.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0; margin: 14px 0; list-style: none; }
.cats a { position: relative; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 10px 8px 26px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 0.94rem; line-height: 1.4;
  background: var(--kraft); clip-path: polygon(14px 0, 100% 0, 100% 100%, 14px 100%, 0 calc(100% - 14px), 0 14px); transition: background 0.15s; }
.cats a::before { content: ""; position: absolute; left: 7px; top: calc(50% - 4px); width: 8px; height: 8px; border-radius: 50%; background: var(--canvas); }
.cats a:hover { background: var(--kraft-deep); }
.cats .icon { color: var(--olive); }

/* 画面の下に固定した合計：小さなはかりの札 */
.mini { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 16px calc(9px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--kraft); text-decoration: none; border-top: 3px solid var(--needle); }
.mini-msg { font-size: 0.8rem; line-height: 1.35; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-total { white-space: nowrap; font-size: 0.82rem; }
.mini-total strong { font-family: var(--narrow); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--cream); margin-left: 4px; }

/* 足：帆布の縫い目 */
.site-footer { margin-top: 48px; padding: 20px 16px; font-size: 0.94rem; color: var(--ink-soft); text-align: center; background: var(--kraft); position: relative; }
.site-footer::before { content: ""; position: absolute; left: 10px; right: 10px; top: 6px; border-top: 2px dashed var(--stitch); opacity: 0.7; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; }
.site-footer a { color: var(--ink); }
.copyright { margin: 8px 0 0; }
body:has(.mini) .site-footer { padding-bottom: 80px; }
.facts dt { font-weight: 700; margin-top: 8px; }
.facts dd { margin: 0 0 4px; }
.ad-slot { margin: 24px 0; }

/* PC：カバンと選ぶ欄を横に並べず、はかりを大きく */
@media (min-width: 760px) {
  .h1-b { font-size: 3rem; }
  .bag { padding: 24px 28px 22px; }
  .scale { height: 176px; }
  .dial { width: 240px; height: 240px; }
  .ticks { -webkit-mask: radial-gradient(circle, transparent 0 80px, #000 81px 98px, transparent 99px); mask: radial-gradient(circle, transparent 0 80px, #000 81px 98px, transparent 99px); }
  .needle { top: 22px; height: 91px; }
  .dial::before { left: 54px; top: 134px; }
  .dial-max { right: 40px; top: 134px; }
  .dial::after { top: 38px; }
  .total .num { font-size: 4.4rem; }
  .cats { grid-template-columns: repeat(3, 1fr); }
}

/* PC：左にカバン（はかり）を止めて、右で持ち物を選ぶ。左右を空けない（12/1 採点） */
@media (min-width: 1080px) {
  .site-main { max-width: 1200px; padding: 28px 40px 32px; }
  .hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 40px; align-items: end; }
  .hero-tag { grid-column: 1 / -1; justify-self: start; }
  .hero h1 { margin: 0; }
  .hero .lead { max-width: 30em; margin: 0 0 6px; }
  .work { display: grid; grid-template-columns: 460px minmax(0, 1fr); gap: 0 48px; align-items: start; }
  .work > .bag { position: sticky; top: 72px; margin-top: 70px; }
  .work > section:not(.bag) > h2:first-child { margin-top: 40px; }
  .site-main > p, .site-main > section:not(.bag) > p { max-width: 46em; }
}

/* 動き：はかりの針がゆれて止まる・見出しの赤線が引かれる・荷札が下りてくる・ページの切り替え */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .needle { transition: transform 1.1s cubic-bezier(0.25, 1.7, 0.45, 0.85); }
  .h1-b::after { animation: draw 0.7s 0.25s cubic-bezier(0.6, 0, 0.2, 1) both; }
  .hero-tag { animation: swing 1.2s ease-out both; transform-origin: 0 50%; }
  .bag { animation: drop 0.6s 0.1s cubic-bezier(0.3, 1.3, 0.5, 1) both; }
  .bag-list li { animation: tag-in 0.45s cubic-bezier(0.3, 1.4, 0.5, 1) both; transform-origin: 0 50%; }
  .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s, transform 0.5s cubic-bezier(0.3, 1.3, 0.5, 1); }
  .reveal.is-in { opacity: 1; transform: none; }
  .cats li:nth-child(2n) a { transition-delay: 0.05s; }
  @keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  @keyframes swing { 0% { transform: rotate(-9deg); opacity: 0; } 40% { transform: rotate(5deg); opacity: 1; } 70% { transform: rotate(-2deg); } 100% { transform: none; } }
  @keyframes drop { from { transform: translateY(-18px); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes tag-in { from { transform: rotate(-6deg) translateX(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
}
/* 部門ごとのランキングは、順位の列を細く */
.rank:not(.lightest) td:first-child { min-width: 0; width: 3.2em; white-space: nowrap; font-family: var(--narrow); font-size: 1rem; }
