/* まものラッシュ 独自スタイル（common.css 非依存・横向き前提） */
:root {
  --ink: #3f3946; --sub: #8a8496; --line: #e6def5;
  --acc: #7c6ce8; --acc2: #8f7ae5; --pink: #ff9fb6; --gold: #f0a92d;
  --sky: #bfe6ff; --card: #ffffff; --bg: #eaf6ff;
  --shadow: 0 6px 18px rgba(124, 108, 232, .16);
  --r: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Hiragino Maru Gothic ProN", "BIZ UDGothic", "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(#cde9ff, #eaf6ff 60%, #dff3e0);
  color: var(--ink); overflow-x: hidden;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }

/* ===== ログイン画面 ===== */
#loginView { text-align: center; padding: 30px 14px 40px; max-width: 560px; margin: 0 auto; }
#loginView h1 { font-size: 26px; margin: 10px 0 2px; }
#loginView .series { color: var(--acc); font-size: 14px; font-weight: 700; letter-spacing: .06em; margin-top: 18px; }
#loginView .sub { color: var(--sub); font-size: 14px; margin: 6px 0 22px; }
.login-lang { display: flex; justify-content: flex-end; }
.neko-lg { width: 110px; height: 110px; }
.gbtn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: #fff; border: 2px solid var(--line); border-radius: 999px;
  padding: 13px 18px; font-size: 15px; font-weight: 700; color: var(--ink); box-shadow: var(--shadow);
}
.gicon { width: 20px; height: 20px; }
.ghost-btn { display: block; width: 100%; margin-top: 12px; background: none; border: none; color: var(--acc); font-size: 14px; font-weight: 700; padding: 10px; }
.note { color: var(--sub); font-size: 11.5px; line-height: 1.7; margin: 14px 0 0; }

