:root {
  --pink: #ff6fa3;
  --pink-d: #e8487f;
  --pink-l: #ffe0ea;
  --mint: #7fd8c3;
  --mint-d: #2a9d8f;
  --yellow: #ffe28a;
  --ink: #3b2a3a;
  --muted: #8a7387;
  --card: #ffffff;
  --bg: #fff5f8;
  --red: #e0234e;
  font-family: "Baloo 2", "M PLUS Rounded 1c", "Segoe UI", "Yu Gothic UI", "Hiragino Maru Gothic ProN", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color: var(--ink); overflow: hidden; -webkit-tap-highlight-color: transparent; }
/* Portrait phone game: on wide screens it sits in a phone-shaped column in the middle. */
body { background: radial-gradient(circle at 20% 20%, #ffeaf1 0 8%, transparent 9%) 0 0 / 90px 90px, #f7d6e2; }
button { font-family: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

#app { position: fixed; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100vw, calc(100vh * 0.5625)); display: flex; flex-direction: column; background: var(--bg); box-shadow: 0 0 40px rgba(120,40,80,0.18); overflow: hidden; }
@supports (height: 100dvh) { #app { width: min(100vw, calc(100dvh * 0.5625)); } }
#hud { flex: none; padding: 6px 8px 5px; background: linear-gradient(#fff, #fff0f5); border-bottom: 2px solid #ffd3e2; }
.hud-row { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.hud-row.bars { margin-top: 5px; gap: 8px; }
.chip { background: var(--pink-l); border-radius: 999px; padding: 1px 7px; font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.chip.strong { background: var(--pink); color: #fff; }
.spacer { flex: 1; }
.icon-btn { border: none; background: #fff; border: 2px solid #ffd3e2; border-radius: 10px; width: 32px; height: 28px; font-size: 15px; padding: 0; flex: none; }
.bar { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; }
.bar .label { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.bar .track { flex: 1; height: 10px; background: #f3e3ea; border-radius: 6px; overflow: hidden; min-width: 30px; }
.bar .fill { height: 100%; width: 0; border-radius: 6px; background: var(--mint); transition: width 0.3s, background 0.3s; }
.bar.warn .fill { background: #ffb347; }
.bar.danger .fill { background: var(--red); animation: blink 0.7s infinite; }
@keyframes blink { 50% { opacity: 0.45; } }

#main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#stage { position: relative; flex: 1 1 44%; min-height: 180px; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
#panel { flex: 1 1 56%; overflow-y: auto; padding: 12px; background: #fff; border-top: 2px solid #ffd3e2; }
body.playing #panel, body.playing #hud { display: none; }
body.playing #stage { flex: 1; }

#bubble { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); max-width: min(80%, 360px); background: #fff; border: 3px solid var(--ink); border-radius: 20px; padding: 6px 14px; font-weight: 700; font-size: 16px; text-align: center; pointer-events: none; box-shadow: 0 4px 0 rgba(59,42,58,0.15); }
#bubble::after { content: ""; position: absolute; left: 50%; bottom: -14px; border: 10px solid transparent; border-top-color: var(--ink); transform: translateX(-50%); }

#mgButtons { position: absolute; left: 0; right: 0; bottom: 64px; display: flex; justify-content: space-between; padding: 0 12px; pointer-events: none; gap: 12px; }
#mgButtons.single { justify-content: flex-end; }
#mgButtons button { pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; min-width: 110px; height: 76px; border-radius: 22px; border: 4px solid #fff; background: var(--pink); color: #fff; font-size: 20px; font-weight: 800; box-shadow: 0 6px 0 var(--pink-d); }
#mgButtons button:active, #mgButtons button.down { transform: translateY(4px); box-shadow: 0 2px 0 var(--pink-d); }
#mgTop { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 5px; }
.pill { border: 2px solid #ffd3e2; background: rgba(255,255,255,0.92); border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 14px; }

/* panel content */
h1, h2, h3 { margin: 0.2em 0 0.3em; line-height: 1.15; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
p { margin: 0.35em 0; line-height: 1.4; }
.muted { color: var(--muted); font-size: 14px; }
.logo { font-size: 44px; font-weight: 800; color: var(--pink); text-align: center; text-shadow: 3px 3px 0 #fff, 5px 5px 0 #ffc2d6; margin-top: 8px; }
.center { text-align: center; }
.btn { display: block; width: 100%; border: none; border-radius: 16px; padding: 12px 14px; margin: 8px 0; font-size: 18px; font-weight: 800; background: var(--pink); color: #fff; box-shadow: 0 5px 0 var(--pink-d); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--pink-d); }
.btn.mint { background: var(--mint-d); box-shadow: 0 5px 0 #1d6f65; }
.btn.ghost { background: #fff; color: var(--ink); border: 2px solid #ffd3e2; box-shadow: 0 4px 0 #ffd3e2; }
.btn.small { font-size: 15px; padding: 8px 10px; }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.card { background: #fff; border: 2px solid #ffd3e2; border-radius: 18px; padding: 12px; margin: 10px 0; }
.card.event { background: #fffbea; border-color: #ffe28a; display: flex; gap: 12px; align-items: flex-start; }
.card.event img { width: 84px; height: 84px; flex: none; }
.card.danger { background: #fff0f2; border-color: #ffb3c1; }
.card.good { background: #effbf6; border-color: #b6ead9; }
.warn-line { color: var(--red); font-weight: 800; }
.flash { animation: blink 0.8s infinite; }

.foods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.food { border: 2px solid #ffd3e2; border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 2px; background: #fff; }
.food .top { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 15px; line-height: 1.1; }
.food .ico { font-size: 26px; }
.food .meta { font-size: 12px; color: var(--muted); }
.food .ctl { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.food .ctl button { width: 36px; height: 32px; border-radius: 10px; border: none; background: var(--pink-l); font-size: 20px; font-weight: 800; }
.food .ctl button.plus { background: var(--pink); color: #fff; }
.food .count { font-weight: 800; font-size: 18px; }
.food.has { border-color: var(--pink); background: #fff7fa; }

.meter { position: relative; height: 16px; border-radius: 8px; background: #f3e3ea; overflow: hidden; margin: 6px 0 2px; }
.meter .zone { position: absolute; top: 0; bottom: 0; }
.meter .mark { position: absolute; top: -2px; bottom: -2px; width: 4px; background: var(--ink); border-radius: 2px; transition: left 0.25s; }
.meter-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.games { display: flex; flex-direction: column; gap: 8px; }
.game { display: flex; gap: 10px; align-items: center; text-align: left; width: 100%; border: 2px solid #ffd3e2; border-radius: 16px; background: #fff; padding: 8px 10px; }
.game .ico { font-size: 32px; width: 44px; text-align: center; }
.game .info { flex: 1; }
.game .name { font-weight: 800; font-size: 17px; }
.game .meta { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.game:disabled { opacity: 0.45; }
.game .tag { font-size: 12px; font-weight: 800; background: var(--pink-l); border-radius: 8px; padding: 0 6px; }

.stats { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 15px; }
.stats .v { font-weight: 800; text-align: right; }
.big-num { font-size: 40px; font-weight: 800; text-align: center; line-height: 1; }
.big-num.down { color: var(--mint-d); }
.big-num.up { color: var(--red); }
.quest { display: flex; justify-content: space-between; font-size: 14px; padding: 2px 0; }
.quest.ok { color: var(--mint-d); font-weight: 700; }
.levelup { text-align: center; background: linear-gradient(135deg, #fff3b0, #ffd6e7); border: 3px solid #ffcf5a; border-radius: 18px; padding: 10px; margin: 10px 0; }
.levelup .lv { font-size: 30px; font-weight: 800; color: #e08a00; }
.weights { display: flex; gap: 8px; }
.weights button { flex: 1; border: 2px solid #ffd3e2; background: #fff; border-radius: 14px; padding: 8px 4px; font-weight: 800; font-size: 14px; }
.weights button.on { border-color: var(--pink); background: var(--pink-l); }
.list { margin: 4px 0; padding-left: 18px; }
.list li { margin: 2px 0; }
.bgs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.bgopt { border: 2px solid #ffd3e2; border-radius: 14px; padding: 8px; background: #fff; text-align: center; font-weight: 700; font-size: 14px; }
.bgopt .sw { height: 36px; border-radius: 10px; margin-bottom: 4px; }
.bgopt.on { border-color: var(--pink); background: var(--pink-l); }
.credits { font-size: 12.5px; line-height: 1.45; word-break: break-word; }

#modal { position: fixed; inset: 0; background: rgba(59,42,58,0.45); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
#modal .box { background: #fff; border-radius: 22px; padding: 18px; max-width: 380px; width: 100%; text-align: center; border: 3px solid #ffd3e2; }
#loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: var(--pink); background: var(--bg); z-index: 20; }

.logo-sub { text-align: center; font-weight: 800; color: var(--mint-d); margin: -4px 0 6px; font-size: 17px; }
body.lang-ja .chip { font-size: 12px; }
body.lang-ja #mgButtons button { font-size: 17px; }
