/* あみもの計算帳 — 共通の見た目
 * 生成りの背景・毛糸のテラコッタを差し色に。数字は大きく、指で押しやすく。
 */
:root {
  --bg: #faf6ef;
  --bg-deep: #f3ece1;
  --surface: #ffffff;
  --ink: #3a2e28;
  --muted: #66584f;
  --line: #e7ddd0;
  --field-line: #a8968a;
  --accent: #b5552f;
  --accent-strong: #97431f;
  --accent-ink: #ffffff;
  --accent-soft: #f6e4da;
  --moss: #4b6340;
  --moss-soft: #e7eedf;
  --warn: #9a5b00;
  --warn-soft: #fbefd9;
  --shadow: 0 1px 2px rgba(58, 46, 40, .06), 0 6px 20px rgba(58, 46, 40, .06);
  --radius: 18px;
  --radius-sm: 12px;
  --font-head: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --font-body: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1916; --bg-deep: #25201c; --surface: #2a2420; --ink: #f1e9df; --muted: #b9aa9c;
    --line: #3d3530; --field-line: #7d6e63; --accent: #e3895f; --accent-strong: #f0a27c; --accent-ink: #1d1916; --accent-soft: #3b2a22;
    --moss: #a5c18f; --moss-soft: #2b3326; --warn: #f0b765; --warn-soft: #3a2f1c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1d1916; --bg-deep: #25201c; --surface: #2a2420; --ink: #f1e9df; --muted: #b9aa9c;
  --line: #3d3530; --field-line: #7d6e63; --accent: #e3895f; --accent-strong: #f0a27c; --accent-ink: #1d1916; --accent-soft: #3b2a22;
  --moss: #a5c18f; --moss-soft: #2b3326; --warn: #f0b765; --warn-soft: #3a2f1c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; } /* 上に貼り付いた帯の下に、飛んだ先が隠れないように */
body {
  margin: 0; background: var(--bg); color: var(--ink);
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; /* 短いページでも下の帯を画面の下まで */
  font-family: var(--font-body); font-size: 16px; line-height: 1.75;
  font-feature-settings: "palt" 1;
  line-break: strict; word-break: auto-phrase;
}
h1, h2, h3, .lead, .steps li { text-wrap: pretty; } /* 段落には付けない（iPhone の Safari では行が短くなりすぎるため） */
/* iPhone・iPad の Safari は言葉の切れ目で折り返す設定（auto-phrase）が効かないので、見出しやボタンは <wbr> の所でだけ折り返す */
@supports not (word-break: auto-phrase) {
  h1, h2, .tool-card b, .next-tools a, .tools-nav a, .btn, .tool-group { word-break: keep-all; overflow-wrap: anywhere; }
  .guide table.tbl td { word-break: keep-all; } /* 表のマスは1文字ずつ折らない（入りきらない表は横に動かせる）。後ろの .guide .tbl td より強く */
}
button, .btn, .seg label, summary, a, .km-list label { touch-action: manipulation; } /* すばやく2回押しても画面が拡大されないように */
.nw { white-space: nowrap; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num, input[type="number"], .big { font-variant-numeric: tabular-nums; }

/* ---- ヘッダー ---- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(8px); -webkit-backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .inner { max-width: 760px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink); text-decoration: none; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; letter-spacing: .04em; margin-right: auto; }
.brand svg { width: 30px; height: 30px; flex: none; }
@media (max-width: 400px) {
  .brand { font-size: 1rem; letter-spacing: 0; }
  .brand svg { width: 26px; height: 26px; }
  #menu-btn span { display: none; }
}
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  min-width: 44px; height: 44px; border-radius: 999px; padding: 0 12px; font: inherit; font-size: .9rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }

/* ---- 道具のメニュー ---- */
/* メニューは本文の上に重ねて出す（閉じたときに本文がずれて、押し間違えないように） */
.tools-nav { position: absolute; top: 100%; left: 0; right: 0; max-width: 760px; margin: 0 auto; padding: 0 16px; pointer-events: none; }
.tools-nav ul { pointer-events: auto; max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px); overflow-y: auto; overscroll-behavior: contain; }
.tools-nav[hidden] { display: none; }
.tools-nav ul { list-style: none; margin: 8px 0 12px; padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface); border: 1px solid var(--field-line); border-radius: var(--radius); box-shadow: 0 2px 6px rgba(0, 0, 0, .12), 0 12px 32px rgba(0, 0, 0, .2); }
/* 後ろを少し暗くする（帯のすりガラスの効果で、帯の外に幕を出せないので、リストの影を画面いっぱいに広げる） */
.tools-nav ul { box-shadow: 0 2px 6px rgba(0, 0, 0, .12), 0 12px 32px rgba(0, 0, 0, .2), 0 0 0 100vmax rgba(30, 20, 14, .28); }
:root[data-theme="dark"] .tools-nav ul { box-shadow: 0 2px 6px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .4), 0 0 0 100vmax rgba(0, 0, 0, .5); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tools-nav ul { box-shadow: 0 2px 6px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .4), 0 0 0 100vmax rgba(0, 0, 0, .5); } }
@media (max-width: 360px) { .tools-nav ul { grid-template-columns: 1fr; } }
@media (min-width: 600px) { .tools-nav ul { grid-template-columns: repeat(3, 1fr); } }
.tools-nav a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: .95rem; }
.tools-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }
@media (hover: hover) { .tools-nav a:hover { background: var(--accent-soft); color: var(--accent-strong); } }

