:root {
  --ink: #4A3428;
  --accent: #FF8A5B;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --spring-dur: 520ms;
  --spring-ease: cubic-bezier(.34, 1.56, .64, 1);
  --nav-h: calc(52px + var(--safe-bottom));
  --paper: #FFFFFF;
  --ink2: #1F1A24;
  --sub: #8C8494;
  --line: #ECE8F0;
  --soft: #F4F1F6;
  --pink: #FF4D6D;
  --pink-soft: #FFE6EB;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "M PLUS Rounded 1c", "Noto Sans JP", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
/* iPhone のホーム画面アプリでは、画面の下端が #app の外にはみ出して見えることがある。
   その部分は html の背景色になるので、JS で空の下側の色に合わせ続ける */
html { background: #0E0C14; }
body { background: transparent; }

body {
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-font-smoothing: antialiased;
}

input { font: inherit; color: inherit; -webkit-user-select: text; user-select: text; }
input::-webkit-search-cancel-button { display: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.scroll, .hscroll { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.hscroll { overflow-x: auto; scrollbar-width: none; touch-action: pan-x; }
.hscroll::-webkit-scrollbar { display: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

#app { position: fixed; inset: 0; overflow: hidden; }

#sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--sky-top, #FFF6E8), var(--sky-bottom, #FFE2D1));
}

#feed { position: absolute; left: 0; right: 0; top: 0; bottom: var(--nav-h); overflow: hidden; background: #0E0C14; }
#feed-track, #reel { position: absolute; inset: 0; }
#feed-track { will-change: transform; }

#pager { position: absolute; inset: 0; touch-action: none; cursor: grab; }
#pager.grabbing { cursor: grabbing; }

.page { position: absolute; inset: 0; overflow: hidden; will-change: transform; }
.layer { position: absolute; inset: 0; pointer-events: none; will-change: transform, opacity; }

.content {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: calc(var(--safe-top) + 56px) 12px 14px;
}

/* 画面の上に重なる文字は、どの背景でも読めるよう白＋影 */
#topbar, .caption, .rail-btn, #toast, #following {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 0 14px rgba(0, 0, 0, .18);
}

#fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ---------- ページインジケーター ---------- */

#indicator {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 8px 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .14);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
#indicator .track {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  border-radius: 999px;
}
#indicator .dot {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  opacity: .4;
}
#indicator .dot::after { content: ""; position: absolute; inset: -4px -10px; }
#indicator .pill {
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #fff;
  will-change: transform, height;
  pointer-events: none;
  z-index: 1;
}

/* ---------- 上のタブ（フォロー中／おすすめ）と左右のボタン ---------- */

#topbar {
  position: absolute;
  top: calc(var(--safe-top) + 6px);
  left: 0;
  right: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.top-tabs { position: relative; display: flex; gap: 20px; height: 100%; align-items: center; }
.top-tabs button {
  height: 100%;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, .62);
  transition: color 200ms;
}
.top-tabs button.on { color: #fff; }
.top-line {
  position: absolute;
  left: 0;
  bottom: 4px;
  width: 20px;
  height: 3px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  pointer-events: none;
}
.top-icon { position: relative; width: 44px; height: 44px; display: grid; place-items: center; }
.top-icon .ico { width: 26px; height: 26px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); }
.top-icon .line { stroke-width: 2.2; }
.time-chip {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
#time-btn.on .ico { color: #FFE27A; }

/* ---------- 左下のキャプション ---------- */

.caption { padding-right: 76px; }
.caption h2 { font-size: 20px; font-weight: 800; letter-spacing: .04em; line-height: 1.3; }
.caption .handle { margin-left: 8px; font-size: 13px; font-weight: 700; opacity: .8; letter-spacing: 0; }
.caption .music { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; font-weight: 700; }
.marquee { overflow: hidden; width: min(190px, 55vw); -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 88%, transparent); }
.marquee span { display: inline-block; white-space: nowrap; animation: marquee 9s linear infinite; }
@keyframes marquee { to { transform: translateX(-50%); } }
.caption p { margin-top: 4px; font-size: 14px; font-weight: 600; line-height: 1.5; }
.caption .tags { font-size: 13px; font-weight: 700; opacity: .92; }
.caption .tags span { display: inline-block; margin-right: .4em; white-space: nowrap; }

/* ---------- 右側の縦並びボタン ---------- */

