/* ヤコウの世界（chillnight-app）。色・文字・ボタンの土台は LP の styles.css と同じ値。ここから先はアプリ専用に作り込む */

/* スマホ依存度診断 共通スタイル */

:root {
  font-synthesis-weight: none;
  --ink: #14161f;
  --ink-2: #1e2130;
  --ink-3: #292d40;
  --paper: #f4efe6;
  --paper-2: #d9d4ca;
  --muted: #a8a69e;
  --amber: #e8a640;
  --amber-2: #f2c67a;
  --line: rgba(244, 239, 230, .14);
  --line-strong: rgba(244, 239, 230, .38);
  --ok: #8fbfa3;
  --error: #eb9580;

  --ink-0: rgba(20, 22, 31, 0);
  --ink-veil: rgba(20, 22, 31, .72);
  --amber-soft: rgba(232, 166, 64, .1);
  --amber-edge: rgba(232, 166, 64, .6);
  --glow-1: rgba(242, 198, 122, .42);
  --glow-2: rgba(232, 166, 64, .2);
  --glow-3: rgba(232, 166, 64, .07);
  --amber-0: rgba(232, 166, 64, 0);
  --amber-2-0: rgba(242, 198, 122, 0);
  --amber-glow: rgba(232, 166, 64, .5);

  /* 5段階の「そう思わない」側 */
  --indigo: #8fa3d9;
  --indigo-glow: rgba(143, 163, 217, .45);

  /* 住人の灯り（画像が無いときの代わり）。夜型は藍の頭に琥珀、朝型はクリームから桃、下に空色 */
  --night-head: #3a3f78;
  --night-core: #f2b24c;
  --night-core-2: #ffd98f;
  --night-core-0: rgba(242, 178, 76, 0);
  --night-glow: rgba(242, 178, 76, .28);
  --dawn-head: #fff1d6;
  --dawn-peach: #f4a58a;
  --dawn-sky: #b9d6ec;
  --dawn-glow: rgba(244, 165, 138, .26);
  --lilac: #b89cf0;
  --lilac-0: rgba(184, 156, 240, 0);
  /* 広場の朝と昼 */
  --mist: rgba(255, 250, 244, .55);
  --mist-0: rgba(255, 250, 244, 0);
  --sun: rgba(255, 228, 186, .5);
  --sun-0: rgba(255, 228, 186, 0);
  --shade: rgba(20, 22, 31, .18);
  --shade-0: rgba(20, 22, 31, 0);
  --sky-veil: rgba(255, 250, 244, .78);
  --sky-veil-0: rgba(255, 250, 244, 0);
  --ink-soft: #4a4640;
  --ground: rgba(70, 48, 24, .32);
  --ground-0: rgba(70, 48, 24, 0);
  --outline: rgba(70, 48, 24, .45);
  /* 部屋とおみやげ開封 */
  --line-art: #f8e2b4;
  --box: #2b3150;
  --box-lid: #363e66;
  --box-ribbon: #e8a640;
  --paper-glow: rgba(255, 246, 226, .5);
  --paper-glow-0: rgba(255, 246, 226, 0);

  --font-serif: "Shippori Antique B1", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --font-sans: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;

  --gutter: 24px;
  --maxw: 640px;
  --radius: 12px;
  --radius-lg: 18px;
  --dur: 150ms;
  --sticky-space: 104px;

  --resident-xs: 40px;
  --resident-sm: 72px;
  --resident-pv: 96px;
  --resident-md: 150px;
  --resident-lg: 240px;
  --scale-lg: 46px;
  --scale-md: 36px;
  --scale-sm: 28px;
  --scale-hit: 56px;
}

@media (max-width: 359px) {
  :root { --gutter: 20px; }
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 720px) {
  body { font-size: 16px; }
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: .04em;
  font-feature-settings: "palt";
  word-break: auto-phrase;
  text-wrap: balance;
}

p, dd, li { text-wrap: pretty; }

.nowrap { white-space: nowrap; }

p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: inherit; }