/* ---- 本文 ---- */
main { max-width: 760px; margin: 0 auto; padding: 8px 16px 48px; }
.page-head { padding: 20px 4px 8px; }
.kicker { display: inline-block; font-size: .8rem; color: var(--accent-strong); background: var(--accent-soft); padding: 2px 10px; border-radius: 999px; letter-spacing: .06em; }
.sub-h { font-family: var(--font-body); font-size: 1.05rem; margin: 18px 0 8px; }
h1 { font-family: var(--font-head); font-size: clamp(1.6rem, 6vw, 2.2rem); line-height: 1.35; margin: 10px 0 8px; letter-spacing: .02em; }
.lead { color: var(--muted); margin: 0 0 8px; }
h2 { font-family: var(--font-head); font-size: 1.35rem; line-height: 1.4; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 20px 0 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 14px 0; }
.card.result { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); overflow-wrap: anywhere; }
.card.result .tbl { overflow-wrap: normal; } /* 表は折り返さずに横にスクロール（数が途中で折れないように） */
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.card-title h2 { margin: 0; font-size: 1.15rem; }

/* ---- 入力 ---- */
.field { margin: 0 0 16px; }
.field > label, .field > .label { display: block; font-weight: 700; margin: 0 0 6px; }
.field .hint { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .row-2 { grid-template-columns: 1fr; } }

.stepper { display: flex; align-items: stretch; border: 1.5px solid var(--field-line); border-radius: 14px; background: var(--bg); overflow: hidden; }
.stepper:focus-within { border-color: var(--accent); }
.stepper button { appearance: none; border: 0; background: transparent; color: var(--accent); width: 52px; font-size: 1.6rem; line-height: 1; cursor: pointer; flex: none; }
.stepper button:active { background: var(--accent-soft); }
.stepper input { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; color: var(--ink); text-align: center; font: inherit; font-size: 1.6rem; font-weight: 700; padding: 8px 0; }
.stepper .unit { align-self: center; color: var(--muted); padding-right: 10px; font-size: .9rem; white-space: nowrap; }
.stepper input:focus { outline: none; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.text-input { width: 100%; border: 1.5px solid var(--field-line); border-radius: 14px; background: var(--bg); color: var(--ink); font: inherit; font-size: 1.3rem; padding: 12px 14px; }
.text-input:focus { outline: none; border-color: var(--accent); }
select.text-input { appearance: none; -webkit-appearance: none; font-size: 1.05rem; padding: 12px 44px 12px 14px; cursor: pointer;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b5552f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 20px 20px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) select.text-input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e3895f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); } }
:root[data-theme="dark"] select.text-input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e3895f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
textarea.text-input { min-height: 96px; resize: vertical; line-height: 1.6; font-size: 1.05rem; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; flex: 1 1 auto; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 10px 12px; border: 1.5px solid var(--field-line); border-radius: 12px; background: var(--bg); font-size: .95rem; cursor: pointer; min-height: 44px; }
.seg input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

details.more { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 10px; }
details.more > summary { cursor: pointer; color: var(--accent-strong); font-weight: 700; list-style: none; padding: 10px 0; min-height: 44px; display: block; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "＋ "; }
details.more[open] > summary::before { content: "－ "; }

/* ---- 結果 ---- */
.notation { font-family: var(--font-body); font-variant-numeric: tabular-nums; font-size: clamp(1.7rem, 8vw, 2.3rem); font-weight: 800; letter-spacing: .04em; line-height: 1.45; margin: 4px 0 6px; padding: 12px 16px; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.notation .note { display: block; font-size: .85rem; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.big { font-size: clamp(2rem, 10vw, 2.8rem); font-weight: 800; line-height: 1.2; }
.big small { font-size: .45em; font-weight: 700; color: var(--muted); margin-left: 2px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 10px 0; }
.stat { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; border: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; }
.stat .k { display: block; color: var(--muted); font-size: .8rem; }
.stat .v { font-size: 1.3rem; font-weight: 800; }
.steps { list-style: none; padding: 0; margin: 8px 0; counter-reset: st; }
.steps li { position: relative; padding: 10px 12px 10px 46px; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps li::before { counter-increment: st; content: counter(st); position: absolute; left: 6px; top: 10px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; display: grid; place-items: center; font-size: .9rem; }
.steps .sub { display: block; color: var(--muted); font-size: .85rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; padding: 0; list-style: none; }
.chips li { background: color-mix(in srgb, var(--accent) 7%, var(--bg)); border: 1px solid transparent; border-radius: 999px; padding: 2px 10px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.chips li.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-strong); font-weight: 700; }
.chips li.hit { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 30%, var(--surface)); } /* 図の段を押したとき */
.seqline { font-variant-numeric: tabular-nums; line-height: 2; word-break: break-all; }
.seqline b { color: var(--accent); }
.msg { border-radius: var(--radius-sm); padding: 12px 14px; margin: 8px 0; }
.msg.err { background: var(--warn-soft); color: var(--warn); font-weight: 700; }
.msg.info { background: var(--moss-soft); color: var(--moss); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.calc-note { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
table.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.tbl th, table.tbl td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
table.tbl th { color: var(--muted); font-size: .85rem; font-weight: 700; white-space: nowrap; }
table.tbl td.nw, table.tbl th.nw { white-space: nowrap; }
@media (max-width: 400px) { table.tbl th, table.tbl td { padding: 8px 3px; } }
table.tbl tr.hit td { background: var(--accent-soft); font-weight: 700; }
.tbl-wrap { overflow-x: auto;
  background: linear-gradient(to right, var(--surface) 30%, transparent) left / 24px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right / 24px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .18), transparent) left / 10px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .18), transparent) right / 10px 100% no-repeat scroll; }