#rail {
  position: absolute;
  right: 4px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 64px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rail-btn svg {
  width: 36px;
  height: 36px;
  overflow: visible;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .3));
  transition: transform var(--spring-dur) var(--spring-ease);
}
.rail-btn .fill { fill: #fff; transition: fill 160ms; }
.rail-btn .line { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rail-btn .when-off { display: none; }
.rail-btn:not(.on) .when-on { display: none; }
.rail-btn[data-rail="sound"]:not(.on) .when-off { display: inline; }
.rail-btn[data-rail="shake"]:not(.on) svg { opacity: .7; }
.rail-btn[data-rail="like"].on .fill { fill: #FF4D6D; }
.rail-btn.pressed svg { transform: scale(.82); transition: transform 90ms ease-out; }
.rail-btn.bounce svg { animation: railBounce 520ms; }
@keyframes railBounce {
  0% { transform: scale(.8); }
  35% { transform: scale(1.28); }
  60% { transform: scale(.92); }
  80% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ---------- ダブルタップのハート ---------- */

.heart-pop {
  position: absolute;
  width: 110px;
  height: 110px;
  margin: -55px 0 0 -55px;
  pointer-events: none;
  animation: heartPop 950ms forwards;
}
.heart-pop svg { width: 100%; height: 100%; fill: #FF4D6D; filter: drop-shadow(0 6px 14px rgba(255, 50, 90, .45)); }
@keyframes heartPop {
  0% { transform: rotate(var(--rot)) scale(0); opacity: 0; }
  15% { transform: rotate(var(--rot)) scale(1.3); opacity: 1; }
  28% { transform: rotate(var(--rot)) scale(.9); }
  42% { transform: rotate(var(--rot)) scale(1.06); }
  70% { transform: rotate(var(--rot)) scale(1); opacity: 1; }
  100% { transform: rotate(var(--rot)) translateY(-70px) scale(1.25); opacity: 0; }
}

/* ---------- お知らせ ---------- */

#toast {
  position: absolute;
  top: calc(var(--safe-top) + 58px);
  left: 50%;
  z-index: 5;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .42);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -10px) scale(.9);
  transition: opacity 200ms, transform var(--spring-dur) var(--spring-ease);
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- ぷにっと押せるボタン ---------- */

[data-squish] { transition: transform var(--spring-dur) var(--spring-ease), box-shadow 120ms; }
[data-squish].pressed { transform: scale(.94) translateY(3px); transition: transform 90ms ease-out, box-shadow 90ms; }

/* ---------- なかま ---------- */

.buddy {
  position: relative;
  width: 148px;
  height: 148px;
  touch-action: none;
  cursor: pointer;
}
.buddy-wrap {
  position: absolute;
  inset: 0;
  transform-origin: 50% 100%;
  will-change: transform;
}
.buddy-body {
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 46% 46% / 56% 56% 44% 44%;
  background:
    radial-gradient(circle at 34% 28%, color-mix(in srgb, var(--buddy) 45%, white) 0 14%, transparent 34%),
    radial-gradient(circle at 50% 40%, var(--buddy) 55%, color-mix(in srgb, var(--buddy) 82%, #3a2050));
  box-shadow: 0 6px 0 color-mix(in srgb, var(--buddy) 70%, #3a2050);
  transform-origin: 50% 100%;
  animation: breathe 3.2s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.035, .965); }
}

.buddy-face {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 78px;
  height: 46px;
  transform: translate(-50%, -50%);
}
.eye {
  position: absolute;
  top: 0;
  width: 16px;
  height: 21px;
  border-radius: 50%;
  background: #2B1E2E;
  overflow: hidden;
  transition: height 80ms, top 80ms;
}
.eye.l { left: 12px; }
.eye.r { right: 12px; }
.pupil {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease-out;
}
.buddy.blink .eye { height: 3px; top: 10px; }

.cheek {
  position: absolute;
  top: 24px;
  width: 17px;
  height: 9px;
  border-radius: 50%;
  background: #FF6F96;
  opacity: .42;
}
.cheek.l { left: -2px; }
.cheek.r { right: -2px; }

.mouth {
  position: absolute;
  left: 50%;
  top: 25px;
  width: 14px;
  height: 8px;
  transform: translateX(-50%);
  border: 3px solid #2B1E2E;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  transition: all 120ms;
}

/* 連打中：にこにこ顔 */
.buddy.happy .eye {
  height: 11px;
  top: 6px;
  background: none;
  border: 3.5px solid #2B1E2E;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
}
.buddy.happy .pupil { display: none; }
.buddy.happy .mouth { width: 20px; height: 12px; background: #2B1E2E; border-radius: 3px 3px 12px 12px; }

/* 長押し中：ほっぺをふくらませる */
.buddy.charging .mouth { width: 10px; height: 10px; border: 3px solid #2B1E2E; border-radius: 50%; top: 24px; }
.buddy.charging .cheek { opacity: .75; transform: scale(1.25); }

.buddy-shadow {
  position: absolute;
  left: 50%;
  bottom: -12px;
  width: 112px;
  height: 16px;
  border-radius: 50%;
  background: rgba(30, 10, 40, .16);
  transform: translateX(-50%);
  filter: blur(2px);
}

.combo {
  position: absolute;
  left: 50%;
  top: -46px;
  transform: translateX(-50%) scale(0);
  font-size: 30px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--page-ink);
  text-shadow: 0 3px 0 color-mix(in srgb, var(--page-ink) 18%, transparent);
  pointer-events: none;
}
.combo.hot { color: var(--page-accent); }

/* 部屋ごとの小物（きせかえが「いつもの」のとき） */
/* ゲームべや：ヘッドホン */
.buddy[data-variant="game"] .buddy-body::before {
  content: "";
  position: absolute;
  left: -10px;
  right: -10px;
  top: -12px;
  height: 96px;
  border: 8px solid #3A3160;
  border-bottom: 0;
  border-radius: 80px 80px 0 0;
}
.buddy[data-variant="game"] .buddy-body::after {
  content: "";
  position: absolute;
  left: -18px;
  right: -18px;
  top: 52px;
  height: 40px;
  background:
    radial-gradient(ellipse 13px 20px at 13px 50%, #7CF0D2 0 60%, #3A3160 64% 100%, transparent 102%),
    radial-gradient(ellipse 13px 20px at calc(100% - 13px) 50%, #7CF0D2 0 60%, #3A3160 64% 100%, transparent 102%);
}
/* ざっかや：はちまき */
.buddy[data-variant="shop"] .buddy-body::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 16px;
  height: 13px;
  border-radius: 8px;
  background: repeating-linear-gradient(90deg, #3B6FB6 0 10px, #F5F1E8 10px 13px);
}
.buddy[data-variant="shop"] .buddy-body::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 10px;
  width: 22px;
  height: 22px;
  background:
    radial-gradient(ellipse 6px 10px at 30% 40%, #3B6FB6 0 90%, transparent 100%),
    radial-gradient(ellipse 10px 5px at 70% 75%, #3B6FB6 0 90%, transparent 100%);
  transform: rotate(-20deg);
}
/* ちゅうかや：コック帽 */
.buddy[data-variant="chuka"] .buddy-body::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -52px;
  width: 86px;
  height: 56px;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 22% 62%, #fff 0 26%, transparent 27%),
    radial-gradient(circle at 50% 42%, #fff 0 34%, transparent 35%),
    radial-gradient(circle at 78% 62%, #fff 0 26%, transparent 27%);
  filter: drop-shadow(0 2px 0 #E5DCCB);
}
.buddy[data-variant="chuka"] .buddy-body::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -10px;
  width: 70px;
  height: 20px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 2px 0 #E5DCCB;
}

/* ---------- きせかえ ----------
   #pager の data-outfit で切り替える。default は部屋ごとの小物（ヘッドホン・はちまき・コック帽） */

.outfit { position: absolute; pointer-events: none; display: none; }

#pager:not([data-outfit="default"]) .buddy-body::before,
#pager:not([data-outfit="default"]) .buddy-body::after { display: none; }

#pager[data-outfit="ribbon"] .outfit {
  display: block;
  right: 14px;
  top: 4px;
  width: 48px;
  height: 28px;
  transform: rotate(18deg);
  background:
    radial-gradient(circle at 50% 50%, #E04878 0 17%, transparent 19%),
    radial-gradient(ellipse 46% 50% at 24% 50%, #FF6F96 0 92%, transparent 96%),
    radial-gradient(ellipse 46% 50% at 76% 50%, #FF6F96 0 92%, transparent 96%);
}

#pager[data-outfit="glasses"] .outfit {
  display: block;
  left: 50%;
  top: 37%;
  width: 82px;
  height: 30px;
  transform: translate(-50%, -50%);
  z-index: 1;
  background:
    radial-gradient(circle at 24% 50%, rgba(255, 255, 255, .25) 0 11px, #2B1E2E 11.5px 14px, transparent 14.5px),
    radial-gradient(circle at 76% 50%, rgba(255, 255, 255, .25) 0 11px, #2B1E2E 11.5px 14px, transparent 14.5px),
    linear-gradient(#2B1E2E, #2B1E2E) 50% 45% / 12px 3px no-repeat;
}

#pager[data-outfit="crown"] .outfit {
  display: block;
  left: 50%;
  top: -22px;
  width: 52px;
  height: 32px;
  transform: translateX(-50%) rotate(-6deg);
  background: linear-gradient(#FFE27A, #F5B82E);
  clip-path: polygon(0 100%, 0 20%, 22% 55%, 50% 0, 78% 55%, 100% 20%, 100% 100%);
  filter: drop-shadow(0 2px 0 rgba(160, 100, 0, .4));
}

/* ---------- 部屋 ----------
   部屋の中身は 390×844 の設計で置いてあり、--s（画面に合わせた倍率）で縮める */

.wall, .floor { position: absolute; left: 0; right: 0; }
.wall { top: 0; bottom: 0; }
.floor { bottom: 0; }

.scene {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 390px;
  height: 844px;
  transform: translateX(-50%) scale(var(--s, 1));
  transform-origin: 50% 100%;
}
.prop, .window, .shelf, .cabinet, .boxes, .counter, .red-band, .tiles, .menu-rail, .buddy-spot { position: absolute; }
.prop { pointer-events: auto; will-change: transform; }
.prop svg { display: block; overflow: visible; }
.lamp-src { position: absolute; width: 0; height: 0; }

.buddy-spot { transform: scale(.82); transform-origin: 50% 100%; }
.buddy { pointer-events: auto; }

/* 窓の外 */
.window { overflow: hidden; border-radius: 6px; }
.outside { position: absolute; inset: 0; background: linear-gradient(var(--out-top, #9CC6FF), var(--out-bottom, #FFE3C8)); }
.outside .stars {
  position: absolute;
  inset: 0;
  opacity: var(--night, 0);
  background-image:
    radial-gradient(1.3px 1.3px at 18% 22%, #fff 99%, transparent),
    radial-gradient(1px 1px at 42% 12%, #fff 99%, transparent),
    radial-gradient(1.4px 1.4px at 70% 30%, #fff 99%, transparent),
    radial-gradient(1px 1px at 86% 14%, #fff 99%, transparent),
    radial-gradient(1.2px 1.2px at 30% 46%, #fff 99%, transparent),
    radial-gradient(1px 1px at 60% 52%, #fff 99%, transparent);
}
.orb {
  position: absolute;
  left: var(--orb-x, 30%);
  top: var(--orb-y, 30%);
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
}
.orb .sun, .orb .moon { position: absolute; inset: 0; border-radius: 50%; }
.orb .sun {
  background: radial-gradient(circle, #FFF8D0 0 40%, #FFC66B);
  box-shadow: 0 0 18px 6px rgba(255, 210, 120, .6);
  opacity: calc(1 - var(--night, 0));
}
.orb .moon {
  background: #FFF3C4;
  box-shadow: inset -7px -2px 0 0 #E2D08F, 0 0 14px 3px rgba(255, 243, 196, .45);
  opacity: var(--night, 0);
}
.skyline { position: absolute; left: 0; bottom: 0; width: 100%; height: 30%; }
.skyline .bld { fill: #2B2A44; opacity: calc(.4 + var(--night, 0) * .6); }
.skyline .lit { fill: #FFE08A; opacity: var(--night, 0); }
.win-frame { position: absolute; inset: 0; width: 100%; height: 100%; }

/* 夜の光：部屋全体を暗く青くして、灯りのまわりだけ明るく残す */
.light .ambient, .light .lamplight { position: absolute; inset: 0; }
.light .ambient {
  mix-blend-mode: multiply;
  background: radial-gradient(circle calc(var(--lr) * var(--s, 1)) at var(--lx, 50%) var(--ly, 25%),
    rgb(255 255 255 / 0) 25%, var(--tint, transparent) 100%);
}
.light .lamplight {
  mix-blend-mode: screen;
  background: radial-gradient(circle calc(var(--lr) * .62 * var(--s, 1)) at var(--lx, 50%) var(--ly, 25%),
    rgb(var(--glow) / calc(var(--night, 0) * .42)), transparent 100%);
}
.bulb { filter: drop-shadow(0 0 calc(var(--night, 0) * 10px) rgba(255, 230, 160, .9)); }

/* ---------- ゲームべや ---------- */

.room-game .wall {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 2px, transparent 2px 38px),
    linear-gradient(#4B3F80, #3B3168);
}
.room-game .floor {
  background:
    radial-gradient(ellipse 46% 30% at 50% 38%, #6B5BA8 0 96%, transparent 100%),
    linear-gradient(#4A3A73, #3A2D5E);
}
.win-game { box-shadow: 0 4px 0 rgba(0, 0, 0, .2); }
.win-frame.cross {
  border: 7px solid #2A2350;
  border-radius: 6px;
  background:
    linear-gradient(#2A2350, #2A2350) 50% 0 / 6px 100% no-repeat,
    linear-gradient(#2A2350, #2A2350) 0 50% / 100% 6px no-repeat;
}
.blinds {
  position: absolute;
  left: 7px;
  right: 7px;
  top: 7px;
  height: 36%;
  background: repeating-linear-gradient(#EDE7FF 0 6px, #C9C0EA 6px 8px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .15);
}
.shelf-game { background: #2A2350; border-radius: 3px; box-shadow: 0 4px 0 rgba(0, 0, 0, .2); }
.cabinet {
  border-radius: 8px;
  background: linear-gradient(#332A5E 0 10px, #2A2350 10px);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .18);
}
.cabinet .knob { position: absolute; top: 46px; width: 8px; height: 8px; border-radius: 50%; background: #7CF0D2; }
.cabinet .knob.l { left: 96px; }
.cabinet .knob.r { right: 96px; }

.tv-body {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: #D8D2C4;
  box-shadow: inset 0 -7px 0 #B9B2A3, 0 5px 0 rgba(0, 0, 0, .18);
}
.tv-dial { position: absolute; right: 14px; top: 26px; width: 16px; height: 16px; border-radius: 50%; background: #8D86A8; }
.tv-dial.b { top: 54px; background: #FF7AA8; }
.screen {
  position: absolute;
  left: 12px;
  top: 12px;
  right: 42px;
  bottom: 16px;
  border-radius: 16px / 20px;
  overflow: hidden;
  background: #12233A;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, .5), 0 0 22px rgba(124, 240, 210, .35);
}
.screen::after { content: ""; position: absolute; }
.screen[data-ch="0"] { background: radial-gradient(circle at 50% 50%, #1D3A5A, #0E1A2C); }
.screen[data-ch="0"]::after {
  left: 10px;
  bottom: 12px;
  width: 12px;
  height: 12px;
  background: #7CF0D2;
  box-shadow: 0 0 8px #7CF0D2, 64px 4px 0 -2px #FF7AA8, 40px 10px 0 -3px #FFE66D;
  animation: pixelHop 1.6s steps(16) infinite;
}
@keyframes pixelHop {
  0% { transform: translate(0, 0); }
  25% { transform: translate(24px, -34px); }
  50% { transform: translate(48px, 0); }
  75% { transform: translate(72px, -34px); }
  100% { transform: translate(0, 0); }
}
.screen[data-ch="1"] {
  background: linear-gradient(90deg, #fff 0 14%, #FFE66D 14% 28%, #7CF0D2 28% 42%, #8FE08F 42% 57%, #FF7AA8 57% 71%, #FF5A4A 71% 85%, #6A7BFF 85%);
}
.screen[data-ch="2"] {
  background: repeating-linear-gradient(0deg, #9AA 0 2px, #445 2px 3px, #CCD 3px 4px, #223 4px 6px);
  background-size: 100% 13px;
  animation: snow 0.25s steps(4) infinite;
}
@keyframes snow { to { background-position: 0 13px; } }
.screen[data-ch="3"] { background: #0A0F14; box-shadow: inset 0 0 18px rgba(0, 0, 0, .6); }
.screen[data-ch="3"]::after { left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: #fff; opacity: .6; }

/* ---------- ざっかや ---------- */

.room-shop .wall {
  background:
    repeating-linear-gradient(90deg, rgba(120, 80, 40, .08) 0 2px, transparent 2px 46px),
    linear-gradient(#E6CFA2, #D6B98A);
}
.win-shop { box-shadow: 0 4px 0 rgba(0, 0, 0, .12); }
.win-frame.lattice {
  border: 7px solid #6B4A2E;
  border-radius: 4px;
  background:
    linear-gradient(#6B4A2E, #6B4A2E) 50% 0 / 5px 100% no-repeat,
    linear-gradient(#6B4A2E, #6B4A2E) 0 50% / 100% 5px no-repeat,
    linear-gradient(#6B4A2E, #6B4A2E) 25% 0 / 2px 100% no-repeat,
    linear-gradient(#6B4A2E, #6B4A2E) 75% 0 / 2px 100% no-repeat;
}
.shelf-wood { background: linear-gradient(#A8774A, #7A4F2E); border-radius: 2px; box-shadow: 0 5px 0 rgba(70, 40, 20, .18); }
.boxes span { position: absolute; left: 0; right: 0; border-radius: 3px; }
.boxes span:first-child { bottom: 0; height: 20px; background: #C9A26A; box-shadow: inset 0 -3px 0 #A98552; }
.boxes span:last-child { bottom: 20px; left: 8px; right: 8px; height: 16px; background: #E36A5A; box-shadow: inset 0 -3px 0 #BF4F41; }
.counter { pointer-events: auto; }
.counter-wood { background: repeating-linear-gradient(90deg, #7A4A2E 0 58px, #6A3F26 58px 61px); }
.counter-top { position: absolute; left: 0; right: 0; top: 0; height: 14px; }
.counter-wood .counter-top { background: #A8743F; box-shadow: 0 4px 0 #5A3620; }
.paw {
  position: absolute;
  right: 0;
  top: 12px;
  width: 11px;
  height: 16px;
  border-radius: 6px 6px 4px 4px;
  background: #FFF8EE;
  box-shadow: inset 0 -2px 0 #EAD9C4;
  transform-origin: 50% 100%;
  animation: wave 1.8s ease-in-out infinite;
}
@keyframes wave {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(14deg) translateY(-2px); }
}

/* ---------- ちゅうかや ---------- */

.room-chuka .wall { background: linear-gradient(#F3DFB8, #EAD2A6); }
.red-band { background: #B8322A; border-bottom: 6px solid #E0A93A; }
.win-chuka { border-radius: 50%; }
.tiles {
  background:
    repeating-linear-gradient(90deg, #E5D9C3 0 2px, transparent 2px 30px),
    repeating-linear-gradient(#E5D9C3 0 2px, transparent 2px 30px),
    #FFF8EC;
  border-top: 4px solid #C9B796;
}
.menu-rail { background: #5A2A1E; border-radius: 3px; }
.menu-card {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  padding-top: 9px;
  border-radius: 2px;
  background: #FFF6E2;
  box-shadow: inset 0 0 0 1.5px #E7CFA0, 0 3px 0 rgba(90, 40, 20, .12);
}
.menu-card::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -3px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: #5A2A1E;
}
.menu-card span {
  writing-mode: vertical-rl;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #B82319;
}
.counter-red { background: linear-gradient(#8E2A22, #7E241E); }
.counter-red .counter-top { background: #C23A2E; box-shadow: 0 4px 0 #6A1C16; }
.counter-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 40px;
  height: 12px;
  background: repeating-linear-gradient(90deg, #E0A93A 0 12px, transparent 12px 16px, #E0A93A 16px 20px, transparent 20px 28px);
  opacity: .8;
}

/* ラーメン */
.bowl-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46px;
  border-radius: 6px 6px 54px 54px / 6px 6px 46px 46px;
  background:
    repeating-linear-gradient(90deg, transparent 0 8px, #E5382B 8px 10px, transparent 10px 14px) 0 10px / 100% 6px no-repeat,
    #F7F2E8;
  box-shadow: inset 0 -5px 0 #E2D9C8;
}
.soup {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 6px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  background: #C9783A;
  z-index: 1;
}
.surface {
  position: absolute;
  left: -20%;
  right: -20%;
  top: -60%;
  bottom: -60%;
  background: linear-gradient(#F0B566 0 50%, #D88A44 50%);
  transform-origin: 50% 50%;
}
.surface span { position: absolute; top: 50%; }
.surface .nori { left: 26%; width: 14px; height: 18px; margin-top: -14px; background: #2E3A2A; border-radius: 2px; }
.surface .egg { left: 38%; width: 18px; height: 12px; margin-top: -8px; border-radius: 50%; background: radial-gradient(circle at 55% 50%, #FFB52E 0 35%, #FFF8E8 38%); }
.surface .naruto { left: 54%; width: 14px; height: 10px; margin-top: -7px; border-radius: 50%; background: radial-gradient(circle, #FF8FA3 0 25%, #fff 28% 50%, #FF8FA3 53% 62%, #fff 65%); }
.surface .negi { left: 66%; width: 16px; height: 6px; margin-top: -5px; border-radius: 3px; background: radial-gradient(circle at 25% 50%, #7CC86A 0 30%, transparent 32%), radial-gradient(circle at 75% 50%, #7CC86A 0 30%, transparent 32%); }
.steam {
  position: absolute;
  bottom: 56px;
  width: 10px;
  height: 34px;
  border-left: 3px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  animation: steam 2.6s ease-in-out infinite;
}
.steam.s1 { left: 30px; }
.steam.s2 { left: 52px; animation-delay: -.9s; }
.steam.s3 { left: 74px; animation-delay: -1.7s; }
@keyframes steam {
  0% { transform: translateY(8px) scaleY(.6); opacity: 0; }
  35% { opacity: .8; }
  100% { transform: translateY(-26px) scaleY(1.1) skewX(-12deg); opacity: 0; }
}

/* 動きを減らす設定の人には、待機中の動きを止める */
@media (prefers-reduced-motion: reduce) {
  .buddy-body, .paw, .steam, .screen::after, .screen { animation: none; }
}

/* =========================================================
   まわりの画面：アイコン、下のメニュー、各画面、シート
   ========================================================= */

.ico { width: 24px; height: 24px; display: block; flex: none; overflow: visible; }
.ico .line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico .fill { fill: currentColor; }

/* 押したときに弾む（右側のボタン以外） */
.bounce:not(.rail-btn) { animation: popBounce 480ms; }
@keyframes popBounce {
  0% { transform: scale(.86); }
  40% { transform: scale(1.12); }
  65% { transform: scale(.96); }
  100% { transform: scale(1); }
}
.badge.bounce { animation: badgePop 520ms; }
@keyframes badgePop {
  0% { transform: scale(0); }
  45% { transform: scale(1.35); }
  70% { transform: scale(.9); }
  100% { transform: scale(1); }
}

/* ---------- 丸い顔のアイコン ---------- */

.face {
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--fs);
  height: var(--fs);
  border-radius: 50%;
  background: var(--fc);
  box-shadow: inset 0 calc(var(--fs) * -.07) 0 rgba(0, 0, 0, .08);
}
.face .fe { position: absolute; top: 40%; width: 11%; height: 15%; border-radius: 50%; background: #2B1E2E; }
.face .fe.l { left: 29%; }
.face .fe.r { right: 29%; }
.face .fm {
  position: absolute;
  left: 41%;
  top: 59%;
  width: 18%;
  height: 9%;
  border: calc(var(--fs) * .045) solid #2B1E2E;
  border-top: 0;
  border-radius: 0 0 999px 999px;
}
.face::before, .face::after {
  content: "";
  position: absolute;
  top: 55%;
  width: 14%;
  height: 9%;
  border-radius: 50%;
  background: #FF7F98;
  opacity: .55;
}
.face::before { left: 14%; }
.face::after { right: 14%; }

/* ---------- 右側：部屋のアイコン・ほぞん・レコード ---------- */

.rail-avatar { position: relative; margin-bottom: 14px; }
.avatar-btn {
  display: block;
  width: 50px;
  height: 50px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #fff;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.avatar-btn .face { display: block; margin: 0; width: 100%; height: 100%; }
.avatar-btn.bounce { animation: popBounce 480ms; }
.follow-badge {
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .25);
  transition: transform var(--spring-dur) var(--spring-ease), background 150ms, color 150ms;
}
.follow-badge .ico { position: absolute; width: 16px; height: 16px; transition: transform 300ms var(--spring-ease), opacity 150ms; }
.follow-badge .ico .line { stroke-width: 3; }
.follow-badge .ico:last-child { opacity: 0; transform: scale(.4) rotate(-45deg); }
.follow-badge.done { background: #fff; color: var(--pink); transform: rotate(360deg); }
.follow-badge.done .ico:first-child { opacity: 0; transform: scale(.4) rotate(90deg); }
.follow-badge.done .ico:last-child { opacity: 1; transform: none; }
.follow-badge.gone { transform: rotate(360deg) scale(0); transition: transform 300ms ease-in; }

.rail-btn .ico { width: 36px; height: 36px; }
.rail-btn[data-rail="comment"] { --dot: rgba(0, 0, 0, .28); }
.rail-btn[data-rail="save"].on .fill { fill: #FFC93C; }

.disc {
  position: relative;
  width: 48px;
  height: 48px;
  margin-top: 6px;
  padding: 0;
  border-radius: 50%;
}
.disc-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--disc, #FFC58F) 0 26%, #2A2630 27% 30%, transparent 31%),
    repeating-radial-gradient(circle, #222 0 2px, #2E2A34 2px 4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35), inset 0 0 0 5px #1A1720;
  animation: spin 5s linear infinite;
  animation-play-state: paused;
}
.disc.on .disc-face { animation-play-state: running; }
.disc:not(.on) .disc-face { filter: saturate(.3) brightness(.8); }
.disc:not(.on)::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 3px;
  margin: -1.5px 0 0 -17px;
  border-radius: 2px;
  background: #fff;
  transform: rotate(-45deg);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .4);
}
@keyframes spin { to { transform: rotate(360deg); } }
.disc-notes i {
  position: absolute;
  left: -2px;
  top: 6px;
  color: #fff;
  font-style: normal;
  font-size: 13px;
  opacity: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
.disc.on .disc-notes i { animation: noteFloat 2.6s ease-out infinite; }
.disc.on .disc-notes i:last-child { animation-delay: 1.3s; }
@keyframes noteFloat {
  0% { transform: translate(14px, 14px) scale(.6); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translate(-14px, -26px) rotate(-20deg) scale(1.1); opacity: 0; }
}

/* ---------- 下のメニュー ---------- */

#tabbar {
  --nav-bg: #0E0C14;
  --nav-ink: #fff;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--nav-h);
  padding-bottom: var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--nav-bg);
  color: var(--nav-ink);
  border-top: 1px solid rgba(255, 255, 255, .06);
  transition: background 220ms, color 220ms, border-color 220ms;
}
#app:not([data-view="home"]) #tabbar { --nav-bg: #FFFFFF; --nav-ink: var(--ink2); border-top-color: var(--line); }
#tabbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  opacity: .58;
  transition: opacity 180ms;
}
#tabbar button.on { opacity: 1; }
#tabbar .ti { position: relative; width: 26px; height: 26px; transition: transform var(--spring-dur) var(--spring-ease); }
#tabbar .ti .ico { position: absolute; inset: 0; width: 26px; height: 26px; }
#tabbar .ti .ico:nth-child(2) { opacity: 0; transform: scale(.6); transition: opacity 120ms, transform 380ms var(--spring-ease); }
#tabbar button.on .ti .ico:nth-child(1) { opacity: 0; }
#tabbar button.on .ti .ico:nth-child(2) { opacity: 1; transform: none; }
#tabbar button.pressed .ti, #tabbar button.pressed .plus-key { transform: scale(.84); transition: transform 90ms ease-out; }
#tabbar .tl { font-size: 10px; font-weight: 800; letter-spacing: .02em; }
#tabbar .badge {
  position: absolute;
  top: -5px;
  left: 16px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  border: 2px solid var(--nav-bg);
  font-size: 10px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
}
#tabbar .create-btn { opacity: 1; }
.plus-key {
  display: grid;
  place-items: center;
  width: 48px;
  height: 32px;
  border-radius: 11px;
  background: linear-gradient(135deg, #FFB86B, #FF6B8E);
  color: #fff;
  box-shadow: 0 3px 0 #D9476A, 0 4px 10px rgba(255, 107, 142, .35);
  transition: transform var(--spring-dur) var(--spring-ease);
}
.plus-key .ico { width: 22px; height: 22px; }
.plus-key .ico .line { stroke-width: 3; }

/* ---------- ホームの「フォロー中」 ---------- */

#following {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -100%;
  width: 100%;
  overflow-y: auto;
  padding: calc(var(--safe-top) + 64px) 0 24px;
  background: radial-gradient(120% 60% at 50% 0%, #2C2550, #0E0C14 70%);
  text-shadow: none;
  touch-action: pan-y;
}
.empty-state { text-align: center; padding: 70px 24px; }
.empty-state h3 { margin: 18px 0 6px; font-size: 17px; font-weight: 800; }
.empty-state p { margin-bottom: 20px; font-size: 13px; line-height: 1.6; opacity: .7; }
.empty-state.small { padding: 60px 24px; color: var(--sub); }
.empty-faces { display: flex; justify-content: center; }
.empty-faces .face { margin: 0 -6px; border: 3px solid #0E0C14; animation: breatheFace 2.4s ease-in-out infinite; }
.empty-faces .face:nth-child(2) { animation-delay: -.8s; transform: translateY(-8px); }
.empty-faces .face:nth-child(3) { animation-delay: -1.6s; }
@keyframes breatheFace { 50% { transform: translateY(-6px) scale(1.04, .97); } }
.follow-title { padding: 0 16px 12px; font-size: 15px; font-weight: 800; }
.follow-list { display: grid; gap: 14px; padding: 0 16px; }
.follow-card { border-radius: 16px; overflow: hidden; background: rgba(255, 255, 255, .07); }
.follow-card .thumb { aspect-ratio: 16 / 10; border-radius: 0; }
.follow-info { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.follow-info b { display: block; font-size: 15px; }
.follow-info small { font-size: 12px; opacity: .6; }
.follow-meta { display: flex; align-items: center; gap: 4px; margin-left: auto; font-size: 12px; font-weight: 700; opacity: .85; }
.follow-meta .ico { width: 14px; height: 14px; --dot: transparent; }

/* ---------- 下のメニューで切り替える画面 ---------- */

.tab-screen, .push {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  background: var(--paper);
  color: var(--ink2);
  overflow-y: auto;
  touch-action: pan-y;
  padding-bottom: 28px;
}
.tab-screen {
  bottom: var(--nav-h);
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(.985);
  transition: opacity 160ms, transform var(--spring-dur) var(--spring-ease), visibility 0s 160ms;
}
.tab-screen.active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 160ms, transform var(--spring-dur) var(--spring-ease), visibility 0s;
}
.push { bottom: 0; will-change: transform; box-shadow: -12px 0 30px rgba(0, 0, 0, .18); }
.push-shade { position: absolute; inset: 0; background: rgba(10, 6, 20, .3); }

.screen-head, .push-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(var(--safe-top) + 8px) 16px 10px;
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.screen-head h1 { font-size: 18px; font-weight: 800; }
.screen-head.center { justify-content: center; }
.push-head { justify-content: space-between; padding-left: 4px; padding-right: 4px; }
.push-head b { font-size: 16px; font-weight: 800; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.icon-btn:active { background: var(--soft); }

.search-head { padding-left: 8px; }
.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--sub);
}
.search-box .ico { width: 20px; height: 20px; }
.search-box input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink2); font-size: 16px; }
.search-head:not(:has([data-back])) { padding-left: 16px; }

.chips { display: flex; gap: 8px; padding: 2px 16px 6px; }
.chip {
  flex: none;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--soft);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.chip:active { background: var(--line); }
.sec { padding: 16px 16px 8px; font-size: 15px; font-weight: 800; }
.empty-line { padding: 26px 16px; text-align: center; font-size: 13px; color: var(--sub); line-height: 1.6; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; padding: 0 16px; }
.card { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.card b { font-size: 14px; }
.card-meta { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--sub); }
.card-meta > span { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.card-meta .ico { width: 14px; height: 14px; }
.hrow { display: flex; gap: 10px; padding: 0 16px; scroll-snap-type: x mandatory; scroll-padding: 0 16px; }
.hrow .thumb { flex: 0 0 40%; scroll-snap-align: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.grid3 .thumb { border-radius: 0; }

/* 部屋のサムネイル */
.thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #2A2440;
  transition: transform var(--spring-dur) var(--spring-ease);
}
.thumb:active { transform: scale(.96); transition: transform 90ms; }
.thumb-room, .thumb-room * { pointer-events: none !important; }
.thumb-room { position: absolute; inset: 0; }
.thumb-label {
  position: absolute;
  left: 8px;
  bottom: 7px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}

/* おしらせ */
.inbox-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px 10px 18px;
  text-align: left;
}
.inbox-item:active { background: var(--soft); }
.inbox-item.unread::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--pink);
}
.inbox-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.inbox-text b { font-size: 14px; }
.inbox-tag { padding: 1px 6px; border-radius: 4px; background: var(--soft); color: var(--sub); font-size: 10px; font-weight: 800; }
.inbox-body { width: 100%; font-size: 14px; line-height: 1.45; }
.inbox-text small { font-size: 12px; color: var(--sub); }
.inbox-room, .inbox-thumb { flex: none; width: 44px; height: 58px; border-radius: 6px; object-fit: cover; }
.inbox-room { display: grid; place-items: center; background: var(--fc); color: #fff; font-size: 18px; font-weight: 800; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }

/* プロフィール（マイページ・部屋） */
.profile { padding: 14px 16px 18px; text-align: center; }
.profile-face { display: inline-block; padding: 4px; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 3px var(--fc); animation: popBounce 520ms; }
.profile-face .face { display: block; }
.profile h2 { margin-top: 10px; font-size: 15px; font-weight: 800; }
.stats { display: flex; justify-content: center; gap: 30px; margin: 14px 0 16px; }
.stats b { display: block; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stats small { font-size: 12px; color: var(--sub); }
.profile-btns { display: flex; justify-content: center; gap: 8px; }
.bio { margin-top: 14px; font-size: 14px; line-height: 1.7; }
.keeper { font-size: 12px; color: var(--sub); }

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 42px;
  padding: 0 20px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--ink2);
  font-size: 14px;
  font-weight: 800;
  transition: transform var(--spring-dur) var(--spring-ease), background 150ms, opacity 150ms;
}
.pill-btn:active { transform: scale(.95); transition: transform 90ms; }
.pill-btn .ico { width: 18px; height: 18px; }
.pill-btn .ico .line { stroke-width: 2.6; }
.pill-btn.accent { background: var(--pa, var(--pink)); color: #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, .14); }
.pill-btn.danger { color: #E5383B; }
.pill-btn.danger.sure { background: #E5383B; color: #fff; }
.pill-btn.small { height: 32px; padding: 0 14px; font-size: 13px; }
.pill-btn.wide { display: flex; width: calc(100% - 32px); margin: 4px 16px 16px; }
.pill-btn:disabled { opacity: .35; }

.ptabs { position: sticky; top: calc(var(--safe-top) + 58px); z-index: 1; display: flex; background: var(--paper); border-bottom: 1px solid var(--line); }
.ptabs > * {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 44px;
  color: var(--sub);
  font-size: 13px;
  font-weight: 800;
  transition: color 160ms;
}
.ptabs .ico { width: 18px; height: 18px; }
.ptabs .on { color: var(--ink2); }
.ptabs > span.on { box-shadow: inset 0 -2.5px 0 var(--ink2); }
.ptab-line { position: absolute; left: 0; bottom: -1px; flex: none !important; width: 20px; height: 2.5px !important; border-radius: 2px; background: var(--ink2); pointer-events: none; }
.me-grid.swap { animation: gridIn 360ms var(--spring-ease); }
@keyframes gridIn { from { opacity: 0; transform: translateY(10px); } }
.tile { position: relative; aspect-ratio: 3 / 4; padding: 0; overflow: hidden; background: var(--soft); }
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.new-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--sub); border: 2px dashed var(--line); }
.new-tile .ico { width: 30px; height: 30px; }
.new-tile small { font-size: 11px; font-weight: 800; }

/* ---------- 下から出てくるシート ---------- */

.sheet-root { position: absolute; inset: 0; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 6, 20, .45); opacity: 0; }
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--kb, 0px);
  height: var(--sheet-h);
  max-height: calc(100% - var(--safe-top) - 24px - var(--kb, 0px));
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
  border-radius: 18px 18px 0 0;
  background: var(--paper);
  color: var(--ink2);
  transform: translate3d(0, 100%, 0);
  will-change: transform;
  touch-action: none;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .18);
}
.sheet .scroll { touch-action: pan-y; }
.sheet .hscroll { touch-action: pan-x; }
.sheet-grab { display: grid; place-items: center; height: 18px; flex: none; }
.sheet-grab span { width: 38px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 42px; padding: 0 8px 6px 16px; flex: none; }
.sheet-head b { font-size: 15px; font-weight: 800; }

/* ひとこと */
.comment-list { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 0 10px; }
.comment { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px 8px 16px; }
.comment.reply { padding-left: 62px; padding-top: 2px; }
.comment.fresh { animation: commentIn 560ms var(--spring-ease); }
@keyframes commentIn { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
.c-body { flex: 1; min-width: 0; }
.c-name { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--sub); }
.c-tag { padding: 1px 5px; border-radius: 4px; background: var(--pink-soft); color: var(--pink); font-size: 10px; font-weight: 800; }
.c-body p { margin: 2px 0 3px; font-size: 14px; line-height: 1.5; word-break: break-word; }
.c-time { font-size: 11px; color: var(--sub); }
.c-like { display: flex; flex-direction: column; align-items: center; min-width: 32px; padding-top: 6px; color: var(--sub); }
.c-like .ico { width: 18px; height: 18px; }
.c-like small { font-size: 11px; font-weight: 700; min-height: 14px; }
.c-like.on { color: var(--pink); }
.typing .dots { display: flex; gap: 4px; padding: 12px 12px; border-radius: 14px; background: var(--soft); }
.typing .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--sub); animation: typing 1s infinite; }
.typing .dots i:nth-child(2) { animation-delay: .15s; }
.typing .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 30% { transform: translateY(-4px); opacity: .5; } }
.comment-foot { flex: none; padding: 8px 12px 10px; border-top: 1px solid var(--line); }
.quick { display: flex; gap: 6px; margin-bottom: 8px; }
.comment-form { display: flex; align-items: center; gap: 8px; }
.comment-form .face { display: block; }
.comment-form input { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border: 0; outline: 0; border-radius: 20px; background: var(--soft); font-size: 16px; }
.send { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--pink); color: #fff; flex: none; transition: transform var(--spring-dur) var(--spring-ease), opacity 150ms; }
.send:disabled { opacity: .3; transform: scale(.85); }
.send .ico { width: 20px; height: 20px; }

/* シェア */
.share-row { display: flex; gap: 6px; padding: 6px 16px 10px; }
.share-btn { flex: 0 0 74px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.share-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--soft); transition: background 150ms, color 150ms; }
.share-ico .ico { width: 26px; height: 26px; }
.share-btn.on .share-ico { background: var(--pink-soft); color: var(--pink); }
.share-btn small { font-size: 11px; font-weight: 700; line-height: 1.35; text-align: center; white-space: nowrap; }
.share-btn em { display: block; font-style: normal; font-size: 10px; color: var(--sub); }
.share-btn.on em { color: var(--pink); }
.share-sub { padding: 6px 16px 2px; font-size: 12px; font-weight: 800; color: var(--sub); }
.sheet-cancel { margin: 8px 16px 10px; height: 46px; border-radius: 12px; background: var(--soft); font-size: 15px; font-weight: 800; flex: none; }

/* プロフィール編集 */
.edit-face { text-align: center; margin: 4px 0 14px; }
.field { display: block; margin: 0 16px; }
.field small { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 800; color: var(--sub); }
.field input { width: 100%; height: 44px; padding: 0 12px; border: 0; outline: 0; border-radius: 10px; background: var(--soft); font-size: 16px; }
.swatches { display: flex; justify-content: center; gap: 12px; margin: 18px 0; }
.swatch { width: 34px; height: 34px; border-radius: 50%; background: var(--c); transition: transform var(--spring-dur) var(--spring-ease), box-shadow 150ms; }
.swatch.on { transform: scale(1.12); box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--c); }

/* スケッチを見る */
.viewer-img { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 16px; }
.viewer-img img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); }
.viewer-btns { display: flex; justify-content: center; gap: 10px; padding: 14px 16px 12px; flex: none; }

/* スケッチ（＋） */
.create-sheet .sheet { max-height: 100%; border-radius: 0; padding-top: var(--safe-top); background: #FFF1E4; }
.create-sheet .sheet-grab { display: none; }
.create-sheet .sheet-head { padding: 6px 12px 8px 4px; }
.paper {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 0 12px;
  border-radius: 18px;
  overflow: hidden;
  background: #FFF9F0;
  box-shadow: 0 4px 0 #F0D9C2, 0 8px 20px rgba(160, 100, 60, .15);
}
.paper canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.paper-hint { position: absolute; left: 0; right: 0; top: 50%; text-align: center; font-size: 15px; font-weight: 800; color: #D7BFA8; pointer-events: none; }
.tools { flex: none; padding: 12px 12px 10px; }
.pens { display: flex; gap: 10px; padding: 4px 4px 6px; }
.pen {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .1);
  transition: transform var(--spring-dur) var(--spring-ease), box-shadow 150ms;
}
.pen.on { transform: scale(1.15); box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .1), 0 0 0 3px #FFF1E4, 0 0 0 5px #2B1E2E; }
.tool-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.size, .tool { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #fff; box-shadow: 0 2px 0 #F0D9C2; transition: background 150ms, color 150ms; }
.size i { display: block; width: var(--w); height: var(--w); border-radius: 50%; background: var(--ink2); }
.size.on { background: #2B1E2E; }
.size.on i { background: #fff; }
.tool { margin-left: auto; }
.tool ~ .tool { margin-left: 0; }
.tool.on { background: #2B1E2E; color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .marquee span, .disc-face, .disc-notes i, .empty-faces .face { animation: none !important; }
}

/* ---------- 自分の絵の部屋（エディターで作った部屋） ---------- */

.room-art .wall { background: var(--wall, #EFE4D2); }
.art-sky { position: absolute; left: -400px; right: -400px; top: 0; bottom: 0; }
.art-sky .outside { position: absolute; inset: 0; }
.art-sky .skyline { display: none; }
.art-static { position: absolute; pointer-events: none; }
.art-static img, .art-prop img { display: block; width: 100%; height: 100%; -webkit-user-drag: none; user-select: none; }
.art-liquid { overflow: hidden; }
.art-liquid .surface { position: absolute; inset: -8%; background: none; }
.art-liquid .surface img { width: 100%; height: 100%; }

/* ---------- 連番 PNG のなかま ---------- */

.buddy-spot.sprite-spot { width: 0; height: 0; transform: none; }
.buddy.sprite { position: absolute; }
.buddy.sprite .buddy-wrap { transform-origin: var(--ax) var(--ay); }
.sprite-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.buddy.sprite .buddy-shadow { left: var(--ax); top: calc(var(--ay) - 8px); bottom: auto; width: 60%; max-width: 112px; }