/* ===== 共通ヘッダー ===== */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 6px 2px; }
.home-btn { text-decoration: none; color: var(--ink); font-weight: 700; font-size: 13px; background: #fff; border-radius: 999px; padding: 7px 14px; box-shadow: var(--shadow); }
.userbox { display: flex; align-items: center; gap: 8px; position: relative; }
.lang-switch { display: inline-flex; background: #fff; border-radius: 999px; padding: 3px; box-shadow: var(--shadow); }
.lang-switch button { background: none; border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 700; color: var(--sub); }
.lang-switch button.on, .lang-switch button[aria-pressed="true"] { background: var(--acc); color: #fff; }
.login-mini { background: var(--acc); color: #fff; border-radius: 999px; padding: 7px 13px; font-size: 12px; font-weight: 700; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #fff; box-shadow: var(--shadow); }
.menu-btn { background: #fff; border-radius: 50%; width: 34px; height: 34px; font-size: 16px; box-shadow: var(--shadow); }
.menu { position: absolute; right: 0; top: 42px; background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 10px; z-index: 40; min-width: 160px; }
.menu .uname { font-size: 12px; color: var(--sub); padding: 4px 6px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu button { display: block; width: 100%; text-align: left; background: none; padding: 8px 6px; font-size: 13px; font-weight: 700; color: var(--ink); border-radius: 8px; }
.menu button:hover { background: var(--bg); }
.demo-banner { display: flex; align-items: center; gap: 10px; justify-content: space-between; background: #fff6e3; border: 1.5px dashed var(--gold); border-radius: 12px; padding: 7px 12px; font-size: 12px; margin: 6px 0; }
.demo-banner button { background: var(--gold); color: #fff; border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 700; }

/* くろねこ吹き出し */
.neko-area { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.neko-sm { width: 46px; height: 46px; flex: none; }
.bubble { background: #fff; border-radius: 14px; padding: 8px 13px; font-size: 12.5px; box-shadow: var(--shadow); position: relative; }
.bubble::before { content: ""; position: absolute; left: -6px; top: 50%; transform: translateY(-50%); border: 6px solid transparent; border-right-color: #fff; border-left: 0; }

/* ===== ホーム（にゃむら広場） ===== */
#homeScr { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(230px, 1fr); gap: 14px; align-items: start; }
.panel { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; }
.plaza-panel { padding: 10px; }
#plaza { width: 100%; aspect-ratio: 13 / 5; display: block; border-radius: 14px; touch-action: manipulation; }
.plaza-hint { text-align: center; color: var(--sub); font-size: 11.5px; margin: 6px 0 2px; font-weight: 700; }
.series-title { font-size: 12px; color: var(--acc); font-weight: 800; letter-spacing: .05em; margin: 0; }
.game-title { font-size: 21px; font-weight: 900; margin: 2px 0 10px; }
.gold-row { display: flex; align-items: center; gap: 6px; background: #fff8e6; border-radius: 999px; padding: 7px 14px; font-weight: 900; font-size: 16px; color: #a4700f; width: fit-content; margin-bottom: 10px; }
.stat { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--sub); font-weight: 700; padding: 3px 2px; }
.stat b { color: var(--ink); }
.mode-btns { display: grid; gap: 9px; margin-top: 10px; }
.big-btn { border-radius: 16px; padding: 14px; font-size: 16px; font-weight: 900; color: #fff; background: linear-gradient(135deg, #8f7ae5, #7c6ce8); box-shadow: var(--shadow); transition: transform .08s; }
.big-btn:active { transform: scale(.97); }
.big-btn.alt { background: linear-gradient(135deg, #ff9fb6, #f27ba1); }
.big-btn.ghost { background: #fff; color: var(--acc); border: 2px solid var(--line); }
.boss-note { color: #e05a6b; font-weight: 900; font-size: 12px; text-align: center; margin-top: -3px; }
.lb-title { font-weight: 900; font-size: 14px; margin: 14px 0 6px; }
.lb { background: #faf8ff; border-radius: 12px; max-height: 200px; overflow-y: auto; font-size: 12.5px; }
.lb-row { display: grid; grid-template-columns: 30px 1fr auto auto; gap: 6px; padding: 6px 10px; border-bottom: 1px solid #efeaf9; align-items: center; }
.lb-row.lb-me { background: #efe9ff; }
.lb-rank { font-weight: 900; color: var(--acc); }
.lb-day { color: var(--sub); font-size: 10.5px; }
.lb-score { font-weight: 900; }
.lb-empty { padding: 16px; text-align: center; color: var(--sub); }

/* ===== バトル ===== */
#battleScr { position: relative; }
/* HUDはプレー画面（canvas）の上に重ねる */
.cvwrap { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; }
.hud-pill { background: rgba(255, 255, 255, .88); border-radius: 999px; padding: 6px 14px; font-weight: 900; font-size: 13.5px; box-shadow: var(--shadow); }
#hudMode { position: absolute; top: 9px; left: 52px; z-index: 5; }
#hudGoldPill { position: absolute; top: 9px; right: 8px; z-index: 5; color: #a4700f; background: rgba(255, 248, 230, .92); }
#pauseBtn { position: absolute; top: 8px; left: 8px; z-index: 5; width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .88); box-shadow: var(--shadow); font-size: 14px; }
/* 細長スマホでも16:9を崩さない（高さ基準でサイズ決定・左右は余白） */
#game { aspect-ratio: 16 / 9; height: min(56vw, calc(100dvh - 130px)); width: auto; max-width: 100%; display: block; margin: 0 auto; border-radius: 16px; box-shadow: var(--shadow); touch-action: manipulation; background: #cfe9ff; }
/* レベル選択列が表示されている間はその分だけ縮める */
#battleScr:has(#lvRow:not(.hidden)) #game { height: min(56vw, calc(100dvh - 172px)); }
#waveBanner { position: absolute; left: 50%; top: 36%; transform: translate(-50%, -50%); font-size: 34px; font-weight: 900; color: #fff; text-shadow: 0 3px 10px rgba(90, 70, 180, .45); opacity: 0; pointer-events: none; }
#waveBanner.bshow { animation: bpop 1.6s ease forwards; }
@keyframes bpop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 30% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }

/* 召喚レベル選択列（キャラ列の上・全キャラ共通） */
.lvrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; padding: 7px 0 0; }
.lvlab { font-size: 12px; font-weight: 900; color: var(--sub); margin-right: 2px; }
.lvsel { min-width: 42px; padding: 7px 0; border-radius: 12px; background: #fff; font-weight: 900; font-size: 13px; color: var(--sub); box-shadow: var(--shadow); }
.lvsel.on { background: var(--acc); color: #fff; }

.cardbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; justify-content: center; padding: 8px 0 2px; }
.ucard .ulv { position: absolute; top: 4px; left: 7px; font-size: 10px; font-weight: 900; color: var(--acc); pointer-events: none; }
.ucard {
  position: relative; overflow: hidden; width: 86px; border-radius: 14px; background: #fff;
  box-shadow: var(--shadow); padding: 6px 4px 7px; text-align: center; transition: transform .07s;
}
.ucard:active { transform: scale(.94); }
.ucard canvas { width: 56px; height: 56px; }
.ucard .cost { display: block; font-weight: 900; font-size: 15px; color: #a4700f; line-height: 1; }
.ucard.poor .cost { color: #c9c2d8; }
.ucard.poor canvas { filter: grayscale(.7) opacity(.6); }
.cdov { position: absolute; left: 0; bottom: 0; width: 100%; height: 0%; background: rgba(63, 57, 70, .38); pointer-events: none; }
.sidebtn { position: relative; overflow: hidden; width: 96px; border-radius: 14px; box-shadow: var(--shadow); font-weight: 900; }
#walletBtn { background: #fff8e6; color: #a4700f; font-size: 13px; }
#walletBtn .wlv { display: block; font-size: 10.5px; color: var(--sub); }
#walletBtn.poor { opacity: .55; }
#skillBtn { background: linear-gradient(135deg, #ffd66e, #f0a92d); color: #7a5200; font-size: 12px; line-height: 1.3; }

/* ===== オーバーレイ ===== */
.ov { position: fixed; inset: 0; background: rgba(63, 57, 70, .45); display: flex; align-items: center; justify-content: center; z-index: 60; }
.ovcard { background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 22px 26px; text-align: center; max-width: 420px; width: calc(100% - 40px); }
.ovcard h2 { margin: 0 0 8px; font-size: 22px; }
.ovcard .body { white-space: pre-line; color: var(--sub); font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.ovbtns { display: grid; gap: 8px; }
.ovbtns .big-btn { font-size: 15px; padding: 12px; }
#evoOv .ovcard { background: linear-gradient(#fffdf4, #fff); }
#evoCv { width: 100%; max-width: 360px; aspect-ratio: 9 / 5; }
#evoTxt { font-weight: 900; color: var(--acc); font-size: 16px; margin: 4px 0 2px; }
.evotap { font-size: 11px; color: var(--sub); }

/* ===== 強化 ===== */
#upScr .panel { max-width: 640px; margin: 0 auto; }
.uphead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.uphead h2 { font-size: 18px; margin: 0; }
.uprow { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px solid #f0ecfa; }
.upicon { width: 48px; height: 48px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 26px; background: #faf8ff; border-radius: 12px; }
.upinfo { flex: 1; min-width: 0; }
.upname { font-weight: 900; font-size: 14px; }
.uplv { color: var(--acc); font-size: 12px; margin-left: 4px; }
.updetail { font-size: 12px; color: var(--sub); margin-top: 2px; }
.updetail b { color: var(--ink); }
.evomark { color: var(--gold); font-weight: 900; }
.upbuy { background: var(--acc); color: #fff; border-radius: 999px; padding: 9px 16px; font-weight: 900; font-size: 13px; min-width: 82px; }
.upbuy.off { background: #d9d3ea; }

/* ===== トースト・縦向き案内 ===== */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; border-radius: 999px; padding: 10px 20px; font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; z-index: 90; }
.toast.show { opacity: 1; transform: translateX(-50%); }

.foot { text-align: center; color: var(--sub); font-size: 11px; line-height: 1.8; margin: 18px 0 6px; }

/* 縦向き・幅の狭い画面：1カラムに積む（縦でも遊べる） */
@media (max-width: 760px) and (orientation: portrait) {
  #homeScr { grid-template-columns: 1fr; }
  #plaza { aspect-ratio: 13 / 6; }
  .ucard { width: 76px; }
  .ucard canvas { width: 48px; height: 48px; }
  .sidebtn { width: 86px; font-size: 11.5px; }
  #game { height: auto; width: 100%; }  /* 縦は幅いっぱいの16:9 */
}

/* 狭い横画面（スマホ横向き）向け圧縮 */
@media (max-height: 480px) {
  .topbar { padding: 2px; }
  .neko-area { display: none; }
  #homeScr { grid-template-columns: 1.4fr 1fr; gap: 8px; }
  .panel { padding: 8px 10px; }
  .game-title { font-size: 16px; margin-bottom: 4px; }
  .big-btn { padding: 9px; font-size: 13.5px; }
  .lb { max-height: 90px; }
  #game { height: min(56vw, calc(100dvh - 92px)); }
  #battleScr:has(#lvRow:not(.hidden)) #game { height: min(56vw, calc(100dvh - 130px)); }
  .lvsel { min-width: 36px; padding: 5px 0; }
  .ucard { width: 72px; }
  .ucard canvas { width: 44px; height: 44px; }
}
