/* みんなのデジダルマ・管理のページ(キャラメイクの画面と同じ色・文字の決まり) */
body.page { overflow: auto; background: var(--bg); }
.page-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 14px; padding: 12px 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: 16px; margin: 0; flex: 1 1 auto; }
.page-logo img { height: 20px; display: block; }
.page-main { max-width: 1180px; margin: 0 auto; padding: 16px 20px 40px; }
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--tile); color: var(--ink); border-radius: 999px; padding: 8px 14px; font-size: 13px; text-decoration: none; cursor: pointer; }
.pill[aria-pressed=true], .pill.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.gal-tools { display: flex; gap: 8px; margin-bottom: 12px; }
.gal-msg { color: var(--sub); min-height: 1.2em; margin: 6px 0; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.gal-tile { background: var(--tile); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.gal-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.gal-open img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.gal-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 10px; }
.gal-nick { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gal-like { white-space: nowrap; flex: 0 0 auto; border: 1px solid var(--line); background: var(--board); border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.gal-like[aria-pressed=true] { color: var(--red); border-color: var(--red); }
.more { display: block; margin: 18px auto 0; }
.gal-modal { border: 0; padding: 0; border-radius: 20px; width: min(980px, calc(100vw - 24px)); max-height: calc(100vh - 24px); background: var(--board); }
.gal-modal::backdrop { background: rgba(17, 17, 17, 0.45); }
.gal-modal-body { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.gal-viewer { aspect-ratio: 1; background: var(--bg); }
.gal-viewer iframe { width: 100%; height: 100%; border: 0; display: block; }
.gal-side { padding: 20px 18px; }
.gal-name { font-size: 16px; font-weight: 600; margin: 8px 0 2px; overflow-wrap: anywhere; }
.gal-date { color: var(--sub); margin: 0 0 8px; font-size: 12px; }
.gal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.gal-share-label { margin: 16px 0 0; font-weight: 600; font-size: 13px; }
.gal-modal .close { position: absolute; right: 10px; top: 8px; z-index: 1; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--sub); }
.gal-report { margin: 8px 0 0; }
.link { border: 0; background: none; padding: 0; color: var(--sub); text-decoration: underline; font-size: 12px; cursor: pointer; }
.link:disabled { text-decoration: none; cursor: default; }
/* ---- キャラクター選択の画面(みんなのデジダルマ) */
body.select-page { display: flex; flex-direction: column; min-height: 100dvh; }
.select-page .page-head { position: relative; flex-wrap: wrap; }
.select-page .gal-tools { margin: 0; }
.sel-stage { position: relative; flex: 1 1 auto; min-height: 360px; height: 58dvh; overflow: hidden; background: var(--bg); touch-action: pan-y; user-select: none; outline: none; --cs: 300px; }
.sel-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 36%; background: #E7E1DA; }
.sel-row { position: absolute; inset: 0; }
.chara { position: absolute; left: 50%; bottom: 10%; width: var(--cs); height: var(--cs); padding: 0; border: 0; background: none; cursor: pointer; transform-origin: 50% 100%; transition: transform .38s cubic-bezier(.3,.7,.3,1), opacity .3s; }
.chara.far { opacity: 0; pointer-events: none; }
.chara .plat { position: absolute; left: 14%; right: 14%; bottom: 10%; height: 15%; border-radius: 50%; background: #D8D0C8; }
.chara.sel .plat { background: #FFFFFF; box-shadow: 0 0 0 6px var(--red); animation: platGlow 1.6s ease-in-out infinite; }
.chara .chara-body { position: absolute; inset: 0 0 4% 0; display: block; transform-origin: 50% 100%; animation: sway 3.2s ease-in-out var(--delay, 0s) infinite alternate; }
.chara .chara-body img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.chara.old .chara-body img { width: 74%; height: 74%; margin: 13% auto 0; border-radius: 50%; object-fit: cover; border: 4px solid var(--tile); }
.chara.sel .chara-body { animation: bounce 1.6s ease-in-out infinite; }
.chara.hide .chara-body { visibility: hidden; }
@keyframes sway { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-4%); } 50% { transform: translateY(0); } 62% { transform: translateY(-1.5%); } }
@keyframes platGlow { 0%, 100% { box-shadow: 0 0 0 6px var(--red); } 50% { box-shadow: 0 0 0 10px var(--red); } }
/* 選んだ1体の 3D: 選んだ場所と同じ位置・大きさに重ね、操作は舞台に通す */
.sel-3d { position: absolute; left: 50%; bottom: calc(10% + var(--cs) * 0.04); width: calc(var(--cs) * 0.96); height: calc(var(--cs) * 0.96); margin-left: calc(var(--cs) * -0.48); pointer-events: none; z-index: 60; opacity: 0; transition: opacity .2s; animation: bounce 1.6s ease-in-out infinite; }
.sel-3d.on { opacity: 1; }
.sel-3d iframe { width: 100%; height: 100%; border: 0; background: transparent; color-scheme: normal; }
.sel-arrow { position: absolute; top: 46%; z-index: 70; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; display: grid; place-items: center; cursor: pointer; }
.sel-arrow svg { width: 24px; height: 24px; stroke-width: 2.4; }
.sel-arrow.prev { left: 16px; } .sel-arrow.next { right: 16px; }
.sel-arrow:disabled { opacity: 0.25; cursor: default; }
.sel-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; z-index: 80; font-size: 16px; font-weight: 600; }
.sel-empty p { margin: 0; }
body.empty .sel-arrow { display: none; }
.sel-msg { position: absolute; left: 0; right: 0; top: 10px; text-align: center; z-index: 75; }
/* 名札 */
.nameplate { position: relative; z-index: 5; width: min(620px, calc(100vw - 24px)); margin: -28px auto 24px; padding: 14px 18px 12px; background: var(--tile); border: 3px solid var(--ink); border-radius: 18px; }
.nameplate[hidden] { display: none; }
.np-head { display: flex; align-items: baseline; gap: 10px; }
.np-no { flex: 0 0 auto; background: var(--ink); color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.np-name { margin: 0; font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.np-name small { font-size: 13px; font-weight: 400; margin-left: 4px; color: var(--sub); }
.np-stats { display: flex; gap: 16px; margin: 6px 0 2px; color: var(--sub); font-size: 13px; }
.np-stats b { color: var(--ink); font-weight: 600; }
.np-actions, .np-share { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.np-share[hidden] { display: none; }
.gal-modal.full { width: min(1100px, calc(100vw - 24px)); height: min(820px, calc(100dvh - 24px)); padding: 0; position: fixed; }
.gal-modal.full iframe { width: 100%; height: 100%; border: 0; display: block; }
.gal-modal-note { position: absolute; left: 16px; bottom: 6px; margin: 0; color: var(--sub); font-size: 12px; }
/* 管理のページ */
.adm-hidden { border-color: var(--err); box-shadow: inset 0 0 0 1px var(--err); }
.adm-badge { display: inline-block; font-size: 11px; color: #fff; background: var(--err); border-radius: 999px; padding: 2px 8px; margin: 0 10px 6px; }
.adm-reports { font-size: 12px; color: var(--err); }
.adm-login { max-width: 360px; display: grid; gap: 10px; }
.adm-login input { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: #fff; }
.adm-tile .gal-meta { flex-wrap: wrap; }
.adm-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px 10px; }
.adm-actions .pill { padding: 6px 10px; font-size: 12px; }
.adm-actions .danger { color: var(--err); border-color: #e7b8b3; }
@media (max-width: 760px) {
  .select-page .page-head h1 { display: none; }
  .select-page .gal-tools { order: 3; width: auto; }
  .select-page .page-head .pill.dark { margin-left: auto; }
  .sel-stage { height: 52dvh; min-height: 320px; }
  .sel-arrow { width: 44px; height: 44px; top: auto; bottom: 6%; }
  .sel-arrow.prev { left: 10px; } .sel-arrow.next { right: 10px; }
  .np-name { font-size: 17px; }
  .page-head { padding: 10px 12px; gap: 8px; }
  .page-head h1 { font-size: 13px; white-space: nowrap; }
  .page-logo img { height: 13px; }
  .page-head .pill { padding: 6px 10px; font-size: 12px; }
  .page-main { padding: 12px 12px 32px; }
  .gal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gal-modal-body { grid-template-columns: 1fr; }
  .gal-side { padding: 12px 14px 16px; }
}

/* ==== 見た目の決まり(style.css と同じ: 平らな塗り・細い線。差し色は選んだデジダルマの台の輪だけ)==== */
.pill { border: 1px solid var(--line2); box-shadow: none; font-weight: 600; min-height: 40px; box-sizing: border-box; }
.pill:hover { background: var(--hover); }
.pill:active { transform: scale(0.97); }
.pill[aria-pressed=true], .pill.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.page-head { border-bottom: 1px solid var(--line2); }
.page-head h1::before { content: ""; display: inline-block; width: 3px; height: 10px; border-radius: 2px; background: var(--ink); box-shadow: 6px 0 0 var(--ink); margin-right: 12px; }
.sel-floor { border-top: 1px solid var(--line2); }
.sel-arrow { background: var(--tile); color: var(--ink); border: 1px solid var(--line2); box-shadow: none; }
.sel-arrow:hover:not(:disabled) { background: var(--hover); }
.nameplate { border: 1px solid var(--line2); box-shadow: none; border-radius: 20px; }
.np-no { background: var(--ink); }
#galLike[aria-pressed=true] { color: var(--red); border-color: var(--red); background: var(--tile); }
.empty-sil-svg { width: 120px; height: 120px; color: #D8D0C8; animation: sway 2.8s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.adm-tile { border: 1px solid var(--line2); box-shadow: none; }
.adm-hidden { border-color: var(--err); box-shadow: inset 0 0 0 1px var(--err); }
@media (prefers-reduced-motion: reduce) { .chara .chara-body, .sel-3d, .chara.sel .plat, .empty-sil-svg { animation: none !important; } }

/* ==== 配置と押しやすさの調整(2026-12-02)==== */
.pill { white-space: nowrap; }
.np-name small { white-space: nowrap; }
.gal-modal-loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--bg); }
.gal-modal-loading[hidden] { display: none; }
body.empty .page-head .pill.dark { display: none; }
.sel-empty { place-content: start center; padding-top: 9%; }
/* マウスの端末では、選んだデジダルマの 3D をドラッグで回せる(指の端末では左右のスワイプを優先する) */
@media (pointer: fine) { .sel-3d.on { pointer-events: auto; cursor: grab; } }
.gal-report .link { min-height: 32px; }
.adm-empty { margin: 24px 0; color: var(--sub); }
@media (max-width: 760px) {
  .select-page .page-head h1 { display: block; flex: 1 1 auto; font-size: 13px; }
  .select-page .page-head .pill.dark { margin-left: 0; }
  .sel-stage { height: 340px; min-height: 300px; flex: 0 0 auto; }
  .pill, .sel-arrow, .np-actions .pill, .np-share .pill { min-height: 44px; }
  .gal-report .link { min-height: 44px; }
  .page-head { flex-wrap: wrap; }
  #admLogout { margin-left: auto; }
  .gal-modal .close { width: 44px; height: 44px; }
}
.gal-date { word-break: keep-all; }

/* ==== 群れの表示(既定)==== */
.crowd { position: relative; flex: 1 1 auto; min-height: 420px; height: calc(100dvh - 66px); overflow: hidden; background: var(--bg); touch-action: none; }
.crowd-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.crowd-hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(255,255,255,0.88); border: 1px solid var(--line2); font-size: 12px; color: var(--sub); white-space: nowrap; pointer-events: none; z-index: 2; }
.crowd-empty { z-index: 3; }
body.view-crowd .sel-stage { display: none; }
body.view-card .crowd { display: none; }
body.view-card .np-close { display: none; }
/* 群れのときの名札は、画面の下から出す */
body.view-crowd .nameplate { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); margin: 0; z-index: 20; animation: npUp .22s ease-out; }
@keyframes npUp { from { transform: translate(-50%, 24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.np-close { position: absolute; right: 8px; top: 6px; width: 40px; height: 40px; border: 0; background: none; font-size: 22px; color: var(--sub); cursor: pointer; }
body.view-crowd .sel-msg { position: fixed; top: 76px; }
@media (max-width: 760px) {
  .crowd { height: calc(100dvh - 118px); min-height: 360px; }
  body.view-crowd .nameplate { bottom: 0; width: 100vw; border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .crowd-hint { font-size: 11px; top: 8px; white-space: normal; width: max-content; max-width: calc(100vw - 32px); text-align: center; }
  .np-close { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) { body.view-crowd .nameplate { animation: none; } }
.np-no[hidden] { display: none; }