button {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

:focus-visible {
  outline: 2px solid var(--amber-2);
  outline-offset: 3px;
}

[tabindex="-1"]:focus { outline: none; }

.icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 句のまとまりで改行させる */
.phrase { display: inline-block; }

.wrap {
  width: 100%;
  max-width: calc(var(--maxw) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.logotype {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: .28em;
  color: var(--paper);
  text-decoration: none;
}

.note {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

/* ボタン */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: .02em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur) ease-out, border-color var(--dur) ease-out, color var(--dur) ease-out;
}

.btn-primary {
  background: var(--amber);
  color: var(--ink);
}

@media (hover: hover) {
  .btn-primary:hover { background: var(--amber-2); }
}
.btn-primary:active { background: var(--amber-2); }

.btn-sub {
  font-size: .82em;
  font-weight: 500;
  white-space: nowrap;
}

/* ヒーローの CTA は文言が長いので、狭い画面でも1行に収める */
.btn-hero { font-size: min(16px, 4vw); }

@media (max-width: 379px) {
  .btn-hero .icon { display: none; }
}

@media (min-width: 720px) {
  .btn {
    display: inline-flex;
    width: auto;
    min-width: 340px;
    padding: 14px 32px;
  }
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--paper);
  font-weight: 500;
}

@media (hover: hover) {
  .btn-ghost:hover { border-color: var(--amber-edge); }
}

.footer {
  padding: 48px 0 calc(48px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 2.1;
  color: var(--muted);
}

.footer a {
  color: var(--muted);
  text-underline-offset: 3px;
}

@media (hover: hover) {
  .footer a:hover { color: var(--paper); }
}

@media (min-width: 720px) {
  .footer { padding-bottom: 64px; }
}

/* ---------- わたしのヤコウとヤコウの広場（me.html・plaza.html） ---------- */

.yk-main { padding-top: 16px; padding-bottom: 96px; }

.yk-title {
  margin-top: 24px;
  font-size: 26px;
  line-height: 1.5;
}

.yk-lead {
  margin-top: 12px;
  color: var(--paper-2);
  line-height: 1.9;
  word-break: auto-phrase;
}

.yk-fig svg { display: block; width: 100%; height: auto; }
.yk-fig-lg { width: min(260px, 70vw); margin: 0 auto; }
.yk-fig-md { width: 180px; margin: 0 auto; }
.yk-fig-sm { width: 100%; }

.yk-stage {
  margin-top: 8px;
  text-align: center;
}

.yk-stage.is-asleep { margin-top: 40px; }

.yk-name {
  margin-top: 4px;
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.5;
}

.yk-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.yk-oyasumi {
  display: block;
  color: var(--paper);
  text-decoration: none;
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px solid var(--amber-edge);
  border-radius: var(--radius);
  background: var(--amber-soft);
  line-height: 1.8;
  word-break: auto-phrase;
}

.yk-section { margin-top: 48px; }

.yk-h2 {
  font-size: 18px;
  color: var(--amber-2);
}

.yk-tabs {
  display: flex;
  gap: 8px;
  margin: 16px calc(var(--gutter) * -1) 0;
  padding: 0 var(--gutter) 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.yk-tabs::-webkit-scrollbar { display: none; }

.yk-tab {
  flex: none;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--paper);
  font: 500 14px/1 var(--font-sans);
  cursor: pointer;
}

.yk-tab[aria-selected="true"] {
  border-color: var(--amber);
  background: var(--amber);
  color: var(--ink);
  font-weight: 700;
}

.yk-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.yk-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 6px 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-2);
  color: var(--paper);
  font: 500 12px/1.4 var(--font-sans);
  cursor: pointer;
  transition: border-color var(--dur) ease-out;
}

.yk-tile[aria-pressed="true"] {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber) inset;
}

.yk-tile-name { word-break: auto-phrase; text-align: center; }

.yk-empty {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.yk-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.yk-badges-center { justify-content: center; }

/* しるしは押せないので、縁取りのない札にする（縁取りの丸は押せる物だけ） */
.yk-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--ink-3);
  font-size: 13px;
}

.yk-badge-glow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--paper-2);
  font-size: 12px;
}

.yk-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}

.yk-next {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.yk-name-form {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.yk-input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--ink-2);
  color: var(--paper);
  font: 500 16px/1.4 var(--font-sans);
}

.yk-input:focus { outline: 2px solid var(--amber); outline-offset: 1px; }

.yk-name-form .btn { width: auto; min-height: 48px; flex: none; }

.yk-link { margin-top: 48px; }

.yk-plaza {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 10px;
  margin: 28px 0 0;
  padding: 24px 12px;
  list-style: none;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--ink-2), var(--ink-3));
}

.yk-member { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; }

.yk-member-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0 0 6px;
  border: 0;
  background: transparent;
  color: var(--paper);
  font: 500 12px/1.4 var(--font-sans);
  cursor: pointer;
}

