:root {
  --bg1: #2b1055;
  --bg2: #7597de;
  --panel: rgba(255, 255, 255, 0.95);
  --ink: #2a2440;
  --muted: #7a7394;
  --primary: #ff5a8a;
  --primary-d: #d83d6d;
  --accent: #ffc93c;
  --ok: #2ecc8f;
  --line: #e6e1f2;
  --radius: 18px;
  font-family: 'M PLUS Rounded 1c', system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: linear-gradient(160deg, var(--bg1), #5d3a9b 45%, var(--bg2));
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
input, select, textarea { user-select: text; font: inherit; }

#bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
#bg span {
  position: absolute; bottom: -80px; border-radius: 30%;
  opacity: .22; animation: floatUp linear infinite;
}
@keyframes floatUp {
  to { transform: translateY(-120vh) rotate(360deg); }
}

.conn {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
  background: #222; color: #fff; padding: 6px 16px; border-radius: 99px;
  font-size: 14px; z-index: 50; transition: opacity .3s;
}
.conn.ok { opacity: 0; pointer-events: none; }
.noscript { position: relative; z-index: 80; max-width: 720px; margin: 40px auto; padding: 24px; background: #fff; border-radius: 18px; line-height: 1.8; }
body.is-test::before {
  content: '🧪 テスト環境（データは本番と別）'; position: fixed; top: 0; left: 0; z-index: 70;
  background: #ff6b00; color: #fff; font-weight: 800; font-size: 12px; padding: 3px 12px;
  border-bottom-right-radius: 10px; pointer-events: none;
}

/* ---------- 画面 ---------- */
.screen {
  position: fixed; inset: 0; display: none; flex-direction: column;
  padding: 16px; overflow-y: auto;
}
.screen.active { display: flex; animation: screenIn .35s ease; }
@keyframes screenIn { from { opacity: 0; transform: translateY(12px); } }

.bar {
  display: flex; align-items: center; gap: 12px; margin: 0 auto 16px;
  width: 100%; max-width: 1100px;
}
.bar h2 { flex: 1; text-align: center; margin: 0; color: #fff; font-size: clamp(20px, 4vw, 30px); text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.bar-spacer { flex: 1; }
.bar > .bar-spacer { flex: 0 0 90px; }

/* ---------- ボタン ---------- */
.btn {
  font: inherit; font-weight: 800; font-size: 18px; color: var(--ink);
  background: #fff; border: none; border-radius: 14px; padding: 12px 22px;
  box-shadow: 0 5px 0 #c9c2dd; cursor: pointer;
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #c9c2dd; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 5px 0 var(--primary-d); }
.btn.primary:active { box-shadow: 0 1px 0 var(--primary-d); }
.btn.ok { background: var(--ok); color: #fff; box-shadow: 0 5px 0 #1f9c6b; }
.btn.danger { background: #ff6b6b; color: #fff; box-shadow: 0 5px 0 #c94545; }
.btn.big { font-size: 24px; padding: 16px 30px; }
.btn.tour {
  background: linear-gradient(135deg, #ffe066, #ffb400); color: #5a3a00; box-shadow: 0 5px 0 #c98a00;
  display: flex; flex-direction: column; align-items: center; line-height: 1.2; position: relative; overflow: hidden;
}
.btn.tour:active { box-shadow: 0 1px 0 #c98a00; }
.btn.tour small { font-size: 13px; font-weight: 700; opacity: .8; margin-top: 2px; }
.btn.tour::after {
  content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  transform: skewX(-20deg); animation: shine 3s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.xfer { border-top: 3px dashed var(--line); margin: 16px 0; padding-top: 12px; }
.xfer h3 { margin: 0 0 4px; font-size: 17px; }
.xfer .hint { text-align: left; margin: 0 0 10px; font-size: 13px; }
.xfer-code { background: #f3f0fa; border-radius: 14px; padding: 12px; margin: 10px 0; text-align: center; }
.xfer-code .code-big { font-size: 30px; font-weight: 800; letter-spacing: .12em; margin-bottom: 8px; user-select: all; }
.xfer-code .hint { text-align: center; margin: 8px 0 0; }
.xfer-in { display: flex; gap: 8px; margin-top: 10px; }
.xfer-in input { flex: 1; min-width: 0; font: inherit; font-size: 18px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; border: 3px solid var(--line); border-radius: 12px; padding: 6px 10px; }
.title-links { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; align-items: center; font-size: 13px; }
.title-links a { color: #fff; opacity: .8; }
.lang-btn { font: inherit; font-weight: 700; font-size: 13px; background: rgba(255,255,255,.18); color: #fff; border: none; border-radius: 99px; padding: 4px 12px; cursor: pointer; }
.invite-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; width: 100%; max-width: 1100px; margin: -6px auto 14px; }
.btn.invite { background: var(--accent); box-shadow: 0 4px 0 #c98a00; }
.rate-box { background: #f6f3fc; border-radius: 16px; padding: 10px; margin-bottom: 12px; }
.rate-q { font-weight: 800; font-size: 15px; }
.rate-stars { display: flex; justify-content: center; gap: 4px; }
.rate-stars button { font-size: 32px; line-height: 1; border: none; background: none; cursor: pointer; color: #d9d2ea; padding: 2px 4px; transition: transform .1s; }
.rate-stars button.on { color: #ffb400; }
.rate-stars button:hover { transform: scale(1.2); }
.rate-note { font-size: 12px; color: var(--muted); min-height: 1.2em; }
.share-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
.player-list li .more { border: none; background: none; font-size: 18px; cursor: pointer; padding: 0 4px; color: var(--muted); }
.player-list li.muted .nm { text-decoration: line-through; opacity: .6; }
.player-menu { position: fixed; z-index: 55; background: #fff; border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.3); padding: 6px; display: flex; flex-direction: column; min-width: 160px; }
.player-menu button { font: inherit; font-weight: 700; text-align: left; border: none; background: none; padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.player-menu button:hover { background: #f3f0fa; }
.report-reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.name-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.name-row .name-label { font-weight: 800; font-size: 14px; white-space: nowrap; }
.name-row input { flex: 1; min-width: 0; font: inherit; font-weight: 700; font-size: 16px; border: 3px solid var(--line); border-radius: 12px; padding: 6px 10px; }
.name-row input:focus { outline: none; border-color: var(--primary); }
.name-row input:disabled { background: #f3f0fa; color: var(--muted); }
.menu-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu-pair .btn { font-size: 17px; padding: 12px 6px; white-space: nowrap; }
.btn.quick-btn { background: #3ecf8e; color: #fff; box-shadow: 0 5px 0 #23a36b; }
.btn.quick-btn:active { box-shadow: 0 1px 0 #23a36b; }
.btn.code-join-btn { background: #fff; border: 3px solid #d9cff0; font-size: 19px; }
.join-card { text-align: center; }
.join-card .hint { margin: 0 0 14px; }
.join-code-in {
  width: 100%; font: inherit; font-size: 40px; font-weight: 800; letter-spacing: .35em; text-align: center;
  border: 4px solid var(--line); border-radius: 18px; padding: 10px 0 10px .35em; margin-bottom: 18px;
}
.join-code-in:focus { outline: none; border-color: var(--primary); }
.room-item .tour-sub { color: #c98a00; font-size: 13px; }
.btn.small { font-size: 15px; padding: 8px 14px; box-shadow: 0 4px 0 #c9c2dd; }
.btn.wide { width: 100%; }

.pill {
  display: inline-block; background: var(--accent); color: var(--ink); border-radius: 99px;
  padding: 1px 10px; font-size: .75em; vertical-align: middle;
}

/* ---------- タイトル ---------- */
#title { align-items: center; justify-content: safe center; gap: 28px; }
.menu-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu-sub .btn { font-size: 16px; padding: 10px 8px; white-space: nowrap; }
@media (max-height: 720px) {
  #title { gap: 16px; }
  .logo h1 { font-size: clamp(36px, 8vh, 72px); }
  .logo-sub { font-size: 22px; }
  .btn.big { font-size: 20px; padding: 12px 24px; }
}
.logo { text-align: center; color: #fff; animation: bob 3s ease-in-out infinite; }
.logo-sub { font-size: clamp(22px, 5vw, 34px); font-weight: 800; color: var(--accent); letter-spacing: .3em; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.logo h1 {
  margin: 0; font-size: clamp(44px, 11vw, 96px); line-height: 1.05; font-weight: 800;
  text-shadow: 0 6px 0 #d83d6d, 0 12px 20px rgba(0,0,0,.3);
}
.logo h1 span { color: #ffe066; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-1deg); } }
.menu { display: flex; flex-direction: column; gap: 14px; width: min(340px, 100%); }
.title-foot { color: #fff; opacity: .85; display: flex; gap: 20px; font-size: 15px; }

/* ---------- ゲーム一覧 ---------- */
.game-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px;
  width: 100%; max-width: 1100px; margin: 0 auto; padding-bottom: 24px;
}
.grid-tools {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; width: 100%; max-width: 1100px; margin: 0 auto 14px;
  background: rgba(255,255,255,.14); border-radius: 16px; padding: 10px 14px; color: #fff; font-weight: 700; font-size: 14px;
}
.grid-tools label { display: flex; align-items: center; gap: 6px; }
.grid-tools select, .grid-tools input[type=search] {
  font: inherit; font-weight: 700; border: none; border-radius: 10px; padding: 6px 10px; color: var(--ink); background: #fff;
}
.grid-tools input[type=search] { flex: 1; min-width: 140px; }
.grid-tools .team-only input { width: 18px; height: 18px; accent-color: var(--primary); }
.game-card .rating { font-size: 13px; font-weight: 800; color: #b8860b; }
.game-card .rating .st { color: #ffb400; letter-spacing: 1px; }
.game-card .rating small { color: var(--muted); font-weight: 700; }
.game-card {
  background: var(--panel); border-radius: var(--radius); padding: 18px; cursor: pointer;
  box-shadow: 0 8px 0 rgba(0,0,0,.18); transition: transform .15s; border: none; text-align: left; font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
}
.game-card:hover { transform: translateY(-5px) rotate(-.5deg); }
.game-card .icon {
  font-size: 46px; width: 76px; height: 76px; display: grid; place-items: center; border-radius: 20px; margin-bottom: 4px;
}
.game-card h3 { margin: 0; font-size: 21px; }
.game-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; flex: 1; }
.game-card .meta { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; justify-content: space-between; }
.game-card .played { color: var(--ok); }

/* ---------- パネル ---------- */
.panel {
  background: var(--panel); border-radius: var(--radius); padding: 18px;
  box-shadow: 0 8px 0 rgba(0,0,0,.18);
}
.panel h3 { margin: 0 0 12px; }

.game-info { display: flex; gap: 14px; align-items: flex-start; }
.game-info .icon { font-size: 40px; width: 64px; height: 64px; flex: none; display: grid; place-items: center; border-radius: 18px; }
.game-info h3 { margin: 0 0 4px; font-size: 20px; }
.game-info p { margin: 0 0 6px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.game-info .controls { font-size: 13px; background: #f3f0fa; border-radius: 10px; padding: 6px 10px; display: inline-block; }

/* ---------- ロビー ---------- */
.lobby-wrap {
  display: grid; grid-template-columns: 340px 1fr; gap: 18px; width: 100%; max-width: 1100px; margin: 0 auto;
}
.lobby-actions { display: flex; flex-direction: column; gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.code-join { display: flex; gap: 8px; }
.code-join input {
  width: 150px; font-size: 22px; font-weight: 800; letter-spacing: .12em;
  text-align: center; border: 3px solid var(--line); border-radius: 12px; padding: 6px;
}
.code-join .btn { flex: 1; }
.room-list { display: flex; flex-direction: column; gap: 10px; }
.room-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px;
  background: #f6f3fc; border: 3px solid transparent;
}
.room-item .code { font-size: 20px; }
.room-item .who { flex: 1; font-weight: 700; }
.room-item .cnt { color: var(--muted); font-weight: 700; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; line-height: 1.8; }

.code { font-weight: 800; letter-spacing: .15em; background: var(--accent); color: var(--ink); padding: 2px 12px; border-radius: 10px; cursor: pointer; }

/* ---------- ルーム ---------- */
.room-wrap {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; width: 100%; max-width: 1100px; margin: 0 auto;
}
.select-wrap { margin-top: 14px; }
.select-wrap select { display: block; width: 100%; margin-top: 6px; padding: 8px; border-radius: 10px; border: 3px solid var(--line); font-weight: 700; }
.player-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.player-list li {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: #f6f3fc; font-weight: 700;
}
.player-list li.me { outline: 3px solid var(--accent); }
.player-list .dot { width: 24px; height: 24px; border-radius: 50%; flex: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.2); }
.player-list .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-list .tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #ddd; color: #555; }
.player-list .tag.ready { background: var(--ok); color: #fff; }
.player-list .tag.host { background: var(--accent); color: var(--ink); }
.player-list .wins { font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.hint { color: var(--muted); font-size: 14px; text-align: center; margin: 10px 0 0; min-height: 1.4em; }
body:not(.is-host) .host-only { display: none; }

.chat-panel { display: flex; flex-direction: column; min-height: 300px; }
.chat-log { flex: 1; overflow-y: auto; font-size: 14px; display: flex; flex-direction: column; gap: 4px; max-height: 360px; min-height: 160px; padding-right: 4px; }
.chat-log .sys { color: var(--muted); font-size: 13px; }
.chat-log b { margin-right: 4px; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; }
.chat-form input { flex: 1; min-width: 0; border: 3px solid var(--line); border-radius: 12px; padding: 6px 10px; }

/* ---------- ゲーム ---------- */
#game { padding: 0; align-items: center; justify-content: center; background: #140b2b; }
.game-stage { position: relative; width: min(100vw, calc(100vh * 4 / 3)); aspect-ratio: 4 / 3; max-height: 100vh; }
/* スマホのアドレスバーを除いた高さに合わせる */
@supports (height: 100dvh) { .game-stage { width: min(100vw, calc(100dvh * 4 / 3)); max-height: 100dvh; } }
#cv { width: 100%; height: 100%; display: block; touch-action: none; border-radius: 6px; }
.quit { position: absolute; bottom: 8px; left: 8px; opacity: .6; }
.countdown {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-size: clamp(80px, 22vw, 200px); font-weight: 800; color: #fff;
  text-shadow: 0 8px 0 var(--primary-d), 0 0 40px rgba(0,0,0,.5);
}
.countdown.pop { animation: pop .5s ease-out; }
@keyframes pop { from { transform: scale(1.8); opacity: 0; } }

.results { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20, 10, 40, .7); }
.results-card { background: var(--panel); border-radius: 24px; padding: 24px 28px; width: min(460px, 92%); text-align: center; animation: pop .45s ease-out; max-height: 94%; overflow-y: auto; }
.results-card h2 { margin: 0 0 14px; font-size: 30px; }
.res-list { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 8px; }
.res-list li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: #f6f3fc; font-weight: 800; animation: slideIn .4s ease-out backwards; }
.res-list li.me { outline: 3px solid var(--accent); }
.res-list .rank { font-size: 24px; width: 40px; }
.res-list .dot { width: 22px; height: 22px; border-radius: 50%; flex: none; }
.res-list .nm { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-list .sc { color: var(--muted); }
@keyframes slideIn { from { transform: translateX(-30px); opacity: 0; } }

/* ---------- 表彰台・称号 ---------- */
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.results-card { position: relative; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 8px; margin: 4px 0 14px; min-height: 40px; }
.podium .pd { display: flex; flex-direction: column; align-items: center; width: 110px; }
.podium .pd .avatar { animation: hop 1s ease-in-out infinite; }
.podium .pd.p1 .avatar { animation-duration: .7s; }
.podium .pd .nm { font-weight: 800; font-size: 13px; max-width: 106px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0 4px; }
.podium .pd .block {
  width: 100%; border-radius: 12px 12px 4px 4px; display: grid; place-items: center; font-size: 26px; font-weight: 800; color: #fff;
  transform-origin: bottom; animation: rise .7s cubic-bezier(.2,1.4,.4,1) backwards;
}
.podium .p1 .block { height: 86px; background: linear-gradient(#ffd54f, #ffb300); animation-delay: .9s; }
.podium .p2 .block { height: 62px; background: linear-gradient(#e0e0e0, #9e9e9e); animation-delay: .5s; }
.podium .p3 .block { height: 44px; background: linear-gradient(#ffcc80, #d8894a); animation-delay: .2s; }
.podium .pd .avatar, .podium .pd .nm { animation-delay: inherit; }
@keyframes rise { from { transform: scaleY(0); } }
@keyframes hop { 50% { transform: translateY(-6px); } }
.podium + .res-list { margin-top: 0; }
.awards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.awards:empty { display: none; }
.results-card { overflow-x: hidden; }
.award {
  min-width: 0; overflow: hidden;
  display: flex; align-items: center; gap: 8px; text-align: left; background: linear-gradient(135deg, #fff8e1, #ffe9f0);
  border-radius: 14px; padding: 8px 10px; animation: pop .45s ease-out backwards;
}
.award .ai { font-size: 26px; }
.award b { display: block; font-size: 14px; }
.award small { display: block; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.award .who { min-width: 0; flex: 1; }
@media (max-width: 480px) { .awards { grid-template-columns: 1fr; } .podium .pd { width: 88px; } }

/* ---------- モーダル ---------- */
.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20, 10, 40, .55); z-index: 30; padding: 16px; }
.modal-card { background: var(--panel); border-radius: 24px; padding: 24px; width: min(440px, 100%); max-height: 100%; overflow-y: auto; animation: pop .3s ease-out; }
.modal-card.wide { width: min(720px, 100%); }
.modal-card h2 { margin: 0 0 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; margin-bottom: 16px; }
.field input:not([type=range]) { border: 3px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 18px; }
.field input[type=range] { accent-color: var(--primary); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 38px; height: 38px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 0 2px var(--line); cursor: pointer; }
.swatches button.sel { box-shadow: 0 0 0 3px var(--ink); }
.avatar { flex: none; display: block; }
#lookPreview { display: block; width: 140px; height: 140px; margin: 0 auto 16px; background: #f3f0fa; border-radius: 24px; }
.look-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.look-grid button {
  width: 46px; height: 46px; padding: 0; border-radius: 12px; border: 3px solid var(--line);
  background: #fff; cursor: pointer; display: grid; place-items: center; position: relative;
}
.look-grid button.sel { border-color: var(--primary); background: #fff0f5; }
.look-grid button.locked { background: #eee; }
.look-grid button.locked .avatar { opacity: .25; filter: grayscale(1); }
.look-grid button.locked::after { content: '🔒'; position: absolute; font-size: 16px; }
#titleName { display: inline-flex; align-items: center; gap: 4px; }
.stats-line { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.stats-line span { background: #f3f0fa; border-radius: 10px; padding: 6px 12px; font-weight: 700; font-size: 14px; }
.ach-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 16px; }
.ach { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: #f3f0fa; }
.ach .ai { font-size: 30px; width: 44px; text-align: center; }
.ach b { display: block; font-size: 15px; }
.ach small { color: var(--muted); font-size: 12px; }
.ach.locked { opacity: .45; filter: grayscale(1); }
.ach.locked .ai { filter: blur(1px); }

.hidden { display: none !important; }

/* ---------- トースト ---------- */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; align-items: center; pointer-events: none; }
.toast { background: #fff; color: var(--ink); padding: 10px 18px; border-radius: 14px; font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,.3); animation: toastIn .3s ease-out; }
.toast.ach { background: linear-gradient(90deg, #ffe066, #ffc93c); }
.toast.err { background: #ff6b6b; color: #fff; }
.toast.out { opacity: 0; transform: translateY(10px); transition: .3s; }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } }

/* ---------- セグメント切替 ---------- */
.seg { display: flex; background: #eee9f7; border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg button {
  flex: 1; font: inherit; font-weight: 800; font-size: 15px; border: none; border-radius: 10px;
  padding: 8px 6px; background: transparent; color: var(--muted); cursor: pointer;
}
.seg button.sel { background: #fff; color: var(--ink); box-shadow: 0 2px 0 #d5cde8; }
.seg button:disabled { cursor: default; }
.seg.small button { font-size: 13px; padding: 6px 4px; }
.select-wrap .btn.wide { margin-top: 10px; }

/* ---------- 大会 ---------- */
.tour-board { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.tour-board .tb-head { font-weight: 800; font-size: 15px; }
.tour-board .tb-row { display: flex; align-items: center; gap: 8px; background: #f6f3fc; border-radius: 10px; padding: 4px 10px; font-weight: 700; font-size: 14px; }
.tour-board .tb-row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tour-board .played { font-size: 22px; letter-spacing: 4px; }
.tour-res { border-top: 3px dashed var(--line); padding-top: 12px; margin-bottom: 16px; }
.tour-res h3 { margin: 0 0 8px; }
.tour-res .tb-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: #fff8e1; margin-bottom: 6px; font-weight: 800; }
.tour-res .tb-row .nm { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tour-res .gain { color: var(--primary); font-size: 13px; }
.res-team { font-size: 22px; font-weight: 800; margin-bottom: 12px; }
.team-tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; color: #fff; }
.team-tag.t0 { background: #ff5a5f; }
.team-tag.t1 { background: #2d9cdb; }

/* ---------- ルーレット ---------- */
.roulette { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(20, 10, 40, .6); }
.roulette-card { background: var(--panel); border-radius: 28px; padding: 26px 40px; text-align: center; min-width: 280px; animation: pop .35s ease-out; }
.rl-title { font-weight: 800; color: var(--muted); }
.rl-icon { font-size: 96px; line-height: 1.3; }
.rl-name { font-size: 28px; font-weight: 800; }
.roulette.done .rl-icon { animation: pop .5s ease-out; }
.roulette.done .rl-name { color: var(--primary); }

/* ---------- エモート ---------- */
.emote-wrap { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; align-items: center; }
.emote-toggle { opacity: .8; font-size: 20px; padding: 4px 10px; }
.emote-bar { display: flex; gap: 4px; background: rgba(255,255,255,.92); border-radius: 14px; padding: 4px; }
.emote-bar button { font-size: 24px; border: none; background: transparent; cursor: pointer; border-radius: 10px; padding: 2px 6px; position: relative; }
.emote-bar button:hover { background: #f0ebfa; }
.emote-bar button small { position: absolute; bottom: -2px; right: 2px; font-size: 9px; color: var(--muted); }
#emoteLayer { position: fixed; right: 16px; bottom: 70px; z-index: 45; pointer-events: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.emote-pop { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.95); border-radius: 99px; padding: 4px 12px 4px 4px; box-shadow: 0 4px 14px rgba(0,0,0,.25); animation: emoteIn .3s ease-out; font-weight: 800; }
.emote-pop .em { font-size: 30px; }
.emote-pop.out { opacity: 0; transform: translateY(-20px); transition: .5s; }
@keyframes emoteIn { from { transform: scale(.4) translateX(40px); opacity: 0; } }

/* ---------- 戦績 ---------- */
.stat-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 14px; }
.stat-table th { text-align: left; color: var(--muted); font-size: 12px; padding: 4px 6px; }
.stat-table td { padding: 6px; border-top: 2px solid #f0ebfa; font-weight: 700; }
.stat-table td.num { text-align: right; }
.stat-table tr.me td { background: #fff8e1; }
.stat-table .cell-p { display: flex; align-items: center; gap: 6px; }
.board-select { width: 100%; padding: 8px; border-radius: 10px; border: 3px solid var(--line); font-weight: 700; margin-bottom: 10px; }

/* ---------- レスポンシブ ---------- */
@media (max-width: 900px) {
  .room-wrap { grid-template-columns: 1fr; }
  .lobby-wrap { grid-template-columns: 1fr; }
  .bar > .bar-spacer { flex: 0 0 0; }
  /* スマホではプレイヤー欄（スタートボタン）を一番上に */
  .room-wrap > .panel:nth-child(2) { order: -1; }
}

/* ---------- レベル ---------- */
.title-foot { flex-wrap: wrap; justify-content: center; gap: 6px 16px; }
#titleName { white-space: nowrap; }
.title-level { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lv-badge { background: var(--accent); color: var(--ink); border-radius: 99px; padding: 1px 9px; font-size: 13px; font-weight: 800; }
.lv-title { font-weight: 700; font-size: 13px; }
.xp-bar { display: inline-block; width: 90px; height: 8px; border-radius: 99px; background: rgba(255,255,255,.25); overflow: hidden; }
.xp-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffe066, #ff9f1c); border-radius: 99px; transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.title-level small { font-size: 11px; opacity: .8; }
.res-xp { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 12px; font-weight: 800; }
.res-xp .xp-bar { width: 160px; height: 10px; background: #e6e1f2; }
.res-xp .xp-gain { color: var(--primary); }
.lv-tag { font-size: 11px; font-weight: 800; background: #ede7fb; color: #5d3a9b; border-radius: 99px; padding: 1px 7px; }
.look-grid button .lock-lv { position: absolute; bottom: -2px; right: -2px; font-size: 10px; font-weight: 800; background: var(--ink); color: #fff; border-radius: 6px; padding: 0 3px; }

/* ---------- あそびかた ---------- */
.intro { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; background: rgba(20, 10, 40, .72); padding: 16px; }
.intro-card { background: var(--panel); border-radius: 26px; padding: 22px 24px 16px; width: min(560px, 100%); max-height: 100%; overflow-y: auto; animation: pop .35s ease-out; text-align: center; }
.intro-head { display: flex; align-items: center; gap: 14px; text-align: left; margin-bottom: 14px; }
.intro-icon { font-size: 44px; width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; flex: none; }
.intro-head small { color: var(--primary); font-weight: 800; }
.intro-head h2 { margin: 0; font-size: 26px; }
.intro-steps { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.intro-steps li { display: flex; gap: 10px; align-items: flex-start; background: #f6f3fc; border-radius: 14px; padding: 10px 12px; font-weight: 700; line-height: 1.5; }
.intro-steps .mk { font-size: 20px; line-height: 1.2; }
.intro-keys { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 12px; }
.key-chip { background: #2a2440; color: #fff; border-radius: 10px; padding: 5px 12px; font-weight: 800; font-size: 14px; box-shadow: 0 3px 0 #000; }
.intro-ready { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 12px; min-height: 30px; }
.intro-ready .ir { display: inline-flex; align-items: center; gap: 2px; background: #eee; border-radius: 99px; padding: 1px 8px 1px 2px; font-weight: 800; opacity: .6; }
.intro-ready .ir.ok { background: #d8f5e8; color: #1f9c6b; opacity: 1; }
.intro-timer { height: 6px; background: #eee9f7; border-radius: 99px; overflow: hidden; margin-top: 14px; }
.intro-timer span { display: block; height: 100%; width: 100%; background: var(--primary); }

/* ---------- 季節イベント ---------- */
.event-banner {
  background: linear-gradient(90deg, #ff9f1c, #ff5a1f); color: #fff; font-weight: 800; font-size: 14px; border-radius: 16px;
  padding: 8px 16px; max-width: min(520px, 92vw); text-align: center; box-shadow: 0 5px 0 rgba(0,0,0,.2); animation: bob 3s ease-in-out infinite;
}
body.ev-christmas .event-banner { background: linear-gradient(90deg, #2ecc8f, #d83d3d); }
body.ev-halloween { background: linear-gradient(160deg, #1a0b2e, #4a1f5c 45%, #d9771f); }
body.ev-christmas { background: linear-gradient(160deg, #0b2a3f, #1f5c4a 50%, #a8d8f0); }
body.ev-halloween #bg span, body.ev-christmas #bg span { background: none !important; opacity: .55; font-size: 34px; display: grid; place-items: center; }
.install-steps li { margin-bottom: 10px; line-height: 1.6; }

/* ---------- スマホ向け ---------- */
.screen { overflow-x: hidden; }
/* 結果は画面全体に重ねる（縦持ちでゲーム画面が小さくても見切れない） */
.results { position: fixed; z-index: 20; }
.touch-pad { display: none; }

@media (max-width: 560px) {
  .screen { padding: 12px; }
  .bar { margin-bottom: 10px; gap: 8px; }
  .bar h2 { font-size: 19px; }
  /* ゲーム一覧は2列のコンパクト表示 */
  .game-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .game-card { padding: 12px; gap: 4px; }
  .game-card .icon { width: 50px; height: 50px; font-size: 30px; border-radius: 14px; }
  .game-card h3 { font-size: 15px; line-height: 1.3; }
  .game-card p { display: none; }
  .game-card .rating { font-size: 11px; }
  .game-card .meta { flex-wrap: wrap; gap: 2px 6px; font-size: 11px; }
  .grid-tools { padding: 8px 10px; gap: 8px; font-size: 12px; }
  .grid-tools input[type=search] { min-width: 100%; }
  .panel { padding: 14px; }
  .code-join input { width: 120px; }
  .results-card { padding: 16px; }
  .results-card h2 { font-size: 24px; }
  .modal-card { padding: 18px; }
  body.is-test::before { top: auto; bottom: 0; border-radius: 0 10px 0 0; }
}

/* 縦持ちのスマホ：ゲーム画面を上に寄せ、下の空きを操作パッドにする */
@media (orientation: portrait) and (max-width: 820px) {
  #game { flex-direction: column; justify-content: flex-start; }
  #game .game-stage { width: 100vw; max-height: none; order: 1; }
  .touch-pad {
    display: flex; order: 2; flex: 1; width: 100%; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    color: rgba(255,255,255,.45); font-weight: 800; font-size: 15px; text-align: center; touch-action: none; user-select: none;
    background: radial-gradient(circle at 50% 45%, rgba(255,255,255,.08), transparent 60%);
    border-top: 2px dashed rgba(255,255,255,.12); padding-bottom: 70px;
  }
  .touch-pad small { font-size: 12px; font-weight: 700; opacity: .8; }
  .touch-pad.active { background: radial-gradient(circle at 50% 45%, rgba(255,255,255,.16), transparent 60%); }
  /* 退出・スタンプのボタンはゲーム画面に重ねず、下の空きに置く */
  #game .quit { position: fixed; top: auto; bottom: 14px; left: 14px; }
  #game .emote-wrap { position: fixed; bottom: 14px; right: 14px; }
}

/* 横持ちのスマホ（高さが低い）：タイトルを横並びにしてはみ出さないように */
@media (max-height: 500px) and (orientation: landscape) {
  #title { flex-direction: row; flex-wrap: wrap; align-content: center; gap: 10px 32px; padding: 10px; }
  .logo h1 { font-size: 34px; }
  .logo-sub { font-size: 16px; letter-spacing: .2em; }
  .menu { gap: 8px; width: min(320px, 50vw); }
  .btn.big { font-size: 17px; padding: 9px 16px; }
  .btn.tour small { display: none; }
  .menu-pair .btn, .menu-sub .btn { font-size: 14px; padding: 7px 6px; }
  .title-foot, .title-links { width: 100%; justify-content: center; }
  .game-stage { max-height: 100dvh; width: min(100vw, calc(100dvh * 4 / 3)); }
}

/* ---------- ロビーチャット ---------- */
.lobby-chat { grid-column: 1 / -1; min-height: 0; }
.lobby-chat .chat-log { max-height: 220px; min-height: 110px; }
.lobby-chat h3 small { font-weight: 400; font-size: 12px; }
.chat-log .ttl { font-size: 11px; background: #fff3c4; border-radius: 6px; padding: 0 5px; margin-right: 4px; font-weight: 700; }
.chat-log .rep { border: none; background: none; cursor: pointer; opacity: .35; font-size: 11px; padding: 0 2px; }
.chat-log .rep:hover { opacity: 1; }

/* ---------- 大会の種類 ---------- */
#modeSeg { display: grid; grid-template-columns: 1fr 1fr; }
#modeSeg button { font-size: 14px; }
.cpu-skill { font-size: 13px; margin: 0 0 8px; min-height: 0; }
.team-score { display: flex; justify-content: center; align-items: center; gap: 14px; font-size: 26px; font-weight: 800; margin: 6px 0 10px; }
.team-score .r { color: #ff5a5f; } .team-score .b { color: #2d9cdb; }
.team-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.team-cols .col { border-radius: 12px; padding: 6px; }
.team-cols .col.t0 { background: #ffe9ea; } .team-cols .col.t1 { background: #e3f2fc; }
.team-cols .tb-row { font-size: 13px; }
.team-hist { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-bottom: 8px; font-size: 13px; }
.team-hist span { background: #f3f0fa; border-radius: 8px; padding: 1px 6px; }

/* トーナメント表 */
.bracket { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; }
.bracket .rd { display: flex; flex-direction: column; justify-content: space-around; gap: 8px; min-width: 118px; flex: 1; }
.bracket .rd h4 { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.bracket .mt { background: #f6f3fc; border-radius: 10px; padding: 3px; display: flex; flex-direction: column; gap: 2px; border: 2px solid transparent; }
.bracket .mt.cur { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,90,138,.2); }
.bracket .sl { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 1px 4px; border-radius: 7px; white-space: nowrap; overflow: hidden; }
.bracket .sl .nm { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.bracket .sl.win { background: #fff3c4; }
.bracket .sl.lose { opacity: .45; }
.bracket .sl.me { outline: 2px solid var(--accent); }
.bracket .sl .avatar { flex: none; }
.bracket .champ { text-align: center; font-weight: 800; font-size: 14px; }
.bracket-now { text-align: center; font-weight: 800; margin: 4px 0 8px; }

/* ---------- ゲーム中の演出 ---------- */
.fx-banner {
  position: absolute; left: 0; right: 0; top: 16%; text-align: center; pointer-events: none;
  font-size: clamp(30px, 7vw, 64px); font-weight: 800; color: #fff; opacity: 0;
  text-shadow: 0 5px 0 var(--primary-d), 0 0 30px rgba(0,0,0,.5);
}
.fx-banner.show { animation: fxBanner 1.8s ease-out; }
.fx-banner.gold { color: #ffe066; text-shadow: 0 5px 0 #c77d00, 0 0 30px rgba(0,0,0,.5); }
@keyframes fxBanner {
  0% { opacity: 0; transform: scale(2.2) rotate(-6deg); }
  15% { opacity: 1; transform: scale(1) rotate(-3deg); }
  75% { opacity: 1; transform: scale(1.05) rotate(-3deg); }
  100% { opacity: 0; transform: scale(.9) translateY(-20px) rotate(-3deg); }
}
.leader-badge {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); pointer-events: none;
  background: rgba(20, 11, 43, .72); color: #ffe066; border-radius: 99px; padding: 3px 12px 3px 6px;
  font-weight: 800; font-size: clamp(11px, 1.8vw, 15px); display: flex; align-items: center; gap: 6px; white-space: nowrap;
  max-width: 60%; overflow: hidden;
}
.leader-badge.close { animation: closePulse .6s ease-in-out infinite alternate; }
@keyframes closePulse { to { background: rgba(216, 61, 109, .85); color: #fff; } }
.spectate { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20,11,43,.7); color: #fff; font-weight: 800; }

/* ---------- 称号 ---------- */
.ttl-tag { font-size: 11px; background: #fff3c4; color: #7a5200; border-radius: 6px; padding: 0 6px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.player-list li { cursor: pointer; }
.player-list .nm-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.player-list .nm-wrap .ttl-tag { align-self: flex-start; }
.title-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-bottom: 16px; max-height: 50vh; overflow-y: auto; }
.title-item { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: #f3f0fa; border: 3px solid transparent; font: inherit; text-align: left; cursor: pointer; }
.title-item .ti { font-size: 24px; }
.title-item b { display: block; font-size: 14px; }
.title-item small { color: var(--muted); font-size: 11px; }
.title-item.sel { border-color: var(--primary); background: #fff0f5; }
.title-item.locked { opacity: .45; cursor: default; }
.ach .rar { display: block; font-size: 11px; color: #9b51e0; font-weight: 700; }
.ach .rar.rare { color: #d83d6d; }
.ach.secret .ai { filter: none; }
.title-name { background: none; border: none; color: inherit; font: inherit; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; text-decoration: underline dotted rgba(255,255,255,.5); text-underline-offset: 4px; }

/* ---------- プロフィールカード ---------- */
.modal-card.card-modal { width: min(760px, 94vw); max-width: 760px; }
#cardCanvas { width: 100%; height: auto; border-radius: 14px; display: block; margin-bottom: 14px; }

/* ---------- ショップ・コイン ---------- */
.coin-pill { background: #fff3c4; color: #7a5200; border-radius: 99px; padding: 1px 10px; font-weight: 800; font-size: 13px; white-space: nowrap; }
.title-level .coin-pill { font-size: 12px; }
.coin-gain { font-weight: 800; color: #c77d00; margin-left: 6px; }
.shop { background: #fffaf0; border: 3px solid #ffe3a3; border-radius: 16px; padding: 10px 12px; margin: 10px 0 14px; }
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shop .hint { margin: 4px 0 8px; text-align: left; font-size: 12px; }
.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 12px; border: 3px solid var(--line); background: #fff; font: inherit; cursor: pointer; min-width: 0; }
.shop-item .nm { font-size: 12px; font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-item .pr { font-size: 12px; font-weight: 800; color: #c77d00; }
.shop-item.owned .pr { color: var(--ok); }
.shop-item.armed { border-color: var(--primary); background: #fff0f5; }
.shop-item.poor { opacity: .6; }
/* ---------- 熟練度 ---------- */
.game-card .mastery { position: absolute; top: 8px; right: 8px; font-size: 20px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.15)); }
.game-card { position: relative; }
.mastery-legend { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
/* ---------- 過去のシーズン ---------- */
.season-block h4 { margin: 12px 0 4px; }
/* ---------- 設定 ---------- */
.set-group { border-top: 2px dashed var(--line); margin-top: 12px; padding-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.set-group h3 { margin: 4px 0; font-size: 16px; }
.set-group .seg { margin-bottom: 0; }
/* 文字を大きく */
body.big-text .screen:not(#game), body.big-text .modal-card, body.big-text #toasts { zoom: 1.13; }
/* 動きを減らす */
body.calm #bg span { animation: none !important; }
body.calm .fx-banner.show { animation: none; opacity: 1; }
body.calm .toast, body.calm .award, body.calm .res-list li, body.calm .countdown.pop, body.calm .modal-card { animation: none !important; }
@media (prefers-reduced-motion: reduce) { #bg span { animation: none !important; } }
/* ---------- 新しい季節イベント ---------- */
body.ev-newyear { background: linear-gradient(160deg, #5b0f14, #b3262e 45%, #f2c14e); }
body.ev-valentine { background: linear-gradient(160deg, #5a1036, #c43b73 50%, #ffb3cf); }
body.ev-summer { background: linear-gradient(160deg, #0b1f4a, #25408f 50%, #f08a4b); }
body.ev-newyear #bg span, body.ev-valentine #bg span, body.ev-summer #bg span { background: none !important; opacity: .55; font-size: 34px; display: grid; place-items: center; }
body.ev-newyear .event-banner { background: linear-gradient(90deg, #d83d3d, #f2c14e); }
body.ev-valentine .event-banner { background: linear-gradient(90deg, #ff5a8a, #c43b73); }
body.ev-summer .event-banner { background: linear-gradient(90deg, #25408f, #f08a4b); }

/* ---------- すごろくパーティ ---------- */
.board-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.board-cv { width: 100%; max-width: 360px; aspect-ratio: 4 / 3; border-radius: 14px; background: #eaf6e4; display: block; }
.board-rows { width: 100%; display: flex; flex-direction: column; gap: 4px; }
.board-rows .tb-row .st { color: #c77d00; font-weight: 800; white-space: nowrap; }
.board-log { font-size: 12px; color: var(--muted); min-height: 1.4em; text-align: center; }
/* ---------- 部屋の雰囲気 ---------- */
.theme-row { display: flex; gap: 8px; margin: 0 0 10px; }
.theme-row label { flex: 1; font-size: 12px; font-weight: 700; color: var(--muted); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.theme-row select { padding: 5px; border-radius: 10px; border: 3px solid var(--line); font-weight: 700; min-width: 0; }
body.room-bg-sakura { background: linear-gradient(160deg, #ffd6e7, #f7a8c8 50%, #c9a7f0); }
body.room-bg-ocean { background: linear-gradient(160deg, #0d3b66, #1f7a8c 50%, #7ad9e6); }
body.room-bg-night { background: linear-gradient(160deg, #05051a, #1b1b4d 55%, #3b2c6b); }
body.room-bg-forest { background: linear-gradient(160deg, #1d4d2b, #3f8f4f 55%, #b8e0a0); }
body.room-bg-candy { background: linear-gradient(160deg, #ffb3d9, #ffe29a 50%, #9ee6ff); }
body.room-bg-sunset { background: linear-gradient(160deg, #3a1c5c, #d9486b 50%, #ffb45c); }

/* ---------- マイルーム ---------- */
.menu-sub .wide-sub { grid-column: 1 / -1; }
.room-modal { max-width: 640px; }
.room-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.room-head h2 { margin: 0; }
.room-modal .hint { text-align: left; margin: 6px 0; font-size: 13px; }
.room-shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; max-height: 34vh; overflow-y: auto; margin-bottom: 12px; padding: 2px; }
.rs-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 12px; border: 3px solid var(--line); background: #fff; font: inherit; cursor: pointer; min-width: 0; }
.rs-item .nm { font-size: 12px; font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-item .pr { font-size: 12px; font-weight: 800; color: #c77d00; }
.rs-item.own .pr { color: var(--ok); }
.rs-item.sel { border-color: var(--primary); background: #fff0f5; }
.rs-item.armed { border-color: var(--primary); background: #fff0f5; }
.rs-item.poor { opacity: .6; }
.stamp-slots { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-bottom: 8px; }
.stamp-slots button { border: 3px solid var(--line); background: #fff; border-radius: 10px; padding: 2px; font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.stamp-slots button.sel { border-color: var(--primary); }
.stamp-slots canvas { width: 40px; height: 40px; }
.stamp-slots small { font-size: 10px; color: var(--muted); }
.emote-bar button canvas { width: 34px; height: 34px; pointer-events: none; }
.emote-pop .em canvas { width: 48px; height: 48px; }

/* ---------- スクロールバーを見せない（スクロールはできる） ---------- */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* きせかえ画面のスタンプ */
.stamp-field { border-top: 2px dashed var(--line); padding-top: 10px; margin-top: 4px; }
.stamp-field .hint { text-align: left; font-size: 12px; margin: 4px 0 8px; }
.stamp-field .room-shop { max-height: none; }
.stamp-field .stamp-slots { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; }
.stamp-field .stamp-slots button { padding: 2px 0; min-width: 0; }
.stamp-field .stamp-slots canvas { width: 100%; max-width: 36px; height: auto; aspect-ratio: 1; }
