/* Filiris 試し書き：私用の試し書きページ（design_ref_private_page.html）の見た目に合わせた。
   フォントのファイルは読み込まず、埋め込みもしない。Filiris の字はすべて canvas にスプライトで描く。 */
:root {
  --bg: #f4f3ef;
  --bg-stage: #ebe9e3;
  --bg-raise: #fbfaf7;
  --ink: #1d1d1f;
  --ink-soft: #55534d;
  --ink-faint: #8a877f;
  --hair: rgba(29, 29, 31, 0.14);
  --chip: rgba(29, 29, 31, 0.06);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #171718;
  --bg-stage: #1f1f21;
  --bg-raise: #232325;
  --ink: #eceae4;
  --ink-soft: #b3b0a8;
  --ink-faint: #7d7b74;
  --hair: rgba(236, 234, 228, 0.16);
  --chip: rgba(236, 234, 228, 0.07);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", system-ui, sans-serif;
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button { min-height: 2.25rem; }
button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 1px solid var(--ink-soft); outline-offset: 2px; }

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 clamp(18px, 4vw, 44px); }

/* ---------- header ---------- */
header { border-bottom: 1px solid var(--hair); }
header .wrap {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 16px; padding-top: 30px; padding-bottom: 24px;
}
.wordmark { display: flex; align-items: center; justify-content: center; min-width: 0; height: 46px; }
.wordmark canvas { display: block; height: 46px; }
.theme-btn {
  justify-self: end;
  width: 38px; height: 38px; min-height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
  transition: color 0.2s ease;
}
.theme-btn .dot {
  width: 13px; height: 13px; border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  box-shadow: inset 0 0 0 1.5px currentColor;
  flex: none;
}
.theme-btn:hover { color: var(--ink); }

/* ---------- stage ---------- */
.stage { background: var(--bg-stage); transition: background-color 0.25s ease; }
.stage .wrap { padding-top: 30px; padding-bottom: 38px; }

.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; margin-bottom: 8px; }
.tab {
  position: relative;
  padding: 12px 12px 9px; min-height: 2.5rem;
  line-height: 1.15; color: var(--ink-soft);
  border-radius: 6px;
  transition: color 0.2s ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-pressed="true"] { color: var(--ink); }
.tab .spark {
  position: absolute; top: 0; left: 50%; width: 12px; height: 12px; margin-left: -6px;
  display: block; opacity: 0; pointer-events: none;
}
.tab[aria-pressed="true"] .spark { opacity: 1; animation: spark-grow 3s ease-in-out infinite; will-change: transform; }
.tab::after {
  content: ""; position: absolute; left: 20%; right: 20%; bottom: 3px;
  height: 1px; background: var(--ink);
  transform: scaleX(0); transform-origin: center;
  transition: transform 0.35s ease;
}
.tab[aria-pressed="true"]::after { transform: scaleX(1); }
@keyframes spark-grow { 0%, 100% { transform: scale(0.8); } 50% { transform: scale(1); } }
/* 書体名：その書体で組んだ画像を型抜きに使い、文字色（currentColor）で塗る。大きさはタブの文字の大きさ（1em＝画像の 36px）に合わせる */
.tab { font-size: 18px; }
.tab .nm {
  display: block; width: calc(var(--w) * 1em); height: calc(var(--h) * 1em);
  background: currentColor;
  -webkit-mask: url("fonts/tabnames.png") no-repeat; mask: url("fonts/tabnames.png") no-repeat;
  -webkit-mask-size: calc(var(--mw) * 1em) calc(var(--mh) * 1em); mask-size: calc(var(--mw) * 1em) calc(var(--mh) * 1em);
  -webkit-mask-position: calc(var(--mx) * -1em) calc(var(--my) * -1em); mask-position: calc(var(--mx) * -1em) calc(var(--my) * -1em);
}
.tab .tx { display: none; }
/* マスクが使えない古いブラウザでは、ゴシックの文字で出す */
@supports not ((mask-image: none) or (-webkit-mask-image: none)) {
  .tab .nm { display: none; }
  .tab .tx { display: inline; font-size: 15px; }
}

.stage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 14px; }
.stage-head .now { font-size: 12px; letter-spacing: 0.22em; color: var(--ink-faint); }
.stage-head .now b { font-weight: 400; color: var(--ink-soft); }

.preview { padding: clamp(20px, 4vw, 40px) 0 clamp(14px, 3vw, 28px); }
.preview canvas { display: block; width: 100%; }

.note {
  font-size: 12.5px; line-height: 1.7; color: var(--ink-soft);
  background: var(--bg-raise); border: 1px solid var(--hair); border-radius: 6px;
  padding: 10px 14px; margin: 0 auto 14px; max-width: 640px; text-align: center;
}
.note[hidden] { display: none; }