.guide .tbl td:first-child { min-width: 8.5em; }
.tbl-wrap + p, .tbl-wrap + .calc-note, .tbl-wrap + .msg, .guide .tbl-wrap + p { margin-top: 12px; }
.tbl .text-input { font-size: 1.05rem; padding: 8px 6px; min-width: 48px; }

/* ---- ボタン ---- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 0; }
.actions .wide { grid-column: 1 / -1; }
.btn { appearance: none; border: 1.5px solid var(--field-line); flex-wrap: wrap; row-gap: 0; background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; min-height: 48px; border-radius: 14px; padding: 10px 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn svg { width: 20px; height: 20px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn .btn-sub { font-weight: 400; font-size: .85em; white-space: nowrap; margin-left: -6px; }
@media (hover: hover) {
  .btn:not(:disabled):hover, .seg label:hover span { border-color: var(--accent); }
  .btn.primary:not(:disabled):hover { background: var(--accent-strong); border-color: var(--accent-strong); }
  .stepper button:hover { background: var(--accent-soft); }
}

/* ---- 保存した計算 ---- */
.history ul { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history .h-main { flex: 1; min-width: 0; }
.history .h-title { font-weight: 700; display: block; overflow-wrap: anywhere; }
.history .h-date { color: var(--muted); font-size: .8rem; }
.history .empty { color: var(--muted); }
.history .h-btn { min-height: 44px; padding: 6px 12px; font-size: .9rem; }
.history .h-del { margin-left: 8px; }
@media (max-width: 400px) { .history li { flex-wrap: wrap; } .history .h-main { flex-basis: 100%; } } /* 小さい画面は「開く」「消す」を名前の下に */

/* ---- 説明（読みもの） ---- */
/* 読みものの図（knit\assets\img\zu\ の固定の SVG。画像検索にも出す。明るい紙の見た目なので、暗い画面では少しだけ暗く） */
.zu { margin: 14px auto; max-width: 400px; }
.zu img { display: block; width: 100%; height: auto; border-radius: 14px; }
.zu figcaption { color: var(--muted); font-size: .82rem; text-align: center; margin-top: 6px; line-height: 1.6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .zu img { filter: brightness(.88); } }
:root[data-theme="dark"] .zu img { filter: brightness(.88); }
.guide { margin-top: 28px; }
.guide .card { padding: 20px; }
.guide p { margin: 0 0 12px; }
.guide ul, .guide ol { padding-left: 1.3em; margin: 0 0 12px; }
.guide li { margin: 4px 0; }
.guide .tbl td { word-break: inherit; } /* 言葉の切れ目で折り返す（本文と同じ） */
.guide .eg { background: var(--bg); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 0 12px 12px 0; margin: 10px 0; }
.faq dt { font-weight: 700; margin-top: 14px; }
.faq dt::before { content: "Q. "; color: var(--accent); }
.faq dd { margin: 4px 0 0; }
.faq dd::before { content: "A. "; color: var(--moss); font-weight: 700; }
/* ---- 広告の枠（ads.js が中身を入れるまでは見えない） ---- */
.ad-slot:empty { display: none; }
.ad-slot { margin: 40px 0; text-align: center; }
.ad-slot.on { min-height: 280px; }
.ad-slot.on:has(ins[data-ad-status="unfilled"]) { display: none; }
.ad-label { display: block; font-size: .75rem; color: var(--muted); letter-spacing: .08em; margin: 0 0 4px; }

/* ---- 次に使う道具 ---- */
.next-tools { margin: 14px 0; }
.next-tools h2 { font-family: var(--font-body); font-size: 1rem; margin: 0 0 8px; color: var(--muted); }
.next-tools ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
.next-tools li { display: flex; }
@media (min-width: 560px) { .next-tools ul { grid-template-columns: repeat(3, 1fr); } }
.next-tools a { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-weight: 700; font-size: .95rem; line-height: 1.4; }
@media (hover: hover) { .next-tools a:hover { border-color: var(--accent); } }
.next-tools .ic { flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-family: var(--font-head); font-size: .95rem; }
.tool-group { font-family: var(--font-body); font-size: 1.05rem; margin: 26px 4px 10px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tool-group small { color: var(--muted); font-weight: 400; font-size: .85rem; }

/* ---- トップの道具一覧 ---- */
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .tool-grid { grid-template-columns: 1fr 1fr; } }
.tool-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
@media (hover: hover) { .tool-card:hover { border-color: var(--accent); } }
.tool-grid > :only-child { grid-column: 1 / -1; } /* 道具が1つだけのときは横いっぱいに */
.tool-card .ic { flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-weight: 800; font-family: var(--font-head); font-size: 1.2rem; }
.tool-card span { color: var(--muted); font-size: .9rem; display: block; line-height: 1.6; }
.tool-card span .nw { display: inline; font-size: inherit; color: inherit; line-height: inherit; }
.tool-card b { display: block; font-size: 1.05rem; color: var(--ink); }
.hero { padding: 26px 4px 6px; }
.hero h1 { font-size: clamp(1.8rem, 7vw, 2.5rem); }
.yarn-rule { height: 10px; margin: 18px 0; background: radial-gradient(circle at 5px 5px, var(--line) 2.5px, transparent 3px) 0 0 / 14px 10px repeat-x; border: 0; }

/* ---- iPhone を横にしたとき、画面の切り欠きに文字やボタンがかからないように ---- */
.site-header .inner, .tools-nav, main, .site-footer .inner, .knitmode .km-body {
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
main { flex: 1 0 auto; width: 100%; }

/* ---- フッター ---- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-deep); color: var(--muted); font-size: .85rem; }
.site-footer .inner { max-width: 760px; margin: 0 auto; padding: 20px 16px calc(100px + env(safe-area-inset-bottom, 0px)); }
.site-footer a { color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 16px; margin: 0 0 10px; }
.site-footer nav a { display: inline-flex; align-items: center; min-height: 44px; }

/* ---- 編みながら見る画面 ---- */
.knitmode { position: fixed; inset: 0; z-index: 100; background: var(--bg); overflow-y: auto; overflow-wrap: anywhere; padding: 0 0 calc(120px + env(safe-area-inset-bottom, 0px)); }
.knitmode[hidden] { display: none; }
.knitmode .km-bar { position: sticky; top: 0; display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
  padding-left: max(16px, env(safe-area-inset-left, 0px), calc((100% - 760px) / 2 + 16px)); padding-right: max(16px, env(safe-area-inset-right, 0px), calc((100% - 760px) / 2 + 16px)); }
.knitmode .km-bar .km-progress, .knitmode .km-bar .icon-btn { flex: none; white-space: nowrap; }
.knitmode .km-bar h2 { margin: 0 auto 0 0; font-size: 1.05rem; line-height: 1.4; min-width: 0;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; } /* 帯は2行まで（帯が高くなりすぎないように） */
.knitmode .km-fulltitle { margin: 0 0 8px; font-weight: 700; white-space: pre-wrap; overflow-wrap: anywhere; }
.knitmode .km-body { max-width: 760px; margin: 0 auto; padding: 12px 16px; }
.knitmode .km-note { color: var(--muted); font-size: .9rem; }
.km-list { list-style: none; margin: 0; padding: 0; }
.km-list li { border-bottom: 1px solid var(--line); }
.km-list label { display: flex; align-items: center; gap: 14px; padding: 14px 4px; font-size: 1.35rem; font-weight: 700; cursor: pointer; }
.km-list input { appearance: none; -webkit-appearance: none; width: 30px; height: 30px; margin: 0; flex: none; border: 2px solid var(--field-line); border-radius: 8px; background: var(--surface); display: grid; place-content: center; cursor: pointer; }
.km-list input:checked { background: var(--accent); border-color: var(--accent); }
.km-list input:checked::after { content: ""; width: 12px; height: 7px; border: 3px solid var(--accent-ink); border-top: 0; border-right: 0; transform: translateY(-2px) rotate(-45deg); }
.km-list input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.km-list input:checked + span .km-main { color: var(--muted); text-decoration: line-through; font-weight: 400; }
.km-list .km-main { display: block; }
.km-list .km-sub { display: block; font-size: .95rem; font-weight: 400; color: var(--muted); }
.km-progress { font-size: 1rem; font-weight: 700; color: var(--accent); }

.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 72px); transform: translateX(-50%); max-width: calc(100% - 32px); display: flex; align-items: center; flex-wrap: wrap; justify-content: center; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: .95rem; z-index: 200; box-shadow: var(--shadow); }
.toast[hidden] { display: none; }
.toast-btn { margin-left: 12px; background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 999px; padding: 4px 14px; font: inherit; font-weight: 700; min-height: 44px; cursor: pointer; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 300; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 10px; }
.skip-link:focus { top: 8px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ひとことボタン（答えの下） */
.rate { margin: 4px 0 14px; padding: 14px 16px; border: 1px dashed var(--field-line); border-radius: var(--radius); background: var(--bg); }
.rate-q { margin: 0 0 8px; font-weight: 700; }
.rate-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rate-btns .btn { min-height: 44px; font-size: .95rem; padding: 8px 10px; }
.rate-btns .btn:last-child { grid-column: 1 / -1; }
@media (max-width: 360px) { .rate-btns { grid-template-columns: 1fr; } .rate-btns .btn:last-child { grid-column: auto; } }
@media (min-width: 560px) { .rate-btns { grid-template-columns: repeat(3, 1fr); } .rate-btns .btn:last-child { grid-column: auto; } }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 図 */
.figure { margin: 10px 0 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; }
.figure svg { display: block; width: 100%; max-width: 460px; height: auto; max-height: 55vh; margin: 0 auto; } /* 横向きのスマホで図が画面をうめないように */
.figure figcaption { color: var(--muted); font-size: .8rem; text-align: center; }

/* ---- 広い画面：左に入力・右に答え（ui.js が .tool-cols と .result-col で包む）----
 * 答えの列は画面についてくる。広告の枠（.ad-slot）はこの外に置く（AdSense は、ついてくる所に広告を置くのを認めていないため）
 */
@media (min-width: 1100px) {
  body:has(.tool-cols) .site-header .inner, body:has(.tool-cols) .tools-nav, body:has(.tool-cols) .site-footer .inner, main:has(.tool-cols) { max-width: 1160px; }
  .tool-cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0 24px; align-items: start; }
  /* 答えが画面に入りきるときだけ、画面についてくる（ui.js が .stick を付ける）。入りきらないときは、ふつうに全部を出す（途中で切らない） */
  .result-col { margin: 14px 0; }
  .result-col.stick { position: sticky; top: 84px; }
  .result-col > .card { margin-top: 0; }
  .result-col > .rate { margin-bottom: 0; }
  main:has(.tool-cols) .guide, main:has(.tool-cols) .page-head { max-width: 760px; } /* 読みものは行が長くなりすぎないように（左のはしは上とそろえる） */
}

