/* 書体：端末の角ゴシック（英数字は Segoe UI、かなは Yu Gothic UI）。
   同梱の Zen Maru Gothic（assets/fonts/、SIL OFL 1.1）は、合う書体がない端末での控え。 */
/* 見出し：しっぽり明朝（SIL Open Font License 1.1。ライセンス文は assets/fonts/shippori/OFL.txt） */
@font-face { font-family: "Shippori Mincho"; font-weight: 600; font-display: swap; src: url(../assets/fonts/shippori/ShipporiMincho-SemiBold.woff2) format("woff2"); }
@font-face { font-family: "Zen Maru Gothic"; font-weight: 500; font-display: swap; src: url(../assets/fonts/ZenMaruGothic-Medium.woff2) format("woff2"); }
@font-face { font-family: "Zen Maru Gothic"; font-weight: 700; font-display: swap; src: url(../assets/fonts/ZenMaruGothic-Bold.woff2) format("woff2"); }
/* 見た目の考え方：ロイヤルブルーの夜に、金の細い線。
   面は深い紺を重ねて奥行きを作り、金は「価値のあるもの・押せるもの」にだけ使う。
   ポポーは印（ロゴ、コイン、アイコンの形）として残す。 */
:root {
  --ink: #070d26; /* いちばん深い紺（左の一覧、絵の地） */
  --night: #0b1438;
  --deep: #111d55;
  --navy: #172a78;
  --royal: #2443b8;
  --azure: #4f7bff;
  --sky: #8fb0ff;
  --ice: #c9d6ff;
  --ivory: #f4f1e6; /* 文字 */
  --gold: #e3c16f;
  --gold-light: #fbeebe;
  --gold-dark: #a47c26;
  --leaf: #7cc98f;
  --danger: #e8637f;
  --muted: #97a3cf;

  --card: rgba(201, 214, 255, .055);
  --card-hi: rgba(201, 214, 255, .1);
  --line: rgba(201, 214, 255, .16);
  --line-gold: rgba(227, 193, 111, .42);
  --gold-fill: linear-gradient(135deg, #fbeebe, #e3c16f 45%, #b98f33);
  --soft: 0 10px 30px rgba(3, 7, 24, .35);
  --lift: 0 6px 16px rgba(3, 7, 24, .45);
  --r: 14px;
  --ease: cubic-bezier(.16, 1, .3, 1); /* すっと減速して止まる */
  --display: "Shippori Mincho", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; /* 見出し */

  /* 以前の名前（各ゲームの部品が使う） */
  --text: var(--ivory);
  --bg: var(--night);
  --panel: var(--card);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--night);
  color: var(--text);
  font: 500 15px/1.5 "Segoe UI Variable Display", "Segoe UI", "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", "Zen Maru Gothic", system-ui, sans-serif;
  user-select: none;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, h3, p { margin: 0; }
h1 { font: 600 24px/1.25 var(--display); letter-spacing: .06em; }
h2 { font: 600 21px/1.3 var(--display); letter-spacing: .06em; }
h3 { font-size: 13.5px; font-weight: 700; letter-spacing: .05em; color: var(--gold-light); display: flex; align-items: center; gap: 7px; }
small, .sub { color: var(--muted); font-size: 12.5px; }
p:empty, .sub:empty, small:empty { display: none; }
img, svg { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.center { text-align: center; }
::selection { background: rgba(227, 193, 111, .35); color: #fff; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
textarea, input { caret-color: var(--gold); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(201, 214, 255, .2); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(227, 193, 111, .5); background-clip: content-box; }

#app { display: flex; height: 100%; }

/* ---- 左：一覧 ---- */
#side {
  width: 244px; flex: none; padding: 16px 12px 12px; overflow: hidden;
  background: linear-gradient(180deg, #0a1233, var(--ink));
  display: flex; flex-direction: column; gap: 12px;
  border-right: 1px solid var(--line-gold);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 4px 10px; border-bottom: 1px solid var(--line); }
.brand strong { display: block; font: 600 12.5px/1.35 var(--display); letter-spacing: .01em; color: var(--gold-light); }
.brand small { letter-spacing: .12em; font-size: 11px; }
.logo { width: 40px; height: 40px; flex: none; }
.games { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 2px 6px; }
.list { display: flex; flex-direction: column; gap: 5px; }
.sect { font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--gold); padding: 8px 6px 0; display: flex; align-items: center; gap: 10px; }
.sect::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-gold), transparent); }
.card {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--ivory);
  transition: background .12s, border-color .12s;
}
.card:hover { background: var(--card); }
/* 選んでいるゲームは、青い面に金の線 */
.card.on { background: linear-gradient(100deg, rgba(79, 123, 255, .34), rgba(36, 67, 184, .12)); border-color: var(--gold); box-shadow: var(--lift); }
.card.locked { border: 1px dashed var(--line); cursor: default; align-items: flex-start; background: none; }
.ctext { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 0; line-height: 1.3; }
.ctext b { font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gold-light); }
.cname { font-size: 12.5px; font-weight: 600; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; color: var(--ice); }
.parents { display: inline-flex; margin-left: auto; }
.parents i { width: 16px; height: 16px; display: block; margin-left: -4px; }
.gicon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; font-size: 24px; line-height: 1; filter: drop-shadow(0 3px 6px rgba(3, 7, 24, .5)); }
.gicon.big { width: 54px; height: 54px; font-size: 38px; }
.navs { display: flex; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.nav {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 6px;
  border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--ice); font-size: 12px; font-weight: 600; letter-spacing: .06em;
}
.nav .gicon { width: 28px; height: 28px; }
.nav:hover { background: var(--card); }
.nav.on { background: linear-gradient(160deg, rgba(79, 123, 255, .3), rgba(36, 67, 184, .1)); border-color: var(--line-gold); color: var(--gold-light); }

