* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* 明るいテーマ（一般的なSNSに合わせた白基調）。動画を扱う全画面（投稿の
     再生・モンスターを貼る画面）とカメラ枠だけは黒のまま（下の .dark-surface）。 */
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #eef0f3;
  --text: #15171c;
  --muted: #6b7280;
  --border: rgba(0, 0, 0, .12);
  --accent: #ff4d5e;
  --accent-2: #2f6fed;
  --danger: #e23a4c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05);
  /* Checkerboard = "this is transparent" indicator behind cut-out yokai. */
  --checker: repeating-conic-gradient(#e9ebef 0% 25%, #f7f8fa 0% 50%) 50% / 16px 16px;
}
/* Lock horizontal scroll with overflow-x: CLIP (not hidden). `hidden` coerces
   overflow-y to `auto`, turning the element into its own scroll container — which
   made window.scrollY stop updating and broke pull-to-refresh. `clip` blocks the
   horizontal axis while leaving overflow-y visible, so the window stays the
   vertical scroller. */
html {
  height: 100%;
  overflow-x: clip;
  overscroll-behavior-x: none;
  /* 9/28 iPhone で下端までスクロールして引っ張ると、画面全体が跳ね返り（ラバーバンド）
     下のタブバーまで持ち上がって見えていた。縦の跳ね返りを止める。上端の「引っ張って更新」は
     自前のタッチ処理なので影響しない。 */
  overscroll-behavior-y: none;
}
body {
  min-height: 100%;
  overflow-x: clip;
  overscroll-behavior-y: none;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  max-width: 100%;
  /* スマホで勝手にズームしない：ダブルタップ拡大を無効化、回転時の文字拡大も無効化 */
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
/* iOS Safari は 16px 未満の入力欄にフォーカスすると画面ごと拡大する。
   入力欄は全部 16px 以上に固定する（見た目が大きすぎるところは padding で調整）。 */
input, textarea, select { font-size: 16px; font-family: inherit; }
.screen { min-height: 100vh; min-height: 100dvh; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.error { color: var(--accent); min-height: 1.2em; margin-top: 8px; }
.link { background: none; border: none; color: var(--muted); font-size: 14px; }

/* Login */
#login { display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--border);
  padding: 28px 24px; border-radius: 18px; text-align: center;
}
.login-card h1 { font-size: 28px; margin-bottom: 6px; }
.login-card p { margin-bottom: 16px; }
.login-card input {
  width: 100%; padding: 14px; margin-bottom: 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); font-size: 16px;
}
.login-card button {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 700;
}