/* 置かなかった人は、灯りを落とすだけ（消えかけに見せない） */
.yk-member.is-dark .yk-fig { opacity: .6; filter: saturate(.75); }

.yk-member-name { margin-top: -2px; word-break: auto-phrase; }

.yk-you {
  margin-top: 2px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--amber);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.yk-join { margin-top: 40px; }
.yk-join .yk-link { margin-top: 16px; }

.yk-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--ink-veil);
}

/* シートは画面の高さに収める。収まらないときは中だけスクロールする */
.yk-sheet-body {
  width: 100%;
  max-width: calc(var(--maxw) + var(--gutter) * 2);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--ink-2);
  text-align: center;
}

.yk-sheet-body .yk-fig-md { width: min(150px, 20dvh); }
.yk-sheet-body .yk-badges { margin-top: 12px; }

/* パソコンの幅では、画面の中央に出す */
@media (min-width: 568px) {
  .yk-sheet { align-items: center; padding: 16px; }
  .yk-sheet-body { max-width: 420px; max-height: calc(100dvh - 32px); border-radius: var(--radius-lg); }
}

.yk-send { margin-top: 16px; }

.yk-close {
  min-height: 44px;
  margin-top: 8px;
  padding: 8px 16px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 500 14px/1 var(--font-sans);
  cursor: pointer;
}

.yk-moon {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 22px;
  height: 22px;
  color: var(--amber-2);
}

.yk-moon svg { width: 100%; height: 100%; }
.yk-moon.is-sent { color: var(--amber); }

/* LINE の「着せてみる」から来たとき、届いた部品に一度だけ光の輪 */
.yk-tile.is-new { animation: yk-new 1.6s ease-out 2; }

@keyframes yk-new {
  0% { box-shadow: 0 0 0 0 var(--amber-glow); }
  100% { box-shadow: 0 0 0 10px var(--amber-0); }
}

@media (prefers-reduced-motion: reduce) {
  .yk-tile.is-new { animation: none; border-color: var(--amber-edge); }
}

/* 広場の場面（plaza.html）。背景の絵の上を、みんなのヤコウが歩き回る */
/* 見出しは、絵の上部の夜空に重ねる */
.yk-scene-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100000;
  padding: 18px 68px 28px var(--gutter);
  background: linear-gradient(180deg, var(--ink-veil), var(--ink-0));
  pointer-events: none;
}

/* 朝と昼は空が明るいので、見出しは明るい帯に濃い字 */
.yk-scene.is-morning .yk-scene-head,
.yk-scene.is-day .yk-scene-head { background: linear-gradient(180deg, var(--sky-veil), var(--sky-veil-0)); color: var(--ink); }
.yk-scene.is-morning .yk-scene-head .yk-lead,
.yk-scene.is-day .yk-scene-head .yk-lead { color: var(--ink); }
.yk-scene.is-morning .yk-scene-head,
.yk-scene.is-day .yk-scene-head { background: linear-gradient(180deg, var(--sky-veil), var(--sky-veil) 60%, var(--sky-veil-0)); }

.yk-scene-head .yk-title { margin-top: 0; }
.yk-scene-head .yk-lead { margin-top: 4px; }

/* 絵は 2:3。画面の高さに収まる大きさにし、スマホでは左右いっぱいに広げる */
.yk-scene {
  --sw: min(100vw, 560px, calc((100svh - 24px) * 2 / 3));
  position: relative;
  width: var(--sw);
  margin: 0 calc((100% - var(--sw)) / 2);
  aspect-ratio: 2 / 3;
  overflow: hidden;
  isolation: isolate; /* 中の重なり順を場面の中に閉じる（シートより上に出ないように） */
  background: var(--ink);
  -webkit-user-select: none;
  user-select: none;
}

@media (min-width: 568px) {
  .yk-scene { border-radius: var(--radius-lg); }
}

body[data-page="plaza"] .yk-main { padding-top: 12px; }

.yk-scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yk-scene.is-asleep .yk-scene-bg { filter: brightness(.6); }

/* 時間帯が変わるときは、新しい絵を上に重ねてゆっくり出す */
.yk-scene-bg { transition: opacity 3s ease; }
.yk-scene-bg.is-entering { opacity: 0; }

/* 時間帯ごとの空気。絵とヤコウのあいだに重ねる */
.yk-ambient {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.yk-star {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--amber-2);
  box-shadow: 0 0 6px var(--amber-glow);
  animation: yk-twinkle 3.2s ease-in-out infinite;
}

@keyframes yk-twinkle {
  0%, 100% { opacity: .1; }
  50% { opacity: .9; }
}

