/* ピンクの重箱にドット絵。角は丸く、影はやわらかく、差し色は紅一色。 */
:root {
  --ground: #fff5f3;
  --ink: #4a3440;
  --sub: #7a5a66;
  --accent: #c93a55;
  --box: #f29aa8;
  --soft: #fde4e7;
  --line: #f6d5da;
  --card: #ffffff;
  --pick: #fff3c4;
  --ring: #f2b705;
  --dot: 'DotGothic16', 'Zen Maru Gothic', sans-serif;
  --body: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Yu Gothic', sans-serif;
  --shadow: 0 1px 3px rgba(201, 58, 85, 0.06), 0 4px 12px rgba(201, 58, 85, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 500;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
button, input, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.6; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
svg { display: block; }
.sprite { display: block; }
.sprite img, .hero img, .head img, .loading img, .relay img, .shime { display: block; max-width: 100%; height: auto; user-select: none; }

#app {
  position: relative;
  isolation: isolate;
  max-width: 430px;
  margin: 0 auto;
  /* 上下の余白は、背景の絵（横幅の3分の1の高さ）にかからない分だけ空ける */
  padding: calc(var(--bgw) * 0.30) 24px calc(var(--bgw) * 0.31);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100dvh;
}

/* お正月の背景。body の data-bg で3種を切りかえる。絵は上下1枚ずつ（どれも横3:縦1）。 */
body { --bgw: min(100vw, 430px); --bg-top: url(img/bg-sunrise-top.png); --bg-bottom: url(img/bg-sunrise-bottom.png); --ground: #fff7ed; transition: background-color 0.25s; }
body[data-bg="plum"] {
  --bg-top: url(img/bg-plum-top.png); --bg-bottom: url(img/bg-plum-bottom.png); --ground: #fff8ef;
  /* ごく薄い線を重ねた、和紙風の地模様 */
  background-image:
    repeating-linear-gradient(24deg, transparent 0 6px, rgba(155, 119, 79, 0.03) 6px 7px, transparent 7px 14px),
    repeating-linear-gradient(143deg, transparent 0 10px, rgba(155, 119, 79, 0.03) 10px 11px, transparent 11px 22px);
}
body[data-bg="snow"] { --bg-top: url(img/bg-snow-top.png); --bg-bottom: url(img/bg-snow-bottom.png); --ground: #f3f2f8; }
/* キンピカ。金屏風ときらめきを画面いっぱいに敷き、その上に放射光と扇を重ねる。 */
body[data-bg="kinpika"] { --bg-top: url(img/bg-kinpika-top.png); --bg-bottom: url(img/bg-kinpika-bottom.png); --ground: #f5cf52; }
body[data-bg="kinpika"]::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    url(img/bg-kinpika-sparkles.png) center top / 300px 300px repeat,
    url(img/bg-kinpika-wall.png) center top / auto 100% repeat-x;
  image-rendering: pixelated;
}
/* 金の上に直接文字をのせると読めないので、中身の後ろにクリーム色の紙を1枚敷く。ふちに金が残る。 */
body[data-bg="kinpika"] { position: relative; }
body[data-bg="kinpika"]::after {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  top: calc(var(--bgw) * 0.13); bottom: calc(var(--bgw) * 0.2);
  left: 50%; width: min(100% - 20px, 1100px); transform: translateX(-50%);
  border-radius: 28px; background: rgba(255, 250, 236, 0.9);
  box-shadow: 0 0 0 3px rgba(255, 244, 200, 0.9), 0 6px 24px rgba(140, 90, 0, 0.25);
}
/* 放射光は四角い絵なので、下と左右のふちをぼかして屏風になじませる */
body[data-bg="kinpika"] #app::before {
  -webkit-mask-image: linear-gradient(#000 50%, transparent), linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(#000 50%, transparent), linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
#app::before, #app::after {
  content: '';
  position: absolute; left: 50%; width: var(--bgw); transform: translateX(-50%); z-index: -1;
  aspect-ratio: 3 / 1;
  background: center / 100% 100% no-repeat;
  pointer-events: none;
}
#app::before { top: 0; background-image: var(--bg-top); }
#app::after { bottom: 0; background-image: var(--bg-bottom); }

.head { display: flex; flex-direction: column; gap: 4px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--sub); }
h1 { margin: 0; font-family: var(--dot); font-size: 24px; font-weight: 400; line-height: 1.4; text-wrap: balance; }
h2 { margin: 0; font-size: 14px; font-weight: 700; }
p { margin: 0; }
.note { font-size: 13px; color: var(--sub); }
.center { text-align: center; }

/* 重箱 */
.jubako-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.jubako {
  position: relative;
  width: min(262px, 100%);
  aspect-ratio: 1;
  padding: 11px;
  background: var(--box);
  border-radius: 30px;
  box-shadow: 0 1px 3px rgba(201, 58, 85, 0.10), 0 14px 30px rgba(201, 58, 85, 0.16);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
/* お重の種類。朱ぬり・黒×金・さくら */
.jubako.st-shu { background: #e2574f; }
.jubako.st-kuro { background: #3b2b30; box-shadow: inset 0 0 0 3px #d9a93b, 0 1px 3px rgba(59, 43, 48, 0.14), 0 14px 30px rgba(59, 43, 48, 0.20); }
.jubako.st-kuro .cell { background: #fffaf0; }
.jubako.st-sakura { background: var(--box); }
.jubako.show { width: 150px; padding: 7px; gap: 4px; border-radius: 20px; }
.jubako.show .cell { border-radius: 11px; }
.jubako.show .sprite { width: 76%; }
.jubako.show .sprite img { width: 100%; }
.jubako.show .hole { width: 24px; height: 24px; }
.styles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.style-btn {
  position: relative;
  min-height: 84px; padding: 10px 4px 8px;
  border: 2px solid var(--line); border-radius: 18px;
  background: var(--card);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-weight: 700; font-size: 13px;
  transition: background 0.2s, border-color 0.2s;
}
.style-btn[aria-pressed="true"] { background: var(--pick); border-color: var(--accent); }
/* えらんだ印 */
.style-btn[aria-pressed="true"]::after {
  content: '';
  position: absolute; top: -8px; right: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.6 6.3l2.3 2.3 4.5-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
  box-shadow: 0 0 0 2px #ffffff;
}
.swatch {
  width: 40px; height: 40px; padding: 4px; border-radius: 9px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px;
}
.swatch i { border-radius: 2px; background: #ffffff; }
.swatch.st-shu { background: #e2574f; }
.swatch.st-kuro { background: #3b2b30; box-shadow: inset 0 0 0 2px #d9a93b; }
.swatch.st-sakura { background: var(--box); }
.bg-swatch { width: 100%; height: 40px; border-radius: 9px; background-repeat: no-repeat; box-shadow: inset 0 0 0 1px rgba(74, 52, 64, 0.08); }
.bg-swatch.bg-sunrise { background-color: #fff7ed; background-image: url(img/bg-sunrise-top.png); background-size: 190% auto; background-position: 50% 30%; }
.bg-swatch.bg-plum { background-color: #fff8ef; background-image: url(img/bg-plum-top.png); background-size: 230% auto; background-position: 0 0; }
.bg-swatch.bg-kinpika { background-color: #f5cf52; background-image: url(img/bg-kinpika-top.png); background-size: 150% auto; background-position: 50% 0; }
.bg-swatch.bg-snow { background-color: #f3f2f8; background-image: url(img/bg-snow-bottom.png); background-size: 230% auto; background-position: 100% 100%; }

/* 持ち主からのあいさつ */
.greet { padding: 16px 20px; gap: 4px; }
.greet-from { font-size: 13px; font-weight: 700; color: var(--accent); }
.greet-body { font-size: 16px; line-height: 1.7; white-space: pre-line; overflow-wrap: anywhere; }

.jubako.shake { animation: kshake 0.5s ease-out 0.3s both; }
.cell {
  position: relative;
  border: none;
  padding: 0;
  border-radius: 18px;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
/* 詰めた人のニックネーム（持ち主ページ） */
.cell.has-name { flex-direction: column; }
.cell.has-name .sprite img { width: 52px; }
.cell-name { max-width: calc(100% - 10px); margin-top: -1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 700; line-height: 1.3; color: var(--sub); }
.cell.is-picked, .cell.is-new { background: var(--pick); box-shadow: inset 0 0 0 3px var(--ring); }
.cell.is-new .sprite { animation: kpop 0.65s cubic-bezier(0.3, 1.3, 0.6, 1) both; }
.cell.boing .sprite { animation: kboing 0.5s ease-out both; }
.cell .hole { width: 44px; height: 44px; border-radius: 50%; border: 2px dashed #f3c3cb; }
.spark {
  position: absolute; left: 50%; top: 50%;
  width: 9px; height: 9px; margin: -4.5px;
  border-radius: 50%; opacity: 0;
  animation: 0.7s ease-out 0.25s both;
}
.spark.s1 { background: var(--ring); animation-name: ksp1; }
.spark.s2 { background: #ffffff; animation-name: ksp2; }
.spark.s3 { background: #ffffff; animation-name: ksp3; }
.spark.s4 { background: var(--ring); animation-name: ksp4; }

.sleepy { display: flex; align-items: center; justify-content: center; gap: 10px; }

/* 干支リレー */
.relay { padding: 16px 18px 14px; gap: 6px; }
.relay-title { font-weight: 700; font-size: 17px; line-height: 1.4; text-align: center; font-variant-numeric: tabular-nums; }
.relay-note { text-align: center; }
.relay-note:empty { display: none; }
.relay-track { --p: 0; position: relative; height: 90px; }
.relay-year { position: absolute; top: 0; font-size: 12px; font-weight: 700; color: var(--sub); }
.relay-year.from { left: 0; }
.relay-year.to { right: 0; }
/* 馬の足あと。2つ分の絵を横にくり返し、馬が進んだところまで見せる。 */
.relay-trail {
  position: absolute; left: 2px; bottom: 0; height: 16px;
  width: calc(var(--p) * (100% - 112px) + 14px);
  background: url(img/footprints.png) left center / 44px 16px repeat-x;
  transition: width 1.2s cubic-bezier(0.3, 0, 0.2, 1);
}
.relay-horse {
  position: absolute; bottom: 8px; width: 64px;
  left: calc(var(--p) * (100% - 112px));
  transition: left 1.2s cubic-bezier(0.3, 0, 0.2, 1);
}
/* 2コマを160ミリ秒ずつ交互に見せる */
.relay-horse .f1 { animation: kframe1 0.32s steps(1) infinite; }
.relay-horse .f2 { position: absolute; left: 0; top: 0; opacity: 0; animation: kframe2 0.32s steps(1) infinite; }
.relay-sheep { position: absolute; right: 0; bottom: 8px; width: 56px; }
.relay-baton { position: absolute; left: -6px; bottom: 12px; width: 18px; opacity: 0; }
.relay .spark { left: 4px; top: 60%; animation: none; }
.relay.is-done .relay-horse .f1 { animation: none; }
.relay.is-done .relay-horse .f2 { display: none; }
.relay.is-done .relay-baton { opacity: 1; animation: kpop 0.5s cubic-bezier(0.3, 1.3, 0.6, 1) both; }
.relay.is-done .relay-sheep > img:first-child { animation: khop 0.9s ease-out 0.15s both; }
.relay.is-done .spark { animation: 0.7s ease-out 0.05s both; }
.relay.is-done .spark.s1 { animation-name: ksp1; }
.relay.is-done .spark.s2 { animation-name: ksp2; }
.relay.is-done .spark.s3 { animation-name: ksp3; }
.relay.is-done .spark.s4 { animation-name: ksp4; }
.relay.no-anim * { animation: none !important; transition: none !important; }
.open-box { display: flex; flex-direction: column; gap: 18px; }
.after-relay { animation: kreveal 0.6s ease-out 1.9s both; }
.tabs[hidden] { display: none; }
.pill {
  padding: 6px 16px; border-radius: 999px;
  background: var(--card);
  font-weight: 700; font-size: 14px;
}

/* 料理えらび */
.picker {
  display: flex; gap: 10px;
  overflow-x: auto;
  margin: 0 -24px; padding: 4px 24px;
  scroll-snap-type: x proximity; scroll-padding-left: 24px;
  scrollbar-width: none;
}
.picker::-webkit-scrollbar { display: none; }
.dish {
  flex: 0 0 76px; height: 88px;
  padding: 6px 0 0;
  border-radius: 18px;
  border: 2px solid var(--line);
  background: var(--card);
  scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: background 0.2s, border-color 0.2s;
}
.dish[aria-pressed="true"] { background: var(--pick); border-color: var(--accent); }
.dish > span:last-child { font-weight: 700; font-size: 12px; line-height: 1.3; white-space: nowrap; }
.wish { font-size: 13px; color: var(--sub); }
.wish b { font-weight: 900; color: var(--ink); }

/* 入力 */
.form { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
label, .label { font-size: 13px; font-weight: 700; }
textarea, input[type="text"] {
  width: 100%;
  border: 2px solid var(--line);
  background: var(--card);
  font-size: 16px; font-weight: 500;
}
textarea.short { height: 76px; }
textarea { height: 92px; padding: 12px 16px; border-radius: 18px; line-height: 1.6; resize: none; }
input[type="text"] { height: 48px; padding: 0 16px; border-radius: 999px; }
input[readonly] { font-size: 13px; color: var(--sub); }
.check { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; color: var(--sub); min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.error { font-size: 13px; font-weight: 700; color: var(--accent); }

/* ボタン */
.btn {
  min-height: 52px; padding: 0 20px;
  border: none; border-radius: 999px;
  background: var(--accent); color: #ffffff;
  font-size: 16px; font-weight: 900; letter-spacing: 0.04em;
  box-shadow: 0 1px 3px rgba(201, 58, 85, 0.14), 0 6px 14px rgba(201, 58, 85, 0.18);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn.soft {
  min-height: 48px;
  background: var(--soft); color: var(--ink);
  font-size: 14px; font-weight: 700; letter-spacing: 0;
  box-shadow: none;
}
.btn.small { min-height: 44px; padding: 0 16px; font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1 1 0; }

/* カード */
.card {
  padding: 20px 22px;
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.card-title { font-weight: 700; font-size: 20px; line-height: 1.4; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 18px 20px; gap: 4px; }
.stat .k { font-size: 13px; font-weight: 700; color: var(--sub); }
.stat .v { font-weight: 700; font-size: 32px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 15px; }
.stat .v.clock { font-size: 26px; line-height: 1.5; }

/* 段の切り替え */
.tabs { display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: var(--soft); }
.tab {
  flex: 1 1 0; min-height: 44px;
  border: none; border-radius: 999px;
  background: transparent;
  font-weight: 700; font-size: 15px;
}
.tab[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 3px rgba(201, 58, 85, 0.12); }

/* メッセージ */
.msg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.msg-dish { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; }
.msg-wish { font-size: 13px; font-weight: 700; color: var(--sub); }
.msg-body { font-size: 16px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-from { font-size: 13px; font-weight: 700; color: var(--sub); text-align: right; overflow-wrap: anywhere; }

/* メッセージをめくる。カードを横1列にならべ、1枚ずつ止まるようにする。
   スマホでは画面のはしまで広げ、となりのカードが画面の外から入ってくるように見せる。 */
.msg-deck { display: flex; flex-direction: column; gap: 12px; }
.msg-strip {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  /* カードの影が切れないよう、上下にすき間を取り、その分を外側で打ち消す */
  margin: -6px -24px -16px; padding: 6px 0 16px;
}
.msg-strip::-webkit-scrollbar { display: none; }
.msg-slide { flex: 0 0 100%; display: flex; padding: 0 24px; scroll-snap-align: center; scroll-snap-stop: always; }
.msg-slide > .msg-card { flex: 1 1 auto; min-width: 0; }
/* カードの高さは、いちばん長いメッセージにそろう。短いメッセージでは、名前をカードの下によせる。 */
.msg-slide .msg-body { flex: 1 1 auto; }
.msg-nav { display: flex; align-items: center; gap: 12px; }
.msg-nav .btn { flex: 0 0 96px; }
.msg-count { flex: 1 1 auto; text-align: center; font-weight: 700; font-size: 15px; color: var(--sub); font-variant-numeric: tabular-nums; }
.msg-hint { text-align: center; }
/* マウスで使う画面には、スワイプの案内を出さない */
@media (hover: hover) and (pointer: fine) { .msg-hint { display: none; } }

/* hidden を付けた部品は、display を指定していても出さない */
[hidden] { display: none !important; }

/* 特定商取引法に基づく表記 */
/* 説明文の中のリンク（特定商取引法に基づく表記へ） */
.note a { color: inherit; text-underline-offset: 3px; }
.law { margin: 0; gap: 0; padding: 6px 22px; }
.law-row { display: flex; flex-direction: column; gap: 2px; padding: 14px 0; border-top: 1px solid var(--line); }
.law-row:first-child { border-top: none; }
.law-row dt { font-size: 13px; font-weight: 700; color: var(--sub); }
.law-row dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }

/* 整理リスト */
.manage { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: 18px; background: var(--card);
  box-shadow: var(--shadow);
}
.item .meta { flex: 1 1 auto; font-size: 13px; color: var(--sub); }
.item .meta b { display: block; font-size: 14px; color: var(--ink); }
.item .acts { display: flex; gap: 6px; }

.loading { padding: 80px 0; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--sub); font-size: 13px; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 8px; }

@keyframes kpop { 0% { transform: translateY(-46px) scale(0.3); opacity: 0; } 55% { transform: translateY(4px) scale(1.18); opacity: 1; } 75% { transform: translateY(-3px) scale(0.94); } 100% { transform: none; opacity: 1; } }
@keyframes kboing { 0% { transform: scale(1); } 40% { transform: scale(1.22) rotate(-6deg); } 70% { transform: scale(0.94) rotate(4deg); } 100% { transform: none; } }
@keyframes kshake { 0%, 100% { transform: none; } 30% { transform: translateY(3px) scale(1.02, 0.98); } 60% { transform: translateY(-2px); } }
@keyframes ksp1 { 0% { transform: none; opacity: 1; } 100% { transform: translate(-34px, -34px) scale(0.2); opacity: 0; } }
@keyframes ksp2 { 0% { transform: none; opacity: 1; } 100% { transform: translate(34px, -34px) scale(0.2); opacity: 0; } }
@keyframes ksp3 { 0% { transform: none; opacity: 1; } 100% { transform: translate(-34px, 34px) scale(0.2); opacity: 0; } }
@keyframes ksp4 { 0% { transform: none; opacity: 1; } 100% { transform: translate(34px, 34px) scale(0.2); opacity: 0; } }
@keyframes kframe1 { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes kframe2 { 0% { opacity: 0; transform: none; } 50% { opacity: 1; transform: translateY(-2px); } }
@keyframes khop { 0%, 100% { transform: none; } 25% { transform: translateY(-12px); } 50% { transform: none; } 70% { transform: translateY(-6px); } }
@keyframes kreveal { 0% { opacity: 0; transform: translateY(12px); } 100% { opacity: 1; transform: none; } }

/* ---------- 作成画面 ---------- */
.topbar { display: none; }
.home-head { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.shime { width: 88px; margin-bottom: 6px; }
.home-head p { font-size: 15px; }
/* あそび方の3ステップ。横ならびの1行。あいだに小さな矢印。 */
.how { list-style: none; margin: 10px 0 0; padding: 0; width: 100%; max-width: 420px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.how li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.how li + li::before { content: ''; position: absolute; left: -13px; top: 26px; width: 8px; height: 8px; border-top: 3px solid #e3b96a; border-right: 3px solid #e3b96a; border-radius: 1px; transform: rotate(45deg); }
.how-pic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: #ffffff; box-shadow: 0 1px 3px rgba(120, 60, 70, 0.08), 0 4px 12px rgba(120, 60, 70, 0.06); }
.how-pic img { width: 50px; height: 50px; object-fit: contain; image-rendering: pixelated; }
.how-box { width: 34px; height: 34px; border-radius: 8px; background-color: #e0584f;
  background-image: radial-gradient(circle, #ffffff 0 3px, transparent 3.5px); background-size: 10px 10px; background-position: 2px 2px; background-repeat: repeat; }
.how-text { font-size: 13px; font-weight: 700; line-height: 1.45; text-wrap: balance; word-break: auto-phrase; }
.how-num { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 4px; border-radius: 50%; background: var(--accent); color: #ffffff; font-size: 11px; line-height: 1; vertical-align: 1px; }
.nb { display: inline-block; }
.home-grid { display: flex; flex-direction: column; gap: 22px; }
.home-main, .home-side { display: contents; }
.home-preview { order: 1; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.home-side > .form { order: 2; }
.home-main > .relay { order: 3; }
.home-side > .stack { order: 4; }
.show-title { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.show-title::before, .show-title::after { content: ''; flex: 0 0 28px; height: 2px; border-radius: 1px; background: #e3b96a; }
.form-title { font-weight: 700; font-size: 20px; line-height: 1.4; }
/* よくある質問。質問を押すと答えが開く。 */
.foot { margin: 8px 0 0; text-align: center; font-size: 13px; }
.foot a { display: inline-block; padding: 10px 14px; color: var(--sub); font-weight: 700; text-underline-offset: 4px; }
/* 作り手の名前（presented by mojimaru）。じゃまにならないよう、小さく置く。 */
.credit { margin: 0; font-size: 12px; line-height: 1.6; letter-spacing: 0.04em; color: var(--sub); }
.foot .credit a { display: inline; padding: 10px 2px; }
.faq { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 640px; margin: 0 auto; }
.faq-head { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 6px; text-align: center; }
.faq-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.faq-item { border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 12px 20px; cursor: pointer; list-style: none; font-weight: 700; font-size: 16px; line-height: 1.5; border-radius: 18px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.faq-mark { flex: none; width: 9px; height: 9px; margin-right: 4px; border-right: 3px solid var(--accent); border-bottom: 3px solid var(--accent); border-radius: 1px; transform: translateY(-2px) rotate(45deg); transition: transform 0.2s; }
.faq-item[open] .faq-mark { transform: translateY(2px) rotate(-135deg); }
.faq-a { display: flex; flex-direction: column; gap: 8px; padding: 0 20px 18px; font-size: 15px; line-height: 1.7; }
.faq-a p { margin: 0; }
@media (prefers-reduced-motion: reduce) { .faq-mark { transition: none; } }
/* おみくじ。フタが開いたあとに出る。 */
.kuji { align-items: center; text-align: center; gap: 12px; }
.kuji-sheep { width: 96px; height: 96px; image-rendering: pixelated; }
.kuji.shaking .kuji-sheep { animation: kuji-shake 0.9s ease-in-out; }
@keyframes kuji-shake { 0%, 100% { transform: rotate(0); } 15%, 45%, 75% { transform: rotate(-12deg) translateY(-4px); } 30%, 60%, 90% { transform: rotate(12deg) translateY(-4px); } }
.kuji-eyebrow { font-size: 13px; font-weight: 700; color: var(--sub); }
.kuji-slip { width: 100%; padding: 18px 16px; border-radius: 16px; background: #fff8ea; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.kuji-slip.pop { animation: kuji-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes kuji-pop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.kuji-rank { font-size: 48px; font-weight: 700; line-height: 1.2; letter-spacing: 0.08em; color: var(--accent); }
.kuji-word { font-size: 15px; text-wrap: balance; word-break: auto-phrase; }
.kuji-lucky { display: flex; align-items: center; gap: 12px; text-align: left; }
.kuji-lucky .k { font-size: 12px; font-weight: 700; color: var(--sub); }
.kuji-lucky .v { font-size: 15px; font-weight: 700; }
.kuji .btn { width: 100%; }
@media (prefers-reduced-motion: reduce) { .kuji.shaking .kuji-sheep, .kuji-slip.pop { animation: none; } }
/* 持ち主ページの「① ほぞん → ② おくる」の番号 */
.step-title { display: flex; align-items: center; gap: 10px; }
.step-num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #ffffff; font-size: 16px; line-height: 1; }
.note.warn { color: var(--accent); font-weight: 700; }
/* アプリの中のブラウザ（LINE や Instagram）で開いているときのお知らせ。淡い黄色の地で、ふつうの補足と見分ける。 */
.inapp { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 18px; background: var(--pick); font-size: 14px; line-height: 1.6; }
.inapp p { margin: 0; }
/* 文字だけの小さなボタン（「このまま、ここでつくる」）。主役のボタンより目立たせない。 */
.link-btn { align-self: center; min-height: 44px; padding: 10px 14px; border: 0; background: none; font-size: 13px; font-weight: 700; color: var(--sub); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.link-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
/* 重箱の下の敷き紙。奥にたおした白い紙に、紅と金の線。 */
.mat { position: relative; isolation: isolate; padding-bottom: 12px; }
.mat::before {
  content: '';
  position: absolute; left: -14%; right: -14%; bottom: 0; height: 56%;
  z-index: -1;
  background: #ffffff;
  border: 3px solid #e2574f;
  box-shadow: inset 0 0 0 5px #ffffff, inset 0 0 0 7px #e8c36a, 0 8px 18px rgba(201, 58, 85, 0.08);
  transform: perspective(520px) rotateX(46deg);
  transform-origin: 50% 100%;
}

/* ---------- 左右2列の画面（詰める・持ち主・開いたあと） ----------
   スマホでは1列。あいさつ → リレー → 重箱 → 右側の中身 の順に並べる。 */
/* しめ飾りと見出しは、スマホでも中央にそろえる */
.pc-only { align-self: center; margin-bottom: -8px; }
body[data-screen="duo"] .head { align-items: center; text-align: center; }
body[data-screen="duo"] .head-row { justify-content: center; }
/* 見出しが2行になるときは、文節の切れ目で折る（対応していないブラウザでは今までどおり） */
body[data-screen="duo"] .head h1 { word-break: auto-phrase; text-wrap: balance; }
.duo { display: flex; flex-direction: column; gap: 18px; }
.duo-main, .duo-side { display: contents; }
.duo-main > * { order: 4; }
.duo-side > * { order: 5; }
.duo .o-first { order: 1; }
.duo .o-greet { order: 2; }
.duo .o-relay { order: 3; }
.duo .o-last { order: 6; }
.side-title { font-weight: 700; font-size: 20px; line-height: 1.4; text-align: center; }

/* PC。どの画面も左右2列にする。重箱が見つからないときなどの画面は1列のまま。 */
@media (min-width: 900px) {
  body { --bgw: 720px; --bg-top: url(img/bg-sunrise-top-wide.png); --bg-bottom: url(img/bg-sunrise-bottom-wide.png); }
  body[data-bg="plum"] { --bg-top: url(img/bg-plum-top-wide.png); --bg-bottom: url(img/bg-plum-bottom-wide.png); }
  body[data-bg="snow"] { --bg-top: url(img/bg-snow-top-wide.png); --bg-bottom: url(img/bg-snow-bottom-wide.png); }
  body[data-bg="kinpika"] { --bg-top: url(img/bg-kinpika-top-wide.png); --bg-bottom: url(img/bg-kinpika-bottom-wide.png); }
  /* PC では左上のロゴも紙の上にのせる */
  body[data-bg="kinpika"]::after { top: 12px; }
  #app { padding-top: calc(var(--bgw) * 0.26); }

  /* 作成画面は、背景の絵が左上のロゴに重ならない幅にする */
  body[data-screen] { --bgw: 520px; }
  body[data-screen] #app { max-width: 1080px; padding: 132px 40px calc(var(--bgw) * 0.31); gap: 28px; }
  .topbar {
    position: absolute; top: 40px; left: 40px; right: 40px;
    display: flex; align-items: center; justify-content: space-between;
  }
  .logo { display: flex; align-items: center; gap: 10px; font-family: var(--dot); font-size: 20px; }
  .logo-mark {
    width: 22px; height: 22px; border-radius: 5px;
    background: repeating-conic-gradient(var(--accent) 0 25%, #ffffff 0 50%) 0 0 / 11px 11px;
    box-shadow: 0 0 0 2px var(--accent);
  }
  .year-pill {
    padding: 4px 18px; border-radius: 999px;
    border: 1.5px solid var(--accent); color: var(--accent);
    background: rgba(255, 255, 255, 0.6);
    font-weight: 700; font-size: 17px;
  }
  .home-head .eyebrow { display: none; }
  .home-head h1 { font-size: 36px; }
  .home-head p { font-size: 16px; }
  .how { max-width: 520px; gap: 28px; margin-top: 14px; }
  .how li + li::before { left: -19px; }
  .how-text { font-size: 15px; }
  .how-num { width: 20px; height: 20px; font-size: 12px; }
  .shime { width: 104px; }
  .home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 500px); gap: 64px; align-items: start; margin-top: 16px; }
  .home-main, .home-side { display: flex; flex-direction: column; gap: 28px; }
  .home-main { align-items: center; }
  .home-main > .relay { width: 100%; max-width: 460px; }
  .home-preview { gap: 24px; }
  .show-title { font-size: 22px; gap: 16px; }
  .show-title::before, .show-title::after { flex-basis: 44px; }
  .jubako.show { width: 400px; padding: 17px; gap: 11px; border-radius: 44px; }
  .jubako.show .cell { border-radius: 24px; }
  .jubako.show .hole { width: 58px; height: 58px; }
  .mat { padding-bottom: 34px; margin-bottom: 8px; }
  .home-side > .form {
    padding: 30px 34px; border-radius: 24px; gap: 14px;
    background: var(--card);
    box-shadow: var(--shadow), inset 0 0 0 1.5px #f1dcb8;
  }

  /* 左右2列の画面 */
  .pc-only { margin-bottom: 6px; }
  body[data-screen="duo"] .head { gap: 6px; }
  body[data-screen="duo"] .head .eyebrow { font-size: 15px; }
  body[data-screen="duo"] .head h1 { font-size: 32px; }
  .duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 500px); gap: 64px; align-items: start; margin-top: 16px; }
  .duo-main, .duo-side { display: flex; flex-direction: column; gap: 22px; }
  .duo-main { align-items: center; }
  .duo-main > * { width: 100%; max-width: 460px; }
  .duo-main > *, .duo-side > *, .duo .o-first, .duo .o-greet { order: 0; }
  .duo .o-relay { order: 9; }
  .duo-main .jubako { width: 400px; padding: 17px; gap: 11px; border-radius: 44px; }
  .duo-main .jubako .cell { border-radius: 24px; }
  .duo-main .jubako .hole { width: 58px; height: 58px; }
  .duo-main .jubako .sprite img { width: 84px; }
  .duo-main .jubako .cell.has-name .sprite img { width: 76px; }
  .duo-main .jubako .cell-name { font-size: 13px; }
  .duo-side > .form, .duo-side > .panel {
    padding: 30px 34px; border-radius: 24px;
    background: var(--card);
    box-shadow: var(--shadow), inset 0 0 0 1.5px #f1dcb8;
  }
  .duo-side > .form { gap: 14px; }
  .duo-side > .panel { gap: 12px; }
  /* 料理えらびは横スクロールをやめて、4列にならべる */
  .duo-side .picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; overflow: visible; margin: 0; padding: 0; }
  .duo-side .dish { height: 92px; }
  .side-title { font-size: 26px; }
  .duo-side .msg-card { min-height: 260px; padding: 30px 34px; gap: 16px; }
  .duo-side .msg-card .msg-dish { font-size: 24px; }
  .duo-side .msg-card .msg-body { flex: 1 1 auto; font-size: 20px; }
  .duo-side .msg-card .msg-from { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