/* Topbar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  /* 上はノッチ分だけ空ける。下は詰める。 */
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.hello { font-weight: 700; }
.hello-wrap { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.app-ver { font-size: 11px; color: var(--muted); font-weight: 400; white-space: nowrap; }
.topbar-actions { display: flex; gap: 6px; align-items: center; }
/* 11/22：研究担当者の「切り替え」（管理者アプリにもログインしている端末だけ）。出ているときだけ、狭い画面でも1段に収める（参加者の画面は今まで通り） */
#switchBtn { padding: 10px 8px; margin: -10px 0; white-space: nowrap; }
.topbar:has(#switchBtn:not(.hidden)) .topbar-actions { flex: none; }
.topbar:has(#switchBtn:not(.hidden)) .topbar-actions .link { white-space: nowrap; }
.topbar:has(#switchBtn:not(.hidden)) .hello-wrap { flex: 1 1 auto; overflow: hidden; }
.topbar:has(#switchBtn:not(.hidden)) .hello { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 360px) { .topbar:has(#switchBtn:not(.hidden)) .app-ver { display: none; } }

/* Tabs */
.tab { padding: 16px; padding-bottom: 92px; }

/* Camera */
/* Portrait 3:4 frame — must match the server output aspect (VLOG_WIDTH:HEIGHT)
   so the cover-crop shown here equals what's saved. */
.camera-wrap {
  position: relative; width: 100%; aspect-ratio: 3/4; max-height: 66vh;
  margin: 0 auto; background: #000; border-radius: 16px; overflow: hidden;
}
/* object-fit: cover center-crops the camera frame to the 3:4 box — the same
   center-crop ffmpeg does server-side. Front camera is mirrored for a natural
   selfie view; back camera shows the world as-is. */
#preview {
  display: block; width: 100%; height: 100%; object-fit: cover;
}
#preview.mirrored { transform: scaleX(-1); }
/* カメラ起動前のプレースホルダ */
.cam-idle {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  color: #bbb; font-size: 14px; background: #111; cursor: pointer;
}
.cam-idle-icon { font-size: 64px; line-height: 1; }

.switch-cam {
  position: absolute; bottom: 12px; right: 12px;
  background: rgba(0,0,0,.55); color: #fff; border: none;
  padding: 8px 12px; border-radius: 20px; font-size: 13px; font-weight: 600;
}
.switch-cam:disabled { opacity: .5; }
.cam-name {
  position: absolute; bottom: 12px; left: 12px; max-width: 60%;
  background: rgba(0,0,0,.55); color: #fff; padding: 6px 10px; border-radius: 16px;
  font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.rec-dot {
  position: absolute; top: 12px; left: 12px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent); animation: blink 1s infinite;
}
.rec-timer {
  position: absolute; top: 10px; right: 12px; background: rgba(0,0,0,.5); color: #fff;
  padding: 4px 10px; border-radius: 20px; font-variant-numeric: tabular-nums;
}
@keyframes blink { 50% { opacity: .3; } }

.record-btn {
  display: block; margin: 16px auto; width: 100%; max-width: 320px;
  padding: 16px; border: none; border-radius: 14px;
  background: var(--accent); color: #fff; font-size: 18px; font-weight: 700;
}
.record-btn.recording { background: #fff; color: var(--accent); }
.record-btn:disabled { opacity: .5; }
.record-btn.recording:disabled { opacity: 1; }   /* 11/22：録画中は押せないが、残りの秒数ははっきり見せる */

.stock {
  margin: 14px auto; max-width: 320px; text-align: center; border: 1px solid var(--border);
  background: var(--panel); padding: 12px; border-radius: 12px; font-size: 14px;
}
.stock strong { color: var(--accent-2); font-size: 18px; }
.stock-list { list-style: none; max-width: 320px; margin: 0 auto; }
.stock-list li {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; margin-top: 8px;
  font-size: 14px; overflow: hidden;
}
.stock-row { padding: 10px 12px; }
.stock-label { font-weight: 600; margin-bottom: 8px; }
.stock-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stock-actions button { white-space: nowrap; min-width: 0; }
.stock-actions button.gen { grid-column: 1 / -1; }
/* 19時以降は下の段に vlog の印が1つ増える（見る・共有・vlog・削除） */
.stock-actions.has-vlog { grid-template-columns: 1fr 1.3fr .85fr 1fr; gap: 5px; }
/* 4つ並ぶと幅が狭く「✓ 共有済」が切れていたので、文字と余白を少し詰める */
.stock-list .stock-actions.has-vlog button:not(.gen) { font-size: 12.5px; padding: 8px 3px; }
.vlog-mark {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-width: 0;
  font-size: 11px; line-height: 1.15; padding: 3px 2px; border-radius: 8px; white-space: nowrap; overflow: hidden;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); font-weight: 700;
}
.vlog-mark small { font-size: 10px; font-weight: 600; opacity: .8; }
.vlog-mark.in { color: #2ec36b; border-color: rgba(46,195,107,.45); background: rgba(46,195,107,.08); }
.stock-list button {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  font-size: 13px; padding: 8px 6px; border-radius: 8px;
}
.stock-list button.danger { color: var(--danger); border-color: rgba(226,58,76,.35); }
.stock-list button.gen { color: #fff; background: var(--accent-2); font-weight: 700; }
.stock-list button.gen:disabled { opacity: .6; }
.badge {
  background: var(--accent-2); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px; margin-left: 6px;
}
.stock-player { width: 100%; display: block; background: #000; max-height: 60vh; }

/* Character gate on record tab */
.char-gate {
  max-width: 340px; margin: 0 auto 14px; padding: 14px; border-radius: 12px;
  background: rgba(255,77,94,.12); border: 1px solid var(--accent);
  color: var(--text); font-size: 14px; text-align: center;
}
.char-gate button {
  display: block; margin: 10px auto 0; padding: 8px 16px; border: none;
  border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700;
}

/* Mic warning on record tab */
.mic-warn {
  max-width: 340px; margin: 0 auto 14px; padding: 12px; border-radius: 12px;
  background: rgba(255,193,7,.14); border: 1px solid #ffc107;
  color: var(--text); font-size: 13px; text-align: center; line-height: 1.5;
}

/* Character tab */
.char-intro { max-width: 420px; margin: 0 auto 14px; }
.char-intro h2 { margin-bottom: 6px; }
.char-intro p { line-height: 1.6; font-size: 14px; }
.char-form { max-width: 420px; margin: 0 auto; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: #4b5261; margin: 14px 0 6px; }
.char-input {
  display: block; width: 100%; padding: 12px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); font-size: 16px; font-family: inherit;
}
.char-input:focus, .comment-input:focus { outline: none; border-color: var(--accent-2); }
.char-upload {
  display: block; padding: 16px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 14px; text-align: center;
  color: var(--accent-2); font-weight: 700; cursor: pointer;
}
.char-preview {
  display: block; max-width: 180px; max-height: 180px; margin: 10px auto 0;
  border-radius: 12px; background:
    repeating-conic-gradient(#e9ebef 0% 25%, #f7f8fa 0% 50%) 50% / 20px 20px;
}
.char-genbtn {
  display: block; width: 100%; margin: 14px 0 0; padding: 14px; border: none;
  border-radius: 12px; background: var(--accent-2); color: #fff;
  font-size: 16px; font-weight: 700;
}
.char-genbtn:disabled { background: var(--panel-2); color: var(--muted); }
.or-divider {
  text-align: center; color: var(--muted); font-size: 12px; margin: 14px 0 6px;
}
.char-submit {
  display: block; width: 100%; margin: 16px 0 0; padding: 14px; border: none;
  border-radius: 12px; background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 700; transition: background .15s, opacity .15s;
}
/* Dim/greyed until all fields are filled, then it "brightens" to accent. */
.char-submit:disabled { background: var(--panel-2); color: var(--muted); cursor: default; }
.char-meta { padding: 8px 10px 4px; text-align: left; }
.char-name { font-weight: 700; font-size: 14px; }
.char-desc { color: var(--muted); font-size: 12px; line-height: 1.5; max-height: 6em; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; margin-top: 2px; }

/* Yokai dictionary on a post */
.yokai-dict { padding: 12px 14px; border-top: 1px solid var(--border); }
.dict-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.yokai-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.yokai-row img { width: 44px; height: 44px; border-radius: 8px; object-fit: contain; background: var(--checker); flex: none; }
.yokai-info { flex: 1; min-width: 0; }
.yokai-name { font-weight: 700; font-size: 14px; }
.yokai-desc { color: var(--muted); font-size: 12px; line-height: 1.4; }
.yokai-owner { font-size: 11px; color: var(--muted); margin: 1px 0 2px; }
.yokai-owner.mine { color: var(--accent, #e0567a); font-weight: 700; }
.fav { flex: none; background: var(--panel-2); border: none; color: var(--text); font-size: 12px; padding: 6px 10px; border-radius: 16px; }
.fav.on { background: var(--accent); color: #fff; }
.fav:disabled { opacity: .5; }

.char-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; max-width: 420px; margin: 8px auto 0;
}
.char-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; text-align: center; position: relative; }
.char-dl { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: rgba(255,255,255,0.9); color: #333; font-size: 16px; line-height: 1; padding: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.char-dl:disabled { opacity: 0.5; }
/* 10/22：.char-card button（幅100%・透明）に負けて右上の丸ボタンにならず横長に広がっていたので、カードの右上の角に固定する */
.char-card .char-dl { position: absolute; top: 6px; right: 6px; left: auto; width: 32px; height: 32px; padding: 0; z-index: 2; font-size: 16px; line-height: 1;
  background: rgba(255,255,255,0.92); color: #333; border: 1px solid var(--border); border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
/* ストックの「見る」で開いた動画・写真の右上の保存ボタン */
.stock-dl { position: absolute; top: 8px; right: 8px; z-index: 3; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.stock-photo-wrap { position: relative; max-width: 360px; margin: 8px auto 0; }
.stock-photo-wrap .stock-photo { margin: 0; max-width: 100%; }
.stock-photo-wrap.hidden { display: none; }
.char-card img {
  width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--checker); display: block;
}
.char-card button { width: 100%; padding: 8px; border: none; background: transparent; color: var(--accent); font-size: 13px; }

/* Feed — day sections, each a 2-up grid of portrait thumbnails (Shorts-style) */
.feed { max-width: 560px; margin: 0 auto; }
.feed-cell {
  position: relative; padding: 0; border: 1px solid var(--border); background: #000;
  border-radius: 14px; overflow: hidden; aspect-ratio: 3/4; cursor: pointer;
}
.feed-cell video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cell-author {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 10px 8px;
  color: #fff; font-size: 13px; font-weight: 700; text-align: left;
  background: rgba(0,0,0,.66);
}
.cell-badge {
  position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.55);
  color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 12px;
}

/* AI yokai chat builder */
.ychat {
  position: fixed; inset: 0; z-index: 65; background: var(--bg);
  display: flex; flex-direction: column;
}
.ychat-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px; background: var(--panel);
}
.ychat-title { font-weight: 700; }
.ychat-image-wrap {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  position: relative; padding: 12px;
  background: var(--checker);
}
.ychat-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.ychat-candidates { display: flex; gap: 8px; width: 100%; max-width: 600px; }
.cand-card {
  flex: 1; position: relative; padding: 0; border: 2px solid transparent;
  border-radius: 12px; overflow: hidden; background: var(--checker); aspect-ratio: 1;
}
.cand-card img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cand-card:active { border-color: var(--accent-2); }
.cand-num {
  position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.6); color: #fff;
  font-weight: 700; font-size: 15px; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.ychat-undo {
  flex: none; background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 600;
}
.ychat-undo:disabled { opacity: .38; }
.cand-label {
  position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.66);
  color: #fff; font-size: 12px; font-weight: 700; text-align: center;
  padding: 5px 4px; line-height: 1.3; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.ychat-placeholder { color: var(--text); font-size: 15px; text-align: center; line-height: 1.8; max-width: 320px; }
.ychat-busy {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); color: #fff; font-weight: 700;
}
.ychat-busy { flex-direction: column; gap: 14px; text-align: center; }
.ychat-stop { padding: 9px 22px; border-radius: 999px; border: 1px solid rgba(255,255,255,.8); background: rgba(0,0,0,.35); color: #fff; font-size: 14px; font-weight: 700; }
.ychat-status-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 6px; background: var(--panel);
}
.ychat-status { flex: 1; font-size: 14px; line-height: 1.6; min-height: 1.6em; }
.notice {
  padding: 10px 14px 4px; margin: 0;
  background: var(--panel); color: var(--muted);
  font-size: 12px; line-height: 1.6;
}
.char-form .notice, .char-edit .notice { background: transparent; padding: 4px 0 8px; }
.char-edit .notice { padding: 0 0 2px; text-align: left; }
.ychat-input-row { display: flex; gap: 8px; padding: 8px 14px 10px; background: var(--panel); }
.hidden-tag { color: var(--accent); font-weight: 700; }
.char-share { display: flex; align-items: flex-start; gap: 8px; padding: 6px 10px 2px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.char-share input { margin: 3px 0 0; flex: 0 0 auto; width: 16px; height: 16px; }
.ychat-input {
  flex: 1; min-width: 0; padding: 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 16px;
}
.ychat-send { flex: none; white-space: nowrap; background: var(--accent-2); color: #fff; border: none; font-weight: 700; padding: 0 18px; border-radius: 10px; }
.ychat-send:disabled { opacity: .6; }
.ychat-register {
  display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--panel); border-top: 1px solid var(--border);
}
.ychat-register .char-input { margin: 0; flex: 1; }
.ychat-register .char-submit { margin: 0; }

/* Sticker editor */
.editor-modal {
  position: fixed; inset: 0; z-index: 60; background: #0b0d12;
  display: flex; flex-direction: column;
  overflow: hidden; overscroll-behavior: contain; max-width: 100vw;
}
.editor-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px; background: var(--panel);
}
.editor-title { font-weight: 700; }
.editor-save {
  background: var(--accent); color: #fff; border: none; font-weight: 700;
  padding: 8px 18px; border-radius: 20px; font-size: 15px;
}
.editor-save:disabled { opacity: .6; }
.editor-stage-wrap { flex: 1; min-height: 0; display: flex; align-items: flex-start; justify-content: center; overflow: hidden; padding: 6px 8px; container-type: size; }
.editor-stage {
  /* 常に 3:4 のまま、使える幅・高さに収まる最大の大きさ（貼る位置の比率がずれないように） */
  position: relative; aspect-ratio: 3/4; width: min(100cqw, 75cqh); height: auto;
  background: #000; border-radius: 12px; overflow: hidden; touch-action: none;
}
.editor-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.editor-layer { position: absolute; inset: 0; }
.sticker { position: absolute; touch-action: none; cursor: move; }
.sticker img { width: 100%; height: auto; display: block; pointer-events: none; -webkit-user-select: none; user-select: none; }
.sticker.selected { outline: 2px dashed var(--accent-2); outline-offset: 2px; }
.sticker-del {
  position: absolute; top: -12px; right: -12px; width: 26px; height: 26px;
  border-radius: 50%; border: none; background: var(--accent); color: #fff;
  font-size: 13px; display: none;
}
.sticker-resize {
  position: absolute; right: -10px; bottom: -10px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--accent-2); border: 2px solid #fff;
  touch-action: none; display: none;
}
.sticker-rotate {
  position: absolute; left: -12px; bottom: -12px; width: 24px; height: 24px;
  border-radius: 50%; background: #2ec36b; border: 2px solid #fff; color: #fff;
  font-size: 14px; line-height: 20px; text-align: center; touch-action: none; display: none;
}
.sticker.selected .sticker-del,
.sticker.selected .sticker-resize,
.sticker.selected .sticker-rotate { display: block; }
/* つまみは見た目は小さいまま、指で押せる範囲だけシールの外側へ広げる（内側へは広げない：
   内側に広げると角を掴もうとしただけで消える・小さいシールが動かせなくなる） */
.sticker-del::before, .sticker-resize::before, .sticker-rotate::before { content: ''; position: absolute; border-radius: 50%; }
.sticker-del::before { top: -10px; right: -10px; width: 36px; height: 36px; }
.sticker-resize::before { bottom: -12px; right: -12px; width: 32px; height: 32px; }
.sticker-rotate::before { bottom: -12px; left: -12px; width: 34px; height: 34px; }
.editor-bottom { position: relative; background: var(--panel); border-top: 1px solid var(--border); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
/* 長押しでOSの「画像を保存／共有」メニューが出ないようにする */
.pal-item, .pal-item img, .editor-layer img { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
.pal-info {
  position: absolute; left: 10px; right: 10px; bottom: calc(100% + 8px); z-index: 5;
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.pal-info img { width: 88px; height: 88px; flex: none; object-fit: contain; background: var(--checker); border-radius: 10px; }
.pal-info .pi-name { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.pal-info .pi-owner { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.pal-info .pi-desc { font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; max-height: 30vh; overflow-y: auto; }
.pal-info .pi-desc.empty { color: var(--muted); }
.editor-hint { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 6px; }
.editor-palette { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.pal-item {
  flex: 0 0 auto; width: 60px; padding: 4px; border: none; background: var(--panel-2);
  border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.pal-item img { width: 48px; height: 48px; object-fit: contain; background: var(--checker); border-radius: 8px; }
/* 9/30 パレットは2段：上＝自分のモンスター、下＝お気に入り（どちらも最後に関わった順） */
.pal-row + .pal-row { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }
.pal-label { font-size: 11px; line-height: 1.4; color: var(--muted); font-weight: 700; margin: 0 2px 3px; }
.pal-row .editor-palette { min-height: 66px; align-items: center; }
.pal-empty { font-size: 12px; color: var(--muted); }
.pal-item span { font-size: 11px; color: var(--text); max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Fullscreen post viewer */
.post-modal {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.modal-close {
  position: fixed; top: max(10px, env(safe-area-inset-top)); right: 12px; z-index: 51;
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.15); color: #fff; font-size: 18px;
}
/* 動画の周りに余白を取り、角を丸める。閉じるボタンは動画に重ならないよう上の帯に置く */
.modal-inner { max-width: 520px; margin: 0 auto; padding: calc(56px + env(safe-area-inset-top)) 12px 40px; }
.modal-inner video {
  width: 100%; display: block; background: #000; max-height: 74vh; margin: 0 auto;
  border-radius: 14px; object-fit: contain;
}
.modal-inner .modal-meta { padding: 12px 4px; }
.modal-meta { padding: 12px 16px; }
.modal-meta .author { font-weight: 700; font-size: 16px; }
.modal-meta .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Tabbar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: var(--panel); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;   /* 10/23 本人：モンスター一覧のダウンロードボタン（z-index 2）が下の目次の上に出ていた */
}
.tabbar button {
  flex: 1; padding: 13px 2px; background: none; border: none;
  color: #8a919e; font-size: 13px; font-weight: 700; white-space: nowrap; letter-spacing: -.02em;
  border-top: 2px solid transparent; margin-top: -1px;
}
.tabbar button.active { color: var(--text); border-top-color: var(--accent-2); }

/* ---- Clip timeline (video-Twitter) + likes/comments ---------------------- */
.clip-feed { display: flex; flex-direction: column; gap: 14px; padding: 8px 0 16px; }
.clip-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.clip-head { padding: 10px 12px 6px; }
/* Reserve the 3:4 space up-front so the card doesn't jump (and scroll targets
   don't drift) when the video poster finally loads. Clips are 960x1280 = 3:4. */
.clip-video { width: 100%; display: block; background: #000; aspect-ratio: 3 / 4; object-fit: cover; }
.post-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
.post-actions button {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text); font-size: 14px;
  font-weight: 600; padding: 7px 11px; border-radius: 20px; white-space: nowrap; flex: none;
}
.post-actions .act-like.on { background: #ffe8eb; color: var(--danger); border-color: rgba(226,58,76,.3); }
.post-actions .act-del { color: var(--danger); border-color: rgba(226,58,76,.35); }
.clip-dict { padding: 0 12px 12px; }
.clip-dict.hidden { display: none; }
.share { color: var(--accent-2) !important; }
.share.shared { color: #2ec36b !important; }
.share:disabled { opacity: .6; }

/* Feed date separators */
.feed-day-header {
  font-size: 20px; font-weight: 800; color: var(--text); margin: 18px 4px 10px;
}
.feed-day-header:first-child { margin-top: 4px; }
.feed-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 6px;
}

/* Comments sheet */
.comments-modal { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; }
.comments-sheet {
  width: 100%; max-height: 80vh; background: var(--panel); border-radius: 18px 18px 0 0;
  border: 1px solid var(--border); border-bottom: none;
  display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom);
}
.comments-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.comments-title { font-weight: 700; }
.comments-list { flex: 1; overflow-y: auto; padding: 4px 16px; min-height: 30vh; }
.comment { padding: 8px 0; border-bottom: 1px solid var(--border); }
.comment-head { margin-bottom: 2px; }
.comment-body { font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.comment-main { display: flex; align-items: flex-start; gap: 8px; }   /* 11/2：コメントへのいいね（右にハート） */
.comment-main .comment-body { flex: 1; min-width: 0; }
.comment-like { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 36px; margin: -4px -6px 0 0; padding: 4px 6px; background: none; border: none; color: var(--muted, #888); font-size: 11px; line-height: 1.1; }
.comment-like .cl-heart { font-size: 17px; }
.comment-like.on { color: var(--danger); }
.comment-like .cl-n { min-height: 1.1em; font-weight: 600; }
.comments-input-row { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.comment-input { flex: 1; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font-size: 16px; }
.comment-send { background: var(--accent); color: #fff; border: none; font-weight: 700; padding: 0 18px; border-radius: 12px; }
.comment-input { min-width: 0; } .comment-send { flex: none; white-space: nowrap; }   /* 11/2：狭い画面で「送信」が2行になって切れないように */

/* Post actions inside the vlog modal */
#modalActions { margin: 4px 0 2px; }

/* ---- Yokai edit (in the 妖怪 grid) + notifications ------------------------ */
.char-actions { display: flex; gap: 6px; padding: 8px 10px 10px; }
.char-actions button { flex: 1; padding: 7px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); border-radius: 8px; font-size: 12px; font-weight: 600; }
.char-actions button.danger { color: var(--accent); border-color: transparent; background: transparent; }
.char-edit { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.char-edit .char-input { font-size: 16px; padding: 8px; }
.char-edit-btns { display: flex; flex-direction: column; gap: 2px; align-items: stretch; }
.char-edit-btns .gen { width: 100%; background: var(--accent-2); color: #fff; border: none; border-radius: 8px; padding: 10px 8px; font-weight: 700; white-space: nowrap; }
.char-edit-btns .link { width: 100%; padding: 6px; white-space: nowrap; }
.char-edit .char-count { margin: 0 2px 2px; }

.notif-list { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.notif {
  display: flex; align-items: center; gap: 10px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-size: 14px;
}
.notif.unread { border-color: rgba(47,111,237,.45); background: #eef4ff; }
.notif .notif-ico { font-size: 20px; }
.notif .notif-time { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tab-badge {
  display: inline-block; min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px;
  margin-left: 4px; background: var(--accent); color: #fff; border-radius: 8px;
  font-size: 10px; font-weight: 700; vertical-align: top;
}

/* Comment delete + pull-to-refresh */
.comment-head { display: flex; align-items: center; gap: 8px; }
.comment-del { margin-left: auto; background: none; border: none; color: var(--accent); font-size: 12px; }
/* Pull-to-refresh: the active tab slides down; a spinner rests at the top. */
.tab.ptr-anim { transition: transform .28s cubic-bezier(.22,.61,.36,1); }
.ptr-spinner {
  position: fixed; top: 6px; left: calc(50% - 14px); width: 28px; height: 28px;
  z-index: 45; opacity: 0; pointer-events: none;
  border: 3px solid var(--panel-2); border-top-color: var(--accent-2); border-radius: 50%;
  transition: opacity .2s ease;
}
.ptr-spinner.ready { border-top-color: var(--accent); }
.ptr-spinner.spin { animation: ptr-rot .7s linear infinite; }
@keyframes ptr-rot { to { transform: rotate(360deg); } }

/* Tappable notifications (jump to the target) */
.notif.tappable { cursor: pointer; }
.notif.tappable:active { background: var(--panel-2); }
.notif-chev { margin-left: auto; color: var(--muted); font-size: 22px; line-height: 1; padding-left: 6px; }

/* Highlight a post when jumped-to from a notification */
.post-flash { animation: post-flash 3s ease; }
@keyframes post-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(91,149,255,0); }
  8% { box-shadow: 0 0 0 3px var(--accent-2); }
  85% { box-shadow: 0 0 0 3px var(--accent-2); }
}

/* Poster thumbnails (feeds load JPEGs, not video, until you play) */
.feed-cell .cell-poster { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.clip-media { position: relative; width: 100%; aspect-ratio: 3 / 4; background: #000; }
.clip-poster { width: 100%; height: 100%; object-fit: cover; display: block; }
.clip-media .clip-video { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; }
.clip-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 60px; height: 60px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.55); color: #fff; font-size: 24px; padding-left: 4px;
}
.clip-play:active { background: rgba(0,0,0,.75); }

/* Background-generation chip + toast */
.gen-chip {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 55;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  padding: 10px 16px; border-radius: 22px; font-size: 14px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
}
.gen-chip.ready { background: var(--accent-2); color: #fff; border-color: transparent; }
.chip-spin {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.12); border-top-color: var(--accent-2);
  animation: ptr-rot .7s linear infinite;
}
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(120px + env(safe-area-inset-bottom)); z-index: 80;
  background: #000d; color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 600; max-width: 86%; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 妖怪 tab: sectioned like the vlog feed (自分の妖怪 / お気に入り) */
.char-list { max-width: 420px; margin: 0 auto; }
.char-section-header { font-size: 17px; font-weight: 800; color: var(--text); margin: 18px 4px 2px; }
.char-section-header:first-child { margin-top: 6px; }

/* ---------------------------------------------------------------------------
   Daily affect diary (research measurement)
   --------------------------------------------------------------------------- */
body.modal-open { overflow: hidden; }
/* 全画面の画面を開いている間は後ろのページを固定（app.js の scrollLock）。top は JS が入れる */
html.scroll-lock { overflow: hidden; }
html.scroll-lock body { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }

/* Banner shown on any tab while tonight's rating is still missing. */
.affect-banner {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #eef4ff;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.affect-banner button {
  background: var(--accent-2); color: #fff; border: none;
  border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600;
}

/* Full-screen sheet. Scrolls internally: 8 items + note don't fit on a phone. */
.affect-modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .45);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 12px calc(24px + env(safe-area-inset-bottom));
}
.affect-sheet {
  max-width: 520px; margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 16px 16px;
}
.affect-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
.affect-title { font-size: 17px; font-weight: 700; }
.affect-day { color: var(--muted); font-size: 13px; }
.affect-instruction { color: var(--text); font-size: 14px; line-height: 1.6; }
.affect-legend {
  display: flex; justify-content: space-between;
  color: var(--muted); font-size: 12px; margin: 12px 2px 6px;
}
.affect-items { display: flex; flex-direction: column; gap: 4px; }
.affect-item {
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.affect-item.answered { background: rgba(91, 149, 255, .07); border-color: rgba(91, 149, 255, .22); }
.affect-item-label { font-size: 15px; margin-bottom: 8px; }
.affect-options { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.affect-opt {
  padding: 11px 0;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; font-variant-numeric: tabular-nums;
}
.affect-opt.sel { background: var(--accent-2); border-color: var(--accent-2); color: #fff; font-weight: 700; }
.affect-note-label { display: block; margin: 18px 0 6px; font-size: 14px; }
.affect-note {
  width: 100%; padding: 10px 12px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 16px; font-family: inherit; resize: vertical;
}
.affect-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.affect-submit {
  width: 100%; padding: 14px;
  background: var(--accent-2); color: #fff;
  border: none; border-radius: 12px;
  font-size: 16px; font-weight: 700;
}
.affect-submit:disabled { background: var(--panel-2); color: var(--muted); }

/* Baseline period (before APP_UNLOCK): diary only. */
.baseline-card {
  max-width: 480px; margin: 40px auto; padding: 24px 20px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  text-align: center;
}
.baseline-card h2 { font-size: 18px; margin-bottom: 12px; }
.baseline-card p { line-height: 1.7; font-size: 14px; }
.baseline-card .char-submit { margin-top: 20px; }

/* 11/21 グループが閉じたあとの画面（一文だけ）。毎晩の記録の画面（z-index 90）はこの上に出る */
.closed-view {
  position: fixed; inset: 0; z-index: 85; background: var(--bg); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
}
.closed-msg { max-width: 420px; font-size: 17px; font-weight: 700; line-height: 1.8; text-align: center; }

/* ---- 通知設定（プッシュ通知） ---- */
.notif-settings {
  max-width: 560px; margin: 8px auto 4px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; font-size: 14px;
}
.notif-settings summary {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 0; cursor: pointer; list-style: none; font-weight: 600;
}
.notif-settings summary::-webkit-details-marker { display: none; }
.notif-settings[open] summary { border-bottom: 1px solid var(--border); }
.notif-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; }
.notif-master { font-weight: 600; }
.notif-types { padding-left: 12px; border-left: 2px solid var(--border); margin: 4px 0 6px; }
.notif-types .notif-row { padding: 9px 0; }
.notif-types.off { opacity: .45; pointer-events: none; }
.notif-settings p { margin: 4px 0 10px; line-height: 1.6; }
.notif-settings #pushTest { display: block; margin: 0 0 12px; }
input.switch {
  appearance: none; -webkit-appearance: none; width: 46px; height: 26px; border-radius: 13px;
  background: var(--panel-2); border: 1px solid var(--border); position: relative; flex: none; margin: 0;
  transition: background .15s;
}
input.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: transform .15s;
}
input.switch:checked { background: var(--accent); border-color: var(--accent); }
input.switch:checked::after { transform: translateX(20px); }
input.switch:disabled { opacity: .5; }


/* ---- 明るいテーマの仕上げ ---- */
body { background: var(--bg); color: var(--text); }
/* カード類に薄い影（白背景でも区切りが見えるように） */
.stock-list li, .char-card, .clip-card, .notif, .notif-settings, .stock, .login-card { box-shadow: var(--shadow); }
/* スイッチは白背景で見えるように */
input.switch { background: #d9dce2; border-color: transparent; }
input.switch::after { box-shadow: 0 1px 3px rgba(0,0,0,.25); }
/* カメラ枠は黒のまま */
.camera-wrap, .cam-idle { background: #16181d; }
.cam-idle { color: #c9ced8; }
/* 動画を全画面で扱う画面は黒のまま（色変数をこの中だけ暗く戻す） */
.editor-modal, .post-modal {
  --bg: #0c0e13; --panel: #1c212d; --panel-2: #2b3140; --text: #f3f5fa; --muted: #b3bccd;
  --border: rgba(255, 255, 255, .28); --shadow: none;
  --checker: repeating-conic-gradient(#333a49 0% 25%, #232936 0% 50%) 50% / 16px 16px;
  color: var(--text);
}
.post-modal .post-actions .act-like.on { background: #4a1f27; color: #ff8fa0; }
.post-modal .post-actions .act-del { color: #ff8fa0; }
/* モンスター作成の下部は文字が多いので少しゆったり */
.ychat .notice { line-height: 1.7; }
.feed-sentinel { padding: 18px 0 28px; }

/* 標準カメラで撮るモードでは、アプリ内カメラの枠を出さない */
#tab-record.native-cam .camera-wrap, #tab-record.native-cam #micWarn { display: none; }
.link-btn { background: none; border: none; color: var(--accent-2); text-decoration: underline; padding: 4px 8px; font-family: inherit; font-size: 13px; }

/* 動画／写真の切り替え */
.shoot-mode { display: flex; gap: 0; margin: 14px auto 0; max-width: 320px; background: var(--panel); border: 1px solid var(--border, #e3e5ea); border-radius: 999px; padding: 3px; }
.shoot-mode button { flex: 1; border: none; background: none; padding: 8px 0; border-radius: 999px; font: inherit; font-weight: 600; color: var(--muted, #6b7280); }
.shoot-mode button.active { background: var(--accent); color: #fff; }
.shoot-mode button:disabled { opacity: .5; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s ease-out; z-index: 3; }
.cam-flash.on { opacity: .85; transition: none; }
.stock-photo { display: block; width: 100%; max-width: 360px; margin: 8px auto 0; border-radius: 10px; }
.clip-media .clip-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tag { font-size: 12px; font-weight: 600; color: var(--muted, #6b7280); margin-left: 4px; }
.btn-ico { width: 1em; height: 1em; vertical-align: -0.12em; margin-right: 4px; }
.char-count { display: block; clear: both; text-align: right; font-size: 12px; line-height: 1.4; color: var(--muted); margin: 4px 2px 10px; }
.char-count.full { color: var(--danger); }

/* 参加申請 */
.apply-card h2 { font-size: 20px; margin-bottom: 4px; }
.login-card .link-btn { display: block; width: auto; margin: 10px auto 0; padding: 6px 8px; background: none; color: var(--accent-2); font-size: 14px; font-weight: 600; text-decoration: underline; }
.error.ok { color: var(--ok, #188a45); }

/* 通知のおすすめ（初回だけ、タブバーの上に出る） */
.push-ask {
  position: fixed; left: 12px; right: 12px; z-index: 40;
  bottom: calc(62px + env(safe-area-inset-bottom));
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 14px 14px 12px;
}
.push-ask p { margin: 0 0 10px; line-height: 1.5; }
.push-ask .small { font-size: 13px; color: var(--muted); }
.push-ask-btns { display: flex; gap: 8px; }
.push-ask-btns button { flex: 1; padding: 11px 0; border-radius: 10px; font-size: 15px; font-weight: 700; }
.push-ask-no { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); }
.push-ask-yes { background: var(--accent-2); border: none; color: #fff; }

/* 気分の記録の回答枠に未回答なら右下に出しておく（画面は乗っ取らない） */
/* 上の「✕ 閉じる」などの文字ボタンは文字の大きさしか押せなかった。見た目は変えずに押せる範囲を広げる */
.ychat-top .link, .editor-top .link, .comments-top .link, #logoutBtn { padding: 10px 12px; margin: -10px -12px; }

/* モンスターを動かす方式（10/15）：選んだ1匹は動かせない見本 */
.sticker.anim-pick { cursor: default; }
.pal-tip { font-size: 12px; color: var(--accent-2, #2563eb); text-align: center; margin: -2px 0 6px; font-weight: 600; }
.badge.anim-queued, .badge.anim-placing, .badge.anim-generating { background: #fff4d6; color: #8a5a00; }
.badge.anim-done { background: #e6f6ea; color: #1d7a3a; }
.badge.anim-failed { background: #fde8e8; color: #b42318; }

/* 投稿タブ：タイムライン／一覧 */
.feed-view-toggle { display: flex; margin: 4px auto 12px; max-width: 260px; background: var(--panel); border: 1px solid var(--border, #e3e5ea); border-radius: 999px; padding: 3px; }
.feed-view-toggle button { flex: 1; border: none; background: none; padding: 6px 0; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted, #6b7280); }
.feed-view-toggle button.active { background: var(--accent); color: #fff; }
.clip-feed.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.clip-feed.gallery .clip-card { border-radius: 4px; border: none; box-shadow: none; margin: 0; cursor: pointer; }
.clip-feed.gallery .clip-head, .clip-feed.gallery .post-actions, .clip-feed.gallery .clip-dict, .clip-feed.gallery .clip-play { display: none; }
.clip-feed.gallery .clip-media .clip-poster { width: 100%; height: 100%; object-fit: cover; }

/* 動かす方式：選んだモンスターの表示（画像の上には重ねない） */
.editor-pick { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--panel); color: var(--text); border-top: 1px solid var(--border); font-size: 14px; }
.editor-pick img { width: 40px; height: 40px; object-fit: contain; background: var(--checker); border-radius: 8px; flex: 0 0 auto; }
.editor-pick span { flex: 1; min-width: 0; line-height: 1.35; }
.editor-pick small { display: block; font-size: 12px; color: var(--muted); }
.editor-pick button { flex: 0 0 auto; border: none; background: var(--panel-2); color: var(--text); width: 38px; height: 38px; border-radius: 50%; font-size: 16px; }
.pal-item.picked { outline: 3px solid var(--accent); outline-offset: -1px; position: relative; }
.pal-item.picked::after { content: '✓'; position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
/* アルバムから追加（撮影ボタンの下・「または」の下） */
.or-sep { display: flex; align-items: center; gap: 10px; max-width: 320px; margin: -4px auto 0; color: var(--muted); font-size: 13px; }
.or-sep::before, .or-sep::after { content: ''; flex: 1; height: 1px; background: var(--border, #e3e5ea); }
.record-btn.upload-btn { margin-top: 10px; background: var(--panel); color: var(--accent); border: 2px solid var(--accent); padding: 14px; }
/* 投稿タブ：動画を作成中 */
.anim-pending { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 999px; pointer-events: none; }

/* アルバムの写真の切り取り（3:4） */
.crop-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px; position: relative; overflow: hidden; } /* 枠の外を暗くする影が上のボタンまで暗くしないように */
.crop-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #c9ced8; font-weight: 700; }
.lib-wait { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.35); }
.lib-wait div { background: var(--panel); color: var(--text); padding: 14px 18px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; }
.crop-frame { position: relative; overflow: hidden; border-radius: 6px; box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 0 0 9999px rgba(0,0,0,.35); background: #000; }
.crop-frame canvas { display: block; touch-action: none; cursor: grab; }
.crop-bottom { padding: 10px 16px max(14px, env(safe-area-inset-bottom)); background: #151821; }
.crop-zoom { display: flex; align-items: center; gap: 10px; color: #c9ced8; font-weight: 700; margin-bottom: 6px; }
.crop-zoom input { flex: 1; }

/* 名前の候補（押したときだけ） */
.name-suggest { margin: -4px 0 10px; }
.name-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.name-chip { border: 1px solid var(--border, #e3e5ea); background: var(--panel-2, #f3f4f6); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; }

/* 日本語の改行（10/16）：文字の途中では折り返さず、文節の切れ目（phrase.js が入れる区切り）と句読点でだけ折り返す。
   入りきらない長い英数字などは、はみ出さないよう途中でも折り返す。行頭に小さい「ゃ」「っ」などが来ないようにする */
body { word-break: keep-all; overflow-wrap: anywhere; line-break: strict; }
p, .small, .muted, .hint, .sub, .desc, label, li { text-wrap: pretty; }
h1, h2, h3, button, .badge { text-wrap: balance; }

/* 動かす方式で選べないモンスター（アップロードした画像） */
.pal-item.pal-disabled { opacity: 0.4; }

/* 自分のモンスターの「編集」中は横いっぱい。使用許可のチェックの文は左寄せ */
.char-card.editing { grid-column: 1 / -1; }
.char-card.editing img { max-height: 180px; object-fit: contain; }
.char-share { text-align: left; }

/* PC など横に広い画面（10/16）：投稿のタイムラインがその幅いっぱいに拡大されて見にくかったので、スマホと同じくらいの幅の列に収める。
   撮影の枠も、高さの上限に合わせて横幅を絞り、保存される 3:4 と同じ形のままにする（スマホでは今までと変わらない） */
.clip-feed { max-width: max(300px, min(520px, calc((100vh - 190px) * 3 / 4))); margin-left: auto; margin-right: auto; }   /* 1件の動画が画面の高さに収まる幅 */
/* 10/24 UIチェック（iPhone SE で「アルバムから追加」が帯とタブに隠れていた）：撮影ボタンの下の「または」＋アルバムのボタンの分（約76px）も空ける */
.camera-wrap { max-width: min(calc(66vh * 3 / 4), calc((100svh - 436px) * 3 / 4)); min-width: min(100%, 128px); }
/* 10/19：スマホの縦の画面で、撮影の枠が大きすぎて「撮影」ボタンが下のタブ・アンケートのボタンに重なっていた。
   枠・動画／写真の切り替え・撮影ボタンが、スクロールしなくても下のタブより上に収まる高さにする（保存される 3:4 の形はそのまま） */

/* 10/19：うまくできなかったときの「作り直す」ボタン（ストックの各行のラベルの下） */
.stock-list button.regen-btn {
  display: block; width: 100%; margin-top: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--accent-2); background: transparent; border: 1px dashed var(--accent-2); padding: 7px 6px;
}
.stock-list button.regen-btn:disabled { opacity: .6; }
.anim-retry { font-weight: 400; margin-top: 4px; }
.nowrap { white-space: nowrap; }
/* 10/19：長いコメントの通知が一覧で縦に長く伸びていた → 3行まで（押すと投稿とコメントが開く） */
.notif .notif-body { min-width: 0; }
.notif .notif-msg { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* ---- 10/19 使ってみたテスト（2人分の感想）からの直し ---- */
.affect-top { display: flex; align-items: center; gap: 8px; }
.affect-later-top { margin-left: auto; padding: 8px 4px; font-size: 14px; white-space: nowrap; flex: none; }
.affect-title, .affect-day { white-space: nowrap; }   /* 10/31：狭い画面で「10/31 の分」が2行に割れていた */
/* 「あと◯分でvlogへ」はボタンではないので、枠のない文字の印にする */
.vlog-mark { border: none; background: transparent; font-weight: 600; font-size: 11.5px; color: var(--muted); }
.vlog-mark small { font-size: 10.5px; }
.vlog-mark.in { background: transparent; }
/* 小さい画面で押しにくかった所 */
.stock-list button { min-height: 40px; font-size: 13.5px; }
.stock-list .stock-actions.has-vlog button:not(.gen) { font-size: 13px; }
.comment-del { font-size: 13px; padding: 8px 10px; margin: -8px -10px -8px auto; }
.char-share { font-size: 13px; }
.char-share input { width: 20px; height: 20px; margin-top: 1px; }
/* 通知の大もとがオフのときは、下のスイッチも灰色に（オンに見えていた） */
#pushTypes.off input.switch:checked { background: #c7cbd3; border-color: #c7cbd3; }
.ychat-register.hidden { display: none; }
.stock-label > .badge:first-of-type { margin-left: 0; display: inline-block; margin-top: 6px; }

/* 10/20 本人：アンケートの入口は「忘れないように常に見える所」に。下のタブのすぐ上に帯で出す（音楽アプリの再生中の帯のような形）。
   帯の分だけ各タブの下に余白を足し、いちばん下までスクロールしたときにボタンが帯の下に隠れないようにする */
.affect-bar {
  position: fixed; left: 10px; right: 10px; z-index: 35;
  bottom: calc(50px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px; height: 44px; border: none; border-radius: 12px;
  background: var(--accent-2); color: #fff; font: inherit; font-size: 14px; font-weight: 700; text-align: left;
  box-shadow: 0 4px 14px rgba(47,111,237,.35);
}
.affect-bar-ico { font-size: 17px; line-height: 1; }
.affect-bar-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.affect-bar-go { flex: 0 0 auto; font-size: 13px; background: rgba(255,255,255,.2); padding: 5px 10px; border-radius: 999px; }
body.affect-due .tab { padding-bottom: calc(92px + 54px); }
body.affect-due .gen-chip { bottom: calc(70px + 54px + env(safe-area-inset-bottom)); }
body.affect-due .toast { bottom: calc(120px + 54px + env(safe-area-inset-bottom)); }
/* 帯が出ている間は撮影の枠を少し小さくして、「撮影」ボタンが帯の上に収まるようにする */
body.affect-due .camera-wrap { max-width: min(calc(66vh * 3 / 4), calc((100svh - 490px) * 3 / 4)); }
/* 10/24 UIチェック：通知のおすすめがアンケートの帯に重なって「回答する」が隠れていた → 帯がある間は帯の上に積む */
body.affect-due .push-ask { bottom: calc(100px + env(safe-area-inset-bottom)); }
/* 通知のおすすめ（初回だけ・答えれば消える）が出ている間は、作成中の小さな表示をその上に出す（重ならないように） */
/* 作成中の表示は1行で（狭い画面で2行に折れていた） */
.gen-chip { white-space: nowrap; }
body.push-asking .gen-chip { bottom: calc(62px + 220px + env(safe-area-inset-bottom)); }
body.push-asking.affect-due .gen-chip { bottom: calc(100px + 220px + env(safe-area-inset-bottom)); }

/* 10/20：ストックのカードの見出し（1行目：時刻・写真/動画・状態、2行目：モンスター） */
.stock-label { font-weight: 400; margin-bottom: 10px; }
.stock-head { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.stock-time { font-size: 17px; font-weight: 800; letter-spacing: .01em; font-variant-numeric: tabular-nums; white-space: nowrap; flex: 0 0 auto; }
.stock-kind { font-size: 15px; line-height: 1; flex: 0 0 auto; }
/* 10/25 本人（状態の文が長くなって「動画」が縦書き・時刻が途中で改行された）：時刻と種類は縮めない。状態は残りの幅で折り返す */
.stock-head .stock-status { min-width: 0; flex: 0 1 auto; white-space: normal; text-align: right; line-height: 1.35; }
.stock-status { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.stock-status.st-queued, .stock-status.st-placing, .stock-status.st-generating, .stock-status.st-recompose { background: #fff4d6; color: #8a5a00; }
.stock-status.st-done { background: #e6f6ea; color: #1d7a3a; }
.stock-status.st-failed { background: #fde8e8; color: #b42318; }
.st-spin { width: 10px; height: 10px; border-radius: 50%; border: 2px solid rgba(138,90,0,.25); border-top-color: #8a5a00; animation: ptr-rot .8s linear infinite; }
.stock-monster { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--text); }
.stock-note { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.stock-list button.regen-btn { margin-top: 10px; }
/* 10/20：ストックのボタン列。モンスターを選んだ後は「見る・編集・共有・削除」の4つを同じ大きさで */
.stock-actions.four { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stock-list button.edit { color: var(--accent-2); font-weight: 700; }
.stock-list .stock-actions button { padding: 9px 2px; font-size: 13px; }
.stock-vlog { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.stock-vlog.in { color: #1d7a3a; }
.stock { text-align: center; padding: 12px 14px; }
.stock-title { font-size: 15px; font-weight: 700; }
.stock-title strong { font-size: 20px; margin: 0 2px; }
.stock-when { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.char-intro p.muted:first-of-type { font-size: 15px; color: var(--text); }
.char-intro-sub { margin-top: 6px; line-height: 1.6; }
.stock-actions.four { grid-template-columns: .9fr .95fr 1.3fr .95fr; }
.stock-list .stock-actions.four button { font-size: 12.5px; padding: 9px 0; letter-spacing: -.02em; }

/* ---- 10/20 見た目の見直し（デザインの目で見たレビューから） ---- */
/* アンケートの帯：下のタブにすき間なくつける（帯とタブの間から下の文字が覗かないように） */
.affect-bar { left: 0; right: 0; bottom: calc(46px + env(safe-area-inset-bottom)); border-radius: 14px 14px 0 0; height: 46px;
  padding: 0 16px; box-shadow: 0 -4px 14px rgba(47,111,237,.18); }
body.affect-due .tabbar button.active { border-top-color: transparent; }
/* ストックのボタン：4つとも同じ灰色の地・黒い文字にそろえ、削除だけ赤い文字。状態の色は右上の印だけにする */
.stock-list .stock-actions button, .stock-list button.edit { background: var(--panel-2); border: 1px solid transparent; color: var(--text); font-weight: 600; }
.stock-list .stock-actions button.danger { color: var(--danger); border-color: transparent; }
.stock-list .stock-actions button.share.shared { color: var(--muted); }
.stock-list .stock-actions button.gen { background: var(--accent-2); color: #fff; font-weight: 700; }
.stock-list button.regen-btn { border: none; background: #eaf1fe; color: var(--accent-2); font-weight: 700; padding: 9px 6px; border-radius: 10px; }
.stock-vlog, .stock-vlog.in { color: var(--muted); }
/* ストックの件数：左揃えでカードと線をそろえる */
.stock { text-align: left; max-width: 320px; }
.stock-title { display: flex; align-items: baseline; gap: 4px; }
/* 投稿のボタン列：削除は右端の小さな赤い文字に（小さい画面で2行目に落ちていた） */
.post-actions .act-del { margin-left: auto; background: none; border: none; padding: 7px 4px; font-size: 13px; font-weight: 600; color: var(--danger); }
.post-actions .act-like:not(.on) { color: var(--muted); }
/* 「この投稿のモンスター」：「自分」は名前の横の小さなラベルにして、説明に幅を譲る */
.fav.mine { background: none !important; border: none !important; color: var(--muted) !important; font-size: 11px !important; padding: 2px 0 !important; min-width: 0; }
/* vlog の一覧：モンスターがいない投稿に空の丸を出さない */
.cell-badge.hidden { display: none; }
/* 削除の赤は1色に（--danger） */
.char-actions .link.danger, .comment-del { color: var(--danger); }
/* 2つの切り替え（動画/写真・タイムライン/一覧）を同じ大きさに */
.feed-view-toggle { max-width: 300px; }
.feed-view-toggle button, .shoot-mode button { padding: 8px 0; font-size: 15px; }
/* 「または」の区切りをモンスタータブも線つきに */
.or-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
/* AIで作る画面：タイトルを真ん中に、送信はコメントと同じ赤 */
.ychat-top { display: grid; grid-template-columns: 1fr auto 1fr; }
.ychat-top > :first-child { justify-self: start; }
.ychat-top .ychat-title { justify-self: center; }
.ychat-top > :last-child { justify-self: end; }
.ychat-send { background: var(--accent); }
/* 通知の一覧：1件を少しコンパクトに */
.notif { padding: 12px 14px; font-size: 14px; }
/* 上のバーのアプリの版は目立たせない */
.app-ver { font-size: 10.5px; opacity: .7; }
#pushTypes.off input.switch:checked { background: #d9dce2; border-color: transparent; }
#pushTypes.off input.switch:checked::after { transform: none; }
.char-intro-sub { list-style: none; padding: 0; margin-top: 6px; line-height: 1.6; }
.char-intro-sub li { position: relative; padding-left: 12px; }
.char-intro-sub li::before { content: '・'; position: absolute; left: -2px; }
.editor-hint { white-space: pre-line; }
.pal-tip { color: #9aa3b2; font-weight: 400; }
.comments-empty { padding: 36px 0 24px; }

/* 10/21 縁に置いたキャラの影：投稿の枠の下にはみ出す下半分（楕円の中心＝映像の下の縁、縦の半径＝映像の高さの3%） */
.edge-shadow { position: absolute; top: 100%; height: 3%; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse 50% 100% at 50% 0%, rgba(0,0,0,0.42) 0%, rgba(0,0,0,0.25) 45%, rgba(0,0,0,0) 100%); }
.clip-feed.gallery .edge-shadow { display: none; }
/* 10/25 試す：縁に置いたキャラの、枠の下にはみ出した分（投稿の枠より手前に描く） */
.front-over { position: absolute; left: 0; top: 100%; width: 100%; height: auto; pointer-events: none; z-index: 2; display: block; }
.front-src { position: absolute; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; }
.clip-feed.gallery .front-over { display: none; }

/* 10/21 アルバムの動画から使う4秒を選ぶ画面 */
.trim-video { max-width: 100%; max-height: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; background: #000; box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
/* 撮るタブの「見る」：3:4 の枠（縁の影の位置を合わせるため）。高さは画面の6割まで */
.stock-media { position: relative; width: min(100%, calc(60vh * 3 / 4)); aspect-ratio: 3 / 4; margin: 0 auto 14px; background: #000; }
.stock-media .stock-player { width: 100%; height: 100%; max-height: none; object-fit: cover; }
.stock-media, .stock-photo-wrap { container-type: inline-size; }   /* 11/2 本人：ストックの「見る」にもひとことを重ねる（大きさは枠の幅に合わせる） */
.stock-media .cap-over.p-bot { padding-bottom: 44px; }   /* 動画の操作バーにかからない高さ */
/* 10/21 本人：使う4秒は、動画のコマを並べた帯の上で「4秒の箱」をずらして選ぶ */
.trim-strip { position: relative; height: 56px; border-radius: 8px; overflow: hidden; background: #2a2f3a; touch-action: none; user-select: none; -webkit-user-select: none; margin: 4px 0 8px; }
.trim-strip canvas { display: block; width: 100%; height: 100%; }
.trim-box { position: absolute; top: 0; bottom: 0; border: 3px solid #ffd23f; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0,0,0,.55); cursor: grab; box-sizing: border-box; }
.trim-box span { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: #111; background: #ffd23f; padding: 0 6px; border-radius: 6px; }
/* 10/22：自分の投稿・vlogの保存ボタン（削除の左） */
.post-actions .act-dl { margin-left: auto; background: none; border: none; padding: 7px 6px; font-size: 13px; font-weight: 600; color: var(--muted, #888); }
.post-actions .act-dl + .act-del { margin-left: 0; }
/* 11/2 本人（自分の投稿で「編集」が増えて2行になり、削除だけ下に落ちた）：いつも1行に並べる。右側の文字ボタン（編集・保存・削除）は詰めて、狭い画面では全体を少し小さく */
.post-actions { flex-wrap: nowrap; }
.post-actions .act-dl + .act-dl { margin-left: 0; }
.post-actions .act-dl, .post-actions .act-del { padding: 7px 3px; }
@media (max-width: 400px) {
  .post-actions { gap: 5px; padding: 8px 10px; }
  .post-actions .act-like, .post-actions .act-comment, .post-actions .act-yokai { padding: 6px 8px; font-size: 13px; }
  .post-actions .act-dl, .post-actions .act-del { font-size: 12px; padding: 6px 2px; }
}
@media (max-width: 340px) {
  .post-actions { gap: 4px; padding: 8px 8px; }
  .post-actions .act-like, .post-actions .act-comment, .post-actions .act-yokai { padding: 5px 6px; font-size: 12.5px; }
  .post-actions .act-dl, .post-actions .act-del { font-size: 11.5px; padding: 6px 1px; }
}
.post-modal .post-actions .act-dl { color: #ddd; }

/* 10/23 本人：アップロード中・完了を色つきの帯ではっきり見せる（撮影画面の状態の文） */
#recStatus.st-busy, #recStatus.st-done, #recStatus.st-warn, #recStatus.st-err {
  width: fit-content; max-width: calc(100% - 32px); margin: 10px auto; padding: 9px 16px; border-radius: 999px;
  font-size: 15px; font-weight: 700; color: #fff; line-height: 1.4; box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
#recStatus.st-busy { background: #2f6fed; }
#recStatus.st-done { background: #16a34a; }
#recStatus.st-warn { background: #d97706; }
#recStatus.st-err { background: #e23a4c; }
#recStatus.st-busy::before {
  content: ''; display: inline-block; width: 13px; height: 13px; margin-right: 8px; vertical-align: -2px;
  border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: recspin .8s linear infinite;
}
@keyframes recspin { to { transform: rotate(360deg); } }

/* 10/23：作り直しをやめるボタン */
.regen-btn.regen-stop { color: var(--danger); border-color: var(--danger); }
/* 10/24 UIチェック：狭い画面で「タップしてカメラを起動」が左寄せで折れていた */
.cam-idle { text-align: center; }
/* 10/24 本人：モンスターの動画には効果音が入っている（音が出ることに気づけるよう、ストックの「動画ができました」の横に小さく） */
.snd-mark { font-size: 11px; opacity: .8; }
/* 10/24：「通知」タブのホーム画面に追加 */
.install-row { display: block; width: 100%; margin: 0 0 10px; padding: 12px 14px; text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; font-size: 15px; font-weight: 700; color: var(--text); }
.install-row .small { margin-left: 6px; font-weight: 400; }
/* 10/24：動画の画質の設定（通知タブ） */
.view-quality { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; font-size: 15px; font-weight: 700; }
.view-quality > span { flex: 1; min-width: 0; }
.view-quality small { display: block; margin-top: 3px; font-size: 12px; font-weight: 400; line-height: 1.5; }

/* 10/25 本人：モンスターがときどき顔を出す（下の目次の後ろ・画面の左右の端から半分だけ）。押すと説明 */
.peek { position: fixed; z-index: 29; width: 96px; height: 96px; padding: 0; border: none; background: none; transition: transform .5s cubic-bezier(.3,1.4,.5,1); }
.peek img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,.25)); }
.peek-bottom { bottom: var(--peek-tabbar, calc(48px + env(safe-area-inset-bottom))); transform: translateY(100%); }
.peek-bottom.in { transform: translateY(28%) rotate(var(--peek-tilt, 0deg)); }
.peek-left { left: 0; transform: translateX(-100%) rotate(20deg); }
.peek-left.in { transform: translateX(-22%) rotate(20deg); }
.peek-right { right: 0; transform: translateX(100%) rotate(-20deg); }
.peek-right.in { transform: translateX(22%) rotate(-20deg); }
.peek-modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.peek-card { background: var(--panel); color: var(--text); border-radius: 16px; padding: 18px 16px 12px; width: min(320px, 100%); text-align: center; box-shadow: var(--shadow); }
.peek-card img { width: 140px; height: 140px; object-fit: contain; background: var(--checker); border-radius: 12px; }
.peek-name { font-weight: 800; font-size: 18px; margin-top: 8px; }
.peek-desc { font-size: 14px; margin-top: 6px; line-height: 1.5; overflow-wrap: anywhere; }
.peek-who { font-size: 13px; color: var(--muted); margin-top: 8px; }
.peek-btns { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 12px; }
.peek-btns button:not(.link) { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font-weight: 700; }
.peek-btns button.on { background: #fff4c2; border-color: #f0c040; }
/* 10/25 本人：ストックでも縁のキャラは枠より手前。枠の下にはみ出した分（枠の高さの12%）が行の外で切れないよう、下をあける */
.stock-media:has(.front-over) { margin-bottom: 18%; }

/* 10/25 本人：写真は上下左右に、枠の外まで「ほんのちょっと」描く（枠の外の層が投稿のカード・ストックの行で切れないように） */
.clip-card.has-front-box, .stock-list li.has-front-box { overflow: visible; }
.front-over.boxed { z-index: 6; }

/* 10/29 本人：投稿の自動再生（音なしで流れているときの「タップで音」） */
.clip-media .auto-mute { position: absolute; right: 8px; bottom: 8px; z-index: 6; border: 0; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, 0.55); min-height: 32px; }
/* 10/29 本人（スクロールの途中で真っ黒になって待たされる）：動画が出るまでは、真っ黒ではなくサムネと読み込み中の印を見せる */
.clip-media .av-spin { display: none; }
.clip-media.av-wait video.av { opacity: 0; }
.clip-media.av-wait .av-spin { display: block; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; animation: av-spin .8s linear infinite; pointer-events: none; z-index: 5; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
@keyframes av-spin { to { transform: rotate(360deg); } }
/* 10/30 本人：他の人の投稿のサムネ・動画を長押ししても「画像を保存」などを出さない（自分の投稿は「⬇ 保存」ボタンから） */
.clip-media img, .clip-media video, .feed-cell img, #postModal video, .clip-photo { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
/* 10/31：投稿のひとこと（任意・20字まで）。本人（SetLog のイメージ）：写真・動画の真ん中に堂々と。色と字体を選べる */
.clip-mwrap, .modal-mwrap { position: relative; container-type: inline-size; }
.cap-over { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 0 7%; pointer-events: none; z-index: 4; line-height: 1.25; word-break: break-word; letter-spacing: .02em; }
.cap-over span { display: inline-block; max-width: 100%; white-space: nowrap; }   /* 改行は capLines() が言葉の切れ目で入れる */
.cap-over.s1 { font-size: 13cqw; } .cap-over.s2 { font-size: 10cqw; } .cap-over.s3 { font-size: 8cqw; } .cap-over.s4 { font-size: 6.6cqw; }
.f-gothic { font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic", sans-serif; font-weight: 800; }
.f-mincho { font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", "Noto Serif CJK JP", serif; font-weight: 700; }
.f-maru { font-family: "Hiragino Maru Gothic ProN", "M PLUS Rounded 1c", "Rounded Mplus 1c", "Noto Sans JP", sans-serif; font-weight: 700; }
/* 縁取り：明るい色には濃い縁、黒には白い縁（どんな写真の上でも読めるように） */
.cap-over { --o: transparent; }
.o-white { --o: #fff; } .o-black { --o: #111; } .o-red { --o: #ff3b4a; } .o-yellow { --o: #ffd60a; } .o-blue { --o: #2f8cff; } .o-pink { --o: #ff6fb5; } .o-green { --o: #2ecc71; }
.cap-over.o-none span { text-shadow: 0 .04em .25em rgba(0,0,0,.45); }
.cap-over span { text-shadow: 0 0 .06em var(--o), .045em .045em 0 var(--o), -.045em .045em 0 var(--o), .045em -.045em 0 var(--o), -.045em -.045em 0 var(--o), 0 .06em 0 var(--o), 0 -.06em 0 var(--o), .06em 0 0 var(--o), -.06em 0 0 var(--o), 0 .08em .25em rgba(0,0,0,.35); }
.c-white { color: #fff; } .c-black { color: #111; } .c-red { color: #ff3b4a; } .c-yellow { color: #ffd60a; } .c-blue { color: #2f8cff; } .c-pink { color: #ff6fb5; } .c-green { color: #2ecc71; }
.cap-over.free { display: block; padding: 0; }   /* 11/3：スライダーで決めた大きさ・位置（左右の真ん中、上下はスライダー） */
.cap-over.free span { position: absolute; left: 50%; transform: translateX(-50%); max-width: 86%; }
.cap-over.over { overflow: hidden; }   /* 11/4 本人：大きくしてはみ出した文字は、写真・動画の枠で切る */
.modal-mwrap .cap-over.free, .stock-media .cap-over.free { padding: 0; }
.cap-slide { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.cap-slide input { flex: 1; min-width: 0; accent-color: var(--accent-2); }
.cap-lead { font-size: 13px; color: var(--text); margin: -4px 0 10px; line-height: 1.5; }
.stock-actions button.share.auto { background: #fff7e0; border-color: #f0c040; color: #7a5a00; }
.stock-note.auto { color: #7a5a00; }
.cap-over.p-top { align-items: flex-start; padding-top: 7%; }   /* 11/1 本人：位置（上・中・下） */
.cap-over.p-bot { align-items: flex-end; padding-bottom: 13%; }   /* 下は「タップで音」のボタンにかからない高さ */
.modal-mwrap .cap-over { padding-bottom: 44px; }
.modal-mwrap .cap-over.p-bot { padding-bottom: 64px; }   /* 動画の操作バーに重ならないよう少し上に */
.cap-sheet { position: fixed; inset: 0; z-index: 9000; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; }
.cap-box { width: 100%; max-width: 480px; background: var(--panel); color: var(--text); border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.cap-title { font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.cap-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.cap-prev { position: relative; flex: none; width: 38%; max-width: 170px; aspect-ratio: 3 / 4; background: #1f2430; border-radius: 10px; overflow: hidden; container-type: inline-size; }
.cap-prev img, .cap-prev video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cap-side { flex: 1; min-width: 0; }
.cap-input { width: 100%; font-size: 16px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); resize: none; line-height: 1.4; font-family: inherit; }
.cap-note { font-size: 12px; color: var(--muted); margin: 0 2px 6px; }
.cap-count { font-size: 12px; color: var(--muted); text-align: right; margin: 4px 2px 6px; }
.cap-count.over { color: var(--danger); }
.cap-label { font-size: 12px; color: var(--muted); margin: 4px 0; }
.cap-colors { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.cap-colors button { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(0,0,0,.18); padding: 0; }
.cap-colors button.none { background: linear-gradient(135deg, #fff 45%, #e23a4c 45%, #e23a4c 55%, #fff 55%); }
.cap-colors button.on { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.cap-fonts { display: flex; gap: 6px; }
.cap-fonts button { flex: 1; padding: 8px 2px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font-size: 13px; white-space: nowrap; }
.cap-fonts button.on { border-color: var(--accent-2); background: #e8f0ff; }
.cap-btns { display: flex; gap: 10px; }
.cap-btns button { flex: 1; padding: 12px; border-radius: 12px; font-size: 15px; font-weight: 700; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); }
.cap-btns .cap-ok { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
@media (max-width: 359px) {   /* 10/31：小さい画面でひとことの色の丸がはみ出していた */
  .cap-prev { width: 30%; }
  .cap-colors button { width: 18px; height: 18px; }
}

/* 11/2 本人（コメントに返信。1段まで）：返信は少し右に下げて並べる。返信先は入力欄の上に出す */
.comment.reply { margin-left: 26px; padding-left: 10px; border-left: 2px solid var(--border); }
.thread-foot { display: flex; align-items: center; gap: 14px; margin: 2px 0 0; }
.comment.reply + .thread-foot, #commentsList > .thread-foot { margin: 0 0 8px 36px; padding: 2px 0 8px; border-bottom: 1px solid var(--border); }
.thread-toggle { background: none; border: none; padding: 4px 0; color: var(--accent2, #2f6fdf); font-size: 13px; font-weight: 700; }
.thread-reply { background: none; border: none; padding: 4px 0; color: var(--muted, #888); font-size: 12.5px; font-weight: 600; }
.reply-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 14px; font-size: 13px; color: var(--muted, #888); border-top: 1px solid var(--border); background: var(--panel-2); }
.reply-bar.hidden { display: none; }
/* 11/22 本人（返信をやめる ✕ が小さくて見にくい）：丸いボタンにして大きくする。ほかの ✕ も合わせて大きく */
.reply-bar { padding: 5px 10px 5px 14px; }
.reply-bar button { flex: 0 0 auto; width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: var(--panel); color: var(--text); font-size: 16px; line-height: 1; }
.ychat-top .link, .editor-top .link, .comments-top .link, .affect-later-top { font-size: 15px; }
/* 11/22 本人（✕ が丸の真ん中にない）：字の ✕ は字体によって位置がずれるので、丸いボタンの ✕ は線で描いて真ん中に置く */
.reply-bar button, .editor-pick button { position: relative; }
.reply-bar button, .editor-pick button, .modal-close { font-size: 0; }
.reply-bar button::before, .reply-bar button::after, .editor-pick button::before, .editor-pick button::after, .modal-close::before, .modal-close::after { content: ''; position: absolute; left: 50%; top: 50%; width: 14px; height: 2px; margin: -1px 0 0 -7px; border-radius: 1px; background: currentColor; transform: rotate(45deg); }
.reply-bar button::after, .editor-pick button::after, .modal-close::after { transform: rotate(-45deg); }
.modal-close::before, .modal-close::after { width: 16px; margin-left: -8px; }

/* 11/2 本人（コメントの編集。YouTube のように「（編集済み）」） */
.comment-edit { margin-left: auto; background: none; border: none; color: var(--muted, #888); font-size: 13px; padding: 8px 6px; margin-top: -8px; margin-bottom: -8px; }
.comment-head .comment-edit + .comment-del { margin-left: 0; }
.comment-editbox { margin-top: 4px; }
.comment-edit-input { width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font-size: 16px; line-height: 1.45; resize: vertical; font-family: inherit; }
.comment-edit-row { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 6px; }
.comment-edit-save { background: var(--accent); color: #fff; border: none; font-weight: 700; padding: 7px 16px; border-radius: 10px; }

/* 11/3 本人（投稿に気づかない）：「投稿」タブの新着の印 */
.tab-dot { display: inline-block; width: 8px; height: 8px; margin-left: 4px; border-radius: 50%; background: var(--accent); vertical-align: top; }
.tab-dot.hidden { display: none; }

/* 11/17 本人（畑田先生 11/16）：投稿でモンスターを選ぶ画面は、モンスターを大きめに見せる。
   11/18 本人（左に寄って詰まって見える。前のように段ごとに左右にめくって選ぶ方がよい。長押しの説明も見えるように）：段ごとに横に並べて左右にスクロール。
   下の枠は縦にスクロールさせない（長押しの説明カードは下の枠の上にはみ出して出すため） */
#editorModal .pal-item { width: 76px; }
#editorModal .pal-item img { width: 64px; height: 64px; }
#editorModal .pal-item span { max-width: 72px; font-size: 11px; }
#editorModal .pal-row .editor-palette { min-height: 92px; }
#editorModal .pal-label { font-size: 12px; }
.editor-capline { padding: 6px 14px; background: var(--panel); color: var(--text); font-size: 14px; border-top: 1px solid var(--border); white-space: pre-wrap; word-break: break-word; }
.editor-capline small { color: var(--muted); display: block; font-size: 11px; }
/* 11/17 本人（畑田先生 11/16：名前に本当の心の叫びが出るので、名前を大きく目立たせる）：投稿のモンスターの説明は最初から出す */
.clip-dict .yokai-name { font-size: 18px; font-weight: 800; line-height: 1.3; }
/* 11/18 本人（投稿のモンスターの説明：右のお気に入りボタンが場所を取り、説明が細く折り返されて、行数の違いで見た目がそろわない）：
   絵の右に名前・作った人・説明を横いっぱいに出し、お気に入りは説明の下に小さく置く。自分のモンスターには「自分」ボタンを出さない（作った人の行で分かる） */
.clip-dict .yokai-row { display: grid; grid-template-columns: 56px 1fr; column-gap: 12px; row-gap: 6px; align-items: start; margin: 0; padding: 10px 0; }
.clip-dict .yokai-row + .yokai-row { border-top: 1px solid var(--border); }
.clip-dict .yokai-row img { width: 56px; height: 56px; grid-row: 1 / span 2; }
.clip-dict .yokai-desc { font-size: 13px; line-height: 1.5; color: var(--text); opacity: .8; }
.clip-dict .yokai-row .fav { grid-column: 2; justify-self: start; font-size: 12px; padding: 4px 12px; }
.clip-dict .yokai-row .fav.mine { display: none; }
/* 11/18 本人（いろいろな立場で見直して直せるところは直して）：見直しで決めた見た目の直し（並び順・初期の選択・集めるデータは変えない） */
.char-desc, .yokai-desc, .pal-info .pi-desc { word-break: normal; line-break: strict; }   /* 「、」だけが1行になる改行を防ぐ */
#editorModal .pal-item span { white-space: normal; word-break: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 1.25; text-align: center; }   /* 選ぶ画面で名前が切れない（2行まで） */
#editorModal .pal-item img { width: 60px; height: 60px; }
#editorModal .pal-row .editor-palette { min-height: 100px; align-items: flex-start; }
.clip-dict .yokai-owner.mine { color: var(--muted); font-weight: 400; }   /* 作った人の行が名前と目立ち方を競わない */
.char-name { font-size: 16px; font-weight: 800; line-height: 1.35; }   /* モンスタータブでも名前を大きく */
.char-meta { display: flex; flex-direction: column; }
.char-meta .char-desc.muted { order: 1; font-size: 11px; max-height: none; margin-top: 1px; }   /* 名前 → 作った人 → 説明（投稿カードと同じ順） */
.char-meta .char-desc:not(.muted) { order: 2; color: var(--text); opacity: .8; font-size: 13px; }
.char-desc { max-height: none; overflow: visible; }   /* 説明は50字まで。中だけスクロールにしない */
.clip-dict .yokai-row { grid-template-columns: 72px 1fr; }
.clip-dict .yokai-row img { width: 72px; height: 72px; }
.clip-dict .yokai-dict { padding: 12px 2px 0; }
.clip-dict .yokai-row .fav.on { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }   /* お気に入り済みを塗りつぶさない（押させる圧を弱める） */

/* 11/18 本人（選ぶ画面：名前の長さで枠の大きさが違う・名前が途中で切れる）：枠は同じ大きさにそろえ、名前は3行まで全部出す（名前は15字まで） */
#editorModal .pal-item { width: 76px; height: 116px; justify-content: flex-start; }
#editorModal .pal-item span { -webkit-line-clamp: 3; max-width: 70px; }
#editorModal .pal-row .editor-palette { min-height: 120px; }

/* 11/18：選ぶ画面で、並べ終わるまで「準備中です」 */
#editorPalette .pal-loading { display: none; }
#editorPalette.loading .pal-row { display: none; }
#editorPalette.loading .pal-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 260px; color: #fff; font-size: 16px; text-align: center; padding: 0 16px; }
#editorPalette .pal-loading small { color: #b8bcc6; font-size: 13px; }
#editorPalette .pal-spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(255,255,255,.2); border-top-color: #fff; animation: ptr-rot .8s linear infinite; }
/* 11/18 見た目の調整（ペルソナ検討）
   ・モンスターのカード：同じ段の「編集」「削除」「お気に入り」の高さをそろえる（説明が短いカードだけ上に浮いていた）
   ・「〇〇さんが作ったモンスター」「グループの人は使えない設定です」は文節で折り返す（「モン｜スター」と切れていた） */
.char-grid .char-card { display: flex; flex-direction: column; }
.char-grid .char-card .char-actions { margin-top: auto; }
.char-grid .char-card .char-meta { flex: 0 0 auto; }
.char-meta .char-desc.muted { word-break: keep-all; overflow-wrap: anywhere; }
/* ・毎晩の記録：質問の左端を、上の説明・投稿の写真の左端にそろえる */
.affect-item { margin: 0 -8px; }
/* ・選ぶ画面：準備中の間も、選ぶ欄の高さを並べ終わった後に近づけて、動画の大きさが急に変わらないように */
#editorPalette.loading .pal-loading { min-height: 400px; }

/* 11/18 今日の気分のスライダー（最初はつまみなし。押した・なぞった所につまみが出る） */
.mood-slider { position: relative; height: 44px; margin: 4px 14px 0; touch-action: pan-y; cursor: pointer; outline: none; }
.mood-track { position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: var(--border); }
.mood-thumb { position: absolute; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: var(--accent2, #2f6fed); box-shadow: 0 1px 4px rgba(0,0,0,.25); pointer-events: none; }
.mood-slider:focus-visible .mood-track { box-shadow: 0 0 0 3px rgba(47,111,237,.3); }
.mood-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin: 2px 4px 0; }

/* 11/21 本人：テスト通知のボタンを目立たせる */
.notif-settings #pushTest.push-test { display: block; width: calc(100% - 24px); margin: 4px 12px 12px; padding: 11px; border: 1.5px solid var(--accent-2, #2f6fed); border-radius: 10px; background: rgba(47,111,237,.08); color: var(--accent-2, #2f6fed); font-size: 15px; font-weight: 700; font-family: inherit; }
.notif-settings #pushTest.push-test.hidden { display: none; }
.notif-settings #pushTest.push-test:active { background: rgba(47,111,237,.18); }

/* 11/21 本人：選ぶ画面で動画を大きく見せる。ひとことは動画の上に重ねる（投稿と同じ見え方） */
#editorStage { position: relative; }
#editorStage .editor-capline { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; padding: 6px 10px; background: rgba(0,0,0,.5); color: #fff; border: none; text-align: center; font-size: 14px; font-weight: 700; pointer-events: none; }
#editorStage .editor-capline.hidden { display: none; }
/* 11/20 本人：作る所と一覧、一覧の段ごとを薄い線で分ける */
#charGrid:not(:empty) { border-top: 1px solid var(--border); margin-top: 18px; }
#charGrid .char-section-header { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 18px; }
#charGrid .char-section-header:first-child { border-top: 0; padding-top: 0; margin-top: 16px; }
/* 11/21 本人：もやもやを書く画面の入力欄が下すぎる／注意書きの上の空白 */
.ychat-input-row { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.ychat-status-row:has(.ychat-status:empty):not(:has(.ychat-undo:not(.hidden))) { display: none; }
.ychat > .notice { padding-top: 12px; border-top: 1px solid var(--border); }

/* 11/21 本人：見るだけ（終了日を過ぎた）。いちばん上に一文だけ出し、書き込みのボタンは出さない */
.ro-banner { padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: var(--panel-2); color: var(--text); border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 700; line-height: 1.6; text-align: center; }
body.ro .ro-banner:not(.hidden) + .topbar { padding-top: 12px; }
body.ro .tabbar button[data-tab="record"],
body.ro #charStep1, body.ro #charStep2, body.ro .gen-chip,
body.ro .comments-input-row, body.ro #replyBar, body.ro .thread-reply, body.ro .comment-edit, body.ro .comment-del,
body.ro #notifSettings, body.ro #pushAsk, body.ro #installAsk, body.ro #installRow { display: none !important; }
body.ro .comment-like { pointer-events: none; }
body.ro .comment-like:has(.cl-n:empty) { visibility: hidden; }
.post-actions span.act-like, .post-actions span.act-like.on { display: inline-block; flex: none; background: none; border: 0; padding: 7px 4px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.post-actions span.act-like.on { color: var(--danger); }

/* 11/21 本人：通知の項目は押すと開くことが分かるように、右に下向きの矢印 */
.notif-settings .ns-right { display: inline-flex; align-items: center; gap: 10px; }
.notif-settings .ns-chev { width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
.notif-settings[open] .ns-chev { transform: rotate(-135deg) translateY(-1px); }

/* 11/21 本人：保存（ダウンロード）のボタンは出さない（投稿・モンスター・ストック） */
.char-dl, .stock-dl { display: none !important; }