.yk-lamp {
  position: absolute;
  width: 26%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow-1), var(--amber-0));
  mix-blend-mode: screen;
  transform: translate(-50%, -50%);
  animation: yk-flicker 5s ease-in-out infinite;
}

@keyframes yk-flicker {
  0%, 100% { opacity: .7; }
  38% { opacity: 1; }
  42% { opacity: .78; }
  58% { opacity: .95; }
}

.yk-scene.is-asleep .yk-lamp { opacity: .45; animation: none; }

.yk-mist {
  position: absolute;
  left: -40%;
  width: 180%;
  height: 16%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--mist), var(--mist-0));
  animation: yk-drift 26s ease-in-out infinite alternate;
}

@keyframes yk-drift {
  from { transform: translateX(-10%); opacity: .55; }
  to { transform: translateX(10%); opacity: 1; }
}

/* 朝日（絵の 68%・18.5% あたり）から差す光の筋。要素の中心を朝日に合わせる */
.yk-rays {
  position: absolute;
  left: -12%;
  top: -34.8%;
  width: 160%;
  aspect-ratio: 1;
  background: repeating-conic-gradient(var(--sun) 0deg 4deg, var(--sun-0) 4deg 13deg);
  border-radius: 50%;
  -webkit-mask-image: radial-gradient(closest-side, #000, transparent);
  mask-image: radial-gradient(closest-side, #000, transparent);
  mix-blend-mode: soft-light;
  animation: yk-rays 14s ease-in-out infinite alternate;
}

@keyframes yk-rays {
  from { opacity: .5; transform: rotate(-2deg); }
  to { opacity: 1; transform: rotate(2deg); }
}

/* 昼は、雲の影がゆっくり横切る */
.yk-cloud {
  position: absolute;
  left: 0;
  width: 110%;
  height: 34%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--shade), var(--shade-0));
  animation: yk-cloud 68s linear infinite;
}

@keyframes yk-cloud {
  from { transform: translateX(-120%); }
  to { transform: translateX(120%); }
}

@media (prefers-reduced-motion: reduce) {
  .yk-star, .yk-lamp, .yk-mist, .yk-rays, .yk-cloud { animation: none; }
  .yk-cloud { display: none; }
}

.yk-walker {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--paper);
  transform-origin: 50% 86%;
  will-change: transform;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* 押したときの四角い枠は出さない。キーボードで選んだときだけ、足もとに丸い印 */
.yk-walker:focus { outline: none; }
.yk-walker:focus-visible::after {
  content: "";
  position: absolute;
  left: 15%;
  right: 15%;
  top: 20%;
  bottom: 6%;
  border: 2px solid var(--amber-2);
  border-radius: 50%;
  pointer-events: none;
}

.yk-walker-img {
  display: block;
  width: 100%;
  height: auto;
  opacity: .78;
  pointer-events: none;
}

/* 朝と昼は、明るい地面に影を落として立たせる。線が薄くならないよう、輪郭にうすい影 */
.yk-scene.is-morning .yk-walker-img,
.yk-scene.is-day .yk-walker-img { opacity: 1; filter: drop-shadow(0 0 1.5px var(--outline)); }
.yk-scene.is-morning .yk-walker::after,
.yk-scene.is-day .yk-walker::after {
  content: "";
  position: absolute;
  left: 24%;
  right: 24%;
  bottom: 9%;
  height: 8%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--ground), var(--ground-0));
  pointer-events: none;
}

/* ゆうべ置いた人は灯りが明るく、足もとが照らされる */
.yk-walker.is-lit .yk-walker-img { opacity: 1; filter: drop-shadow(0 0 8px var(--glow-2)); }
.yk-walker.is-lit::before {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 8%;
  height: 12%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow-1), var(--amber-0));
  pointer-events: none;
}

.yk-walker-ring {
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 9%;
  height: 10%;
  border: 1.5px solid var(--amber-2);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--amber-glow);
  pointer-events: none;
}

/* 名前札は場面の左上を原点に、足もとの位置へ毎フレーム動かす（ヤコウ全員より上、見出しより下） */
.yk-walker-name {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 99999;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--ink-veil);
  color: var(--paper);
  font: 500 12px/1.5 var(--font-sans);
  white-space: nowrap;
  pointer-events: none;
  will-change: transform;
}

.yk-walker-name.is-me { background: var(--amber); color: var(--ink); font-weight: 700; }

