:root {
  --bg: #F2EFEC;
  --board: #FAF8F6;
  --tile: #FFFFFF;
  --ink: #111111;
  --sub: #5b5752;
  --line: #e2ddd8;
  --sel: #111111;
  --red: #FC3C2D;
  --err: #b42318;
  --board-w: 420px;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-weight: 400;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
b, strong, h1, h2, h3, th { font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
input[type=range], input[type=checkbox], input[type=radio] { accent-color: #111; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }

/* ---- 3D の画面(画面全体) */
.stage { position: fixed; inset: 0; background: var(--bg); }
#three { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--sub); pointer-events: none; }
.loading.hidden { display: none; }

.logo { position: absolute; left: 20px; top: 16px; margin: 0; font-size: 18px; letter-spacing: 0.02em; pointer-events: none; }
.logo img { display: block; height: 20px; width: auto; max-width: min(300px, calc(100vw - var(--board-w) - 380px)); object-fit: contain; object-position: left center; }

.topbar { position: absolute; top: 12px; right: calc(var(--board-w) + 28px); display: flex; gap: 6px; }
.topbar button { display: flex; align-items: center; gap: 6px; background: var(--tile); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; cursor: pointer; font-size: 13px; }
.topbar button.accent { background: var(--ink); color: #fff; border-color: var(--ink); }
.topbar button:disabled { opacity: 0.4; cursor: default; }
.topbar svg { width: 18px; height: 18px; }
.topbar .toplink { display: flex; align-items: center; gap: 6px; background: var(--tile); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 13px; color: var(--ink); text-decoration: none; }
input[type=text] { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; grid-column: 1 / -1; width: 100%; }
/* 一覧のページの中で 3D だけを見せる表示(?viewer=1) */
.stage.viewer .board, .stage.viewer .topbar, .stage.viewer .view-tools, .stage.viewer .help, .stage.viewer .logo, .stage.viewer .bg-warn { display: none !important; }

.help { position: absolute; left: 16px; top: 58px; max-width: 330px; background: var(--tile); border: 1px solid var(--line); border-radius: 12px; padding: 8px 30px 8px 12px; font-size: 11.5px; line-height: 1.55; }
.help[hidden] { display: none; }
.help-title { margin: 0 0 4px; font-weight: 600; }
.help ul { margin: 0; padding-left: 1.1em; }
.help li { white-space: nowrap; }
.help .close { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--sub); }

.drop-hint { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: #fff; font-size: 13px; padding: 5px 10px; border-radius: 8px; white-space: nowrap; transform: translate(14px, 14px); }
.drop-hint[hidden] { display: none; }
.bg-warn { position: absolute; left: 50%; top: 56px; transform: translateX(calc(-50% - var(--board-w) / 2)); margin: 0; background: var(--tile); border: 1px solid var(--line); color: var(--err); font-size: 12px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.stage.dark .logo { color: #fff; }
.stage.dark .topbar button.accent { background: #fff; color: var(--ink); border-color: #fff; }

.view-tools { position: absolute; left: 16px; bottom: 14px; z-index: 5; }   /* 高さと下端は入口(.gal-door)と同じ */
.vt-toggle { width: 60px; height: 60px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line2); background: var(--tile); color: var(--ink); border-radius: 999px; cursor: pointer; }
.vt-toggle svg { width: 26px; height: 26px; }
.vt-toggle:hover { background: var(--hover); }
.vt-toggle[aria-expanded="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.vt-panel { position: absolute; left: 0; bottom: calc(100% + 8px); display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: max-content; max-width: calc(100vw - 16px); background: var(--tile); border: 1px solid var(--line2); border-radius: 14px; padding: 8px 12px; font-size: 13px; }
.vt-panel[hidden] { display: none; }
.vt-panel button { border: 1px solid var(--line2); background: var(--board); border-radius: 999px; padding: 4px 12px; cursor: pointer; }

/* ---- 設定の板 */
.board { position: absolute; right: 16px; top: 16px; bottom: 16px; width: var(--board-w); display: flex; background: var(--board); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: 0 1px 0 rgba(0,0,0,0.03); font-size: 13px; }
.tabs { flex: 0 0 76px; display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; overflow-y: auto; background: #F2EFEC; border-right: 1px solid var(--line); }
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border: 0; border-radius: 12px; background: none; cursor: pointer; color: var(--sub); font-size: 12px; }
.tabs button svg { width: 24px; height: 24px; }
.tabs button span { white-space: nowrap; font-size: 11px; letter-spacing: -0.02em; }   /* 「顔モニター」を1行に収める */
.tabs button[aria-selected=true] { background: var(--tile); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.pages { flex: 1 1 auto; overflow-y: auto; padding: 6px 16px 20px; }
.page[hidden] { display: none; }
.page h2 { font-size: 14px; margin: 14px 0 8px; }
.note { margin: -2px 0 8px; color: var(--sub); font-size: 12px; }

.row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.col { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; margin: 8px 0; }
.col > input[type=range], .col > textarea { grid-column: 1 / -1; width: 100%; }
.col > .val { grid-row: 1; grid-column: 2; color: var(--sub); font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 6px; margin: 8px 0; cursor: pointer; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--sub); }
textarea { resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; }
input[type=color] { width: 40px; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
button { border: 1px solid var(--line); background: var(--tile); border-radius: 8px; padding: 7px 10px; cursor: pointer; }
button:hover, .filebtn.button:hover { border-color: #b9b2ab; }
button:disabled { opacity: 0.5; cursor: wait; }
button.wide.insta { background: var(--tile); color: var(--ink); border-color: var(--ink); }
button.wide { width: 100%; margin-top: 8px; background: var(--ink); color: #fff; border-color: var(--ink); padding: 10px; }

/* ---- タイル(選んだタイルは黒い枠と右上のチェックの印) */
.tiles { display: grid; gap: 8px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: var(--tile); border: 1.5px solid var(--line); border-radius: 14px; padding: 8px 4px; cursor: pointer; text-align: center; }
.tile input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.tile.selected, .tile:has(input:checked), .tile[aria-pressed=true] { border-color: var(--sel); box-shadow: inset 0 0 0 1px var(--sel); }
.tile.selected::after, .tile:has(input:checked)::after, .tile[aria-pressed=true]::after {
  content: ""; position: absolute; right: 5px; top: 5px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--sel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.2l2.6 2.6L12 5.4' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.tile.disabled { opacity: 0.45; cursor: not-allowed; }
.tile:focus-visible, .tile:has(input:focus-visible) { outline: 2px solid var(--red); outline-offset: 2px; }

.color-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.swatch { padding: 8px 2px 6px; font-size: 12px; color: var(--sub); }
.swatch i { width: 46px; height: 46px; border-radius: 50%; display: block; border: 1px solid rgba(0,0,0,0.12); }
.custom-color { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; }
.custom-color .row { margin: 0; }
.chip { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.15); cursor: grab; }

.pattern-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ptile .thumb { width: 64px; height: 48px; border-radius: 8px; display: grid; place-items: center; background: #F2EFEC center / cover no-repeat; color: var(--sub); }
.ptile .thumb svg { width: 26px; height: 26px; }
.tlabel { font-size: 12px; }

.expr-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.etile { padding: 6px 4px 6px; font-size: 12px; }
.etile canvas { width: 100%; max-width: 90px; height: auto; aspect-ratio: 180 / 116; display: block; }

.seg-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 6px 0; }
.seg-tiles.four { grid-template-columns: repeat(4, 1fr); }
.seg-tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg-tiles.four .stile { font-size: 11px; white-space: nowrap; padding: 9px 2px; }
#pedestalTiles .stile { white-space: normal; line-height: 1.3; }
.stile { padding: 9px 4px; font-size: 12px; min-height: 42px; }

.color-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ctile { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--tile); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 4px; cursor: pointer; font-size: 12px; }
.ctile input[type=color] { width: 46px; height: 46px; border-radius: 50%; padding: 0; overflow: hidden; }
.ctile input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.ctile input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }

.gaze-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }   /* 設定の板の幅いっぱいに並べる */
.gaze-pad button { border-radius: 10px; padding: 9px 4px; }
.gaze-pad button[aria-pressed=true] { background: var(--ink); color: #fff; border-color: var(--ink); }

details.fine { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 8px; }
details.fine summary { cursor: pointer; font-weight: 600; padding: 4px 0; list-style-position: inside; }

.seg { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0; }
.seg label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.sub { margin: 8px 0; }
.sub[hidden] { display: none; }
.gen { margin-top: 10px; }
/* 顔モニターのタブの、見出しごとに折りたためる欄(見出しは h2 と同じ大きさ) */
details.sec { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 6px; }
details.sec > summary { cursor: pointer; font-size: 14px; font-weight: 600; padding: 6px 0 8px; list-style-position: inside; }
.msg { margin: 6px 0 0; color: var(--sub); white-space: pre-wrap; min-height: 1em; }
.msg.err { color: var(--err); }
.quota { margin: 6px 0 0; font-size: 12px; color: var(--sub); }
.quota.err { color: var(--err); }
.drop { border: 1px dashed #c9c2bb; border-radius: 10px; padding: 12px; text-align: center; color: var(--sub); background: #fff; }
.drop.over { background: #efe9e3; border-color: var(--ink); }
.filebtn { color: var(--ink); text-decoration: underline; cursor: pointer; }
.filebtn input { display: none; }
.filebtn.button { text-decoration: none; display: inline-block; border: 1px solid var(--line); background: var(--tile); border-radius: 8px; padding: 7px 10px; }
.buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ---- iPad 横など、やや狭い横長の画面 */
@media (max-width: 1100px) and (min-aspect-ratio: 1/1) {
  :root { --board-w: 380px; }
  .topbar button span, .topbar .toplink span { display: none; }
}
/* ---- 共有のボタン(右上で一番目立たせる) */
.topbar button.share { background: var(--red); color: #fff; border-color: var(--red); font-weight: 600; }
.topbar button.share span { display: inline !important; }
.stage.dark .topbar button.share { background: var(--red); color: #fff; border-color: var(--red); }
/* ---- みんなのデジダルマの入口(3D の画面の右下) */
.gal-door { position: absolute; right: calc(var(--board-w) + 28px); bottom: 14px; display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 20px 8px 10px; border-radius: 999px; background: var(--ink); color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; line-height: 1.25; box-shadow: 0 0 0 3px var(--bg); }
.gal-door:hover { background: #2a2a2a; }
.door-faces { display: flex; }
.door-faces:empty { display: none; }
.gal-door:not(.has-faces) { padding-left: 20px; }
.door-faces img { width: 44px; height: 44px; border-radius: 50%; background: var(--bg); border: 2px solid var(--ink); object-fit: contain; margin-left: -12px; }
.door-faces img:first-child { margin-left: 0; }
.door-faces img.old { object-fit: cover; }
.stage.viewer .gal-door { display: none !important; }
/* 投稿のあとの「一覧で見る」 */
.wide-link { display: block; text-align: center; margin-top: 6px; padding: 10px; border: 1px solid var(--ink); border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600; }
.wide-link[hidden] { display: none; }
/* ---- 共有の画面 */
.share-sheet { border: 0; padding: 20px 20px 16px; border-radius: 20px; width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--board); color: var(--ink); font-size: 13px; }
.share-sheet::backdrop { background: rgba(17, 17, 17, 0.45); }
.share-sheet .close { position: absolute; right: 12px; top: 8px; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--sub); }
.sheet-title { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
.share-preview { display: flex; justify-content: center; margin: 10px 0; }
.share-preview img { max-width: 100%; max-height: 34dvh; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.share-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.share-row button { border: 1px solid var(--line); background: var(--tile); border-radius: 999px; padding: 9px 4px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.share-cta { border-top: 1px solid var(--line); padding-top: 10px; }
.share-cta[hidden] { display: none; }
/* ---- 長押しで保存する画面 */
.img-sheet { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; background: rgba(17, 17, 17, 0.88); color: #fff; font-size: 14px; font-weight: 600; }
.img-sheet[hidden] { display: none; }
.img-sheet img { max-width: 100%; max-height: 72dvh; -webkit-touch-callout: default; user-select: auto; }
.img-sheet button { border: 1px solid #fff; background: none; color: #fff; border-radius: 999px; padding: 8px 18px; }
/* ---- 一覧の舞台に重ねる表示(?viewer=1&stage=1): 背景を透明にする */
html.stage-mode, html.stage-mode body, html.stage-mode .stage { background: transparent !important; }
html.stage-mode .loading { display: none; }
/* ---- 縦長の画面: 板を下に置き、タブを横に並べる */
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  :root { --board-w: 0px; --board-h: 48vh; }
  .board { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; height: var(--board-h); flex-direction: column; border-radius: 18px; }
  .tabs { flex: 0 0 auto; flex-direction: row; padding: 6px; border-right: 0; border-bottom: 1px solid var(--line); }
  .tabs button { flex: 1 1 0; padding: 6px 2px; }
  .tabs button svg { width: 20px; height: 20px; }
  .pages { padding: 4px 12px 16px; }
  .topbar { right: 10px; top: 10px; }
  .topbar button { padding: 7px 9px; }
  .topbar button span, .topbar .toplink span { display: none; }
  .logo { left: 14px; top: 16px; font-size: 15px; }
  .logo img { height: 15px; max-width: calc(100vw - 200px); }
  .gal-door { right: 8px; bottom: calc(var(--board-h) + 18px); min-height: 50px; padding: 5px 14px 5px 6px; font-size: 12px; gap: 8px; }
  .door-faces img { width: 36px; height: 36px; }
  .share-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-tools { left: 8px; right: auto; bottom: calc(var(--board-h) + 18px); }
  .vt-toggle { width: 50px; height: 50px; }
  .vt-panel { font-size: 12px; }
  .help { left: 8px; right: auto; max-width: calc(100vw - 16px); top: 48px; font-size: 11px; }
  .color-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .swatch i { width: 38px; height: 38px; }
  .etile canvas { max-width: 78px; }
}

/* ==== 見た目の決まり(2026-12-02 に整理: 立体風の影と太い輪郭をやめ、平らな塗り・細い線・色の違いで区別する)====
   線: 1px の rgba(17,17,17,0.18)。角の丸み: 小さい部品 10px・タイル 14px・板 20px・ボタン 999px。文字: 11 / 12 / 13 / 14 / 16px。
   差し色(花の色)は、右上の「共有」と、選んだデジダルマの台の輪だけに使う。デジダルマの形(タブのアイコン・選んだ印の顔モニター・
   見出しの頭の目・読み込み中のまばたき・花の紙吹雪)は残す */
:root { --line2: rgba(17,17,17,0.18); --hover: #F6F3F0; --cyan: #00DCE6; --yellow: #FFCD29; --blue: #0054E6; --pink: #F6BEC8; --mon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 16'%3E%3Cpath d='M2.15 5.05L1.51 6.70L1.08 8.66L1.13 11.29L1.38 12.27L2.02 13.41L2.87 14.22L3.76 14.69L5.97 14.90L9.79 14.43L12.21 14.43L15.99 14.90L17.56 14.86L18.49 14.60L19.34 14.09L20.11 13.29L20.66 12.23L20.96 11.04L21.00 9.17L20.75 7.47L20.11 5.47L19.34 4.16L18.49 3.27L16.12 1.86L14.38 1.35L12.38 1.10L9.66 1.10L7.45 1.40L5.59 1.99L4.18 2.76L3.12 3.65Z' fill='%23111'/%3E%3C/svg%3E"); }
@keyframes pop { 0% { transform: scale(0.97); } 100% { transform: none; } }
@keyframes hop { 0% { transform: none; } 35% { transform: translateY(-3px); } 60% { transform: translateY(0) scaleY(0.92); } 100% { transform: none; } }
@keyframes blink { 0%, 86%, 100% { transform: scaleY(1); } 92% { transform: scaleY(0.1); } }
@keyframes look { 0% { transform: translateX(0); } 30% { transform: translateX(2px); } 60% { transform: translateX(-1px); } 100% { transform: translateX(0); } }
@keyframes sway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
.pop { animation: pop .16s ease-out; }
button, .tile, .ctile, .pill, .wide-link, .filebtn.button { transition: background-color .12s, border-color .12s, color .12s; }

/* 右上のボタン: 白の地に細い線。おまかせは黒、共有だけ赤 */
.topbar { gap: 6px; }
.topbar button { border: 1px solid var(--line2); background: var(--tile); font-weight: 600; min-height: 40px; }
.topbar button:hover:not(:disabled) { background: var(--hover); }
.topbar button:active:not(:disabled) { transform: scale(0.97); }
.topbar button.accent, .stage.dark .topbar button.accent { background: var(--ink); color: #fff; border-color: var(--ink); }
.topbar button.share, .stage.dark .topbar button.share { background: var(--red); color: #fff; border-color: var(--red); }
.topbar svg { width: 20px; height: 20px; }
.stage.dark .topbar button:disabled { opacity: 1; background: rgba(255,255,255,0.55); color: rgba(17,17,17,0.55); }

/* 設定の板とタブ */
.board { border: 1px solid var(--line2); box-shadow: none; border-radius: 20px; }
.tabs { gap: 4px; border-right: 1px solid var(--line2); }
.tabs button { border: 1px solid transparent; border-radius: 14px; padding: 8px 0; }
.tabs button:hover { background: rgba(255,255,255,0.75); }
.tabs button[aria-selected=true] { background: var(--tile); color: var(--ink); border-color: var(--line2); box-shadow: none; }
.tabs button span { font-size: 10.5px; letter-spacing: -0.04em; }
.tabs button.hop svg { animation: hop .36s ease-out; transform-origin: 50% 100%; }

/* 見出し: 頭に、顔モニターの縦長の目を2つ置く */
.page h2::before, .sheet-title::before { content: ""; display: inline-block; width: 3px; height: 9px; border-radius: 2px; background: var(--ink); box-shadow: 6px 0 0 var(--ink); margin: 0 12px 0 1px; vertical-align: 0; }

/* タイル: 細い線。選んだタイルは黒い線と、目が2つ並んだ小さな顔モニターの印(文字に重ならないよう、右上の角に小さく置く) */
.tile, .ctile { border: 1px solid var(--line2); box-shadow: none; border-radius: 14px; }
.tile:hover, .ctile:hover { background: var(--hover); border-color: rgba(17,17,17,0.3); }
.tile:active { transform: scale(0.98); }
.tile.selected, .tile:has(input:checked), .tile[aria-pressed=true] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--tile); }
.tile.selected::after, .tile:has(input:checked)::after, .tile[aria-pressed=true]::after {
  right: -6px; top: -6px; width: 22px; height: 16px; border-radius: 0; background: var(--mon) center / contain no-repeat;
}
.tile.selected::before, .tile:has(input:checked)::before, .tile[aria-pressed=true]::before {
  content: ""; position: absolute; z-index: 1; right: 4px; top: -1px; width: 2.5px; height: 5px; border-radius: 2px; background: var(--cyan); box-shadow: 5px 0 0 var(--cyan);
  animation: look .5s ease-out .05s, blink 3.6s 1s infinite; transform-origin: 50% 50%;
}
.tiles { padding: 6px 6px 0 0; }
.stile { padding: 9px 4px; word-break: keep-all; overflow-wrap: anywhere; line-height: 1.35; }
.tlabel, .swatch, .etile { word-break: keep-all; overflow-wrap: anywhere; }

/* 大きいボタン: 黒の地(押せることを塗りで示す) */
button.wide { background: var(--ink); border: 1px solid var(--ink); color: #fff; box-shadow: none; border-radius: 999px; font-weight: 600; padding: 12px; min-height: 44px; }
button.wide:hover { background: #2b2b2b; }
button.wide:active { transform: scale(0.98); }
.wide-link { border: 1px solid var(--line2); box-shadow: none; background: var(--tile); min-height: 44px; box-sizing: border-box; }
.buttons button, .filebtn.button, .vt-panel button, .gaze-pad button { border: 1px solid var(--line2); box-shadow: none; border-radius: 999px; min-height: 36px; }
.gaze-pad button[aria-pressed=true] { background: var(--ink); color: #fff; border-color: var(--ink); }
.vt-panel, .help { border: 1px solid var(--line2); box-shadow: none; }
input[type=text], textarea { border: 1px solid var(--line2); border-radius: 10px; }
input[type=text]:focus, textarea:focus { outline: none; border-color: var(--ink); }

/* みんなのデジダルマの入口: 黒の地、顔は少しずつ揺れる */
.gal-door { border: 0; box-shadow: none; }
.gal-door:active { transform: scale(0.98); }
.door-faces img { border-color: var(--ink); animation: sway 2.6s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.door-faces img:nth-child(2) { animation-delay: -0.9s; } .door-faces img:nth-child(3) { animation-delay: -1.7s; }

/* 共有の画面 */
.share-sheet { border: 1px solid var(--line2); box-shadow: none; border-radius: 20px; }
.share-row button { border: 1px solid var(--line2); box-shadow: none; font-weight: 600; background: var(--tile); min-height: 44px; }
.share-row button:hover { background: var(--hover); }

/* 読み込み中: 顔モニターのドットの目がまばたきする */
.ld { display: grid; justify-items: center; gap: 10px; font-weight: 600; color: var(--ink); }
.ld-mon { position: relative; width: 88px; height: 64px; background: var(--mon) center / contain no-repeat; display: flex; justify-content: center; align-items: center; gap: 16px; padding-bottom: 6px; box-sizing: border-box; }
.ld-mon i { display: block; width: 14px; height: 24px; border-radius: 7px; background: radial-gradient(circle, var(--cyan) 0 1.4px, transparent 1.6px) 0 0 / 4px 4px; animation: blink 2.2s infinite; }

/* 紙吹雪(花の形) */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.fx-flower { position: absolute; display: block; }
.fx-flower svg { width: 100%; height: 100%; display: block; overflow: visible; }

@media (prefers-reduced-motion: reduce) {
  .pop, .tabs button.hop svg, .door-faces img, .ld-mon i, .tile::before { animation: none !important; }
}
.wide + .note { margin-top: 8px; }

/* ==== 配置と押しやすさの調整(2026-12-02)==== */
/* 読み込み中は、設定の板を押せなくする */
.stage.booting .board, .stage.booting .topbar, .stage.booting .view-tools, .stage.booting .gal-door { pointer-events: none; opacity: 0.45; }
/* 自由な色: 丸い見本を押すと色の入力が開く(入力は見本の中に重ねて隠す) */
.row-label { font-size: 12px; color: var(--sub); }
.chip { position: relative; width: 40px; height: 40px; border: 1px solid var(--line2); border-radius: 50%; cursor: pointer; overflow: hidden; display: inline-block; }
.chip-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.custom-color input[type=color] { width: 40px; height: 40px; border-radius: 50%; padding: 0; overflow: hidden; border: 1px solid var(--line2); }
.custom-color input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.custom-color input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
/* 顔モニターの上の切り替え: 「プロンプトで生成」は塗りを少し変える */
.gen-jump { background: #F6F3F0; }
/* 共有の画面: 補助のリンク */
.share-links { display: flex; gap: 18px; margin: 4px 0 8px; }
.share-links .link { font-size: 13px; min-height: 44px; padding: 0 2px; color: var(--ink); }
.share-native-note { margin-top: 6px; }
.share-sheet .note { margin: 8px 0; }
.share-sheet .wide + .note { margin-top: 6px; }
.share-sheet .wide-link { margin: 8px 0; }
/* 操作の説明: 3D の画面の左下(左下の操作の上)に置き、デジダルマの頭に重ねない */
.help { top: auto; bottom: 64px; max-width: 280px; }
/* 右上: やや狭い画面では、取り消し・やり直しだけアイコンにする */
@media (max-width: 1100px) and (min-aspect-ratio: 1/1) {
  .topbar button span { display: inline; }
  .topbar #undoBtn span, .topbar #redoBtn span { display: none; }
}
/* 縦長の画面(スマホ) */
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  .logo img { max-width: calc(100vw - 252px); }
  .topbar { gap: 4px; right: 8px; }
  .topbar button { min-width: 44px; min-height: 44px; justify-content: center; padding: 0 10px; }
  .help { left: 8px; right: 8px; max-width: none; bottom: calc(var(--board-h) + 14px); z-index: 6; font-size: 11.5px; }
  .help li { white-space: normal; }
  .help .close { width: 44px; height: 44px; right: 0; top: 0; }
  .vt-panel .check { min-height: 44px; }
  .vt-panel button { min-height: 44px; }
  .check { min-height: 44px; margin: 0; }
  .buttons button, .filebtn.button { min-height: 44px; }
  .gaze-pad button { min-height: 44px; }
  .stile { min-height: 44px; }
  button.wide { min-height: 48px; }
  .chip, .custom-color input[type=color], .ctile input[type=color] { width: 44px; height: 44px; }
  .share-sheet .close { width: 44px; height: 44px; top: 4px; right: 4px; }
  .share-links .link { min-height: 44px; }
  details.sec > summary, details.fine summary { min-height: 44px; display: flex; align-items: center; }
}

/* 文字だけのボタン(補助のリンク) */
.link { border: 0; background: none; padding: 0; color: var(--sub); text-decoration: underline; font-size: 12px; cursor: pointer; min-height: 0; }
.link:hover { background: none; color: var(--ink); }
/* 暗い背景: 黒の地の部品を白の地にして、背景と見分けられるようにする */
.stage.dark .topbar button.accent { background: #fff; color: var(--ink); border-color: #fff; }
.stage.dark .gal-door { background: #fff; color: var(--ink); }
.stage.dark .door-faces img { border-color: #fff; }
