/* ============================================================
   tanukie tools 共通スタイル（ia / print / pkg）
   各ツールの style.css より先に読み込む。色は各ツールの変数（--ac など）を使う。
   1. 共通ヘッダー（ツールの切り替え）
   2. フッター
   3. お知らせ（toast）
   4. ? の説明カード
   5. 打ち合わせメモ
   ============================================================ */
:root {
  --tkh: 34px;
  --memoc: 55px; /* メモを閉じたときの高さ（つまみ＋見出し） */
  --memoh: 320px;
  --drawer: 0px;
  --tline: #b8b8c0;
}

/* ---------- 1. 共通ヘッダー ---------- */
/* 共通ヘッダーは黒地（3ツール共通。各ツールの上部バーと区別しやすいように） */
.tk-bar {
  height: var(--tkh);
  background: #1d1d1f;
  font-size: 12px;
  color: #fff;
}
.tk-in {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tk-in::-webkit-scrollbar {
  display: none;
}
.tk-home {
  font-family: "Inter Tight", "Noto Sans JP", sans-serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  text-decoration: none;
  margin-right: 10px;
  white-space: nowrap;
  font-size: 12.5px;
}
.tk-home small {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  margin-left: 4px;
  letter-spacing: 0.02em;
}
.tk-t {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px 0 7px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  transition:
    background 0.15s,
    color 0.15s;
}
.tk-t img {
  width: 18px;
  height: 18px;
  flex: none;
}
a.tk-t:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.tk-t[aria-current="page"] {
  color: #fff;
  font-weight: 700;
}
.tk-t[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -4px;
  height: 2px;
  border-radius: 2px;
  background: var(--ac-hi, var(--ac));
}
.tk-t.soon {
  cursor: default;
  opacity: 0.55;
}
.tk-t.soon small {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.7);
}
.bar a.btn,
.bar a.brand,
a.go-next {
  text-decoration: none;
}
body.present .tk-bar,
body.smp .tk-bar,
body.proto .tk-bar {
  display: none;
}

/* ---------- 2. フッター ---------- */
.tk-foot {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-top: 18px;
  padding-bottom: calc(var(--drawer) + 22px + env(safe-area-inset-bottom, 0px));
  margin-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.tk-foot nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.tk-foot a,
.tk-foot button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--sub);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}
.tk-foot a:hover,
.tk-foot button:hover {
  color: var(--ink);
}
.tk-foot .fsync {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--ac);
  color: var(--ac);
  font-weight: 700;
}
.tk-foot .fsync svg {
  width: 14px;
  height: 14px;
}
.tk-foot .fsync:hover {
  background: var(--ac-soft);
  color: var(--ac);
}
.tk-foot .copy {
  margin-left: auto;
  font-weight: 600;
}
body.nofoot .tk-foot,
body.present .tk-foot {
  display: none;
}