.yk-walker-moon {
  position: absolute;
  top: 2%;
  right: 10%;
  width: 18%;
  height: auto;
  color: var(--amber);
  pointer-events: none;
}

/* 眠っている時間は、寄り集まって寝息に合わせて灯りがゆっくり明滅する */
.yk-scene.is-asleep .yk-walker { cursor: default; }
.yk-scene.is-asleep .yk-walker-img { opacity: .85; animation: yk-breathe 4.5s ease-in-out infinite; }

@keyframes yk-breathe {
  0%, 100% { opacity: .7; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .yk-scene.is-asleep .yk-walker-img { animation: none; }
}

/* ---------- シートの出入り ---------- */
.yk-sheet { animation: yk-fade-in .2s ease-out; }
.yk-sheet .yk-sheet-body { animation: yk-sheet-up .32s cubic-bezier(.2, .9, .3, 1.1); }
.yk-sheet.is-leaving { animation: yk-fade-out .22s ease-in forwards; }
.yk-sheet.is-leaving .yk-sheet-body { animation: yk-sheet-down .22s ease-in forwards; }

@keyframes yk-fade-in { from { opacity: 0; } }
@keyframes yk-fade-out { to { opacity: 0; } }
@keyframes yk-sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes yk-sheet-down { to { transform: translateY(40px); opacity: 0; } }

/* ---------- メニュー（右上のボタン） ---------- */
.yk-icon { display: inline-flex; width: 22px; height: 22px; }
.yk-icon svg { width: 100%; height: 100%; }

.yk-menu-button {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  right: 12px;
  z-index: 1200;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--ink-veil);
  color: var(--paper);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: transform var(--dur) ease;
}
.yk-menu-button:active { transform: scale(.94); }
.yk-menu-button:focus-visible { outline: 2px solid var(--amber-2); outline-offset: 2px; }

.yk-menu {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: var(--ink-0);
  transition: background .24s ease;
}
.yk-menu.is-open { background: var(--ink-veil); }

.yk-menu-panel {
  position: absolute;
  top: calc(62px + env(safe-area-inset-top));
  right: 12px;
  width: min(260px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--ink-2);
  box-shadow: 0 18px 40px var(--ink-veil);
  opacity: 0;
  transform: translateY(-8px) scale(.97);
  transform-origin: top right;
  transition: opacity .2s ease, transform .24s cubic-bezier(.2, .9, .3, 1.1);
}
.yk-menu.is-open .yk-menu-panel { opacity: 1; transform: none; }

.yk-menu-panel ul { margin: 0; padding: 0; list-style: none; }

.yk-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border-radius: var(--radius);
  color: var(--paper);
  font-weight: 500;
  text-decoration: none;
}
.yk-menu-link .yk-icon { color: var(--muted); }
.yk-menu-link:hover { background: var(--ink-3); }
.yk-menu-link[aria-current="page"] { background: var(--amber-soft); color: var(--amber-2); }
.yk-menu-link[aria-current="page"] .yk-icon { color: var(--amber-2); }

@media (prefers-reduced-motion: reduce) {
  .yk-sheet, .yk-sheet .yk-sheet-body, .yk-sheet.is-leaving, .yk-sheet.is-leaving .yk-sheet-body { animation: none; }
  .yk-menu, .yk-menu-panel { transition: none; }
}

/* ---------- 部屋（わたしのヤコウ） ---------- */
body[data-page="me"] .yk-main { padding-top: 12px; }

.yk-room .yk-scene-head .yk-title { font-size: 24px; }

.yk-room.is-asleep .yk-scene-bg { filter: brightness(.55) saturate(.8); }

/* 触れる場所。ふだんは見えず、小さな丸い印だけがゆっくり浮かぶ */
.yk-spot {
  position: absolute;
  z-index: 20;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur) ease, box-shadow var(--dur) ease;
}
.yk-spot:hover, .yk-spot:focus-visible { background: var(--paper-glow); box-shadow: 0 0 0 2px var(--amber-2); outline: none; }
.yk-spot:active { background: var(--paper-glow); }

.yk-spot-tag {
  position: absolute;
  top: -14px;
  left: 50%;
  margin-left: -15px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink-veil);
  color: var(--amber-2);
  box-shadow: 0 0 0 1px var(--line-strong), 0 0 12px var(--amber-glow);
}
.yk-spot-tag .yk-icon { width: 16px; height: 16px; }
.yk-spot-shelf .yk-spot-tag { top: auto; bottom: -22px; }
.yk-spot-door .yk-spot-tag { top: 18%; }
.yk-spot-closet .yk-spot-tag { top: 10%; }

