:root {
  --ink: #3b2a22;
  --ink-soft: #7a6458;
  --line: #ecdccf;
  --brand: #c4532f;      /* しっぽの赤茶 */
  --brand-dark: #a2401f;
  --gold: #f4b63f;
  --surface: #fff;
  --shadow: 0 8px 24px rgba(60, 30, 15, .22);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: #2b1d17;
  color: var(--ink);
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* =========================================================
   ステージ（画面全体）
   ========================================================= */
.stage {
  position: relative;
  height: 100vh; height: 100dvh;
  overflow: hidden;
  overflow: clip; /* フォーカス時などに横へスクロールしないように */
  user-select: none; -webkit-user-select: none;
}
.wall {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 2px, transparent 2px 46px),
    radial-gradient(120% 70% at 30% 25%, #fff6ea 0%, #f9dfc4 55%, #eab993 100%);
}
.counter {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  height: 24%;
  background:
    linear-gradient(#e2a874, #e2a874 6px, #b9774a 6px, #b9774a 9px, transparent 9px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.05) 0 1px, transparent 1px 60px),
    linear-gradient(#a8693f, #7d4a2b);
  box-shadow: 0 -6px 18px rgba(60, 30, 15, .25);
}

/* ---------- ヘッダー ---------- */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 7;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + var(--safe-t)) 10px 0 14px;
}
.shop-name {
  padding: 4px 12px; border-radius: 14px;
  background: rgba(59, 42, 34, .82); color: #fff;
  font-size: 13px; font-weight: 800; letter-spacing: .03em;
}
.top-actions { display: flex; align-items: center; gap: 6px; }
.normal-btn {
  height: 34px; padding: 0 12px;
  border: 2px solid var(--brand); border-radius: 17px;
  background: rgba(255, 255, 255, .92); color: var(--brand);
  font-size: 12px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(60, 30, 15, .18);
}
.normal-btn:active { transform: scale(.94); }
.icon-btn {
  position: relative; width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .88); color: var(--ink);
  box-shadow: 0 2px 8px rgba(60, 30, 15, .18);
}
.icon-btn:active { transform: scale(.94); }
.cart-count {
  position: absolute; top: -2px; right: -2px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
#cartBtn.bump { animation: bump .45s ease; }

/* ---------- 商品ショーケース ---------- */
.showcase {
  position: absolute; z-index: 3;
  top: calc(64px + var(--safe-t)); left: 4%;
  width: min(46%, 300px, 42vh); /* 横長・タブレットでも大きくなりすぎないように */
}
.rays {
  position: absolute; left: 50%; top: 52%;
  width: 260%; aspect-ratio: 1;
  margin: -130% 0 0 -130%;
  background: repeating-conic-gradient(rgba(255, 233, 160, .55) 0 9deg, transparent 9deg 22deg);
  -webkit-mask: radial-gradient(closest-side, #000 20%, transparent 75%);
          mask: radial-gradient(closest-side, #000 20%, transparent 75%);
  animation: spin 30s linear infinite;
  pointer-events: none;
}

.item-slot { position: relative; }
.item {
  display: block; width: 100%; padding: 8px 8px 10px;
  border: 0; border-radius: 16px; text-align: center;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: rotate(-4deg);
  animation: itemIn .55s cubic-bezier(.2, 1.3, .4, 1) both;
}
.item:active { transform: rotate(-4deg) scale(.97); }
.item-img { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #f6eee7; }
.item-img img { width: 100%; height: 100%; object-fit: cover; }
.item.soldout .item-img img { filter: grayscale(.8) brightness(1.05); }
.item-price {
  margin-top: 6px;
  font-size: 18px; font-weight: 900; color: var(--brand); line-height: 1.2;
}
.item-price small { font-size: 11px; color: var(--ink-soft); font-weight: 700; margin-right: 2px; }
.item-price s { display: block; font-size: 11px; color: var(--ink-soft); font-weight: 400; }
.ribbon {
  position: absolute; top: 8px; left: -4px;
  padding: 2px 10px 2px 8px;
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 900;
  border-radius: 0 8px 8px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.ribbon.gray { background: #555; }
.item-hint { margin-top: 2px; font-size: 10px; color: var(--ink-soft); }

/* 紹介中の商品から一覧へ戻る */
.back-btn {
  display: block; margin: 0 0 8px;
  height: 32px; padding: 0 12px;
  border: 0; border-radius: 16px;
  background: rgba(255, 255, 255, .9); color: var(--brand);
  font-size: 12px; font-weight: 800;
  box-shadow: 0 2px 6px rgba(60, 30, 15, .15);
}

/* ---------- 商品をまとめて表示 ---------- */
.lineup {
  display: none;
  position: absolute; z-index: 3;
  top: calc(60px + var(--safe-t)); left: 10px;
  width: min(62%, 440px);
  bottom: calc(150px + var(--safe-b));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 6px 6px 16px;
  scrollbar-width: none;
}
.lineup::-webkit-scrollbar { display: none; }
.stage.mode-lineup .lineup { display: block; }
.stage.mode-lineup .showcase { display: none; }
.lineup-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px 10px;
  align-content: start;
}
.lu-card {
  display: block; width: 100%; padding: 5px 5px 7px;
  border: 0; border-radius: 12px; text-align: center;
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(60, 30, 15, .2);
  transform: rotate(-2deg);
  animation: luIn .5s cubic-bezier(.2, 1.3, .4, 1) both;
  transition: transform .15s;
}
.lu-card:nth-child(even) { transform: rotate(2deg); }
.lu-card:active { transform: scale(.95); }
.lu-img { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #f6eee7; }
.lu-img img { width: 100%; height: 100%; object-fit: cover; }
.lu-img .ribbon { top: 6px; left: 0; padding: 1px 7px 1px 5px; font-size: 10px; }
.lu-card.soldout .lu-img img { filter: grayscale(.8) brightness(1.05); }
.lu-title {
  margin-top: 5px; font-size: 11px; font-weight: 700; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.7em;
}
.lu-price { font-size: 15px; font-weight: 900; color: var(--brand); line-height: 1.3; }
.lu-price small { font-size: 10px; color: var(--ink-soft); margin-right: 2px; }
.lu-remain { font-size: 10px; color: var(--ink-soft); min-height: 1.4em; }

/* オープニングの看板 */
.sign {
  padding: 14px 10px 16px; border-radius: 16px; text-align: center;
  background: linear-gradient(160deg, #c4532f, #8e3418);
  color: #fff; box-shadow: var(--shadow);
  border: 3px solid #fff;
  transform: rotate(-3deg);
  animation: itemIn .6s cubic-bezier(.2, 1.3, .4, 1) both;
}
.sign-sub { font-size: 11px; letter-spacing: .2em; opacity: .9; }
.sign-main { font-size: 26px; font-weight: 900; line-height: 1.25; margin: 4px 0; }
.sign-count { display: inline-block; padding: 2px 10px; border-radius: 10px; background: var(--gold); color: var(--ink); font-size: 13px; font-weight: 900; }

/* 購入完了 */
.sign.thanks { background: linear-gradient(160deg, #e0738f, #b8445f); }
.sign.thanks .sign-count { padding: 2px 8px; font-size: 11px; white-space: nowrap; }
.hearts { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.hearts i {
  position: absolute; bottom: 30%;
  color: #e0738f; font-style: normal; font-weight: 900;
  text-shadow: 0 2px 4px rgba(255, 255, 255, .8);
  opacity: 0;
  animation: heartUp 2.6s ease-out forwards;
}
.hearts i:nth-child(3n) { color: var(--gold); }

/* カートへ飛ぶ演出 */
.fly {
  position: fixed; z-index: 80; pointer-events: none;
  border-radius: 10px; box-shadow: var(--shadow);
  transition: transform .7s cubic-bezier(.5, -0.3, .7, .6), opacity .7s ease-in;
}

/* ---------- キャラクター ---------- */
.chara-pos {
  position: absolute; z-index: 2;
  right: 0; bottom: 15%;
  height: 72%;
  aspect-ratio: 1201 / 2000;
  translate: 22% 0;
}
.chara-pos.hop { animation: hop .6s ease; }
.chara-float { height: 100%; animation: float 3.4s ease-in-out infinite; }
.chara { height: 100%; width: auto; max-width: none; transform-origin: 50% 100%; }
.chara.talking { animation: talk .32s ease-in-out infinite; }

/* ---------- セリフ ---------- */
.talk {
  position: absolute; z-index: 6; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  padding: 0 12px calc(12px + var(--safe-b));
}
.choices {
  display: flex; flex-direction: column; gap: 8px;
  width: min(74%, 320px);
}
.choice {
  min-height: 46px; padding: 8px 16px;
  border: 2.5px solid var(--brand); border-radius: 24px;
  background: rgba(255, 255, 255, .96); color: var(--brand);
  font-size: 15px; font-weight: 800; text-align: center;
  box-shadow: 0 4px 12px rgba(60, 30, 15, .2);
  animation: choiceIn .35s cubic-bezier(.2, 1.2, .4, 1) both;
}
.choice.primary { background: var(--brand); color: #fff; }
.choice:active { transform: scale(.96); }

.msg {
  position: relative; width: 100%;
  min-height: 112px;
  padding: 22px 18px 16px;
  background: rgba(255, 255, 255, .96);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 6px 0 rgba(59, 42, 34, .25);
  cursor: pointer; outline: none;
}
.msg:focus-visible { box-shadow: 0 0 0 3px var(--gold); }
.nameplate {
  position: absolute; top: -15px; left: 14px;
  padding: 2px 14px; border-radius: 12px;
  background: var(--brand); color: #fff; border: 2.5px solid var(--ink);
  font-size: 14px; font-weight: 900;
}
.msg-text { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.7; min-height: 3.4em; }
.msg-next {
  position: absolute; right: 14px; bottom: 6px;
  color: var(--brand); font-size: 14px;
  animation: blink 1s ease-in-out infinite;
}
.msg-next.off { visibility: hidden; }

/* ---------- 番号選択 ---------- */
.picker {
  position: absolute; z-index: 5;
  top: calc(60px + var(--safe-t)); left: 10px; right: 10px;
  bottom: calc(150px + var(--safe-b));
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, .97);
  border: 3px solid var(--ink); border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pickerIn .35s cubic-bezier(.2, 1.1, .4, 1);
}
.picker-head { display: flex; align-items: flex-start; gap: 8px; padding: 10px 8px 4px 14px; }
.picker-info { flex: 1; min-width: 0; }
.picker-title { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-sub { font-size: 12px; color: var(--ink-soft); }
.picker-sub b { color: var(--brand); font-size: 15px; }
.picker-close { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f4ebe3; font-size: 20px; line-height: 1; }
.legend { display: flex; gap: 10px; padding: 0 14px 6px; font-size: 11px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 3px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; border: 1.5px solid var(--line); }
.legend .lg-sel { background: var(--brand); border-color: var(--brand); }
.legend .lg-cart { border-color: #3f8f3a; background: #eaf6e8; }
.legend .lg-sold { background: #e6e1dd; border-color: #e6e1dd; }
.num-grid {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 7px;
  align-content: start;
  padding: 4px 12px 12px;
}
.num {
  position: relative; height: 46px; padding: 0;
  border: 2px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink);
  font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums;
  transition: background .15s, color .15s, border-color .15s;
}
.num.sel { background: var(--brand); border-color: var(--brand); color: #fff; animation: numPop .3s cubic-bezier(.3, 1.6, .5, 1); }
.num.sold { background: #e6e1dd; border-color: #e6e1dd; color: #b3aaa3; font-size: 14px; }
.num.sold::after, .num.cart::after {
  position: absolute; left: 0; right: 0; bottom: 1px;
  font-size: 9px; font-weight: 700; line-height: 1;
}
.num.sold::after { content: "売約済"; }
.num.cart { border-color: #3f8f3a; background: #eaf6e8; color: #2f6e2b; font-size: 14px; }
.num.cart::after { content: "カート"; }
.num.flash { animation: numFlash .5s ease; }
.picker-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px 10px; border-top: 1px solid var(--line); background: #fffaf5;
}
.picker-sum { flex: 1 0 auto; font-size: 13px; font-weight: 700; }
.picker-sum b { font-size: 20px; color: var(--brand); }
.picker-sum span { margin-left: 4px; font-size: 15px; font-weight: 900; }
.picker-actions { display: flex; gap: 6px; }
.pa-btn {
  height: 40px; padding: 0 12px; border-radius: 20px;
  border: 2px solid var(--brand); background: var(--surface); color: var(--brand);
  font-size: 13px; font-weight: 800;
}
.pa-btn.primary { background: var(--brand); color: #fff; padding: 0 18px; font-size: 15px; }
.pa-btn:disabled { opacity: .4; }
.pa-btn:active:not(:disabled) { transform: scale(.95); }

/* 番号選択中はキャラを顔アイコンで表示 */
.stage.picking .chara-pos { opacity: .0; transition: opacity .2s; }
.stage.picking .choices { display: none; }
.stage.picking .msg { padding-left: 80px; min-height: 96px; }
.stage.picking .msg-text { min-height: 0; font-size: 15px; }
.avatar {
  display: none;
  position: absolute; left: 10px; top: 50%; margin-top: -30px;
  width: 60px; height: 60px; border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: #fbe3cf url("img/chara.webp") no-repeat;
  background-size: 250% auto; /* 顔まわり 480px 四方を切り出し */
  background-position: 56% 26%;
}
.stage.picking .avatar { display: block; }
.avatar.nod { animation: nod .35s ease; }

.fly-num {
  position: fixed; z-index: 80; pointer-events: none;
  display: grid; place-items: center;
  border-radius: 12px; background: var(--brand); color: #fff;
  font-size: 16px; font-weight: 900;
  transition: transform .7s cubic-bezier(.5, -0.3, .7, .6), opacity .7s ease-in;
}

/* =========================================================
   ボトムシート
   ========================================================= */
.btn {
  height: 50px; padding: 0 24px;
  border: 0; border-radius: 25px;
  font-weight: 800; font-size: 16px;
  transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.block { width: 100%; }

.sheet-bg {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(30, 18, 12, .5);
  animation: fade .25s ease;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-height: 90vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .2);
  animation: slideUp .32s cubic-bezier(.2, .9, .3, 1);
}
@supports (height: 1dvh) { .sheet { max-height: 90dvh; } }
@media (min-width: 560px) { .sheet { left: 50%; right: auto; width: 520px; margin-left: -260px; } }
.sheet-close {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .92); font-size: 24px; line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(16px + var(--safe-b)); }
.sheet-title { margin: 0; padding: 18px 20px 10px; font-size: 18px; }

/* 商品詳細 */
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; background: #f6eee7; border-radius: 22px 22px 0 0; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { flex: 0 0 100%; aspect-ratio: 1; object-fit: contain; scroll-snap-align: center; }
.dots { display: flex; justify-content: center; gap: 6px; padding-top: 8px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--brand); }
.detail-info { padding: 12px 20px 0; }
.detail-title { margin: 0; font-size: 18px; line-height: 1.45; }
.detail-price { margin: 6px 0 0; font-size: 22px; font-weight: 900; color: var(--brand); }
.detail-price s { margin-left: 8px; font-size: 14px; color: var(--ink-soft); font-weight: 400; }
.opt { margin-top: 14px; }
.opt-name { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.opt-values { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.opt-values button { min-height: 38px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 14px; }
.opt-values button[aria-pressed="true"] { border-color: var(--brand); color: var(--brand); font-weight: 700; background: #fff3ee; }
.opt-values button.na { color: #bbb; text-decoration: line-through; }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.qty button { width: 40px; height: 40px; border: 0; background: var(--surface); font-size: 18px; }
.qty span { min-width: 36px; text-align: center; font-weight: 700; }
.detail-desc { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
.detail-desc img { height: auto; border-radius: 8px; }
.detail-cta {
  position: sticky; bottom: 0;
  margin-top: 18px; padding: 12px 20px calc(12px + var(--safe-b));
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
}
#detail .sheet-body { padding-bottom: 0; }

/* カート */
.cart-lines { list-style: none; margin: 0; padding: 0 20px; }
.cart-line { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: #f6eee7; }
.cart-line-title { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.4; }
.cart-line-variant { font-size: 12px; color: var(--ink-soft); }
.cart-line-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.cart-line .qty button { width: 34px; height: 34px; }
.cart-line-price { font-weight: 800; }
.cart-empty { padding: 32px 0; text-align: center; color: var(--ink-soft); }
.cart-foot { padding: 16px 20px 0; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; }
.cart-total strong { font-size: 22px; }
.cart-note { margin: 2px 0 12px; font-size: 12px; color: var(--ink-soft); }
.busy { opacity: .5; pointer-events: none; }

.skeleton { aspect-ratio: 1; background: linear-gradient(90deg, #f1e5da 25%, #f8efe7 50%, #f1e5da 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }

/* トースト */
.toast {
  position: fixed; left: 50%; top: calc(64px + var(--safe-t)); z-index: 90;
  transform: translate(-50%, -10px); opacity: 0;
  padding: 10px 18px; border-radius: 20px;
  background: rgba(40, 26, 20, .92); color: #fff; font-size: 14px; font-weight: 700;
  pointer-events: none; transition: opacity .25s, transform .25s;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   アニメーション
   ========================================================= */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes talk { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-2px) scale(1.006, .994); } }
@keyframes hop { 0% { transform: translateY(0); } 30% { transform: translateY(-22px) scale(1.02, .98); } 60% { transform: translateY(0) scale(.98, 1.02); } 100% { transform: none; } }
@keyframes itemIn { from { opacity: 0; transform: translate(-60%, 20px) rotate(-24deg) scale(.6); } }
@keyframes luIn { from { opacity: 0; transform: translateY(24px) scale(.8); } }
@keyframes choiceIn { from { opacity: 0; transform: translateX(40px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 100% { opacity: 1; transform: translateY(0); } 50% { opacity: .3; transform: translateY(3px); } }
@keyframes bump { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.3); } }
@keyframes pickerIn { from { opacity: 0; transform: translateY(24px) scale(.96); } }
@keyframes numPop { 0% { transform: scale(.8); } 100% { transform: scale(1); } }
@keyframes numFlash { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes nod { 0%, 100% { transform: none; } 40% { transform: translateY(3px) rotate(-4deg); } }
@keyframes heartUp {
  0% { opacity: 0; transform: translateY(0) scale(.6); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-55vh) translateX(12px) scale(1.1); }
}
@keyframes fade { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(100%); } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* =========================================================
   PC・タブレット横向き（横幅900px以上）: ノベルゲーム風の横長レイアウト
   ========================================================= */
@media (min-width: 900px), (orientation: landscape) and (min-width: 640px) {
  .topbar { padding: 16px 28px 0; }
  .shop-name { padding: 6px 16px; font-size: 16px; }
  .normal-btn { height: 40px; padding: 0 16px; font-size: 14px; }

  /* 商品は左、めぐるは右に大きく */
  .showcase { top: 96px; left: max(5%, calc(50% - 560px)); width: min(380px, 44vh); }
  .item-price { font-size: 24px; }
  .item-price small { font-size: 13px; }
  .item-hint { font-size: 13px; }
  .chara-pos { right: max(4%, calc(50% - 600px)); bottom: 4%; height: 94%; translate: 0 0; }
  .counter { height: 26%; }

  .lineup {
    top: 84px; left: max(4%, calc(50% - 580px));
    width: min(760px, 56vw); bottom: 200px;
  }
  .lineup-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px 18px; }
  .lu-card { padding: 8px 8px 10px; border-radius: 16px; }
  .lu-img { border-radius: 10px; }
  .lu-title { font-size: 15px; }
  .lu-price { font-size: 22px; }
  .lu-remain { font-size: 13px; }
  .back-btn { height: 36px; font-size: 14px; }

  /* セリフ枠は下中央、選択肢は画面中央 */
  .talk {
    left: 50%; right: auto; width: min(1000px, 92%);
    translate: -50% 0;
    align-items: center;
    padding: 0 0 24px;
  }
  .choices { width: 380px; }
  .choice { min-height: 50px; font-size: 16px; }
  .msg { min-height: 140px; padding: 30px 30px 22px; }
  .msg-text { font-size: 18px; }
  .nameplate { top: -17px; left: 22px; padding: 3px 18px; font-size: 16px; }

  /* 番号選択: 左にパネル、めぐるは右に出したまま */
  .picker {
    left: max(4%, calc(50% - 580px)); right: auto;
    width: min(620px, 52vw);
    top: 84px; bottom: 200px;
  }
  .num-grid { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
  .num { height: 52px; font-size: 18px; }
  .stage.picking .chara-pos { opacity: 1; }
  .stage.picking .avatar { display: none; }
  .stage.picking .msg { padding-left: 30px; min-height: 110px; }
  .stage.picking .msg-text { font-size: 17px; }

  .sheet { width: 600px; margin-left: -300px; }
}

/* スマホ横向きなど、高さが低い画面: セリフ枠と選択肢をコンパクトに */
@media (orientation: landscape) and (max-height: 500px) {
  .topbar { padding-top: calc(6px + var(--safe-t)); }
  .showcase { top: 52px; width: min(200px, 34vh); }
  .counter { height: 22%; }
  .talk { padding-bottom: calc(8px + var(--safe-b)); gap: 6px; }
  .choices { flex-direction: row; flex-wrap: wrap; justify-content: center; width: auto; }
  .choice { min-height: 38px; padding: 4px 14px; font-size: 13px; }
  .msg { min-height: 0; padding: 16px 18px 10px; }
  .msg-text { min-height: 0; font-size: 14px; line-height: 1.6; }
  .picker { top: 52px; bottom: 96px; }
  .lineup { top: 50px; bottom: 90px; }
  .lineup-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .stage.picking .msg { min-height: 0; }
  .num { height: 40px; font-size: 15px; }
}

/* マウス操作のときだけのホバー表現 */
@media (hover: hover) {
  .choice:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(60, 30, 15, .25); }
  .num:not(.sold):not(.cart):not(.sel):hover { border-color: var(--brand); color: var(--brand); }
  .item:hover { transform: rotate(-4deg) translateY(-4px); }
  .lu-card:hover { transform: translateY(-4px) rotate(0); box-shadow: 0 8px 18px rgba(60, 30, 15, .25); }
  .icon-btn:hover, .normal-btn:hover, .back-btn:hover { filter: brightness(.96); }
}

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