/* ---- 右：本体 ---- */
main {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background:
    radial-gradient(900px 520px at 88% -12%, rgba(79, 123, 255, .36), transparent 62%),
    radial-gradient(700px 500px at -6% 108%, rgba(36, 67, 184, .4), transparent 60%),
    linear-gradient(165deg, #14226a, var(--night) 58%);
}
#guide {
  display: flex; align-items: center; gap: 10px; margin: 14px 24px 0; padding: 7px 16px 7px 10px;
  background: var(--card); border: 1px solid var(--line-gold); border-radius: 999px; font-weight: 600; font-size: 13.5px; letter-spacing: .04em;
}
#guide { position: relative; overflow: hidden; }
#guide.done::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(100deg, transparent 30%, rgba(251, 238, 190, .45) 50%, transparent 70%); background-size: 250% 100%; animation: sweep .7s var(--ease); }
.gbadge { width: 24px; height: 24px; flex: none; }
.glabel { display: none; }
#guide .bar { width: 130px; margin-left: auto; flex: none; }
#panel { flex: 1; overflow-y: auto; padding: 18px 24px 36px; display: flex; flex-direction: column; gap: 14px; }

.ghead { display: flex; align-items: center; gap: 14px; }
.grow { flex: 1; }
.right { text-align: right; }
.amount {
  font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; letter-spacing: .01em; color: var(--gold-light);
}
.amount.small { font-size: 18px; }
.gbody { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.play { flex: 1 1 380px; min-width: 300px; }
.play.col { display: flex; flex-direction: column; gap: 12px; }
/* 強化の欄：ふだんは 1 列。画面が広いときは幅を広げ、強化のボタンを 2 列に並べる */
.shop { flex: 0 1 clamp(340px, 32%, 640px); min-width: 280px; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 6px; align-content: start; }
.shop > :not(.up) { grid-column: 1 / -1; }
.shop > h3 { margin-top: 10px; }

.box, .playbox {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px; box-shadow: var(--soft);
}
/* 絵の大きさ：画面が広く、縦にも余裕があるときは、もとの 2 倍まで大きくする（--fit は、絵に使える縦の長さ） */
.playbox { --fit: calc(100dvh - 380px); --scene-w: clamp(480px, calc(var(--fit) * 1.85), 960px); }
.playbox { position: relative; align-items: center; text-align: center; gap: 12px; min-height: 340px; justify-content: center; padding: 18px 16px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; }
.row.center { justify-content: center; }

/* ---- ボタン ---- */
.btn, .mini, .chip {
  border: 1px solid var(--line); background: var(--card-hi); border-radius: 10px; padding: 6px 16px; font-weight: 600; letter-spacing: .04em;
  transition: transform .1s var(--ease), background .15s, border-color .15s;
}
.btn:hover:not(:disabled), .mini:hover:not(:disabled), .chip:hover:not(:disabled) { border-color: var(--line-gold); background: rgba(201, 214, 255, .16); }
.btn:active:not(:disabled), .mini:active:not(:disabled), .chip:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--gold-fill); border-color: transparent; color: var(--ink); font-weight: 700; box-shadow: var(--lift); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, #fff6d6, #efd28a 45%, #c79c3d); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.small { padding: 3px 14px; font-size: 12.5px; align-self: flex-start; margin-top: 6px; }
.btn:disabled, .mini:disabled { opacity: .38; box-shadow: none; filter: saturate(.4); }
.mini { padding: 4px 14px; font-size: 13px; }
/* 酒のしずく（醸造所）：熟成の段を、字ではなく酒の色で示す */
.winedrop { display: inline-block; width: 12px; height: 12px; margin: 3px 4px; border-radius: 0 50% 50% 50%; transform: rotate(45deg); background: radial-gradient(circle at 62% 62%, #fff8 0 16%, transparent 18%), var(--c); box-shadow: 0 0 0 1px rgba(7, 13, 38, .7), 0 0 8px color-mix(in srgb, var(--c) 60%, transparent); vertical-align: middle; }
.dropline { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 22px; }
.mini.on, .chip.on { background: rgba(227, 193, 111, .2); border-color: var(--gold); color: var(--gold-light); }
.chip { display: flex; align-items: center; gap: 6px; padding: 5px 14px 5px 8px; font-size: 13px; }
.chip .gicon { width: 24px; height: 24px; font-size: 18px; filter: none; }
.chip:disabled { opacity: .38; cursor: default; }
.chip.fav { border-color: var(--gold); border-width: 2px; padding: 4px 13px 4px 7px; }

/* 強化の行：買えるものは金の線でふちどる */
.up {
  display: grid; grid-template-columns: 1fr auto; gap: 0 10px; text-align: left; width: 100%;
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 7px 8px 7px 14px;
  transition: transform .1s var(--ease), background .15s, border-color .15s;
}
.up:not(:disabled) { border-color: var(--line-gold); background: linear-gradient(100deg, rgba(79, 123, 255, .2), rgba(201, 214, 255, .05)); }
.up:not(:disabled):hover { border-color: var(--gold); background: linear-gradient(100deg, rgba(79, 123, 255, .34), rgba(201, 214, 255, .1)); }
.up:not(:disabled):active { transform: translateY(1px); }
.up:disabled { color: var(--muted); }
.up:disabled small { color: rgba(151, 163, 207, .7); }
.up.maxed { opacity: .6; }
.up.locked { opacity: .6; border-style: dashed; }
/* 買った瞬間：行を金の光が横切る */
.up.bought::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(100deg, transparent 30%, rgba(251, 238, 190, .5) 50%, transparent 70%); background-size: 250% 100%; animation: sweep .45s var(--ease); }
@keyframes sweep { from { background-position: 100% 0; } to { background-position: 0 0; opacity: 0; } }
.uptop { display: flex; gap: 8px; align-items: baseline; }
.uptop b { font-weight: 700; letter-spacing: .03em; }
.lv { color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.up small { grid-column: 1; }
.up .need { grid-column: 1 / -1; color: var(--danger); }
.cost {
  grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px;
  padding: 3px 11px; border-radius: 8px; background: rgba(7, 13, 38, .45); border: 1px solid var(--line); white-space: nowrap;
}
.up:not(:disabled) .cost { background: var(--gold-fill); border-color: transparent; color: var(--ink); }

/* ---- 各ゲームの遊び場 ---- */
.float {
  position: absolute; pointer-events: none; font-weight: 700; color: var(--gold-light); z-index: 3; font-variant-numeric: tabular-nums;
  transform: translate(-50%, -100%); animation: floatup .8s var(--ease) forwards; text-shadow: 0 1px 2px rgba(3, 7, 24, .95), 0 2px 8px rgba(3, 7, 24, .8);
}
.float.big { font-size: 19px; color: #fff; }
@keyframes floatup { to { transform: translate(-50%, -260%); opacity: 0; } }

.depth { font-weight: 700; font-size: 16px; letter-spacing: .04em; }
.depth[data-st="good"] { color: var(--leaf); }
.depth[data-st="hot"], .depth[data-st="slag"] { color: var(--danger); }
.zone { font-size: 12px; font-weight: 700; padding: 2px 14px; border-radius: 999px; border: 1px solid var(--line-gold); color: var(--gold-light); letter-spacing: .06em; }

.bar { width: 240px; height: 8px; border-radius: 999px; background: rgba(201, 214, 255, .14); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--azure), var(--gold)); border-radius: 999px; }
.bar.thin { height: 6px; }
.bar.wide { width: 100%; }

/* 各ゲームの絵（キャンバス） */
.scene, .field {
  --w: 480; --ar: 1.85;
  width: 100%; max-width: clamp(calc(var(--w) * 1px), calc(var(--fit, 0px) * var(--ar)), calc(var(--w) * 2px));
  border: 1px solid var(--line-gold); border-radius: var(--r); background: var(--ink);
  box-shadow: 0 14px 34px rgba(3, 7, 24, .55); cursor: pointer; touch-action: none;
}
.field { --ar: 1.412; aspect-ratio: 480 / 340; }
.field.maze { --w: 320; --ar: 1; aspect-ratio: 1; }
.field.drop { --w: 400; --ar: 1.25; aspect-ratio: 400 / 320; }
.board { position: relative; width: 100%; max-width: 480px; }
.board .field { display: block; }

.gauge { position: relative; display: flex; width: 100%; max-width: calc(var(--scene-w, 480px) * .875); height: 18px; border: 1px solid var(--line-gold); border-radius: 999px; overflow: visible; background: var(--ink); }
.gauge i { display: block; height: 100%; }
.z-cold { background: #3a5fd0; border-radius: 999px 0 0 999px; }
.z-warm { background: #8a7fd8; }
.z-good { background: var(--gold); }
.z-hot { background: #f08a4a; }
.z-slag { background: var(--danger); border-radius: 0 999px 999px 0; }
.gauge.charge { overflow: hidden; }
.gauge.charge .z-good { border-radius: 999px; background: linear-gradient(90deg, var(--azure), var(--gold)); }
.needle { position: absolute; top: -6px; bottom: -6px; width: 4px; margin-left: -2px; background: #fff; border-radius: 3px; box-shadow: 0 2px 4px rgba(3, 7, 24, .7); }
.needle.auto { background: var(--sky); top: 0; bottom: 0; width: 2px; box-shadow: none; }

/* 大きな操作ボタン */
.bigbtn {
  font-size: 15px; font-weight: 700; letter-spacing: .08em; padding: 10px 28px; border-radius: 12px; border: 1px solid transparent; background: var(--gold-fill); color: var(--ink);
  box-shadow: 0 3px 0 rgba(3, 7, 24, .55), var(--lift); transition: transform .1s var(--ease), box-shadow .1s var(--ease), filter .15s;
}
.bigbtn:hover:not(:disabled) { filter: brightness(1.08); }
/* 押すと沈む：下の影が縮む */
.bigbtn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 rgba(3, 7, 24, .55), 0 2px 6px rgba(3, 7, 24, .45); }
.bigbtn:disabled { opacity: .38; box-shadow: none; filter: saturate(.4); }
.bigbtn.fire { background: linear-gradient(135deg, #ffc48a, #f0864a 50%, #c4503a); }
.bigbtn.water { background: linear-gradient(135deg, #dbe4ff, #8fb0ff 50%, #4f7bff); }
.bigbtn.ghost { background: var(--card-hi); border-color: var(--line-gold); color: var(--ivory); box-shadow: none; }
.blowctl { display: flex; align-items: center; gap: 10px; }
.blowtxt { min-width: 104px; font-weight: 700; }

/* 効果（豊作など） */
.buffs { min-height: 24px; }
.buff { font-size: 12.5px; font-weight: 700; letter-spacing: .06em; padding: 2px 12px; border-radius: 999px; background: rgba(227, 193, 111, .18); border: 1px solid var(--gold); color: var(--gold-light); }

/* 工程・路線の行 */
.fline { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: var(--scene-w, 480px); }
.frow { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 12px; text-align: left; background: rgba(7, 13, 38, .35); }
.frow .gicon { width: 28px; height: 28px; filter: none; }
.frow.slow { border-color: var(--danger); background: rgba(232, 99, 127, .12); }
.frow.surge { border-color: var(--gold); background: rgba(227, 193, 111, .12); }
.fmid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fname { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.ftag { font-style: normal; font-size: 12px; font-weight: 700; padding: 0 8px; border-radius: 999px; background: var(--danger); color: #fff; }
.ftag.hot { background: var(--gold); color: var(--ink); }
.frate { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 84px; text-align: right; color: var(--gold-light); }
.orderbox { width: 100%; max-width: var(--scene-w, 480px); padding: 8px 12px; border: 1px dashed var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.orderbox.active { border-style: solid; border-color: var(--gold); background: rgba(227, 193, 111, .1); color: var(--text); font-weight: 700; }
.crowd { width: 100%; max-width: calc(var(--scene-w, 480px) * .75); display: flex; flex-direction: column; gap: 4px; }

/* ---- タブ、転生ツリー、実績 ---- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab { border: none; border-bottom: 2px solid transparent; background: none; padding: 7px 16px 9px; font-weight: 600; font-size: 13.5px; letter-spacing: .05em; color: var(--muted); margin-bottom: -1px; transition: color .15s, border-color .15s; }
.tabbody, .gbody { animation: arrive .22s var(--ease); }
@keyframes arrive { from { opacity: 0; transform: translateY(4px); } }
.tab:hover { color: var(--ivory); }
.tab.on { color: var(--gold-light); border-bottom-color: var(--gold); }
.tabbody { display: flex; flex-direction: column; gap: 10px; }
.treegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 8px; }
.achgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.ach { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; }
.ach .ticon { filter: grayscale(1); opacity: .35; }
.ach.done { color: var(--text); border-color: var(--line-gold); background: rgba(227, 193, 111, .08); font-weight: 600; }
.ach.done .ticon { filter: none; opacity: 1; }

/* ---- 実験室：2 つを並べて掛け合わせる台 ---- */
.bench { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 0 4px; }
.bench b { font-size: 20px; font-weight: 400; color: var(--gold); }
.slot { width: 76px; height: 76px; padding: 10px; border-radius: 16px; background: rgba(7, 13, 38, .45); border: 1px solid var(--line); display: grid; place-items: center; }
.slot.empty { border-style: dashed; }
.slot.result { width: 92px; height: 92px; border-color: var(--gold); background: radial-gradient(circle, rgba(227, 193, 111, .25), rgba(7, 13, 38, .45) 70%); box-shadow: var(--lift); }
.slot.result.unknown, .slot.result.empty { background: rgba(7, 13, 38, .45); box-shadow: none; border-style: dashed; border-color: var(--line); }
.slot.result.unknown svg { animation: wonder 2.4s ease-in-out infinite; }
@keyframes wonder { 50% { opacity: .55; } }
.linkmark { font-size: 19px; font-weight: 700; color: var(--gold-light); }

/* ---- 本部 ---- */
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.rule { display: flex; flex-direction: column; gap: 0; text-align: left; padding: 7px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.rule:hover:not(:disabled) { border-color: var(--line-gold); }
.rule:disabled { opacity: .45; }
.rule.on { border-color: var(--gold); background: rgba(227, 193, 111, .14); }

/* ---- 解放するゲームを選ぶ ---- */
.pick { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; margin-top: 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ivory); }
.pick:hover:not(:disabled) { border-color: var(--gold); background: rgba(227, 193, 111, .14); }
.pick:disabled { opacity: .45; }
.pick .gicon { width: 28px; height: 28px; font-size: 20px; }
.pick b { font-size: 13px; }

h3.center { justify-content: center; text-align: center; }

/* ---- 知らせと確認 ---- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 30; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px; background: rgba(11, 20, 56, .94); color: var(--ivory); font-weight: 600; letter-spacing: .04em;
  padding: 8px 18px 8px 12px; border-radius: 12px; border: 1px solid var(--line-gold); box-shadow: var(--soft); animation: pop .3s var(--ease);
}
.toast.out { opacity: 0; transform: translateX(12px); transition: opacity .18s, transform .18s; }
.ticon { width: 20px; height: 20px; display: inline-block; flex: none; }
@keyframes pop { from { transform: translateY(8px) scale(.96); opacity: 0; } }
/* 節目の演出（転生、総転生、新世界、エンディング）。絵は js/ui/ceremony.js がキャンバスに描く */
#ceremony { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; cursor: pointer; animation: dim .25s; background: radial-gradient(ellipse at 50% 45%, rgba(20, 34, 110, .93), rgba(4, 8, 26, .97) 70%); }
#ceremony.out { opacity: 0; transition: opacity .25s; pointer-events: none; }
#ceremony.cer-prestige { background: radial-gradient(ellipse at 50% 50%, rgba(20, 34, 110, .72), rgba(4, 8, 26, .86) 70%); }
#ceremony.cer-ending { cursor: default; }
#ceremony canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cer-text { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px; max-width: min(640px, 92vw); text-align: center; text-shadow: 0 2px 14px rgba(3, 7, 24, .9); }
.cer-title { font-family: var(--display); font-size: 20px; letter-spacing: .28em; color: var(--gold); animation: cer-in .6s var(--ease) both; }
.cer-big { font-family: var(--display); font-size: clamp(34px, 6vw, 60px); font-weight: 600; line-height: 1.2; color: var(--gold-light); font-variant-numeric: tabular-nums; animation: cer-in .7s var(--ease) .25s both; }
.cer-sub { font-size: 15px; color: var(--ice); white-space: pre-line; animation: cer-in .7s var(--ease) .45s both; }
.cer-grand .cer-big, .cer-grand .cer-sub { animation-delay: 1.5s; }
.cer-grand .cer-text { margin-top: 34vh; }
.cer-world .cer-big, .cer-world .cer-sub { animation-delay: 2s; }
.cer-ending .cer-text { background: rgba(7, 13, 38, .72); border: 1px solid var(--line-gold); border-radius: var(--r); padding: 28px 34px; gap: 14px; box-shadow: var(--lift); }
.cer-ending .cer-big { font-size: clamp(22px, 3.4vw, 30px); }
.cer-ending .cer-sub { line-height: 1.8; }
.cer-stats { display: grid; grid-template-columns: auto auto; gap: 4px 28px; font-size: 14px; animation: cer-in .7s var(--ease) .8s both; }
.cer-line { display: contents; }
.cer-line span { text-align: right; color: var(--muted); }
.cer-line b { text-align: left; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.cer-credits { font-size: 12px; color: var(--muted); animation: cer-in .7s var(--ease) 1.1s both; }
.cer-btn { margin-top: 6px; animation: cer-in .7s var(--ease) 1.6s both; }
@keyframes cer-in { from { opacity: 0; transform: translateY(10px); } }
#ceremony.still .cer-text > * { animation: none; }
/* 読み込み中の印（回線が遅いとき、画面が出るまでのあいだ）。金の輪がゆっくり回る */
#boot { position: fixed; inset: 0; display: grid; place-items: center; z-index: 40; pointer-events: none; }
#boot i { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line-gold); border-top-color: var(--gold-light); animation: boot-spin 1s linear infinite; }
@keyframes boot-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { #boot i { animation: none; } }
/* 左の札の点：転生のしどき（金）、手を入れてほしい（紅） */
.cdot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-left: auto; opacity: 0; }
.cdot.pp { opacity: 1; background: var(--gold-light); }
.cdot.att { opacity: 1; background: var(--danger); }
/* 金の鳥（ときどき、ゲームの絵に来る客） */
.visitor { position: absolute; z-index: 4; left: 12%; width: 124px; padding: 12px; border: 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(251, 238, 190, .34), rgba(251, 238, 190, 0)); cursor: pointer; filter: drop-shadow(0 5px 6px rgba(3, 7, 24, .6)); animation: visit-fly 9s ease-in-out infinite alternate, visit-bob 1.7s ease-in-out infinite; }
.visitor img { display: block; width: 100%; animation: visit-flap .26s ease-in-out infinite alternate; }
.visitor:hover img { filter: brightness(1.15); }
@keyframes visit-fly { to { left: calc(88% - 124px); } }
@keyframes visit-bob { 50% { translate: 0 -12px; } }
@keyframes visit-flap { to { transform: scaleX(.78); } }
.cdot.bird { opacity: 1; width: 10px; height: 10px; background: var(--gold-light); outline: 2px solid rgba(227, 193, 111, .45); outline-offset: 2px; animation: dot-pulse 1.1s ease-in-out infinite; }
@keyframes dot-pulse { 50% { transform: scale(.7); } }
.hchip.bird { border-color: var(--gold); color: var(--ink); background: var(--gold-fill); font-weight: 700; }
.htile.bird { border-color: var(--gold); }
@media (prefers-reduced-motion: reduce) { .visitor, .visitor img, .cdot.bird { animation: none; } }
/* 司令室 */
.hubflow { width: 100%; max-width: 960px; align-self: center; aspect-ratio: 960 / 230; }
.hubgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.htile { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; padding: 10px 12px; text-align: left; cursor: pointer; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); transition: border-color .15s, background .15s, transform .15s var(--ease); }
.htile:hover, .htile:focus-visible { border-color: var(--line-gold); background: rgba(201, 214, 255, .12); transform: translateY(-1px); outline: none; }
.htile.att { border-color: rgba(240, 122, 146, .6); }
.htile .gicon { width: 40px; height: 40px; }
.htile .ctext { display: flex; flex-direction: column; min-width: 0; }
.htile .ctext b { color: var(--gold-light); font-variant-numeric: tabular-nums; }
.hbar, .hchips, .hflow { grid-column: 1 / -1; }
.hbar { height: 4px; border-radius: 2px; background: rgba(201, 214, 255, .12); overflow: hidden; }
.hbar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--azure), var(--gold)); transition: width .4s var(--ease); }
.hchips { display: flex; flex-wrap: wrap; gap: 5px; min-height: 22px; }
.hchip { font: inherit; font-size: 12px; line-height: 1.4; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--line); background: rgba(7, 13, 38, .5); color: var(--ice); }
.hchip.att { border-color: var(--danger); color: #ffc2cf; }
.hchip.lag { color: var(--muted); }
button.hchip.pp { cursor: pointer; border-color: var(--line-gold); color: var(--gold-light); }
button.hchip.pp:hover { background: rgba(227, 193, 111, .2); }
button.hchip.pp.ripe { background: var(--gold-fill, linear-gradient(180deg, #f6dc8f, #c99a3c)); color: var(--ink); border-color: var(--gold); font-weight: 700; }
.hflow { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 買い物で稼ぎが跳ねた瞬間 */
.boom { position: absolute; left: 50%; top: 42%; z-index: 5; pointer-events: none; display: grid; place-items: center; transform: translate(-50%, -50%); animation: boom-in 1.2s var(--ease) forwards; }
.boom b { font: 600 44px/1 var(--display); color: var(--gold-light); text-shadow: 0 2px 18px rgba(3, 7, 24, .9); font-variant-numeric: tabular-nums; }
.boom small { font-size: 13px; letter-spacing: .2em; color: var(--gold); text-shadow: 0 1px 8px rgba(3, 7, 24, .9); }
.boom i { position: absolute; width: 60px; height: 60px; border-radius: 50%; border: 2px solid var(--gold-light); animation: boom-ring .9s var(--ease) forwards; }
.boom.big { animation-duration: 1.7s; }
.boom.big b { font-size: 68px; }
.boom.big i { border-width: 3px; }
.boom.huge b { font-size: 92px; }
@keyframes boom-in { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); } 14% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); } 26% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -64%) scale(1); } }
@keyframes boom-ring { from { transform: scale(.4); opacity: 1; } to { transform: scale(7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .boom, .boom i { animation: none; } .boom i { display: none; } }
#modal { position: fixed; inset: 0; background: rgba(3, 7, 24, .72); display: grid; place-items: center; z-index: 20; animation: dim .2s; }
@keyframes dim { from { opacity: 0; } }
.dialog {
  background: linear-gradient(165deg, #1a2c7c, #0c1640 70%); border: 1px solid var(--line-gold); border-radius: 18px; padding: 24px; width: min(480px, 92vw);
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px rgba(3, 7, 24, .7); animation: pop .32s var(--ease);
}
.dialog h2 { text-align: center; color: var(--gold-light); }
.dbody { display: flex; flex-direction: column; gap: 8px; }
.shine { width: 84px; height: 84px; align-self: center; font-size: 60px; text-align: center; animation: bob 2.4s ease-in-out infinite; filter: drop-shadow(0 8px 10px rgba(3, 7, 24, .6)); }
@keyframes bob { 50% { transform: translateY(-5px); } }
textarea { width: 100%; font: 12px/1.4 Consolas, monospace; border: 1px solid var(--line); border-radius: 10px; padding: 8px; resize: vertical; user-select: text; background: rgba(7, 13, 38, .6); color: var(--ice); }
input[type="range"] { width: 240px; accent-color: var(--gold); }

/* 新しいゲームが増えた瞬間にはじける、金の粒 */
.burst { position: fixed; left: 50%; top: 45%; z-index: 40; pointer-events: none; }
.burst i { position: absolute; display: block; animation: fly 1s cubic-bezier(.2, .7, .3, 1) forwards; }
.burst .seed { width: 6px; height: 6px; border-radius: 50%; background: var(--gold-light); }
.burst .leaf { width: 12px; height: 12px; background: var(--gold); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
@keyframes fly { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }

/* 動きを減らす設定：位置の動きは止め、色と濃さの変化だけ残す */
@media (prefers-reduced-motion: reduce) {
  .shine, .slot.result.unknown svg, .tabbody, .gbody, .burst i, .cslot.copy.fresh { animation: none; }
  .burst { display: none; }
  .toast, .dialog { animation: dim .2s; }
  .float { animation: fadeout .8s forwards; }
  .btn, .mini, .chip, .up, .bigbtn { transition: background .15s, border-color .15s; }
}
@keyframes fadeout { to { opacity: 0; } }

/* 本部：ゲームごとの成長度と、コインで払う費用 */
.digits { display: flex; flex-wrap: wrap; gap: 6px; }
.digit { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px 2px 4px; border-radius: 999px; background: rgba(7, 13, 38, .4); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.digit i { width: 22px; height: 22px; display: block; }
.cost.coin::before { content: ""; display: inline-block; width: 15px; height: 15px; margin: 0 4px -3px 0; background: url(../assets/img/royal/coin.svg) center / contain no-repeat; }
.cost.star::before { content: ""; display: inline-block; width: 14px; height: 14px; margin: 0 4px -2px 0; background: url(../assets/img/royal/star.svg) center / contain no-repeat; }
.up:not(:disabled) .cost.coin::before, .up:not(:disabled) .cost.star::before { filter: brightness(.35); }
.wshop { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.stat { display: flex; gap: 18px; flex-wrap: wrap; }
.stat div { display: flex; flex-direction: column; }
.stat b { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gold-light); }
.stat small { letter-spacing: .04em; font-size: 12px; }

/* ---- 複製：本体 → 写し ---- */
.cflow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cslots { display: flex; gap: 6px; flex-wrap: wrap; }
.cslot { min-width: 74px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 12px; background: rgba(7, 13, 38, .4); display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 12px; line-height: 1.25; }
.cslot .gicon { width: 28px; height: 28px; }
.cslot small { font-size: 12px; }
.cslot b { color: var(--gold-light); font-variant-numeric: tabular-nums; }
.cslot.src { border-color: var(--gold); }
.cslot.copy .gicon { opacity: .6; }
.cslot.copy.weak { border-color: var(--danger); }
.cslot.copy.fresh { animation: pop .35s ease-out; }
.cslot.empty { border-style: dashed; justify-content: center; min-height: 62px; color: var(--muted); background: none; }
.carrow { font-size: 16px; font-weight: 400; color: var(--gold); }
.ctotal { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.road { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