@keyframes yk-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* 部屋のヤコウ。立つ位置の足もとを基準に置く */
.yk-room-yakou {
  position: absolute;
  z-index: 30;
  width: 34%;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translate(-50%, -86%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.yk-room-yakou:focus { outline: none; }
.yk-room-yakou.is-sleeping { width: 22%; cursor: default; transform: translate(-50%, -62%); }
.yk-room-yakou::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 9%;
  height: 8%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--ground), var(--ground-0));
}
.yk-room-yakou.is-sleeping::after { display: none; }
.yk-room-bob { display: block; transform-origin: 50% 86%; animation: yk-idle 4.2s ease-in-out infinite; }
.yk-room-bob .yk-fig svg { display: block; width: 100%; height: auto; }
.yk-room-yakou.is-sleeping .yk-room-bob { animation: yk-breathe 4.5s ease-in-out infinite; }
.yk-scene.is-night .yk-room-yakou::after { background: radial-gradient(closest-side, var(--glow-2), var(--amber-0)); }

/* 息をして、ときどき見回す */
@keyframes yk-idle {
  0%, 100% { transform: translateY(0) scale(1, 1) rotate(0); }
  25% { transform: translateY(-1.5%) scale(.99, 1.015) rotate(0); }
  50% { transform: translateY(0) scale(1.01, .99) rotate(-2deg); }
  75% { transform: translateY(-1.5%) scale(.99, 1.015) rotate(2deg); }
}

/* 灯りの色を変えたときの、部屋いっぱいの光 */
.yk-room-wash {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: radial-gradient(circle at 50% 62%, var(--c), transparent 70%);
  mix-blend-mode: screen;
  pointer-events: none;
}

/* 棚のしるし。まだ見せていないものは、お披露目まで影のまま */
.yk-shelf-lantern {
  position: absolute;
  z-index: 15;
  width: 5.5%;
  height: auto;
  transform: translate(-50%, -100%);
  filter: drop-shadow(0 0 6px var(--c));
  pointer-events: none;
}
.yk-shelf-lantern.is-unseen { opacity: 0; }

/* 窓辺の手紙（届いたおやすみ） */
.yk-letters {
  position: absolute;
  z-index: 22;
  width: 12%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translate(-50%, -88%);
  color: var(--line-art);
  cursor: pointer;
}
.yk-letter {
  position: absolute;
  inset: 12%;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--amber);
  color: var(--ink);
  box-shadow: 0 0 14px var(--amber-glow);
  animation: yk-float 2.8s ease-in-out infinite;
}
.yk-letter svg { width: 70%; height: 70%; }
.yk-letter.is-second { transform: rotate(-12deg) translate(-18%, 8%); animation-delay: -1.2s; z-index: -1; opacity: .85; }
.yk-letters-big { width: 72px; margin: 8px auto 0; color: var(--amber-2); }

/* 床に置いた包み。ときどき揺れて、押してもらうのを待つ */
.yk-package {
  position: absolute;
  z-index: 32;
  width: 12%;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translate(-50%, -80%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.yk-package svg { display: block; width: 100%; height: auto; overflow: visible; animation: yk-nudge 3s ease-in-out infinite; animation-delay: var(--d); transform-origin: 50% 90%; filter: drop-shadow(0 0 8px var(--amber-glow)); }

@keyframes yk-nudge {
  0%, 70%, 100% { transform: rotate(0); }
  76% { transform: rotate(-7deg); }
  84% { transform: rotate(6deg); }
  92% { transform: rotate(-3deg); }
}

/* 包みの絵（自前の SVG） */
.yk-box-body rect, .yk-box-lid rect { stroke: var(--line-art); stroke-width: 2.4; stroke-linejoin: round; }
.yk-box-body rect { fill: var(--box); }
.yk-box-lid rect { fill: var(--box-lid); }
.yk-box-body .yk-box-ribbon, .yk-box-lid .yk-box-ribbon { fill: var(--box-ribbon); stroke: none; }
.yk-box-bow path, .yk-box-bow circle { fill: var(--box-ribbon); stroke: var(--line-art); stroke-width: 2; stroke-linejoin: round; }
.yk-box-lid, .yk-box-bow, .yk-box-body { transform-box: fill-box; transform-origin: 50% 100%; }

/* 朝と昼の光の筋と、光に舞うほこり */
.yk-room-beam {
  position: absolute;
  width: 34%;
  height: 30%;
  background: linear-gradient(170deg, var(--paper-glow), var(--paper-glow-0) 80%);
  transform: skewX(14deg);
  mix-blend-mode: soft-light;
  animation: yk-beam 9s ease-in-out infinite alternate;
}
@keyframes yk-beam { from { opacity: .6; } to { opacity: 1; } }

.yk-mote {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 0 4px var(--paper-glow);
  opacity: 0;
  animation: yk-mote 9s ease-in-out infinite;
}
@keyframes yk-mote {
  0% { opacity: 0; transform: translate(0, 0); }
  30% { opacity: .8; }
  70% { opacity: .6; }
  100% { opacity: 0; transform: translate(14px, -46px); }
}

.yk-room-lamp { width: 34%; }
.yk-room-lamp.is-off { opacity: .25; animation: none; }

/* 部屋の下のボタン */
.yk-room-actions { margin-top: 16px; }
.yk-room-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.yk-room-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-2);
  color: var(--paper);
  font: 500 13px/1.4 var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--dur) ease, transform var(--dur) ease;
}
.yk-room-button .yk-icon { color: var(--amber-2); }
.yk-room-button:hover { border-color: var(--amber-edge); }
.yk-room-button:active { transform: scale(.97); }

