/* わいわいパークのゲームで共通: ホーム画面（ブロスタふう）・ゲームをえらぶ・プロフィール・ぜんぶのゲームのランキング（home.js が作る） */
:root { --k-navy: #1d2560; --k-ink: #2b1d0e; --k-font: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'BIZ UDPGothic', 'Yu Gothic UI', 'Meiryo', sans-serif; }
.k-legacy { display: none !important; }
.k-home {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  font-family: var(--k-font);
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse 60% 34% at 50% 58%, rgba(255, 236, 160, 0.32) 0%, rgba(255, 236, 160, 0) 100%),
    radial-gradient(ellipse at 50% 48%, rgba(10, 20, 60, 0.18) 0%, rgba(10, 20, 60, 0.42) 55%, rgba(8, 14, 44, 0.8) 100%),
    linear-gradient(180deg, rgba(18, 30, 90, 0.62) 0%, rgba(18, 30, 90, 0) 26%, rgba(8, 14, 44, 0) 62%, rgba(8, 14, 44, 0.7) 100%);
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
.k-home.hidden { display: none !important; }
.k-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.k-wrap > * { pointer-events: auto; }
.k-home b, .k-home .k-pb-tx, .k-logo span, .k-hero-name, .k-sheet h2, .k-opt b { paint-order: stroke fill; }

/* 上: プロフィールとボタン */
.k-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-right: 52px; }
.k-pcard {
  display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 58vw;
  padding: 6px 12px 6px 6px; border-radius: 16px;
  background: rgba(16, 24, 70, 0.82); border: 3px solid rgba(255, 255, 255, 0.22); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
  color: #fff; font: inherit; cursor: pointer; text-align: left;
}
.k-pcard:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.k-ava { position: relative; flex: none; width: 48px; height: 48px; border-radius: 14px; border: 3px solid #fff; background: var(--ava, #4f8cff); box-shadow: inset 0 -7px 0 rgba(0, 0, 0, 0.18); }
.k-ava::before, .k-ava::after { content: ''; position: absolute; top: 13px; width: 11px; height: 13px; border-radius: 50%; background: radial-gradient(circle at 50% 60%, #222 0 34%, #fff 36%); }
.k-ava::before { left: 8px; }
.k-ava::after { right: 8px; }
.k-pc-tx { display: grid; min-width: 0; }
.k-pc-tx b { font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-text-stroke: 4px var(--k-navy); }
.k-prec { font-size: 12px; font-weight: 800; color: #ffd23f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-pedit { flex: none; font-size: 15px; opacity: 0.7; }
.k-icons { display: flex; gap: 7px; }
.k-hicon {
  width: 58px; height: 58px; padding: 0; border-radius: 14px;
  border: 3px solid var(--k-navy);
  background: linear-gradient(180deg, #6b7cf0 0%, #4a58c8 50%, #3c48b2 51%, #34409e 100%);
  box-shadow: 0 4px 0 var(--k-navy), inset 0 3px 0 rgba(255, 255, 255, 0.3);
  color: #fff; font: inherit; display: grid; place-items: center; align-content: center; cursor: pointer;
}
.k-hicon span { font-size: 23px; line-height: 1.05; }
.k-hicon small { font-size: 8.5px; font-weight: 800; white-space: nowrap; letter-spacing: -0.04em; -webkit-text-stroke: 3px var(--k-navy); paint-order: stroke fill; }
.k-hicon:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--k-navy); }

/* ロゴ */
.k-logo { margin: 10px auto 0; text-align: center; line-height: 1; pointer-events: none !important; }
.k-logo-s { display: block; font-size: 22px; font-weight: 800; color: #ff5a4e; letter-spacing: 0.06em; -webkit-text-stroke: 6px #fff; transform: rotate(-4deg); margin-bottom: 4px; }
.k-logo-b {
  display: block; font-size: min(clamp(38px, 12vw, 70px), calc((100vw - 56px) / var(--n, 6))); font-weight: 800; color: #fff; letter-spacing: 0.03em; /* 長いタイトルも はみださない（--n は 文字数） */
  -webkit-text-stroke: 9px var(--k-navy); text-shadow: 0 7px 0 var(--k-navy); transform: rotate(-2deg); white-space: nowrap;
}

/* まん中: 自分のキャラ */
.k-hero { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.k-hero-c { width: min(78vw, 330px); height: min(68vw, 286px); max-height: 38vh; cursor: pointer; touch-action: manipulation; }
.k-hero-name {
  margin-top: -2px; padding: 5px 18px; border-radius: 999px;
  background: rgba(16, 24, 70, 0.85); border: 3px solid rgba(255, 255, 255, 0.25);
  color: #fff; font-size: 17px; font-weight: 800; -webkit-text-stroke: 4px var(--k-navy);
  max-width: 70vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.k-invite {
  align-self: center; margin: 0 0 12px; padding: 8px 16px; border-radius: 14px;
  background: #ffd23f; border: 3px solid var(--k-ink); color: var(--k-ink); font-size: 13px; font-weight: 800; box-shadow: 0 4px 0 var(--k-ink);
}
.k-invite b { letter-spacing: 0.1em; font-size: 16px; }
.k-invite.hidden { display: none; }

/* 下: 左にプレイ、右にゲームをえらぶ */
.k-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.k-play { flex: 0 0 auto; width: min(46vw, 260px); height: 96px; padding: 0; border: none; background: none; font: inherit; cursor: pointer; transform: skewX(-8deg); -webkit-tap-highlight-color: transparent; }
.k-pb {
  display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%;
  border-radius: 18px; background: linear-gradient(180deg, #fff27a 0%, #ffd83f 46%, #ffbf00 50%, #ffa800 100%);
  border: 4px solid var(--k-ink);
  box-shadow: 0 9px 0 var(--k-ink), inset 0 5px 0 rgba(255, 255, 255, 0.65), inset 0 -6px 0 rgba(160, 80, 0, 0.35);
  animation: kPlayPulse 1.7s ease-in-out infinite;
}
.k-pb-tx { font-size: 44px; font-weight: 800; line-height: 1; color: #fff; letter-spacing: 0.06em; -webkit-text-stroke: 8px var(--k-ink); text-shadow: 0 5px 0 var(--k-ink); transform: skewX(8deg); }
.k-pb-sub { margin-top: 6px; max-width: 88%; font-size: 12px; font-weight: 800; color: #6b3f00; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform: skewX(8deg); }
.k-play:active .k-pb { transform: translateY(6px); box-shadow: 0 3px 0 var(--k-ink), inset 0 5px 0 rgba(255, 255, 255, 0.65); animation: none; }
.k-play.go .k-pb { animation: kPlayGo 0.35s ease-out; }
@keyframes kPlayPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); filter: brightness(1.06); } }
@keyframes kPlayGo { 0% { transform: scale(0.92); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
.k-mode {
  position: relative; flex: 0 1 auto; min-width: 0; width: min(48vw, 300px);
  display: flex; align-items: center; gap: 8px; padding: 7px; border-radius: 16px;
  background: rgba(16, 24, 70, 0.88); border: 3px solid var(--mc, #35b866);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.45), 0 0 18px rgba(0, 0, 0, 0.25);
  color: #fff; font: inherit; text-align: left; cursor: pointer;
}
.k-mode:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); }
.k-mc-ic { flex: none; width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center; font-size: 30px; background: var(--mc, #35b866); border: 2px solid rgba(255, 255, 255, 0.5); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.2); }
.k-mc-tx { flex: 1; min-width: 0; display: grid; }
.k-mc-tx small { font-size: 11px; font-weight: 800; color: #c8d0ff; white-space: nowrap; }
.k-mc-tx b { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-text-stroke: 4px var(--k-navy); }
.k-mc-chg {
  position: absolute; top: -15px; right: 10px; padding: 3px 9px; border-radius: 9px;
  background: #ffd23f; border: 2px solid var(--k-ink); color: var(--k-ink);
  font-size: 11px; font-weight: 800; line-height: 1.25; white-space: nowrap; box-shadow: 0 2px 0 var(--k-ink);
}
@media (max-width: 400px) {
  .k-play { height: 86px; }
  .k-pb-tx { font-size: 36px; -webkit-text-stroke-width: 7px; }
  .k-mc-ic { width: 46px; height: 46px; font-size: 26px; }
  .k-mc-tx b { font-size: 14px; }
  .k-hicon { width: 50px; height: 50px; }
  .k-hicon span { font-size: 20px; }
  .k-ava { width: 42px; height: 42px; }
  .k-ava::before, .k-ava::after { top: 11px; }
  .k-pcard { max-width: none; flex: 1; padding-right: 8px; }
  .k-pedit { display: none; }
  .k-hicon { width: 46px; height: 48px; }
  .k-icons { gap: 5px; }
  .k-top { padding-right: 48px; gap: 6px; }
}
@media (max-height: 620px) { .k-logo-b { font-size: min(38px, calc((100vw - 56px) / var(--n, 6))); } .k-logo-s { font-size: 17px; } }
/* 音のボタンは、右上のアイコンのとなり。シートを出しているときはかくす */
.k-home:not(.hidden) ~ .sound-btn { top: max(12px, env(safe-area-inset-top)); }
body.k-sheet-open .sound-btn, body.k-sheet-open #soundBtn { display: none !important; }

/* シート（ゲームをえらぶ・プロフィール・ランキングなど） */
.k-sheet {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-start; justify-content: center;
  padding: max(14px, env(safe-area-inset-top)) 14px 20px; overflow-y: auto;
  background: rgba(8, 14, 44, 0.86); font-family: var(--k-font);
}
.k-sheet.hidden { display: none; }
.k-sheet-panel { width: 100%; max-width: 620px; margin: 0 auto; padding-bottom: 20px; animation: kSheetIn 0.22s ease-out; }
@keyframes kSheetIn { from { opacity: 0; transform: translateY(24px); } }
.k-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 8px; }
.k-sheet-head h2 { margin: 0; color: #fff; font-size: 24px; font-weight: 800; -webkit-text-stroke: 7px var(--k-navy); }
.k-sheet-x { flex: none; width: 46px; height: 46px; border-radius: 12px; border: 3px solid var(--k-ink); background: #ff5a4e; color: #fff; font: inherit; font-size: 20px; font-weight: 800; cursor: pointer; box-shadow: 0 4px 0 var(--k-ink); }
.k-sec { margin: 16px 2px 8px; color: #c8d0ff; font-size: 13px; font-weight: 800; letter-spacing: 0.08em; }
.k-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.k-opt {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 0 0 10px;
  border-radius: 16px; overflow: hidden; background: #fffdf7; border: 3px solid var(--k-navy); box-shadow: 0 5px 0 var(--k-navy);
  color: #2b2a33; font: inherit; text-align: left; cursor: pointer;
}
.k-opt:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--k-navy); }
.k-band {
  display: grid; place-items: center; height: 66px; margin-bottom: 6px; font-size: 38px; background: var(--mc);
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.22) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 255, 255, 0.22) 75%, transparent 75%);
  background-size: 22px 22px; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.16);
}
.k-opt small { padding: 0 10px; font-size: 11px; font-weight: 800; color: #747083; }
.k-opt b { padding: 0 10px; font-size: 16px; font-weight: 800; line-height: 1.25; }
.k-desc { padding: 0 10px; font-size: 11.5px; font-weight: 700; color: #747083; line-height: 1.4; }
.k-opt.on { border-color: #ffd23f; box-shadow: 0 5px 0 #c99a00, 0 0 0 3px #ffd23f; }
.k-opt.on::after { content: 'えらんでいる'; position: absolute; top: 6px; right: 6px; padding: 3px 8px; border-radius: 999px; background: #ffd23f; border: 2px solid var(--k-ink); color: var(--k-ink); font-size: 10px; font-weight: 800; }
.k-grid.small { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.k-grid.small .k-band { height: 48px; font-size: 28px; }
.k-grid.small .k-opt b { font-size: 14px; }
/* シートの中に出した、もとの画面の部品（友だちと遊ぶ など） */
.k-sheet-panel > :not(.k-sheet-head):not(.k-sec):not(.k-grid):not(.k-allbox):not(.k-field):not(.k-ok):not(.k-howbox):not(.k-stabs):not(.k-wallet):not(.k-acctbox) { background: #fffdf7; border-radius: 18px; padding: 16px; }

/* プロフィール */
.k-field { display: block; margin: 0 0 14px; padding: 14px; border-radius: 16px; background: #fffdf7; }
.k-field > span { display: block; margin: 0 0 8px 2px; font-size: 13px; font-weight: 800; color: #747083; }
.k-field input { width: 100%; padding: 12px 14px; font: inherit; font-size: 18px; font-weight: 700; color: #2b2a33; background: #fff; border: 3px solid #ece5d6; border-radius: 14px; outline: none; -webkit-user-select: text; user-select: text; box-sizing: border-box; }
.k-colors { display: flex; flex-wrap: wrap; gap: 10px; }
.k-swatch { width: 42px; height: 42px; border-radius: 12px; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15), inset 0 -6px 0 rgba(0, 0, 0, 0.15); cursor: pointer; }
.k-swatch.on { box-shadow: 0 0 0 4px #2b2a33, inset 0 -6px 0 rgba(0, 0, 0, 0.15); transform: scale(1.08); }
.k-ok { display: block; width: 100%; padding: 15px; border: 4px solid var(--k-ink); border-radius: 16px; background: #ffd23f; color: var(--k-ink); font: inherit; font-size: 22px; font-weight: 800; cursor: pointer; box-shadow: 0 6px 0 var(--k-ink); }
.k-ok:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--k-ink); }

/* ランキング: 「このゲーム／ぜんぶのゲーム」のタブ */
.k-tabs { display: flex; margin: 0 0 12px; border-radius: 14px; overflow: hidden; border: 3px solid var(--k-navy); }
.k-tabs button { flex: 1; padding: 9px 6px; border: none; background: #fff; color: #2b2a33; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.k-tabs button.on { background: var(--k-navy); color: #fff; }
.k-allbox { display: none; }
.k-all > .k-allbox { display: block; }
.k-all > :not(.k-tabs):not(.k-allbox):not(:last-child) { display: none !important; }
.k-sheet-panel > .k-allbox { display: block; background: #fffdf7; border-radius: 18px; padding: 14px; }
.k-allhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; }
.k-allhead b { font-size: 17px; font-weight: 800; color: #2b2a33; }
.k-seg { display: flex; }
.k-seg button { padding: 6px 12px; margin-left: -2px; border: 2px solid #ece5d6; background: #fff; color: #2b2a33; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.k-seg button:first-child { border-radius: 10px 0 0 10px; margin-left: 0; }
.k-seg button:last-child { border-radius: 0 10px 10px 0; }
.k-seg button.on { background: #2f9bff; border-color: #2f9bff; color: #fff; }
.k-me { margin: 0 0 8px; padding: 8px 12px; border-radius: 12px; background: #fff4c7; font-size: 13px; font-weight: 800; color: #6b4d00; }
.k-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; max-height: 46vh; overflow-y: auto; }
.k-list li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px; background: #f6f1e6; font-weight: 700; font-size: 15px; color: #2b2a33; }
.k-list li.me { outline: 3px solid #2f9bff; background: #eaf4ff; }
.k-list li.k-empty { display: block; text-align: center; color: #747083; font-size: 13px; }
.k-rk { text-align: center; font-weight: 800; color: #747083; font-size: 16px; }
.k-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-by { display: block; font-size: 11.5px; color: #747083; letter-spacing: 0.02em; }
.k-val { font-weight: 800; color: #e8453c; font-size: 18px; }
.k-val small { font-size: 11px; margin-left: 2px; color: #747083; }
.k-note { margin: 10px 2px 0; font-size: 11.5px; font-weight: 700; color: #747083; line-height: 1.5; }
@media (prefers-reduced-motion: reduce) { .k-pb, .k-sheet-panel { animation: none; } }

/* 完全版（アプリだけ。Webでは出ない） */
.k-opt.lock .k-band, .mode-opt.lock .mo-band { filter: grayscale(0.6) brightness(0.85); }
.k-lockb { position: absolute; top: 6px; left: 6px; padding: 3px 8px; border-radius: 999px; background: var(--k-navy); border: 2px solid #ffd23f; color: #ffd23f; font-size: 10.5px; font-weight: 800; line-height: 1.3; }
.k-mode.lock .k-mc-ic { filter: grayscale(0.6); }
.k-shop { text-align: center; color: #2b2a33; }
.k-shop-hero { display: grid; justify-items: center; gap: 4px; padding: 4px 0 14px; }
.k-shop-crown { font-size: 56px; line-height: 1.1; animation: kCrown 2.4s ease-in-out infinite; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.18)); }
@keyframes kCrown { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-6px) rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .k-shop-crown { animation: none; } }
.k-shop-lead { font-size: 20px; font-weight: 800; line-height: 1.35; }
.k-shop-sub { font-size: 13px; font-weight: 700; color: #747083; }
.k-shop-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.k-shop-list li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 7px; border-radius: 12px; background: #f3eee3; font-size: 11px; font-weight: 800; line-height: 1.3; }
.k-shop-ic { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--mc); font-size: 22px; }
.k-shop-list li.lock .k-shop-ic { filter: grayscale(0.6); }
.k-shop-nm { text-align: center; word-break: keep-all; overflow-wrap: anywhere; }
.k-shop-tag { position: absolute; top: 3px; right: 3px; padding: 1px 6px; border-radius: 999px; background: #fff; border: 2px solid #bfe8cd; color: #2a9a55; font-size: 10px; }
.k-shop-list li.lock .k-shop-tag { background: var(--k-navy); border-color: var(--k-navy); color: #ffd23f; }
.k-shop-list li.want { background: #fff4c2; box-shadow: 0 0 0 3px #ffd23f; }
.k-shop-buy { display: grid; justify-items: center; gap: 2px; width: 100%; padding: 12px 15px; border: 4px solid var(--k-ink); border-radius: 18px; background: linear-gradient(#ffe066, #ffb81f); color: var(--k-ink); font: inherit; cursor: pointer; box-shadow: 0 7px 0 var(--k-ink), inset 0 4px 0 rgba(255, 255, 255, 0.6); }
.k-shop-buy:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--k-ink); }
.k-shop-buy:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: 0 7px 0 var(--k-ink); }
.k-shop-buy.owned { background: linear-gradient(#8de89d, #35b866); }
.k-shop-buy-tx { font-size: 24px; font-weight: 800; }
.k-shop-price { font-size: 14px; font-weight: 800; }
.k-shop-price:empty { display: none; }
.k-shop-note { margin: 4px 0; font-size: 12px; font-weight: 700; color: #747083; line-height: 1.6; }
.k-shop-link { display: block; margin: 6px auto 0; padding: 8px 12px; border: 0; background: none; color: #4a58c8; font: inherit; font-size: 13px; font-weight: 800; text-decoration: underline; cursor: pointer; }
.k-shop-link.hidden { display: none; }

/* ショップ（アプリだけ） */
.k-wallet { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 8px 12px; border-radius: 16px; background: rgba(255, 255, 255, 0.1); color: #dfe4ff; }
.k-coins { flex: none; padding: 4px 12px; border-radius: 999px; background: #ffd23f; border: 3px solid var(--k-ink); color: var(--k-ink); font-size: 18px; font-weight: 800; box-shadow: 0 3px 0 var(--k-ink); }
.k-wallet small { font-size: 11.5px; font-weight: 700; line-height: 1.45; }
.k-stabs { display: flex; gap: 5px; margin: 0 0 10px; }
.k-stabs button { flex: 1 1 0; min-width: 0; padding: 8px 2px; border-radius: 14px; border: 3px solid var(--k-navy); background: #fffdf7; color: #2b2a33; font: inherit; font-size: 13px; font-weight: 800; white-space: nowrap; cursor: pointer; box-shadow: 0 3px 0 var(--k-navy); }
.k-stabs button.on { background: #ffd23f; border-color: var(--k-ink); color: var(--k-ink); box-shadow: 0 3px 0 var(--k-ink); }
.k-shop-h { margin: 4px 2px 8px; font-size: 14px; font-weight: 800; color: #4a4560; text-align: left; }
.k-shop-h:not(:first-child) { margin-top: 16px; }
.k-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.k-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 8px; border-radius: 16px; border: 3px solid #e4dccb; background: #fff; color: #2b2a33; font: inherit; cursor: pointer; box-shadow: 0 4px 0 #e4dccb; }
.k-item:active { transform: translateY(3px); box-shadow: 0 1px 0 #e4dccb; }
.k-item-ic { font-size: 40px; line-height: 1.15; }
.k-item b { font-size: 14px; font-weight: 800; }
.k-item small { min-height: 1em; font-size: 10.5px; font-weight: 700; color: #747083; line-height: 1.4; text-align: center; }
.k-item small:empty { display: none; }
.k-item-act { margin-top: 4px; padding: 4px 12px; border-radius: 999px; background: #ffd23f; border: 2px solid var(--k-ink); color: var(--k-ink); font-size: 13px; font-weight: 800; white-space: nowrap; }
.k-item.has .k-item-act { background: #e9f8ee; border-color: #35b866; color: #1f7a42; }
.k-item.on { border-color: #35b866; box-shadow: 0 4px 0 #35b866, 0 0 0 3px #bfe8cd; }
.k-item.on .k-item-act { background: #35b866; color: #fff; }
.k-item.confirm .k-item-act { background: #ff7a3d; color: #fff; animation: kPulse 0.8s ease-in-out infinite; }
.k-item.focus { border-color: #ffd23f; box-shadow: 0 4px 0 #c99a00, 0 0 0 3px #ffd23f; }
@keyframes kPulse { 50% { transform: scale(1.07); } }
.k-packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.k-pack { position: relative; display: grid; justify-items: center; gap: 6px; padding: 22px 10px 12px; border-radius: 16px; border: 3px solid var(--k-ink); background: linear-gradient(#fff6cf, #ffe27a); color: var(--k-ink); font: inherit; cursor: pointer; box-shadow: 0 5px 0 var(--k-ink); }
.k-pack:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--k-ink); }
.k-pack:disabled { opacity: 0.6; transform: none; }
.k-pack b { font-size: 22px; font-weight: 800; }
.k-pack-price { padding: 4px 14px; border-radius: 999px; background: var(--k-navy); color: #fff; font-size: 14px; font-weight: 800; }
.k-pack-tag { position: absolute; top: -10px; padding: 2px 10px; border-radius: 999px; background: #ff5a4e; color: #fff; border: 2px solid var(--k-ink); font-size: 11px; font-weight: 800; }
.k-pack-tag:empty { display: none; }
.k-shop-bonus { margin: 0 0 12px; padding: 8px 12px; border-radius: 12px; background: #fff4c2; font-size: 13px; font-weight: 800; color: #5b4300; }
.k-shop-bonus b { margin-right: 6px; padding: 1px 8px; border-radius: 999px; background: #ff5a4e; color: #fff; font-size: 11px; }
.k-decos { display: flex; flex-wrap: wrap; gap: 8px; }
.k-deco { width: 52px; height: 52px; border-radius: 14px; border: 3px solid #ece5d6; background: #fff; font-size: 28px; line-height: 1; cursor: pointer; color: #9a94a8; font-family: inherit; font-weight: 800; }
.k-deco.on { border-color: #35b866; box-shadow: 0 0 0 3px #bfe8cd; }
.k-deco.more { background: #ffd23f; border-color: var(--k-ink); font-size: 24px; }
.k-toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 9999; max-width: min(92vw, 520px); padding: 10px 18px; border-radius: 999px; background: rgba(20, 24, 60, 0.94); color: #fff; font-family: var(--k-font); font-size: 15px; font-weight: 800; text-align: center; transform: translate(-50%, 140%); opacity: 0; pointer-events: none; transition: transform 0.25s ease, opacity 0.25s ease; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); }
.k-toast.on { transform: translate(-50%, 0); opacity: 1; }

/* ---------- スタンプ（試合の中。ボタンは右下のダッシュの上） ---------- */
.k-stamp { position: fixed; right: max(22px, env(safe-area-inset-right)); bottom: calc(env(safe-area-inset-bottom) + var(--k-stamp-b, 150px)); z-index: 6; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; font-family: var(--k-font); pointer-events: none; }
.k-stamp.hidden, .k-stamp-pal.hidden { display: none; }
.k-stamp-btn { pointer-events: auto; width: 54px; height: 54px; padding: 0; border-radius: 50%; border: 3px solid #fff; background: rgba(255, 210, 63, 0.96); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2); font-size: 28px; line-height: 1; cursor: pointer; touch-action: none; }
.k-stamp-btn:active { transform: scale(0.94); }
.k-stamp-pal { pointer-events: auto; display: grid; grid-template-columns: repeat(2, auto); gap: 6px; padding: 8px; border-radius: 16px; background: rgba(16, 24, 70, 0.9); border: 3px solid rgba(255, 255, 255, 0.3); }
.k-stamp-opt { position: relative; display: flex; align-items: center; gap: 4px; padding: 6px 10px 6px 6px; border-radius: 12px; border: none; background: #fffdf7; font: inherit; cursor: pointer; touch-action: none; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }
.k-stamp-opt span { font-size: 22px; line-height: 1; }
.k-stamp-opt small { font-size: 12px; font-weight: 800; color: var(--k-ink); white-space: nowrap; }
.k-stamp-opt:active { transform: translateY(2px); }
.k-stamp-more { background: #ffd23f; }
.k-stamp.cool .k-stamp-btn, .k-stamp.cool .k-stamp-opt { opacity: 0.45; }
@media (pointer: fine) {
  .k-stamp-opt[data-key]::after { content: attr(data-key); position: absolute; top: 1px; right: 4px; font-size: 9px; font-weight: 800; color: #9a8f80; }
}
/* たて持ちのスマホ: えらぶ画面はボタンの上（2れつ）。横長の画面: ボタンの左（パックがあれば3れつ） */
@media (min-width: 700px), (max-height: 500px) { .k-stamp { flex-direction: row; } .k-stamp-pal.wide { grid-template-columns: repeat(3, auto); } }
@media (max-width: 340px) { .k-stamp-opt small { font-size: 11px; } }

/* ロビー: この部屋のステージ */
.k-stage-line {
  display: block; margin: 8px auto 0; padding: 6px 14px; border-radius: 12px;
  background: rgba(16, 24, 70, 0.08); border: 2px solid rgba(16, 24, 70, 0.18); color: #2b2a33;
  font: inherit; font-size: 14px; font-weight: 800; cursor: default;
}
.k-stage-line.host { cursor: pointer; background: #fff6cf; border-color: #e0b400; }
.k-stage-line.host:active { transform: translateY(2px); }
.k-stage-line.hidden { display: none; }

/* ショップ: 引き継ぎコード */
.k-xfer { margin: 4px 0 8px; padding: 12px; border-radius: 14px; background: #fff; border: 3px solid #d9d3c4; display: grid; gap: 10px; }
.k-xfer-lead { margin: 0; font-size: 13px; font-weight: 700; color: #4a4658; line-height: 1.6; }
.k-xfer-lead b { color: var(--k-ink); }
.k-xfer-code { justify-self: center; padding: 8px 16px; border-radius: 12px; background: #fff6cf; border: 3px dashed #e0b400; font-size: 26px; font-weight: 800; letter-spacing: 0.12em; color: var(--k-ink); user-select: all; -webkit-user-select: all; }
.k-xfer-sub { margin: -4px 0 0; text-align: center; font-size: 12px; font-weight: 700; color: #747083; }
.k-xfer-row { display: flex; flex-wrap: wrap; gap: 8px; }
.k-xfer-btn { flex: 1 1 auto; min-height: 42px; padding: 8px 14px; border-radius: 12px; border: 3px solid var(--k-ink); background: #fff; color: var(--k-ink); font: inherit; font-size: 14px; font-weight: 800; box-shadow: 0 3px 0 var(--k-ink); cursor: pointer; }
.k-xfer-btn.main { background: #ffd23f; }
.k-xfer-btn.ghost { border-color: #c9c3b4; box-shadow: 0 3px 0 #c9c3b4; color: #5a5668; font-size: 13px; }
.k-xfer-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--k-ink); }
.k-xfer-btn:disabled { opacity: 0.6; }
.k-xfer-in { display: flex; gap: 8px; }
.k-xfer-in input { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border-radius: 12px; border: 3px solid #c9c3b4; font: inherit; font-size: 18px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--k-ink); background: #fffdf7; }
.k-xfer-in input::placeholder { font-size: 14px; letter-spacing: 0; text-transform: none; font-weight: 700; }
.k-xfer-in .k-xfer-btn { flex: 0 0 auto; }

/* 保護者ゲート（アプリだけ。お金の買いもの・アプリの外を ひらく前） */
.k-gate { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: 16px; background: rgba(10, 14, 40, 0.72); font-family: var(--k-font); }
.k-gate-panel { width: min(100%, 340px); max-height: calc(100vh - 32px); overflow: auto; padding: 18px 16px 14px; border-radius: 20px; background: #fffdf7; border: 4px solid var(--k-ink); box-shadow: 0 8px 0 var(--k-ink); text-align: center; color: var(--k-ink); }
.k-gate-panel h2 { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.k-gate-why { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: #5a5668; line-height: 1.6; }
.k-gate-q { margin: 0 0 8px; font-size: 22px; font-weight: 800; }
.k-gate-hint { display: block; margin-top: 2px; font-size: 12px; font-weight: 700; color: #747083; }
.k-gate-ans { min-height: 44px; margin: 0 auto 4px; width: 60%; padding: 4px 0; border-radius: 12px; border: 3px solid #c9c3b4; background: #fff; font-size: 28px; font-weight: 800; letter-spacing: 0.1em; }
.k-gate-msg { min-height: 1.4em; margin: 0 0 6px; font-size: 12px; font-weight: 800; color: #d8322a; }
.k-gate-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.k-gate-key { height: 48px; border-radius: 12px; border: 3px solid var(--k-ink); background: #fff; color: var(--k-ink); font: inherit; font-size: 20px; font-weight: 800; box-shadow: 0 3px 0 var(--k-ink); cursor: pointer; }
.k-gate-key:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--k-ink); }
.k-gate-key.ok { background: #ffd23f; }
.k-gate-key.del { background: #eee8da; }
.k-gate-x { margin-top: 12px; padding: 6px 18px; border: none; background: none; color: #5a5668; font: inherit; font-size: 14px; font-weight: 800; text-decoration: underline; cursor: pointer; }

/* パークID（アカウント） */
.k-acct-card { display: grid; gap: 8px; margin: 0 0 14px; }
.k-acct-title { margin: 0; font-size: 17px; font-weight: 800; color: var(--k-ink); word-break: break-all; }
.k-acct-text { margin: 0; font-size: 13px; font-weight: 700; color: #5a5668; line-height: 1.6; }
.k-acct-note { margin: -4px 0 0 4px; font-size: 12px; font-weight: 700; color: #747083; line-height: 1.5; }
.k-acct-st { margin: 0; font-size: 13px; font-weight: 800; color: #2f9b57; }
.k-acct-st.warn { color: #c26a00; }
.k-acct-row { display: flex; flex-wrap: wrap; gap: 8px; }
.k-acct-btn { flex: 1 1 auto; min-height: 46px; padding: 8px 14px; border-radius: 14px; border: 3px solid var(--k-ink); background: #fff; color: var(--k-ink); font: inherit; font-size: 15px; font-weight: 800; box-shadow: 0 3px 0 var(--k-ink); cursor: pointer; }
.k-acct-btn.main { background: #ffd23f; }
.k-acct-btn.danger { background: #ffe1de; border-color: #c62f27; color: #a3231c; box-shadow: 0 3px 0 #c62f27; }
.k-acct-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--k-ink); }
.k-acct-btn:disabled { opacity: 0.6; }
.k-acct-link { justify-self: start; padding: 6px 2px; border: none; background: none; font: inherit; font-size: 14px; font-weight: 800; color: #2f6fd6; text-decoration: underline; cursor: pointer; text-align: left; }
.k-acctbox { display: grid; gap: 10px; }
.k-acctbox .k-field { margin: 0; }
.k-acctbox > .k-acct-text { padding: 0 4px; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.k-acctbox > .k-acct-note { color: #e9e6f5; }
.k-acct-err { margin: 0; min-height: 1.2em; padding: 0 4px; font-size: 13px; font-weight: 800; color: #ffb4ad; }
.k-acct-err:empty { display: none; }
.k-acct-code { justify-self: center; padding: 10px 18px; border-radius: 14px; background: #fff6cf; border: 3px dashed #e0b400; font-size: 24px; font-weight: 800; letter-spacing: 0.08em; color: var(--k-ink); user-select: all; -webkit-user-select: all; }
.k-acct-info { padding: 12px 14px; border-radius: 16px; background: #fffdf7; }
.k-acct-info p { margin: 0; font-size: 15px; font-weight: 800; color: var(--k-ink); line-height: 1.9; word-break: break-all; }
.k-acctbox .k-acct-link { color: #9cc7ff; }

/* ---------- ロード画面（ブロスタふう）と、はじめての画面（ログイン・新しく はじめる・ゲスト） ---------- */
.k-boot { position: fixed; inset: 0; z-index: 8000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(14px, 3.2vh, 26px); padding: 24px 16px calc(64px + env(safe-area-inset-bottom)); overflow: hidden; font-family: var(--k-font); color: #fff; text-align: center; background: radial-gradient(130% 90% at 50% 0%, #74d8ff 0%, #4f8cff 42%, #5a3dd4 100%); transition: opacity 0.38s ease; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.k-boot.out { opacity: 0; pointer-events: none; }
.k-boot::before { content: ''; position: absolute; left: 50%; top: 42%; width: 240vmax; height: 240vmax; margin: -120vmax 0 0 -120vmax; background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.09) 0 9deg, rgba(255, 255, 255, 0) 9deg 18deg); animation: k-boot-spin 60s linear infinite; pointer-events: none; }
.k-boot::after { content: ''; position: absolute; inset: auto 0 0; height: 32%; background: linear-gradient(rgba(29, 37, 96, 0), rgba(29, 37, 96, 0.45)); pointer-events: none; }
.k-boot > * { position: relative; z-index: 1; }
@keyframes k-boot-spin { to { transform: rotate(360deg); } }
.k-boot-chars { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(2px, 1vw, 8px); max-width: 94vw; font-size: clamp(26px, 8.4vw, 46px); line-height: 1; }
.k-boot-chars span { display: inline-block; animation: k-boot-hop 1.3s ease-in-out infinite; animation-delay: calc(var(--i) * 0.11s); filter: drop-shadow(0 4px 0 rgba(29, 37, 96, 0.55)); }
@keyframes k-boot-hop { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-16px) rotate(-8deg); } 50% { transform: translateY(0) rotate(0); } }
.k-boot .k-boot-title { margin: 0; padding: 0; line-height: 1.05; font-family: var(--k-font); color: #fff; background: none; border: 0; }
.k-boot-title small { display: block; margin-bottom: 4px; font-size: clamp(17px, 4.8vw, 24px); font-weight: 800; -webkit-text-stroke: 5px var(--k-navy); paint-order: stroke fill; }
.k-boot-title b { display: block; font-size: clamp(42px, 12.5vw, 78px); font-weight: 900; color: #ffd23f; -webkit-text-stroke: 11px var(--k-navy); paint-order: stroke fill; text-shadow: 0 8px 0 var(--k-navy); white-space: nowrap; animation: k-boot-pop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes k-boot-pop { from { transform: scale(0.3) rotate(-10deg); opacity: 0; } to { transform: scale(1) rotate(-2deg); opacity: 1; } }
.k-boot-title b { transform: rotate(-2deg); }
.k-boot-load { width: min(80vw, 420px); }
.k-boot-bar { height: 24px; border-radius: 999px; background: rgba(29, 37, 96, 0.6); border: 4px solid var(--k-navy); overflow: hidden; box-shadow: 0 5px 0 var(--k-navy); }
.k-boot-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(#ffe46b, #ffad1f); box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.55); }
.k-boot .k-boot-st { margin: 10px 0 0; font-size: 16px; font-weight: 800; color: #fff; -webkit-text-stroke: 4px var(--k-navy); paint-order: stroke fill; }
.k-boot .k-boot-tip { position: absolute; left: 16px; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 560px; padding: 8px 14px; border-radius: 14px; background: rgba(29, 37, 96, 0.55); font-size: 14px; font-weight: 700; line-height: 1.5; color: #fff; }
.k-boot.quick .k-boot-load, .k-boot.quick .k-boot-tip { opacity: 0; animation: k-boot-late 0.3s ease 0.6s forwards; } /* すぐ おわるときは バーを出さない（0.6秒 こえたら 出す） */
@keyframes k-boot-late { to { opacity: 1; } }
.k-boot-pick { display: flex; flex-direction: column; gap: 12px; width: min(88vw, 380px); animation: k-boot-up 0.35s ease both; }
@keyframes k-boot-up { from { transform: translateY(28px); opacity: 0; } }
.k-boot .k-boot-btn { appearance: none; -webkit-appearance: none; margin: 0; width: 100%; border: 4px solid var(--k-navy); border-radius: 20px; padding: 14px 16px; font: 900 20px/1.2 var(--k-font); color: #fff; -webkit-text-stroke: 5px var(--k-navy); paint-order: stroke fill; box-shadow: 0 7px 0 var(--k-navy), inset 0 5px 0 rgba(255, 255, 255, 0.35); cursor: pointer; transition: transform 0.08s ease, box-shadow 0.08s ease; }
.k-boot .k-boot-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--k-navy), inset 0 5px 0 rgba(255, 255, 255, 0.35); }
.k-boot .k-boot-btn.new { background: #ffb020; font-size: 22px; }
.k-boot .k-boot-btn.login { background: #35b866; }
.k-boot .k-boot-btn.guest { background: #7d87b3; font-size: 18px; }
.k-boot .k-boot-note { margin: 4px 0 0; padding: 10px 12px; border-radius: 14px; background: rgba(29, 37, 96, 0.5); font-size: 13px; font-weight: 700; line-height: 1.55; color: #fff; }
body.k-boot-on { overflow: hidden; }
body.k-boot-on .k-sheet { z-index: 8100; } /* はじめての画面から ひらいた パークIDの シートは 上に */
@media (max-height: 560px) { .k-boot-chars { font-size: 24px; } .k-boot-title b { font-size: 40px; } .k-boot .k-boot-btn { padding: 10px 14px; font-size: 17px; } .k-boot .k-boot-btn.new { font-size: 18px; } }
@media (prefers-reduced-motion: reduce) { .k-boot::before, .k-boot-chars span, .k-boot-title b, .k-boot-pick { animation: none; } }

/* 右上: ゲームへ行く（えらんだら すぐ行く） */
.k-hicon.k-gbtn, .hicon.k-gbtn { background: linear-gradient(180deg, #ffb14a 0%, #ff8a1f 50%, #f07400 51%, #d85f00 100%); border-color: var(--k-ink); box-shadow: 0 4px 0 var(--k-ink), inset 0 3px 0 rgba(255, 255, 255, 0.35); }
.k-hicon.k-gbtn small, .hicon.k-gbtn small { -webkit-text-stroke-color: var(--k-ink); }
.k-hicon.k-gbtn.on, .hicon.k-gbtn.on { transform: translateY(3px); box-shadow: 0 1px 0 var(--k-ink); filter: brightness(1.08); }
.k-gmenu { position: fixed; inset: 0; z-index: 15; pointer-events: auto; font-family: var(--k-font); background: rgba(8, 14, 44, 0.35); }
.k-gmenu.hidden { display: none; }
.k-gmenu-p {
  position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 66px); right: max(10px, env(safe-area-inset-right));
  width: min(92vw, 360px); max-height: calc(100% - max(12px, env(safe-area-inset-top)) - 84px); overflow-y: auto;
  padding: 10px; border-radius: 18px; background: #fffdf7; border: 4px solid var(--k-navy); box-shadow: 0 8px 0 var(--k-navy), 0 12px 30px rgba(0, 0, 0, 0.4);
  animation: kGmIn 0.16s ease-out; transform-origin: top right;
}
.k-gmenu-p::before { content: ''; position: absolute; top: -14px; right: 72px; border: 10px solid transparent; border-bottom-color: var(--k-navy); border-top: 0; }
@keyframes kGmIn { from { opacity: 0; transform: scale(0.9) translateY(-8px); } }
.k-gmenu-h { margin: 2px 4px 8px; font-size: 13px; font-weight: 800; color: #747083; letter-spacing: 0.06em; }
.k-gmenu-g { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.k-gm {
  position: relative; display: grid; justify-items: center; gap: 4px; padding: 8px 4px 9px; border-radius: 14px;
  background: #fff; border: 3px solid var(--k-navy); box-shadow: 0 4px 0 var(--k-navy);
  color: #2b2a33; font: inherit; cursor: pointer;
}
.k-gm:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--k-navy); }
.k-gm-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 30px; background: var(--mc, #4a58c8); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18); }
.k-gm b { font-size: 12px; font-weight: 800; line-height: 1.25; text-align: center; }
.k-gm-tag { position: absolute; top: -8px; right: -4px; padding: 2px 7px; border-radius: 999px; background: #ffd23f; border: 2px solid var(--k-ink); color: var(--k-ink); font-size: 10px; font-weight: 800; }
.k-gm.here { opacity: 0.6; cursor: default; }
.k-gm.lock .k-gm-ic { filter: grayscale(0.6) brightness(0.85); }
.k-gm.lock .k-gm-tag { background: var(--k-navy); color: #ffd23f; border-color: #ffd23f; }
@media (max-width: 400px) { .k-gmenu-p { top: calc(max(12px, env(safe-area-inset-top)) + 58px); } .k-gmenu-g { grid-template-columns: repeat(3, 1fr); } .k-gm-ic { width: 46px; height: 46px; font-size: 26px; } }
@media (prefers-reduced-motion: reduce) { .k-gmenu-p { animation: none; } }

/* マッチング中（すぐ遊ぶ: その時に いる人と。10秒で 足りない分は CPU） */
.k-match {
  position: fixed; inset: 0; z-index: 7500; display: grid; place-items: center; padding: 20px;
  font-family: var(--k-font); color: #fff; text-align: center;
  background: radial-gradient(circle at 50% 42%, #3d5bff 0%, #2a2f9e 45%, #171a5c 100%);
  -webkit-user-select: none; user-select: none;
}
.k-match.hidden { display: none; }
.k-match::before { content: ''; position: absolute; inset: -50%; background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.06) 0deg 10deg, transparent 10deg 20deg); animation: k-boot-spin 30s linear infinite; pointer-events: none; }
.k-match-in { position: relative; width: min(92vw, 420px); display: grid; justify-items: center; gap: 10px; }
.k-match-t { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: 0.04em; -webkit-text-stroke: 7px var(--k-navy); paint-order: stroke fill; animation: kMatchBob 1.4s ease-in-out infinite; }
@keyframes kMatchBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.k-match-ring { position: relative; width: 150px; height: 150px; display: grid; place-items: center; }
.k-match-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.k-match-ring circle { fill: none; stroke-width: 9; }
.k-match-ring .bg { stroke: rgba(255, 255, 255, 0.18); fill: rgba(16, 24, 70, 0.6); }
.k-match-ring .fg { stroke: #ffd23f; stroke-linecap: round; transition: stroke-dashoffset 0.2s linear; }
.k-match-n { position: relative; font-size: 58px; font-weight: 800; line-height: 1; -webkit-text-stroke: 8px var(--k-navy); paint-order: stroke fill; }
.k-match-u { position: absolute; bottom: 30px; font-size: 12px; font-weight: 800; color: #c8d0ff; }
.k-match.go .k-match-n { color: #ffd23f; font-size: 50px; animation: kMatchGo 0.5s ease-out; }
.k-match.go .k-match-u, .k-match.wait .k-match-u { display: none; }
.k-match.wait .k-match-ring { animation: kMatchSpin 1.6s linear infinite; }
@keyframes kMatchGo { from { transform: scale(0.5); } 70% { transform: scale(1.15); } }
@keyframes kMatchSpin { to { transform: rotate(360deg); } }
.k-match-s { margin: 0; font-size: 17px; font-weight: 800; color: #ffe98a; -webkit-text-stroke: 5px var(--k-navy); paint-order: stroke fill; }
.k-match-ps { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 4px 0; }
.k-match-p { display: grid; justify-items: center; gap: 4px; width: 72px; animation: kMatchIn 0.35s ease-out; }
@keyframes kMatchIn { from { opacity: 0; transform: scale(0.6) translateY(10px); } }
.k-match-p i { position: relative; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; border: 3px solid #fff; background: var(--ava, #4f8cff); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), inset 0 -7px 0 rgba(0, 0, 0, 0.18); font-style: normal; font-size: 24px; font-weight: 800; }
.k-match-p:not(.q) i::before, .k-match-p:not(.q) i::after { content: ''; position: absolute; top: 14px; width: 11px; height: 13px; border-radius: 50%; background: radial-gradient(circle at 50% 60%, #222 0 34%, #fff 36%); }
.k-match-p:not(.q) i::before { left: 10px; }
.k-match-p:not(.q) i::after { right: 10px; }
.k-match-p b { max-width: 72px; font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-text-stroke: 3px var(--k-navy); paint-order: stroke fill; }
.k-match-p.me i { box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 0 3px #ffd23f; }
.k-match-p.q i { background: rgba(255, 255, 255, 0.12); border-style: dashed; color: #c8d0ff; animation: kMatchQ 1.2s ease-in-out infinite; }
.k-match-p.q b { color: #c8d0ff; }
.k-match.go .k-match-p.q { display: none; }
@keyframes kMatchQ { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
.k-match-note { margin: 2px 0 6px; font-size: 13px; font-weight: 700; color: #c8d0ff; line-height: 1.5; }
.k-match-x { padding: 10px 30px; border-radius: 14px; border: 3px solid var(--k-ink); background: #fffdf7; color: var(--k-ink); font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; box-shadow: 0 4px 0 var(--k-ink); }
.k-match-x:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--k-ink); }
.k-match.go .k-match-x { visibility: hidden; }
body.k-match-on .sound-btn, body.k-match-on #soundBtn { z-index: 7600; }
@media (max-height: 520px) { .k-match-in { gap: 6px; } .k-match-ring { width: 110px; height: 110px; } .k-match-n { font-size: 44px; } .k-match-u { bottom: 20px; } .k-match-t { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) { .k-match::before, .k-match-t, .k-match.wait .k-match-ring, .k-match-p.q i { animation: none; } }

/* よこ向き（スマホを横にしたとき）: 左にロゴ、右にキャラ、下にプレイ */
@media (orientation: landscape) and (max-height: 560px) {
  .k-home { padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .k-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: 'top top' 'logo hero' 'bottom bottom'; column-gap: 16px; }
  .k-top { grid-area: top; }
  .k-logo { grid-area: logo; align-self: center; margin: 0; }
  .k-logo-b { font-size: min(56px, calc((50vw - 48px) / var(--n, 6))); }
  .k-logo-s { font-size: 18px; }
  .k-invite { grid-area: logo; align-self: end; justify-self: center; margin: 0 0 4px; }
  .k-hero { grid-area: hero; min-height: 0; height: 100%; }
  .k-hero-c { width: 100%; height: auto; flex: 1; min-height: 0; max-height: none; }
  .k-hero-name { font-size: 15px; padding: 3px 14px; margin-top: 0; }
  .k-bottom { grid-area: bottom; }
  .k-play { height: 76px; width: min(34vw, 250px); }
  .k-pb-tx { font-size: 34px; -webkit-text-stroke-width: 7px; }
  .k-pb-sub { margin-top: 3px; }
  .k-mode { width: min(40vw, 320px); }
  .k-hicon { width: 50px; height: 50px; }
  .k-hicon span { font-size: 20px; }
  .k-ava { width: 42px; height: 42px; }
  .k-gmenu-p { top: calc(max(8px, env(safe-area-inset-top)) + 58px); width: min(70vw, 520px); }
  .k-gmenu-g { grid-template-columns: repeat(5, 1fr); }
  .k-gm-ic { width: 42px; height: 42px; font-size: 24px; }
  .k-sheet { padding-top: max(8px, env(safe-area-inset-top)); }
}
@media (orientation: landscape) and (max-height: 440px) { .k-boot:has(.k-boot-pick) .k-boot-chars { display: none; } .k-boot-note { font-size: 11.5px; } }

/* オリジナルの絵（art.js が、文字の中の 絵文字を この絵に 置きかえる）。文字の 大きさに あわせる */
.k-art { display: inline-block; width: 1.18em; height: 1.18em; vertical-align: -0.22em; line-height: 0; flex: none; }
.k-art svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* iPhone・iPad の Safari: 「ホーム画面に追加」で 全画面に なることを おしえる カード */
.k-a2hs { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 14px); z-index: 9998; display: flex; align-items: flex-start; gap: 8px; width: min(calc(100vw - 24px), 440px); box-sizing: border-box; padding: 10px 8px 10px 14px; border-radius: 16px; background: #fffdf7; border: 3px solid var(--k-navy); box-shadow: 0 5px 0 var(--k-navy), 0 10px 24px rgba(0, 0, 0, 0.3); font-family: var(--k-font); color: var(--k-ink); transform: translateX(-50%); animation: k-a2hs-in 0.35s ease both; }
.k-a2hs.out { animation: k-a2hs-out 0.3s ease both; }
.k-a2hs-tx { flex: 1; display: grid; gap: 3px; }
.k-a2hs-tx b { font-size: 15px; font-weight: 800; color: var(--k-navy); }
.k-a2hs-tx span { font-size: 13px; font-weight: 700; line-height: 1.55; color: #4a4658; }
.k-a2hs-x { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #d9d3c4; background: #fff; color: #747083; font: inherit; font-size: 20px; font-weight: 800; line-height: 1; cursor: pointer; }
@keyframes k-a2hs-in { from { opacity: 0; transform: translate(-50%, 30px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes k-a2hs-out { to { opacity: 0; transform: translate(-50%, 30px); } }
/* よこ向き: 下の プレイボタンに かぶらないように、上の まん中に 出す */
@media (orientation: landscape) and (max-height: 520px) {
  .k-a2hs { bottom: auto; top: calc(max(8px, env(safe-area-inset-top)) + 4px); width: max(300px, min(380px, calc(100vw - 470px))); padding: 7px 6px 7px 12px; }
  .k-a2hs-tx span { font-size: 12px; line-height: 1.45; }
  @keyframes k-a2hs-in { from { opacity: 0; transform: translate(-50%, -30px); } to { opacity: 1; transform: translate(-50%, 0); } }
}