.type-row { max-width: 640px; margin: 4px auto 0; }
.type-row label { display: block; font-size: 11px; letter-spacing: 0.2em; color: var(--ink-faint); margin-bottom: 2px; text-align: center; }
#text {
  display: block; width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--hair);
  padding: 8px 2px 10px; color: var(--ink);
  font: inherit; font-size: 17px; line-height: 1.6; text-align: center;
  border-radius: 0; outline: none; resize: none; overflow: hidden;
}
#text:focus { border-bottom-color: var(--ink-soft); }
#text::placeholder { color: var(--ink-faint); }

.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 28px; margin-top: 26px; }
.size-ctl { display: flex; align-items: center; gap: 12px; }
.size-ctl label, .toggle .tl { font-size: 11px; letter-spacing: 0.2em; color: var(--ink-faint); white-space: nowrap; }
.size-ctl output { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; min-width: 3.4em; }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: min(240px, 44vw); height: 36px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--ink-faint); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg-stage); border: 1.5px solid var(--ink);
  margin-top: -8.5px;
}
input[type="range"]::-moz-range-track { height: 1px; background: var(--ink-faint); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--bg-stage); border: 1.5px solid var(--ink); }

/* 装飾合字のトグル（参照には無い部品。細い線の四角で揃えた） */
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; min-height: 2.25rem; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .box { width: 14px; height: 14px; border: 1.5px solid var(--ink-soft); border-radius: 3px; position: relative; flex: none; }
.toggle input:checked + .box { background: var(--ink); border-color: var(--ink); }
.toggle input:checked + .box::after {
  content: ""; position: absolute; left: 3.5px; top: 0.5px; width: 4px; height: 8px;
  border: solid var(--bg-stage); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.toggle input:focus-visible + .box { outline: 1px solid var(--ink-soft); outline-offset: 2px; }
.toggle:hover .tl { color: var(--ink-soft); }

/* 画像の保存（参照には無い部品。見本のチップと同じ形） */
.pill {
  font-size: 12px; letter-spacing: 0.12em; color: var(--ink-soft);
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--hair);
}
.pill:hover { color: var(--ink); background: var(--bg-raise); }

.samples { margin-top: 22px; text-align: center; }
.samples .cap { font-size: 11px; letter-spacing: 0.2em; color: var(--ink-faint); margin-bottom: 8px; }
.samples .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.sample {
  font-size: 13px; letter-spacing: 0.08em; line-height: 1.2;
  padding: 8px 14px; min-height: 2.25rem; color: var(--ink-soft);
  background: var(--chip); border-radius: 6px;
}
.sample:hover, .sample[aria-pressed="true"] { color: var(--ink); background: var(--bg-raise); }

/* ---------- glyphs ---------- */
section.block .wrap { padding-top: 46px; padding-bottom: 8px; }
h2 { font-size: 13px; font-weight: 400; letter-spacing: 0.26em; color: var(--ink-soft); margin: 0 0 6px; }
.block .lead { font-size: 12.5px; color: var(--ink-faint); margin: 0 0 18px; }
.ggroup { margin-top: 30px; }
.ggroup h3 { font-size: 12px; font-weight: 400; letter-spacing: 0.22em; color: var(--ink-soft); margin: 0 0 10px; display: flex; align-items: baseline; gap: 10px; }
.ggroup h3 .n { font-size: 11px; letter-spacing: 0.08em; color: var(--ink-faint); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.cell {
  background: var(--bg-raise); border-radius: 6px;
  padding: 10px 4px 9px; text-align: center; min-height: 84px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  transition: background-color 0.25s ease;
}
.cell:hover { outline: 1px solid var(--hair); outline-offset: -1px; }
.cell canvas { display: block; width: 60px; height: 50px; }
.cell .cp { font-size: 9.5px; letter-spacing: 0.08em; color: var(--ink-faint); font-variant-numeric: tabular-nums; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- toast・footer ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 8px);
  background: var(--ink); color: var(--bg);
  font-size: 12.5px; letter-spacing: 0.06em; padding: 9px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

footer .wrap { padding-top: 54px; padding-bottom: 46px; }
footer p { font-size: 11.5px; letter-spacing: 0.1em; color: var(--ink-faint); margin: 0; text-align: center; }
footer .fname { font-size: 13px; letter-spacing: 0.12em; color: var(--ink-soft); }
footer .shop { margin-top: 10px; }
footer a { color: var(--ink-soft); }

@media (max-width: 560px) {
  .wordmark, .wordmark canvas { height: 38px; }
  .tab { font-size: 16.5px; padding: 14px 10px 8px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
  .cell { min-height: 76px; }
  .cell canvas { width: 52px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