/* 着せ替えのシート。上にヤコウ、下に引き出し */
.yk-wardrobe-preview { position: relative; display: flex; justify-content: center; perspective: 600px; }
.yk-wardrobe-preview .yk-fig { width: min(150px, 22dvh); }
.yk-sheet-wardrobe .yk-sheet-body { text-align: left; }
.yk-sheet-wardrobe .yk-h2 { text-align: center; }

/* 粒 */
.yk-burst { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }

/* ---------- おみやげ開封・新しいしるし ---------- */
.yk-unbox {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, var(--ink-2), var(--ink) 75%);
  color: var(--paper);
}

.yk-unbox-rays {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 160vmax;
  height: 160vmax;
  margin: -80vmax 0 0 -80vmax;
  background: repeating-conic-gradient(var(--c) 0deg 5deg, transparent 5deg 18deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 0%, transparent 28%);
  mask-image: radial-gradient(closest-side, #000 0%, transparent 28%);
  opacity: 0;
  transform: scale(.2) rotate(0);
  transition: opacity .6s ease, transform 1.2s cubic-bezier(.2, .9, .3, 1);
  pointer-events: none;
}
.yk-unbox.is-open .yk-unbox-rays { opacity: .22; transform: scale(1) rotate(20deg); animation: yk-spin 40s linear infinite; }
@keyframes yk-spin { to { transform: scale(1) rotate(380deg); } }

.yk-unbox-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(360px, calc(100vw - 48px));
  text-align: center;
}

.yk-unbox-who { width: 76px; margin-bottom: 4px; }
.yk-unbox.is-open .yk-unbox-who { animation: yk-float 3s ease-in-out infinite; }
.yk-unbox-line { margin: 0 0 20px; color: var(--paper-2); font-size: 15px; line-height: 1.8; }

.yk-unbox-box {
  width: min(180px, 46vw);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 0 24px var(--amber-glow));
  -webkit-tap-highlight-color: transparent;
}
.yk-unbox-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.yk-unbox-box:focus { outline: none; }
.yk-unbox-box:disabled { cursor: default; }
.yk-unbox.is-open .yk-unbox-box { position: absolute; top: 56px; pointer-events: none; }

.yk-unbox-item {
  display: none;
  width: min(200px, 52vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--c), transparent);
}
.yk-unbox-item.is-shown { display: block; }
.yk-unbox-item svg { width: 100%; height: 100%; }
.yk-unbox-item.is-floating, .yk-unbox-lantern.is-floating { animation: yk-float 3s ease-in-out infinite; }

.yk-unbox-label, .yk-unbox-name, .yk-unbox-actions { visibility: hidden; }
.yk-unbox-label.is-shown, .yk-unbox-name.is-shown, .yk-unbox-actions.is-shown { visibility: visible; }
.yk-unbox.is-badge .yk-unbox-label, .yk-unbox.is-badge .yk-unbox-name { visibility: visible; }

.yk-unbox-label { margin: 14px 0 0; color: var(--paper-2); font-size: 13px; letter-spacing: .08em; }
.yk-unbox-name { margin: 4px 0 0; font: 400 28px/1.5 var(--font-serif); letter-spacing: .06em; }

.yk-unbox-actions { display: grid; gap: 10px; width: 100%; margin-top: 24px; }