/* ---------- 3. お知らせ ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(29, 29, 31, 0.92);
  color: #fff;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  max-width: min(520px, calc(100vw - 48px));
  z-index: 140;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  animation: tkToast 0.22s ease-out;
}
.toast.act {
  pointer-events: auto;
}
.toast .tact {
  border: 0;
  background: none;
  color: var(--ac-hi);
  font-weight: 700;
  margin-left: 14px;
  padding: 0;
  font-size: 13px;
  cursor: pointer;
}
@keyframes tkToast {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ---------- 4. ? の説明カード ---------- */
.helpi {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--tline);
  background: none;
  color: var(--sub);
  font-size: 12px;
  font-weight: 700;
  padding: 0;
  line-height: 1;
  vertical-align: middle;
  flex: none;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s,
    background 0.15s;
}
.helpi:hover {
  border-color: var(--ac);
  color: var(--ac);
}
.helpi[aria-expanded="true"] {
  background: var(--ac);
  border-color: var(--ac);
  color: var(--ac-ink, #fff);
}
.helpcard {
  position: fixed;
  z-index: 130;
  width: min(330px, calc(100vw - 32px));
  max-height: min(62vh, calc(100vh - 120px));
  overflow: auto;
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.22),
    0 0 0 1px var(--line);
  animation: tkHelp 0.18s ease-out;
}
@keyframes tkHelp {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}
.hc-h {
  position: sticky;
  top: 0;
  background: var(--panel);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 12px 8px 18px;
  font-size: 13.5px;
}
.hc-b {
  padding: 0 18px 16px;
  font-size: 12.5px;
  color: var(--ink);
}
.hc-b h4 {
  margin: 16px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  gap: 8px;
  align-items: center;
}
.hc-b h4::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--ac);
  flex: none;
}
.hc-b > h4:first-child {
  border-top: 0;
  padding-top: 0;
  margin-top: 4px;
}
.hc-b p {
  margin: 0;
  line-height: 1.75;
  color: var(--sub);
}
.hc-b dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0 0 10px;
  align-items: start;
}
.hc-b dt {
  display: flex;
  align-items: center;
  min-height: 20px;
  color: var(--sub);
  font-size: 12px;
  white-space: nowrap;
}
.hc-b dd {
  margin: 0;
  color: var(--ink);
}
.hc-b code,
.hc-b kbd {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  background: var(--chip, #ececf0);
  border-radius: 4px;
  padding: 0 5px;
}
body.proto .helpcard,
body.smp .helpcard {
  display: none;
}

/* ---------- 5. 打ち合わせメモ ---------- */
.memo {
  position: fixed;
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: 0;
  z-index: 55;
  background: #191919;
  color: #e6e6e6;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.28);
  padding-bottom: env(safe-area-inset-bottom, 0);
  overflow: hidden;
  --m-ink: #e6e6e6;
  --m-strong: #fff;
  --m-sub: #9b9b9b;
  --m-ph: #5a5a5a;
  --m-line: #3c3c3c;
  --m-focus: #2a2a2a;
  --m-h1bg: rgba(255, 255, 255, 0.07);
  --m-acc: #8a8a8a;
}
.memo-top {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.memo-gz {
  display: block;
  padding: 7px 0 3px;
  cursor: row-resize;
}
.memo-grip {
  display: block;
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: #5a5a5a;
  margin: 0 auto;
  transition:
    background 0.15s,
    width 0.15s;
}
.memo-gz:hover .memo-grip,
.memo.drag .memo-grip {
  background: var(--ac-hi);
  width: 64px;
}
.memo.drag,
.memo.drag * {
  cursor: row-resize !important;
  user-select: none !important;
}
.memo-h {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px 0 18px;
}
.memo-h .ar {
  font-style: normal;
  color: #8a8a8a;
  font-size: 10px;
}
.memo-h .tt {
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
}
.memo-h .peek {
  font-size: 12px;
  color: #8a8a8a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.memo-h .spacer {
  flex: 1;
}
.memo-h .btn {
  background: #2f2f2f;
  color: #e6e6e6;
  box-shadow: none;
}
.memo-h .btn:hover {
  background: #3a3a3a;
  color: #fff;
}
.memo .mq {
  width: 18px;
  height: 18px;
  font-size: 10.5px;
  border-color: #4a4a4e;
  color: #a1a1a6;
  margin-left: -4px;
}
.memo .mq:hover {
  border-color: var(--ac-hi);
  color: var(--ac-hi);
  background: none;
}
.memo .mq[aria-expanded="true"] {
  background: var(--ac-hi);
  border-color: var(--ac-hi);
  color: #111;
}
.mscroll {
  height: var(--memoh);
  overflow: auto;
  border-top: 1px solid #2a2a2a;
  overscroll-behavior: contain;
}

.mwrap {
  display: grid;
  grid-template-columns: minmax(0, 760px) 200px;
  justify-content: center;
  gap: 32px;
  padding: 0 24px;
}
.mwrap.notoc {
  grid-template-columns: minmax(0, 760px);
}
.mwrap > .mdoc {
  margin: 0;
  max-width: none;
  padding: 20px 0 60px;
}
.mdoc {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 32px 60px;
  color: var(--m-ink);
}
.mdoc.light,
.mwrap.light {
  --m-h1bg: #f1f1f3;
  --m-acc: #9a9a9a;
  --m-ink: #2b2b2b;
  --m-strong: #111;
  --m-sub: #8a8a8a;
  --m-ph: #b5b5b5;
  --m-line: #e2e2e7;
  --m-focus: #f2f2f5;
}
.mdoc.light {
  max-width: none;
  padding: 0;
}
.mwrap.light {
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 36px;
  padding: 0;
}
.mwrap.light.notoc {
  grid-template-columns: minmax(0, 1fr);
}
.mwrap.light > .mdoc {
  padding: 0 0 28px;
}
.mtitle {
  width: 100%;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--m-line);
  outline: 0;
  color: var(--m-strong);
  font-size: 24px;
  font-weight: 700;
  padding: 0 0 10px;
  margin: 0 0 16px;
  letter-spacing: 0.01em;
  font-family: inherit;
}
.mtitle::placeholder {
  color: var(--m-ph);
}
.mb-row {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  padding: 1px 0;
}
.mk2 {
  width: 20px;
  flex: none;
  text-align: center;
  color: var(--m-sub);
  line-height: 1.75;
  font-size: 14px;
}
.mb {
  flex: 1;
  min-width: 0;
  outline: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
  font-size: 14px;
  padding: 1px 2px;
  border-radius: 4px;
  caret-color: var(--m-strong);
  color: var(--m-ink);
}
.mb:empty::before {
  content: attr(data-ph);
  color: var(--m-ph);
}
.mb:not(:focus):empty::before {
  content: "";
}
.mb.first:empty::before {
  content: attr(data-ph);
}
.mb.flash {
  background: color-mix(in srgb, var(--ac-hi) 25%, transparent);
  transition: background 0.6s;
}
.t-h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 20px 0 8px;
  line-height: 1.4;
  color: var(--m-strong);
  background: var(--m-h1bg);
  padding: 7px 14px;
  border-radius: 5px;
}
.t-h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 16px 0 6px;
  line-height: 1.45;
  color: var(--m-strong);
  border-left: 4px solid var(--m-acc);
  padding-left: 10px;
  border-radius: 0;
}
.t-h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 10px 0 4px;
  color: var(--m-strong);
  padding-left: 16px;
  background: linear-gradient(var(--m-acc), var(--m-acc)) 2px 50% / 7px 7px no-repeat;
}
.t-h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--m-sub);
  margin: 6px 0 3px;
}
.t-quote {
  border-left: 3px solid var(--m-ink);
  padding-left: 12px;
}
.mb-hr {
  padding: 10px 0;
  outline: 0;
  border-radius: 4px;
}
.mb-hr:focus {
  background: var(--m-focus);
}
.mb-hr hr {
  border: 0;
  border-top: 1px solid var(--m-line);
  margin: 0;
}

