:root {
    --bg: #f6eef7;
    --ink: #4a3350;
    --sub: #8b6f92;
    --card: #ffffff;
    --line: #e6d6ea;
    --pink: #f48fb1;
    --mint: #8fd8c4;
    --lav: #b79ad6;
    --accent: #ff8fab;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
    font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
    -webkit-tap-highlight-color: transparent;
    background:
        radial-gradient(circle at 12% 8%, #fff6fb 0 60px, transparent 61px),
        radial-gradient(circle at 88% 14%, #f1fbf7 0 80px, transparent 81px),
        var(--bg);
}
.app { max-width: 980px; margin: 0 auto; padding: 10px 16px 28px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 10px; }
.top h1 { font-size: clamp(17px, 4.2vw, 24px); margin: 0; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.logo { font-size: 1.2em; }
.title-wrap { display: flex; align-items: center; gap: 14px; min-width: 0; flex-wrap: wrap; row-gap: 4px; }
/* なまえ（タイトルの となり）：名札ふう */
.pd-name {
    display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 5px 0 6px; white-space: nowrap;
    background: linear-gradient(180deg, #fff 0%, #fff5f9 100%); border: 2px solid #f4c4d7; border-radius: 12px 999px 999px 12px;
    box-shadow: 0 2px 0 #efb7cd, 0 5px 12px rgba(224, 85, 127, .16); position: relative;
}
.pd-name::before { content: ""; position: absolute; left: -2px; top: -2px; bottom: -2px; width: 8px; border-radius: 12px 0 0 12px; background: linear-gradient(180deg, #ff9fbc, #f06d97); }
.pd-tag { position: relative; width: 22px; height: 22px; margin-left: 6px; border-radius: 50% 50% 46% 46%; background: #fffdf6; border: 2px solid #c9b79d; flex-shrink: 0; }
.pd-tag::before, .pd-tag::after { content: ""; position: absolute; top: -8px; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid #c9b79d; }
.pd-tag::before { left: -4px; transform: rotate(-18deg); } .pd-tag::after { right: -4px; transform: rotate(18deg); }
.pd-tag i { position: absolute; left: 3px; right: 3px; top: 5px; height: 12px; background: radial-gradient(circle at 2.5px 2.5px, #2f2a30 0 2px, transparent 2.4px), radial-gradient(circle at calc(100% - 2.5px) 2.5px, #2f2a30 0 2px, transparent 2.4px), radial-gradient(ellipse at 50% 8px, #2f2a30 0 2.4px, transparent 2.8px); }
.pd-name b { font-size: 17px; color: #d94c7a; letter-spacing: .06em; max-width: 9.5em; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 0 #fff; }
.pd-edit { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #f6cfe0; background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; box-shadow: 0 2px 0 #f2c6d8; transition: transform .12s; }
.pd-edit svg { width: 13px; height: 13px; fill: #e0557f; }
.pd-edit:hover { transform: rotate(-12deg) scale(1.08); }
.pd-edit:active { transform: translateY(1px); box-shadow: none; }
.rename-cost { margin: 0 0 4px; padding: 10px 12px; border-radius: 14px; background: #fff4f8; border: 2px dashed #f6c8da; font-size: 13px; color: var(--sub); line-height: 1.6; text-align: center; }
.rename-cost .rc-hearts { display: inline-flex; gap: 2px; vertical-align: -3px; margin: 0 2px; }
.rename-cost .rc-hearts svg { width: 17px; height: 16px; }
.primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.name-field input:disabled { background: #f8f2f6; color: #b9a6bd; }
.rename-cost.ng { background: #fff7f2; border-color: #f7cdb5; color: #b5654a; }
/* ペットになってからの日数・ペット度（タイトルの となり） */
.pet-days { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.pd-day, .pd-love {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 8px;
    background: linear-gradient(180deg, #fff 0%, #fff7fb 100%); border: 2px solid #f6d3e2; border-radius: 999px;
    box-shadow: 0 2px 0 #f2c6d8, 0 4px 10px rgba(244, 143, 177, .14); font-size: 12px; color: var(--sub);
}
.pd-lbl { letter-spacing: .02em; }
.pd-day b { font-size: 15px; color: #e0557f; letter-spacing: .02em; }
.pd-cal { position: relative; width: 18px; height: 18px; border-radius: 5px; background: #fff; border: 2px solid #f48fb1; overflow: hidden; flex-shrink: 0; }
.pd-cal::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: #f48fb1; }
.pd-cal i { position: absolute; left: 3px; right: 3px; bottom: 3px; height: 4px; border-radius: 2px; background: repeating-linear-gradient(90deg, #f7b6cc 0 3px, transparent 3px 5px); }
.pd-hearts { display: inline-flex; gap: 2px; }
.pd-heart { width: 19px; height: 18px; display: block; filter: drop-shadow(0 1px 0 rgba(224, 85, 127, .18)); }
.pd-heart.pop { animation: pdpop .7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pdpop { 0% { transform: scale(1); } 35% { transform: scale(1.45) rotate(-8deg); } 100% { transform: scale(1); } }
@media (max-width: 560px) {
    /* スマホ：1行目に タイトルとボタン、2行目に 日数とハート */
    .top { flex-wrap: wrap; row-gap: 6px; }
    .title-wrap { display: contents; }
    .top h1 { order: 1; }
    .top-buttons { order: 2; margin-left: auto; }
    .top::after { content: ""; order: 3; flex-basis: 100%; height: 0; } /* ここで改行：2行目に なまえ・日数・ハート */
    .pd-name { order: 4; height: 30px; }
    .pd-name b { font-size: 15px; }
    .pet-days { order: 5; gap: 6px; flex-wrap: wrap; }
    .pd-day, .pd-love { height: 26px; padding: 0 9px 0 6px; font-size: 11px; gap: 4px; }
    .pd-day b { font-size: 13px; }
    .pd-cal { width: 15px; height: 15px; }
    .pd-heart { width: 16px; height: 15px; }
}
.top-buttons { display: flex; gap: 6px; flex-shrink: 0; }
.chip {
    border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px;
    padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; box-shadow: 0 2px 0 var(--line);
}
.chip:active { transform: translateY(1px); box-shadow: none; }

.stage-wrap {
    position: relative; border-radius: 22px; overflow: hidden;
    border: 4px solid #fff; box-shadow: 0 6px 0 #e3cfe8, 0 10px 24px rgba(120, 80, 140, .18);
    background: #fdf6ee; touch-action: none; user-select: none; -webkit-user-select: none;
}
#room { display: block; width: 100%; height: auto; cursor: none; }
.bubble {
    position: absolute; left: 12px; top: 12px; max-width: min(72%, 520px);
    background: rgba(255, 255, 255, .94); border: 2px solid #f0dcef; border-radius: 16px 16px 16px 4px;
    padding: 8px 12px; font-size: clamp(12px, 2.6vw, 15px); line-height: 1.5; display: flex; gap: 8px; align-items: center;
    box-shadow: 0 3px 0 rgba(200, 160, 210, .35); pointer-events: none; transition: opacity .6s;
}
.bubble-face { font-size: 1.4em; }
.toast {
    position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
    background: rgba(74, 51, 80, .88); color: #fff; padding: 6px 14px; border-radius: 999px; font-size: 13px;
    pointer-events: none; white-space: nowrap; transition: opacity .3s;
}
.hidden { display: none !important; }

.toolbar { display: flex; gap: 8px; margin: 12px 0 10px; }
.tool {
    flex: 1; border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 16px;
    padding: 8px 6px; font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px;
    box-shadow: 0 3px 0 var(--line); transition: transform .1s;
}
.tool .ti { font-size: 22px; line-height: 1; }
.tool .tl { font-size: 12px; }
.tool.active { border-color: var(--accent); background: #fff0f5; box-shadow: 0 3px 0 #ffc2d4; }
.tool:active { transform: translateY(2px); box-shadow: none; }

.status { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 12px 14px; box-shadow: 0 3px 0 var(--line); }
.stage-name { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.sn-label { font-size: 12px; color: var(--sub); }
.stage-name b { font-size: 18px; }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 14px; }
.meter { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.ml { width: 4.5em; color: var(--sub); flex-shrink: 0; }
.bar { flex: 1; height: 10px; background: #f3e9f5; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .4s; }
.b-trust { background: linear-gradient(90deg, #ffb3c9, #ff6f99); }
.b-fear { background: linear-gradient(90deg, #b8c4ff, #7b88e8); }
.b-full { background: linear-gradient(90deg, #c8eea0, #79c95a); }
.b-energy { background: linear-gradient(90deg, #ffe7a3, #ffc04d); }
.b-mischief { background: linear-gradient(90deg, #ffd0b0, #ff9a5c); }
.days { margin-top: 10px; font-size: 12px; color: var(--sub); }
.link { border: 0; background: none; color: var(--sub); text-decoration: underline; font: inherit; cursor: pointer; padding: 0; margin-left: 8px; }

.modal { position: fixed; inset: 0; background: rgba(74, 51, 80, .35); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal-box { background: #fff; border-radius: 22px; padding: 20px 22px; max-width: 460px; width: 100%; border: 3px solid #f3dff0; box-shadow: 0 8px 0 #ead3ee; }
.modal-box h2 { margin: 0 0 10px; font-size: 19px; }
.howto { padding-left: 1.1em; margin: 0 0 10px; line-height: 1.7; font-size: 14px; }
.howto small { color: var(--sub); }
.note { font-size: 13px; color: var(--sub); }
.intro-box { text-align: center; }
.intro-box p { line-height: 1.8; }
.primary {
    border: 0; background: linear-gradient(180deg, #ff9fbb, #ff7aa0); color: #fff; font: inherit; font-weight: bold;
    padding: 10px 26px; border-radius: 999px; cursor: pointer; box-shadow: 0 4px 0 #e05f86; margin-top: 6px;
}
.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #e05f86; }

@media (max-width: 520px) {
    .app { padding: 8px 12px 24px; }
    .bubble { left: 8px; top: 8px; max-width: 86%; padding: 6px 10px; }
    .tool .tl { font-size: 11px; }
}

/* v2 */
.bubble-body { display: flex; flex-direction: column; }
.bubble-name { font-size: 11px; color: #c06f93; letter-spacing: .05em; }
.toolbar { flex-wrap: wrap; }
.tool { min-width: calc(33.3% - 6px); }
@media (min-width: 640px) { .tool { min-width: 0; } }
.tool-help { font-size: 12px; color: var(--sub); background: #fff; border: 2px dashed var(--line); border-radius: 12px; padding: 6px 10px; margin: 0 0 10px; line-height: 1.6; }
.panels { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
@media (max-width: 700px) { .panels { grid-template-columns: 1fr; } }
.b-clean { background: linear-gradient(90deg, #bfe9ff, #5cbcf0); }
.tricks { margin-top: 8px; font-size: 12px; color: var(--sub); display: flex; gap: 8px; flex-wrap: wrap; }
.trick { background: #fff4f8; border: 1px solid #f6d3e1; border-radius: 999px; padding: 2px 10px; }
.diary { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 10px 14px; box-shadow: 0 3px 0 var(--line); }
.diary h3 { margin: 0 0 6px; font-size: 14px; }
.diary ol { list-style: none; margin: 0; padding: 0; max-height: 170px; overflow: auto; font-size: 12px; line-height: 1.7; }
.diary li { border-bottom: 1px dotted #ecdcef; padding: 2px 0; }
.diary li time { color: var(--sub); margin-right: 6px; font-variant-numeric: tabular-nums; }
.diary li.big { color: #d2558a; font-weight: bold; }
.name-field { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--sub); }
.name-field input { display: block; margin: 6px auto 0; width: 70%; font: inherit; font-size: 16px; text-align: center; padding: 8px 10px; border: 2px solid #f3cfe0; border-radius: 12px; outline: none; }
.name-field input:focus { border-color: var(--accent); }

/* スマホ */
#room { touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
@media (max-width: 600px) {
    .app { padding: 6px 0 20px; }
    .top { padding: 0 12px; margin: 2px 0 6px; }
    .top h1 { font-size: 16px; }
    .chip { padding: 5px 10px; font-size: 12px; }
    .stage-wrap { border-radius: 0; border-left: 0; border-right: 0; box-shadow: 0 4px 0 #e3cfe8; }
    .bubble { left: 6px; top: 6px; max-width: calc(100% - 12px); font-size: 12px; padding: 5px 9px; gap: 6px; border-radius: 12px 12px 12px 4px; }
    .bubble-face { font-size: 1.2em; }
    .toast { font-size: 12px; bottom: 8px; max-width: calc(100% - 20px); white-space: normal; text-align: center; }
    .toolbar { padding: 0 12px; gap: 6px; margin: 10px 0 8px; }
    .tool { padding: 6px 4px; border-radius: 14px; }
    .tool .ti { font-size: 20px; }
    .tool-help { margin: 0 12px 10px; font-size: 11px; }
    .panels { padding: 0 12px; }
    .meters { grid-template-columns: 1fr 1fr; }
    .ml { width: 3.8em; }
}
.ml { white-space: nowrap; }
@media (max-width: 600px) {
    .top h1 { font-size: 15px; white-space: nowrap; }
    .logo { font-size: 1.1em; }
    .ml { width: 4.4em; font-size: 11px; }
    .meter { gap: 6px; }
}

/* このゲームについて */
.about { margin-top: 16px; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 14px 18px; box-shadow: 0 3px 0 var(--line); font-size: 14px; line-height: 1.8; }
.about h2 { font-size: 17px; margin: 0 0 6px; }
.about h3 { font-size: 15px; margin: 14px 0 4px; }
.about p { margin: 6px 0; }
.about ul { padding-left: 1.1em; margin: 4px 0; }
.faq dt { font-weight: bold; margin-top: 8px; }
.faq dd { margin: 2px 0 0 1em; color: #6a5470; }
.noscript { text-align: center; color: #c0577f; }
@media (max-width: 600px) { .about { margin: 16px 12px 0; padding: 12px 14px; font-size: 13px; } }

/* PC：左＝メニュー、右＝ゲーム。スクロールなしで全部見えるように */
@media (min-width: 900px) {
    .app { max-width: 1560px; padding: 8px 18px 24px; }
    .top { margin: 0 0 8px; }
    .layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
    .game { order: 2; display: flex; justify-content: center; }
    .side { order: 1; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 70px); overflow: auto; padding-bottom: 4px; }
    .stage-wrap { width: min(100%, calc((100vh - 80px) * 960 / 620)); }
    .toolbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; }
    .tool { min-width: 0; padding: 6px 4px; }
    .tool .ti { font-size: 20px; }
    .tool-help { margin: 0; }
    .panels { display: flex; flex-direction: column; gap: 10px; }
    .status { padding: 10px 12px; }
    .stage-name { margin-bottom: 6px; }
    .meters { grid-template-columns: 1fr; gap: 5px; }
    .diary { flex: 1; min-height: 0; }
    .diary ol { max-height: 150px; }
    .about { margin-top: 24px; }
}

/* データの引きつぎ */
.sync { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 10px 14px; box-shadow: 0 3px 0 var(--line); font-size: 12px; }
.sync h3 { margin: 0 0 4px; font-size: 14px; }
.sync p { margin: 2px 0 6px; line-height: 1.6; }
.sync-note { color: var(--sub); }
.sync-user { font-weight: bold; word-break: break-all; }
.sync-state { color: var(--sub); }
.gsi-btn { min-height: 36px; }
.choice { display: block; width: 100%; text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 12px; margin: 8px 0; font: inherit; cursor: pointer; color: var(--ink); }
.choice:hover { border-color: var(--accent); background: #fff6fa; }
.choice b { display: block; margin-bottom: 2px; }
.choice span { font-size: 12px; color: var(--sub); }
@media (max-width: 899px) { .sync { margin: 0; } }

/* おへやの切りかえ */
.scenes { display: flex; gap: 6px; }
.scene-btn { flex: 1; border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 4px; font: inherit; font-size: 12px; cursor: pointer; box-shadow: 0 2px 0 var(--line); white-space: nowrap; }
.scene-btn.active { border-color: #8fc7a0; background: #effaf2; box-shadow: 0 2px 0 #bfe3c8; font-weight: bold; }
@media (max-width: 899px) { .scenes { padding: 0 12px; margin-bottom: 8px; } }

/* PC：メニューを画面の高さにおさめる */
@media (min-width: 900px) {
    .side { gap: 8px; }
    .tool { padding: 4px 4px; }
    .tool .ti { font-size: 18px; }
    .tool-help { font-size: 11px; padding: 5px 8px; line-height: 1.5; }
    .status { padding: 8px 12px; }
    .meters { grid-template-columns: 1fr 1fr; gap: 4px 10px; }
    .ml { width: 3.6em; font-size: 11px; }
    .stage-name { margin-bottom: 4px; }
    .stage-name b { font-size: 16px; }
    .tricks { margin-top: 6px; }
    .days { margin-top: 6px; }
    .sync { padding: 8px 12px; }
    .sync h3, .diary h3 { font-size: 13px; margin-bottom: 2px; }
    .sync p { margin: 0 0 4px; }
    .diary { padding: 8px 12px; }
    .diary ol { max-height: 88px; }
}

/* なまえ */
.name-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.name-row b { font-size: 16px; color: #c0577f; }
.name-row .link { margin-left: auto; font-size: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
.modal-actions .primary { margin-top: 0; }
.trick-hint { font-size: 11px; color: var(--sub); align-self: center; }
.name-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.name-row b#pet-name-show { font-size: 16px; color: #c0577f; }
.name-row .sn-label { margin-left: 8px; }
.name-row b#stage-name { font-size: 15px; }
.rename-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; font-size: 12px; padding: 1px 7px; cursor: pointer; }
.status > .stage-name { display: none; }
.name-row { flex-wrap: nowrap; }
.name-row .sn-label { display: none; }
.name-row b#stage-name { margin-left: auto; font-size: 12px; background: #fff0f5; border: 1px solid #f6d3e1; border-radius: 999px; padding: 2px 10px; white-space: nowrap; color: var(--ink); }
.tricks { flex-wrap: nowrap; align-items: center; }
.trick-hint { white-space: nowrap; }

/* 芸 */
button.trick { cursor: pointer; font: inherit; font-size: 12px; color: var(--ink); }
button.trick:hover { border-color: var(--accent); }
.trick-list { list-style: none; padding: 0; margin: 8px 0 12px; max-height: 55vh; overflow: auto; }
.trick-list li { border-bottom: 1px dotted #ecdcef; padding: 6px 2px; }
.tl-top { font-weight: bold; }
.tl-stars { color: #f2a33a; letter-spacing: 1px; }
.tl-how { font-size: 12px; color: var(--sub); margin-top: 2px; }

/* みにしば：3D の部屋をはめる場所 */
#stage { aspect-ratio: 960 / 620; }
#stage canvas { cursor: none; }
#night { position: absolute; inset: 0; background: rgba(70, 60, 140, .16); pointer-events: none; opacity: 0; transition: opacity 1.2s, background-color .8s; mix-blend-mode: multiply; z-index: 2; }
#night.on { opacity: 1; }
#night.lit { background: rgba(236, 196, 140, .16); }       /* 夜に 電気を つけた：すこし あたたかい色・昼より すこし くらい */
#night.dayoff { background: rgba(80, 80, 120, .06); }       /* 昼に 電気を けした：ちがいは ちいさく */
#fade { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .5s; z-index: 3; }
#fade.on { opacity: .9; transition: none; }
.bubble { z-index: 4; }
.toast { z-index: 5; }
.cursor-ico { position: absolute; left: 0; top: 0; pointer-events: none; font-size: 30px; line-height: 1; z-index: 6; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .25)); transform: translate(-30%, -10%); }
.credit { margin-top: 14px; text-align: center; font-size: 11px; color: var(--sub); }
.credit a { color: var(--sub); }
.tool .tl { white-space: nowrap; }

/* 確かめ用（?debug=1）の一覧 */
#panel { position: fixed; right: 0; top: 0; bottom: 0; width: 330px; overflow-y: auto; background: rgba(255, 255, 255, .96); border-left: 2px solid var(--line); padding: 8px 10px 32px; font-size: 12px; z-index: 20; }
#panel[hidden] { display: none; }
#panel h3 { margin: 10px 0 4px; font-size: 12px; color: #9b6b8a; border-bottom: 1px solid var(--line); }
#panel button { margin: 2px 2px 2px 0; padding: 4px 7px; font-size: 12px; border: 1px solid var(--line); background: #fff8fb; border-radius: 6px; cursor: pointer; color: var(--ink); }
#panel button:hover { background: #ffe9f1; }
#panel button.on { background: #ffd0e0; }
#panel label { display: block; margin: 4px 0; }
#panel input[type=range] { width: 150px; vertical-align: middle; }
body.debug .app { margin-right: 340px; margin-left: 0; max-width: none; }
@media (max-width: 899px) { body.debug .app { margin-right: 0; } #panel { position: static; width: auto; } }

/* スマホ：指で あそべる ように */
html, body { -webkit-text-size-adjust: 100%; touch-action: manipulation; overscroll-behavior-y: none; }
.stage-wrap, #stage canvas { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; }
.stage-wrap * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.bubble, .toast, .cursor-ico { -webkit-touch-callout: none; }
/* 指で おせる 大きさ（44px 以上） */
.chip { min-height: 44px; padding: 8px 16px; }
.tool { min-height: 52px; }
.scene-btn { min-height: 44px; padding: 8px 6px; }
.rename-btn { min-width: 44px; min-height: 44px; font-size: 16px; }
.primary { min-height: 44px; }
.link { min-height: 44px; padding: 10px 4px; display: inline-flex; align-items: center; }
.pd-edit { position: relative; }
.pd-edit::after { content: ""; position: absolute; left: -9px; right: -9px; top: -9px; bottom: -9px; }
.trick { min-height: 44px; padding: 8px 14px; }
.modal-actions .chip, .modal-actions .primary { min-width: 96px; }
/* iPhone の切り欠き・下のバー */
.app { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(28px, env(safe-area-inset-bottom)); }
.modal { padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.modal-box { max-height: calc(100dvh - 32px); overflow-y: auto; }
.toast { bottom: max(14px, env(safe-area-inset-bottom)); }
@media (max-width: 520px) { .app { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); } }
/* 横向きの スマホ：3D の画面を 高さに あわせる */
/* 横向きの スマホ：3D の画面は 画面の高さ いっぱい（上のところは スクロールで 外へ）。横も その分 ひろがる */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 899px) { #stage { max-height: none; aspect-ratio: 960 / 540; width: min(100%, calc((100dvh - 8px) * 960 / 540)); margin: 0 auto; } }

/* 吹き出し・トーストは、柴犬と 電気のスイッチから はなれた がわ（上か 下）に でる */
.bubble.low { top: auto !important; bottom: 8px; border-radius: 12px 12px 4px 12px; }
.toast.high { bottom: auto; top: 8px; }

.bubble { font-size: 12px; }
@media (max-width: 560px) { .bubble { font-size: 11px; padding: 4px 8px; } .bubble-face { font-size: 1.1em; } }