.yk-unbox-lantern {
  width: min(170px, 44vw);
  height: auto;
  filter: drop-shadow(0 0 28px var(--c));
}

@media (prefers-reduced-motion: reduce) {
  .yk-spot-tag, .yk-room-bob, .yk-letter, .yk-package svg, .yk-mote, .yk-room-beam, .yk-unbox-item.is-floating, .yk-unbox-lantern.is-floating { animation: none; }
  .yk-unbox-rays { transition: none; }
  .yk-unbox.is-open .yk-unbox-rays { animation: none; }
  .yk-mote { display: none; }
}

/* ---------- しるし ---------- */
body[data-page="badges"] .yk-main { padding-top: 20px; }

.yk-path { position: relative; height: 54px; margin: 28px 12px 8px; }
.yk-path-track { position: absolute; left: 0; right: 0; top: 14px; height: 4px; border-radius: 2px; background: var(--ink-3); overflow: hidden; }
.yk-path-fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--amber-2));
  box-shadow: 0 0 10px var(--amber-glow);
  transition: width 1.4s cubic-bezier(.2, .8, .3, 1) .2s;
}
.yk-path-stop {
  position: absolute;
  top: 8px;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border: 2px solid var(--ink-3);
  border-radius: 50%;
  background: var(--ink);
}
.yk-path-stop.is-on { border-color: var(--c); background: var(--c); box-shadow: 0 0 10px var(--c); }
.yk-path-day { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 12px; white-space: nowrap; }
.yk-path-stop.is-on .yk-path-day { color: var(--paper); }

.yk-badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 20px 0 0; padding: 0; list-style: none; }
.yk-badge-grid li { display: flex; }

.yk-badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 16px 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--ink-2);
  color: var(--paper);
  font: inherit;
  text-align: center;
  animation: yk-card-in .6s cubic-bezier(.2, .8, .3, 1) both;
  animation-delay: calc(var(--i) * 70ms);
}
button.yk-badge-card { cursor: pointer; transition: border-color var(--dur) ease, transform var(--dur) ease; }
button.yk-badge-card:hover { border-color: var(--amber-edge); }
button.yk-badge-card:active { transform: scale(.97); }

@keyframes yk-card-in { from { opacity: 0; transform: translateY(12px); } }

.yk-badge-art { position: relative; display: grid; place-items: center; width: 96px; height: 96px; }
.yk-badge-card.is-earned .yk-badge-art::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--c), transparent);
  opacity: .45;
  animation: yk-breathe 4s ease-in-out infinite;
}
.yk-lantern { position: relative; width: 84px; height: auto; }
.yk-badge-card.is-earned .yk-lantern { filter: drop-shadow(0 0 10px var(--c)); animation: yk-float 3.4s ease-in-out infinite; animation-delay: calc(var(--i) * -.5s); }
.yk-badge-card.is-locked .yk-lantern { filter: grayscale(1) brightness(.35); opacity: .7; }

.yk-badge-title { margin-top: 10px; font-weight: 700; font-size: 15px; }
.yk-badge-when { margin-top: 2px; color: var(--muted); font-size: 12px; }
.yk-badge-card.is-earned .yk-badge-when { color: var(--paper-2); }

.yk-lantern-stage { position: relative; display: grid; place-items: center; width: 180px; height: 180px; margin: 4px auto 0; }
.yk-lantern-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--c), transparent);
  opacity: .5;
  animation: yk-breathe 4s ease-in-out infinite;
}
.yk-lantern.is-big { width: 150px; filter: drop-shadow(0 0 18px var(--c)); animation: yk-float 3.4s ease-in-out infinite; }
.yk-use-glow { margin-top: 16px; width: 100%; }

@media (prefers-reduced-motion: reduce) {
  .yk-path-fill { transition: none; }
  .yk-badge-card, .yk-badge-card.is-earned .yk-lantern, .yk-badge-card.is-earned .yk-badge-art::before, .yk-lantern-stage::before, .yk-lantern.is-big { animation: none; }
}
.yk-sheet-wardrobe .yk-close { display: block; margin-left: auto; margin-right: auto; }
button.yk-oyasumi { width: 100%; margin-top: 0; font: inherit; text-align: left; cursor: pointer; }

/* 名前札の月の印。まだ送っていない相手は輪郭だけ */
.yk-walker-name .yk-moon { position: static; display: inline-block; width: 12px; height: 12px; margin-left: 4px; vertical-align: -1px; }
