:root { --ink: #1b1b1f; --muted: #5b5e68; --bg: #f5f6f8; --surface: #ffffff; --line: #c9ccd3; --accent: #2457d6; --face: #fdfdfb; --face-a: #2457d6; --face-b: #1b1b1f; --edge: #b7bcc8; --back: #e9edf8; --grid: #d5d8df; color-scheme: light dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ink: #f1f2f6; --muted: #a2a6b3; --bg: #121317; --surface: #1c1d22; --line: #4a4d58; --accent: #8fb0ff; --face: #2a2d36; --face-a: #8fb0ff; --face-b: #f1f2f6; --edge: #555a69; --back: #232632; --grid: #2c2f3a; } }
:root[data-theme="dark"] { --ink: #f1f2f6; --muted: #a2a6b3; --bg: #121317; --surface: #1c1d22; --line: #4a4d58; --accent: #8fb0ff; --face: #2a2d36; --face-a: #8fb0ff; --face-b: #f1f2f6; --edge: #555a69; --back: #232632; --grid: #2c2f3a; color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.45 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Segoe UI", sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 8px 16px 24px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 1.25rem; }
.sub { font-weight: 400; color: var(--muted); }
.intro a { color: var(--accent); }
.intro { margin: 2px 0 8px; color: var(--muted); font-size: 0.9rem; }
.tools { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.scene { position: relative; height: 380px; overflow: hidden; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); cursor: grab; user-select: none; -webkit-user-select: none; }
.scene[data-grabbing="1"] { cursor: grabbing; }
.scene:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.zoomer { position: absolute; inset: 0; transform-origin: 50% 50%; }
.grid { position: absolute; inset: -50%; background-image: radial-gradient(var(--grid) 1.5px, transparent 1.6px); background-size: 28px 28px; }
.pin { position: absolute; left: 30%; top: 30%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 2px solid var(--accent); }
.persp { position: absolute; inset: 0; display: grid; place-items: center; perspective: 900px; }
.card { position: relative; width: 150px; height: 210px; transform-style: preserve-3d; }
.face { position: absolute; backface-visibility: hidden; }
.front, .back { inset: 0; border-radius: 10px; background: var(--face); border: 1px solid var(--edge); }
.front { transform: translateZ(14px); }
.back { transform: rotateY(180deg) translateZ(14px); background: var(--back); }
.face svg { width: 100%; height: 100%; display: block; }
.face .a { fill: var(--face-a); }
.face .b { fill: var(--face-b); }
.edge-l, .edge-r { top: 0; width: 28px; height: 100%; left: 50%; margin-left: -14px; background: var(--edge); }
.edge-l { transform: rotateY(-90deg) translateZ(75px); }
.edge-r { transform: rotateY(90deg) translateZ(75px); }
.edge-t, .edge-b { left: 0; width: 100%; height: 28px; top: 50%; margin-top: -14px; background: var(--edge); }
.edge-t { transform: rotateX(90deg) translateZ(105px); }
.edge-b { transform: rotateX(-90deg) translateZ(105px); }
kazoku-view-controls { margin-top: 6px; }
.readout { display: block; margin-top: 6px; color: var(--muted); font: 0.8rem/1.4 ui-monospace, "SF Mono", Menlo, monospace; }
@media (max-width: 640px) {
  main { padding: 4px 12px 16px; }
  .intro { display: none; }
  .scene { height: min(300px, 36vh); }
  .readout { display: none; }
}
.panel { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 6px 0; }
.row .name { flex: none; min-width: 5.5rem; font-weight: 600; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pill { -webkit-appearance: none; appearance: none; box-sizing: border-box; min-height: 48px; min-width: 48px; margin: 0; padding: 0 14px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pill:hover { border-color: var(--ink); }
.pill[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.pill:focus-visible, .text:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.text { -webkit-appearance: none; appearance: none; box-sizing: border-box; min-height: 48px; width: min(20rem, 100%); padding: 0 16px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); color: var(--ink); font: inherit; }
.sample { display: grid; place-items: center; min-height: 120px; margin: 8px 0; border: 1px dashed var(--line); border-radius: 12px; background-size: 18px 18px; font-weight: 700; }
.sample[data-dots="on"] { background-image: radial-gradient(var(--grid) 1.5px, transparent 1.6px); }
.sample span { font-size: 1.1rem; }
.sample[data-size="s"] span { font-size: 0.9rem; }
.sample[data-size="l"] span { font-size: 2rem; }
.log { margin: 6px 0 0; padding: 0; list-style: none; color: var(--muted); font: 0.8rem/1.5 ui-monospace, "SF Mono", Menlo, monospace; }
.nav { margin: 4px 0 0; font-size: 0.9rem; }
.nav a { color: var(--accent); }
output[data-testid="address"] { min-width: 0; overflow-wrap: anywhere; font: 0.85rem/1.4 ui-monospace, "SF Mono", Menlo, monospace; }
.targets { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 8px; }
.target { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.target h2 { margin: 0 0 8px; font-size: 1rem; }
.target canvas { display: block; width: 100%; height: auto; max-height: 220px; border-radius: 8px; background: var(--bg); }
.target svg.art { display: block; width: 150px; height: 210px; max-width: 100%; margin: 0 auto; }
.target kazoku-save-image { margin-top: 8px; }
.sheet { padding: 14px; border: 2px solid var(--accent); border-radius: 16px; background: var(--face); color: var(--ink); }
.sheet h3 { margin: 0 0 6px; font-size: 1.1rem; }
.sheet p { margin: 0 0 8px; color: var(--muted); font-size: 0.9rem; }
.sheet .chip { display: inline-block; padding: 4px 12px; border-radius: 16px; background: var(--face-a); color: var(--surface); font-weight: 700; }
.saved { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.saved img { max-width: 180px; max-height: 120px; border: 1px solid var(--line); border-radius: 8px; background: repeating-conic-gradient(var(--grid) 0 25%, transparent 0 50%) 0 / 16px 16px; }
.card-face { fill: var(--face); stroke: var(--edge); stroke-width: 2; }
.art .a { fill: var(--face-a); }
.art .b { fill: var(--face-b); }

#globe { position: absolute; inset: 0; margin: auto; width: 300px; height: 300px; pointer-events: none; }
/* layouts.html: the layouts side by side. */
.wide main { max-width: 1240px; }
.ranges { margin: 4px 0 10px; }
.layouts { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); align-items: start; }
.layout { min-width: 0; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.layout h2 { margin: 0 0 2px; font-size: 1rem; }
.layout h2 .sub { font-size: 0.9rem; }
.layout .say { margin: 0 0 8px; color: var(--muted); font-size: 0.9rem; }
.layout .scene.small { height: 240px; background: var(--bg); }
.layout .card { width: 110px; height: 154px; }
.layout .edge-l { transform: rotateY(-90deg) translateZ(55px); }
.layout .edge-r { transform: rotateY(90deg) translateZ(55px); }
.layout .edge-t { transform: rotateX(90deg) translateZ(77px); }
.layout .edge-b { transform: rotateX(-90deg) translateZ(77px); }
.stage.beside { display: flex; gap: 12px; align-items: flex-start; }
.stage.beside .scene { flex: 1 1 auto; min-width: 0; height: 280px; }
.stage.beside kazoku-view-controls { margin-top: 0; flex: none; }
.snippet { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; }
.snippet pre { flex: 1 1 auto; margin: 0; }
.code { min-width: 0; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font: 0.8rem/1.5 ui-monospace, "SF Mono", Menlo, monospace; }
.copy { flex: none; }
.picks { display: none; }
@media (max-width: 1099px) {
  .picks { display: flex; margin: 0 0 10px; }
  .layouts[data-show="horizontal"] .layout:not([data-layout="horizontal"]), .layouts[data-show="vertical"] .layout:not([data-layout="vertical"]), .layouts[data-show="compact"] .layout:not([data-layout="compact"]), .layouts[data-show="classic"] .layout:not([data-layout="classic"]) { display: none; }
}
@media (max-width: 640px) {
  .stage.beside { flex-direction: column; align-items: stretch; }
  .stage.beside .scene { height: min(260px, 34vh); }
  .stage.beside kazoku-view-controls { width: auto; }
  .layout .scene.small { height: min(220px, 30vh); }
  .ranges .name { min-width: 0; }
}
.builder { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); margin: 10px 0; }
@media (min-width: 900px) { .builder { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.builder .panel { margin-top: 0; }
.builder h2, .panel h2 { margin: 0 0 8px; font-size: 1rem; }
.stagebox { display: grid; gap: 10px; justify-items: start; min-height: 120px; }
.stagebox .scene { width: 100%; max-width: 560px; }
.stagebox kazoku-view-controls { width: 100%; }