/* 見出しの一覧 */
.mtoc {
  position: sticky;
  top: 16px;
  align-self: start;
  margin-top: 20px;
  display: grid;
  gap: 1px;
  max-height: calc(var(--memoh) - 40px);
  overflow: auto;
  border-left: 1px solid var(--m-line);
  padding-left: 10px;
}
.mtoc h6 {
  margin: 0 0 6px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--m-sub);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.mtoc h6 button {
  border: 0;
  background: none;
  color: var(--m-sub);
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
  cursor: pointer;
}
.mtoc h6 button:hover {
  background: var(--m-focus);
  color: var(--m-strong);
}
.ti {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  text-align: left;
  color: var(--m-sub);
  padding: 3px 6px;
  border-radius: 6px;
  cursor: grab;
  touch-action: none;
  width: 100%;
  font-size: 11.5px;
  line-height: 1.5;
  min-width: 0;
  font-family: inherit;
}
.ti .t {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ti .gh {
  opacity: 0;
  font-size: 10px;
  flex: none;
  letter-spacing: -2px;
}
.ti:hover {
  background: var(--m-focus);
  color: var(--m-strong);
}
.ti:hover .gh {
  opacity: 0.55;
}
.ti.l1,
.ti.l2 {
  color: var(--m-ink);
  font-weight: 600;
}
.ti.drag {
  opacity: 0.35;
}
.ti.db {
  box-shadow: inset 0 2px 0 var(--ac-hi);
}
.ti.da {
  box-shadow: inset 0 -2px 0 var(--ac-hi);
}
.tighost {
  position: fixed;
  z-index: 130;
  pointer-events: none;
  background: var(--ac-hi);
  color: #1d1d1f;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 5px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}
.mwrap.light .mtoc {
  order: -1;
  position: sticky;
  top: calc(var(--barh) + 20px);
  border-left: 0;
  padding-left: 0;
  margin-top: 6px;
  overflow: visible;
  max-height: none;
}
.mwrap.light .mtoc .doc-side {
  position: static;
}
.mwrap.light .mb {
  scroll-margin-top: calc(var(--barh) + 24px);
}
.mwrap.light .doc-side {
  display: grid;
  gap: 2px;
  font-size: 12px;
}
.mwrap.light .doc-side a {
  color: var(--sub);
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 5px;
}
.mwrap.light .doc-side a:hover {
  background: var(--hover, #f2f2f5);
  color: var(--ink);
}
.mwrap.light .doc-side a.sub {
  padding-left: 18px;
}
.mwrap.light .doc-side a.sub2 {
  padding-left: 28px;
}
@media (max-width: 1000px) {
  html:not(.desk) .mwrap,
  html:not(.desk) .mwrap.light {
    grid-template-columns: minmax(0, 1fr);
  }
  html:not(.desk) .mtoc {
    display: none;
  }
}
@media print {
  .tk-bar,
  .tk-foot,
  .memo,
  .toast,
  .helpcard {
    display: none !important;
  }
}

/* ---------- 確認のダイアログ ---------- */
.tkc-back {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(20, 20, 24, 0.32);
  display: grid;
  place-items: center;
  animation: tkcIn 0.14s ease-out;
}
.tkc {
  background: #fff;
  border-radius: 14px;
  padding: 22px 22px 18px;
  width: min(380px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #1d1d1f;
}
.tkc b {
  font-size: 15px;
}
.tkc p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: #6e6e73;
}
.tkc-b {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.tkc .btn.danger {
  background: #d93a2f;
  color: #fff;
}
@keyframes tkcIn {
  from {
    opacity: 0;
  }
}

/* ---------- 使い方の動画 ---------- */
.sec small {
  font-size: 12px;
  font-weight: 500;
  color: var(--sub);
  margin-left: 8px;
}
.ytc {
  padding: 0;
  overflow: hidden;
  aspect-ratio: 16/9;
  position: relative;
  background: #000;
}
.ytc iframe,
.ytf {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.ytf {
  padding: 0;
  margin: 0;
  background: #000;
  cursor: pointer;
  display: block;
}
.ytf img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s;
}
.ytf:hover img {
  opacity: 0.9;
}
.ytp {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 68px;
  height: 48px;
  margin: -24px 0 0 -34px;
  border-radius: 12px;
  background: rgba(20, 20, 20, 0.82);
  transition: background 0.15s;
}
.ytp::after {
  content: "";
  position: absolute;
  left: 28px;
  top: 14px;
  border-style: solid;
  border-width: 10px 0 10px 17px;
  border-color: transparent transparent transparent #fff;
}
.ytf:hover .ytp,
.ytf:focus-visible .ytp {
  background: #e00;
}
.gvid {
  display: inline-block;
  margin: 2px 0 6px;
  font-size: 12.5px;
  color: var(--ac);
  text-decoration: none;
  font-weight: 500;
}
.gvid:hover {
  text-decoration: underline;
}