/* 切り欠きの左右の余白は、フッターと編みながら見る画面の本文の余白の指定より後ろに置く（前に置くと上書きされるため） */
.site-footer .inner, .knitmode .km-body { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ==== 2026-10-22 磨き込み（指定の順番で上書きするため、いちばん後ろに置く） ==== */
/* まちがえた欄のそばの知らせ（ui.js が .has-err と .field-msg を付ける）。赤は答えの欄の知らせ（茶色）と分けて、欄だけに使う */
:root { --err: #b42318; --err-soft: #fde8e6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --err: #ff9b8f; --err-soft: #3d2220; } }
:root[data-theme="dark"] { --err: #ff9b8f; --err-soft: #3d2220; }
.field.has-err .stepper, .field.has-err .text-input { border-color: var(--err); }
.field.has-err .stepper:focus-within, .field.has-err .text-input:focus { border-color: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.field-msg { margin: 6px 0 0; color: var(--err); font-size: .85rem; font-weight: 700; line-height: 1.5; }

/* 「↓ 答えを見る」（道具の名前の上の札と同じ行。行を増やさないよう、押せる広さは余白で取る） */
.head-top { display: flex; align-items: center; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; }
.jump-result { font-size: .85rem; font-weight: 700; color: var(--accent-strong); text-decoration: none; white-space: nowrap; padding: 11px 2px; margin: -11px 0; }
@media (hover: hover) { .jump-result:hover { text-decoration: underline; } }

/* 答えの小さい箱の見出し：Safari では <wbr> の所でだけ折り返す（言葉の途中で割れないように） */
@supports not (word-break: auto-phrase) { .stat .k { word-break: keep-all; overflow-wrap: anywhere; } }
.stat .k .k-sub { white-space: nowrap; font-size: .9em; } /* 「（伸ばす前）」などの添え書きは割らずに、少し小さく */

/* 均等の「1段の並び」：「5＋」をひとかたまりにして、かたまりの間を均等に */
.seqline .sq { display: inline-block; white-space: nowrap; margin-right: .3em; }
.seqline .sq.hit { background: var(--accent-soft); border-radius: 4px; outline: 1px solid var(--accent); } /* 図のかたまりを押したとき */

/* 針の号数の早見表：2つの列を半分ずつにして、どの表でも「太さ」の位置をそろえる */
#t-bou, #t-kagi, #t-lace { table-layout: fixed; }
#t-bou th, #t-kagi th, #t-lace th { width: 50%; }

/* 保存した計算の「消す」は目立たない見た目に（「開く」との押しまちがいを減らす。消したあとは「元に戻す」が出る） */
.history .h-del { border-color: transparent; background: transparent; color: var(--muted); font-weight: 400; }

/* 小さめのノートパソコン（左右に並ぶ形の、答えの列がせまい幅）でも、評価のボタンを1行に */
@media (min-width: 1100px) and (max-width: 1199px) { .result-col .rate-btns .btn { padding-left: 6px; padding-right: 6px; font-size: .9rem; } } /* 余白だけで詰めすぎると窮屈に見えるので、文字もほんの少し小さく */

/* ==== 2026-10-23 磨き込み（Codex の報告の No.3〜5） ==== */
/* 小さい箱の数字：「約」は小さく添える（「約／52cm」と割れないように）・「5目×16」はひとかたまり（入りきらないときだけ中で割れる）・玉数の「余裕〇%込み」は数字の下に小さく */
.stat .v .v-pre { font-size: .7em; font-weight: 700; margin-right: 1px; }
.stat .v .grp { display: inline-block; max-width: 100%; }
.stat .v .v-note { display: block; font-size: .65em; font-weight: 700; color: var(--muted); line-height: 1.4; white-space: nowrap; }

/* ==== 2026-10-28 図解の組み直し（12_knit_zukai.md。zukai.js が描く編み図）==== */
.zk { margin: 12px 0 0; padding: 0; }
.zk-svg { display: block; width: 100%; height: auto; max-width: 480px; max-height: min(72vh, 600px); margin: 0 auto; color: var(--ink); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.zk-svg > :not(.zk-bands) { pointer-events: none; } /* 押せるのは段の帯だけ（記号の上を押しても、その段になる） */
.zk-ink, .zk-inc, .zk-guide { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.zk-ink { stroke: currentColor; stroke-width: 1.1; }
.zk-inc { stroke: var(--accent); stroke-width: 1.35; } /* 増し目はテラコッタで目立たせる */
.zk-guide { stroke: var(--line); stroke-width: .7; }
.zk-ch { fill: none; stroke: currentColor; stroke-width: 1; }
.zk-sl { fill: currentColor; }
.zk-ring { fill: none; stroke: currentColor; stroke-width: 1.1; }
.zk-wa { font-size: 6px; fill: var(--muted); text-anchor: middle; dominant-baseline: central; }
.zk-no { font-size: 8px; font-weight: 800; fill: var(--accent-strong); text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; }
.zk-gap { font-size: 7px; font-weight: 700; fill: var(--muted); text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.km-fig .zk-gap { stroke: var(--bg); }
.zk-band { fill: transparent; fill-rule: evenodd; cursor: pointer; } /* 輪の形（内側はぬかない） */
.zk-band.is-done { fill: color-mix(in srgb, var(--moss) 36%, transparent); }
.zk-band.is-now { fill: color-mix(in srgb, var(--accent) 24%, transparent); }
.zk-band.is-pick { fill: color-mix(in srgb, var(--accent) 30%, transparent); stroke: var(--accent); stroke-width: .8; }
@media (hover: hover) { .zk .zk-band:not(.is-pick):not(.is-done):not(.is-now):hover { fill: color-mix(in srgb, var(--accent) 10%, transparent); } } /* 「編みながら見る」の図（.km-fig）は押せないので、色を変えない */
.zk-cap { text-align: center; font-size: .9rem; color: var(--muted); margin: 6px 0 0; min-height: 1.75em; }
.zk-cap.on { color: var(--accent-strong); font-weight: 700; }
.zk-note { font-size: .8rem; color: var(--muted); margin: 6px 0 0; }
.zk-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 8px 0 0; margin: 8px 0 0; border-top: 1px dashed var(--line); font-size: .82rem; color: var(--muted); line-height: 1.5; }
.zk-legend li { display: inline-flex; align-items: center; gap: 5px; }
.zk-sym { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; color: var(--ink); }
.zk-sym svg { width: 20px; height: 20px; overflow: visible; }
.zk-sym-no { font-weight: 800; color: var(--accent-strong); font-size: .9rem; }
/* フェーズ2：ニット帽・マフラー・玉数の図（形と段数の図・できあがりの形・毛糸玉） */
.zk-lb { font-size: 10px; font-weight: 700; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.zk-lbs { font-size: 8.5px; fill: var(--muted); text-anchor: middle; dominant-baseline: central; }
.zk-lb.zk-r, .zk-lbs.zk-r { text-anchor: end; }
.zk-lb.zk-l, .zk-lbs.zk-l { text-anchor: start; }
.zk-lbl { font-size: 15px; }
.zk-hat { max-width: 440px; }
.zk-hat .zk-lb { font-size: 12px; }
.zk-hat .zk-lbs, .zk-lbs-in { font-size: 10px; font-weight: 400; fill: var(--muted); }
.zk-guide2 { stroke: var(--field-line); stroke-width: .6; } /* 帽子の図の区切り（暗い画面でも見えるように少し濃く） */
.zk-scarf { max-width: 460px; }
.zk-balls { max-width: 300px; max-height: none; }
.zk-fill { stroke: none; }
.zk-tex { fill: none; stroke: color-mix(in srgb, var(--accent) 45%, transparent); stroke-width: .7; stroke-linecap: round; }
.zk-texd { fill: color-mix(in srgb, var(--accent) 55%, transparent); }
.zk-cut { fill: var(--surface); stroke: none; }
.zk-edge { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; } /* 作り目の端 */
.zk-join { fill: none; stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 2.5; }
.zk-ball circle { fill: color-mix(in srgb, var(--accent) 30%, var(--surface)); stroke: var(--accent-strong); stroke-width: 1; }
.zk-ball path { fill: none; stroke: var(--accent-strong); stroke-width: .9; stroke-linecap: round; opacity: .7; }
.zk-ball-x circle { fill: var(--surface); stroke-dasharray: 2.6 1.8; }
.zk-static .zk-legend { justify-content: center; }
.zk-slope { max-width: 420px; }
.zk-slope .zk-lb, .zk-row .zk-lb, .zk-gauge .zk-lb, .zk-needle .zk-lb { font-size: 11px; }
.zk-slope .zk-lbs, .zk-row .zk-lbs, .zk-gauge .zk-lbs, .zk-needle .zk-lbs { font-size: 9.5px; }
.zk-slope .zk-lb { font-size: 12px; }
.zk-slope .zk-lbs { font-size: 10.5px; }
.zk-nopick .zk-band { pointer-events: none; cursor: default; } /* 段が細かすぎて押せないとき */
.zk-dash { stroke-dasharray: 3 2.5; stroke-width: 1; }
.zk-piece { fill: color-mix(in srgb, var(--accent) 12%, var(--surface)); stroke: none; } /* 編み地 */
.zk-gauge .zk-piece { stroke: var(--accent); stroke-width: 1; }
.zk-edge2 { stroke-width: 1.6; }
.zk-dot { fill: var(--accent); stroke: var(--surface); stroke-width: .8; }
.zk-mut { fill: var(--muted); font-weight: 400; }
.zk-strong { fill: var(--accent-strong); font-weight: 700; }
.zk-acc { fill: var(--accent-strong); }
.zk-row { max-width: 440px; }
.zk-st { fill: var(--surface); stroke: currentColor; stroke-width: 1; }
.zk-st-new { fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); stroke: var(--accent); }
.zk-box { fill: var(--surface); stroke: currentColor; stroke-width: 1; }
.zk-num { font-variant-numeric: tabular-nums; }
.zk-gauge { max-width: 440px; }
.zk-sw { fill: var(--surface); stroke: currentColor; stroke-width: 1; }
.zk-sw-me { stroke: var(--accent); stroke-width: 1.4; }
.zk-grid { fill: none; stroke: var(--field-line); stroke-width: .4; }
.zk-needle { max-width: 420px; max-height: none; }
.zk-bar { fill: var(--muted); }
.zk-bar-ref { fill: var(--accent); }
.km-fig .zk-st, .km-fig .zk-box { fill: var(--bg); }

/* 「くわしく見る」（ui.js が #result-more に出す。ボタンの下。開いたかどうかは端末で覚える） */
.result-more { margin: 14px 0 0; }
.detail { border-top: 1px solid var(--line); }
.detail > summary { list-style: none; cursor: pointer; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; min-height: 48px; padding: 10px 30px 10px 2px; position: relative; font-weight: 700; color: var(--accent-strong); }
.detail > summary::-webkit-details-marker { display: none; }
.detail > summary::after { content: ""; position: absolute; right: 8px; top: 50%; width: 9px; height: 9px; margin-top: -7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s, margin .2s; }
.detail[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.detail-s { font-weight: 400; font-size: .85rem; color: var(--muted); }
.detail-body { padding: 2px 0 4px; }
.detail-body > :first-child { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .detail > summary::after { transition: none; } }

/* 「編みながら見る」の上の編み図（帯と一緒に貼り付く。たためる） */
.knitmode .km-top { position: sticky; top: 0; z-index: 2; background: var(--bg); border-bottom: 1px solid var(--line); }
.knitmode .km-top .km-bar { position: static; border-bottom: 0; }
.km-fig { position: relative; max-width: 760px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 4px max(16px, env(safe-area-inset-left, 0px)); }
.km-fig .zk-svg { height: 26vh; min-height: 120px; max-height: 260px; width: 100%; }
.km-fig .zk-band { cursor: default; }
.km-fig.is-closed .km-fig-in { display: none; }
.km-fig-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.km-fig.is-closed .km-fig-note { visibility: hidden; }
.km-fig-note { font-size: .8rem; color: var(--muted); display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; }
.km-sw { display: inline-block; width: 14px; height: 10px; border-radius: 3px; vertical-align: middle; }
.km-sw-now { background: color-mix(in srgb, var(--accent) 45%, var(--bg)); }
.km-sw-done { background: color-mix(in srgb, var(--moss) 50%, var(--bg)); margin-left: 6px; }
.km-fig-btn { display: block; margin: 0 0 0 auto; flex: none; min-height: 36px; padding: 4px 4px; background: none; border: 0; color: var(--accent-strong); font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; }
.km-list li { scroll-margin-top: var(--km-top, 0px); }
@media (max-height: 500px) { .knitmode .km-top { position: static; } .km-fig .zk-svg { height: 60vh; max-height: none; } } /* スマホの横向き：図は貼り付けない（チェックの一覧が狭くならないように） */

/* ==== 2026-10-28 全体のトップ（てのひら道具箱。B 案：ホーム画面風・大小の箱）。body.home の中だけ ==== */
.home { --home-max: 1080px; --tile-a: #e58357; --tile-b: #a9481f;
  background:
    radial-gradient(55% 380px at 8% 0, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
    radial-gradient(45% 340px at 96% 60px, color-mix(in srgb, #5f88b5 12%, transparent), transparent 70%),
    var(--bg) no-repeat; }
.home main, .home .site-header .inner, .home .tools-nav, .home .site-footer .inner { max-width: var(--home-max); }
.home .brand { font-family: var(--font-body); font-weight: 800; letter-spacing: .02em; }
.home h1, .home h2 { font-family: var(--font-body); font-weight: 800; letter-spacing: .01em; }
.home .hero { padding: 26px 4px 4px; }
.home .pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.home .hero h1 { font-size: clamp(2rem, 8.5vw, 3.1rem); line-height: 1.22; margin: 14px 0 12px; letter-spacing: -.01em; }
.home .hl { background: linear-gradient(100deg, var(--accent-strong), #c0602c 55%, #a8661c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home .hero .lead { font-size: 1rem; max-width: 34em; }
:root[data-theme="dark"] .home .hl { background-image: linear-gradient(100deg, #f4b08c, #f0a27c 55%, #e9b46a); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .home .hl { background-image: linear-gradient(100deg, #f4b08c, #f0a27c 55%, #e9b46a); } }
@supports not ((-webkit-background-clip: text) or (background-clip: text)) { .home .hl { background: none; color: var(--accent-strong); } }

/* 季節のおすすめ（大きな札） */
.home .feature { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 18px 0 0; padding: 22px 22px 20px; min-height: 196px;
  border-radius: 26px; text-decoration: none; color: #3a2318;
  background: linear-gradient(140deg, #fbe3d3 0%, #f6c9ac 55%, #efb08c 100%);
  box-shadow: 0 1px 2px rgba(120, 50, 20, .08), 0 14px 34px -12px rgba(160, 70, 30, .35); transition: transform .18s ease, box-shadow .18s ease; }
.home .feature-tag { font-size: .82rem; font-weight: 700; background: rgba(255, 255, 255, .62); padding: 3px 12px; border-radius: 999px; }
.home .feature-title { font-size: clamp(1.55rem, 6.5vw, 2rem); font-weight: 800; line-height: 1.25; margin-top: 4px; position: relative; }
.home .feature-text { font-size: .95rem; line-height: 1.65; max-width: 15em; position: relative; color: #4a2c1e; }
.home .feature-chips { display: flex; flex-wrap: wrap; gap: 6px; position: relative; margin-top: 2px; }
.home .feature-chips span { font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1px solid rgba(58, 35, 24, .22); }
:root[data-theme="dark"] .home .feature-chips span { border-color: rgba(251, 233, 222, .3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .home .feature-chips span { border-color: rgba(251, 233, 222, .3); } }
.home .feature-go { margin-top: auto; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 8px 14px 8px 18px; border-radius: 999px; background: #3a2318; color: #fff; font-weight: 700; font-size: .95rem; position: relative; }
.home .feature-go svg, .home .app-more svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.home .feature > :not(.feature-art) { position: relative; z-index: 1; }
.home .feature-art { position: absolute; z-index: 0; right: -26px; top: -26px; width: 128px; height: 128px; fill: rgba(255, 255, 255, .32); stroke: rgba(169, 72, 31, .35); stroke-width: 3; stroke-linecap: round; pointer-events: none; }
.home .feature-art path { fill: none; }
:root[data-theme="dark"] .home .feature { background: linear-gradient(140deg, #4a2c20 0%, #5e3524 55%, #6e3c26 100%); color: #fbe9de; box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .7); }
:root[data-theme="dark"] .home .feature-text { color: #f1d9cb; }
:root[data-theme="dark"] .home .feature-tag { background: rgba(255, 255, 255, .12); }
:root[data-theme="dark"] .home .feature-go { background: #fbe9de; color: #3a2318; }
:root[data-theme="dark"] .home .feature-art { fill: rgba(255, 255, 255, .06); stroke: rgba(240, 162, 124, .35); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .home .feature { background: linear-gradient(140deg, #4a2c20 0%, #5e3524 55%, #6e3c26 100%); color: #fbe9de; box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .7); }
  :root:not([data-theme="light"]) .home .feature-text { color: #f1d9cb; }
  :root:not([data-theme="light"]) .home .feature-tag { background: rgba(255, 255, 255, .12); }
  :root:not([data-theme="light"]) .home .feature-go { background: #fbe9de; color: #3a2318; }
  :root:not([data-theme="light"]) .home .feature-art { fill: rgba(255, 255, 255, .06); stroke: rgba(240, 162, 124, .35); } }

/* アプリの道具（ホーム画面のようなアイコン。絵の下に必ず名前） */
.home .app-panel { margin: 18px 0 0; padding: 18px 14px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); }
.home .app-head { display: flex; align-items: center; gap: 8px; margin: 0 4px 12px; }
.home .app-head h2 { margin: 0 auto 0 0; font-size: 1.1rem; line-height: 1.35; min-width: 0; }
.home .app-head h2 small { display: block; }
@media (min-width: 600px) { .home .app-head h2 small { display: inline; margin-left: 4px; } }
.home .app-head h2 small { font-size: .8rem; font-weight: 700; color: var(--muted); }
.home .app-dot { display: inline-block; vertical-align: -1px; margin-right: 8px; width: 12px; height: 12px; border-radius: 4px; background: linear-gradient(140deg, var(--tile-a), var(--tile-b)); flex: none; }
.home .app-more { flex: none; display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 4px 0 10px; font-size: .9rem; font-weight: 700; text-decoration: none; color: var(--accent-strong); border-radius: 12px; }
.home .app-icons { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px 4px; }
@media (max-width: 339px) { .home .app-icons { grid-template-columns: repeat(4, 1fr); } }
.home .app-ic { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0 2px; text-decoration: none; color: var(--ink); border-radius: 16px; -webkit-tap-highlight-color: transparent; }
.home .app-ic .tile { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; flex: none;
  background: linear-gradient(145deg, var(--tile-a), var(--tile-b)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 14px -6px rgba(169, 72, 31, .55); transition: transform .16s ease, box-shadow .16s ease; }
.home .app-ic .tile svg { width: 32px; height: 32px; fill: none; stroke: #fff; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.home .app-ic .tile svg .f { fill: #fff; stroke: none; }
.home .app-ic .tile svg .t { fill: #fff; stroke: none; font: 800 10.5px/1 var(--font-body); letter-spacing: -.03em; }
.home .app-ic .nm { font-size: .8rem; font-weight: 700; line-height: 1.35; text-align: center; word-break: keep-all; overflow-wrap: anywhere; }
.home .app-ic:active .tile, .home .feature:active { transform: scale(.96); }

/* 特長（小さい箱を並べる） */
.home .points { margin: 18px 0 0; }
.home .points h2 { font-size: 1.15rem; margin: 0 4px 10px; }
.home .points ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home .points li { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.home .points b { font-size: .95rem; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
.home .points li > span:last-child { color: var(--muted); font-size: .85rem; line-height: 1.6; }
.home .pt-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); margin-bottom: 4px; }
.home .pt-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 599px) { .home .points ul { grid-template-columns: 1fr; gap: 8px; }
  .home .points li { display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; row-gap: 2px; padding: 12px 14px; align-items: start; }
  .home .points .pt-ic { grid-row: 1 / 3; margin: 2px 0 0; } }
.home .guide .card { border-radius: 22px; }

@media (hover: hover) {
  .home .feature:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(120, 50, 20, .08), 0 20px 40px -14px rgba(160, 70, 30, .45); }
  .home .app-ic:hover .tile { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 10px 18px -6px rgba(169, 72, 31, .6); }
  .home .app-ic:hover .nm, .home .app-more:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
}
@media (prefers-reduced-motion: reduce) { .home .feature, .home .app-ic .tile { transition: none; } }

/* 少し広い画面：アイコンを大きく */
@media (min-width: 600px) {
  .home .app-panel { padding: 22px 22px 18px; }
  .home .app-ic .tile { width: 64px; height: 64px; border-radius: 20px; }
  .home .app-ic .tile svg { width: 36px; height: 36px; }
  .home .app-ic .nm { font-size: .88rem; }
  .home .points ul { grid-template-columns: repeat(2, 1fr); }
  .home .feature { min-height: 230px; padding: 26px 26px 22px; }
  .home .feature-text { max-width: 24em; }
  .home .feature-art { width: 190px; height: 190px; top: auto; bottom: -22px; right: -16px; }
}
/* パソコン・横向きのタブレット：上の段は「見出し｜おすすめ」を左右に、道具は1列に10個、特長は4つ並べる */
@media (min-width: 900px) {
  .home main { padding-top: 20px; }
  .home .home-top { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; align-items: stretch; }
  .home .hero { padding: 34px 8px 10px; align-self: center; }
  .home .feature { margin: 0; min-height: 260px; padding: 28px 28px 24px; }
  .home .feature-art { width: 210px; height: 210px; right: -24px; top: auto; bottom: -22px; }
  .home .feature-text { max-width: 17em; }
  .home .app-icons { grid-template-columns: repeat(10, 1fr); }
  .home .points ul { grid-template-columns: repeat(4, 1fr); }
}
