/* =============================================================
   まよなかアリーナ ― 見た目
   KEPIGAME のサイト（太い線・押すと沈むボタン・黄色）を夜の色にしたもの。
   色の意味：武器＝オレンジ／スキル＝むらさき／特性＝みどり／SP＝水色／KP＝黄色
   ============================================================= */

:root {
  --night-0: #110C1D;
  --night-1: #1D1530;
  --night-2: #281E40;
  --night-3: #352950;
  --line: #4A3D6E;
  --line-soft: rgba(190, 178, 209, 0.18);
  --text: #F5F0FF;
  --text-2: #C3B8DC;
  --text-3: #9286B0;
  --ink: #1B171D;
  --pop: #FFD23F;
  --pop-hover: #FFE066;
  --pop-shadow: #8F6B00;
  --lav: #BEB2D1;
  --weapon: #FF9B4A;
  --skill: #A98BFF;
  --trait: #4BE3A0;
  --sp: #5ED8FF;
  --hp: #FF4D6D;
  --orb: #C9A7FF;
  --ticket: #FF7FB8;
  --danger: #FF4D6D;
  --r-l: 18px;
  --r-m: 12px;
  --r-s: 8px;
  --font: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo', sans-serif;
  --font-display: 'Dela Gothic One', 'M PLUS Rounded 1c', 'Hiragino Sans', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --pad: 16px;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--night-1);
  color: var(--text);
  font-family: var(--font);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1, h2, h3, h4, p, ol, ul {
  margin: 0;
}

/* ---------- アイコンの絵（assets/ の画像。assets.js で差し替えできる） ---------- */
.ico {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* 文の中に入れる小さなアイコン（オーブ・KP など） */
.ico.ico-inline {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.26em;
}

/* 敵の絵（メダマは黒目を重ねる） */
.enemy-ico {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}

.enemy-ico .ico {
  position: absolute;
  inset: 0;
}

.enemy-ico .ico-iris {
  transform: translate(6%, 1%);
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--pop);
  outline-offset: 2px;
}

.noscript {
  padding: 24px;
  text-align: center;
}

/* ---------- 全体の箱 ---------- */
.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.app input {
  user-select: text;
  -webkit-user-select: text;
}

/* ---------- 戦場 ---------- */
.battle {
  position: absolute;
  inset: 0;
  touch-action: none;
}

.arena {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- 画面（メニュー） ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: calc(10px + var(--safe-t)) calc(var(--pad) + var(--safe-r)) calc(12px + var(--safe-b)) calc(var(--pad) + var(--safe-l));
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(53, 41, 80, 0.9) 0%, rgba(29, 21, 48, 0.96) 55%, rgba(17, 12, 29, 0.98) 100%);
  overflow: hidden;
}

.screen.is-active {
  display: flex;
}

.screen-title {
  background:
    linear-gradient(180deg, rgba(17, 12, 29, 0.55) 0%, rgba(17, 12, 29, 0.25) 40%, rgba(17, 12, 29, 0.8) 100%);
}

.screen-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 2px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

/* ---------- 上のバー ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.topbar-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.topbar-spacer {
  flex: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  height: 38px;
  padding: 0 14px 0 8px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--night-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.pill:hover {
  background: var(--night-3);
}

/* 言語の切りかえ（🌐） */
.pill-lang {
  padding: 0 10px;
  font-family: inherit;
  font-size: 17px;
  cursor: pointer;
}

.pill svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.who {
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--night-0);
  font-size: 14px;
  white-space: nowrap;
}

.chip b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 15px;
}

.chip-kp b {
  color: var(--pop);
}

.chip-sp b {
  color: var(--sp);
}

.chip-ticket b {
  color: var(--ticket);
}

.chip-unit {
  font-size: 11px;
  margin-left: -2px;
}

/* ---------- ボタン（押すと沈む） ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 18px;
  border: 2px solid var(--ink);
  border-radius: var(--r-m);
  background: var(--night-3);
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.06s ease, box-shadow 0.06s ease, background-color 0.12s ease, opacity 0.12s ease;
  touch-action: manipulation;
}

.btn:hover {
  background: #43356A;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 0 var(--ink);
}

.btn-pop {
  background: var(--pop);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--pop-shadow);
}

.btn-pop:hover {
  background: var(--pop-hover);
}

.btn-pop:active {
  box-shadow: 0 1px 0 var(--pop-shadow);
}

.btn-light {
  background: #FFFFFF;
  color: #3C4043;
}

.btn-light:hover {
  background: #EDE8F5;
}

.btn-ghost {
  background: var(--night-2);
  border-color: var(--line);
  box-shadow: 0 4px 0 var(--night-0);
}

.btn-ghost:active {
  box-shadow: 0 1px 0 var(--night-0);
}

.btn-danger {
  background: #4A1A2E;
  border-color: #8A2C4A;
  color: #FFC2CF;
  box-shadow: 0 4px 0 #2A0E19;
}

.btn-danger:hover {
  background: #5E2139;
}

.btn-x {
  background: #0F1419;
  border-color: #3A4450;
  box-shadow: 0 4px 0 #000000;
}

.btn-x:hover {
  background: #222B35;
}

.btn-small {
  min-height: 36px;
  padding: 4px 12px;
  font-size: 13px;
}

.btn-wide {
  flex: 1;
}

.btn-huge {
  min-height: 64px;
  padding: 12px 54px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: 0.08em;
  border-width: 3px;
  box-shadow: 0 6px 0 var(--pop-shadow);
}

/* ---------- タイトル ---------- */
.title-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.95;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--pop);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 7px 0 #7B4BD8, 0 16px 44px rgba(0, 0, 0, 0.65);
}

.logo-a {
  font-size: clamp(38px, 8.5vw, 104px);
}

.logo-b {
  font-size: clamp(52px, 12vw, 150px);
  color: #FFFFFF;
  transform: rotate(-2deg);
  text-shadow: 0 8px 0 #FF4D6D, 0 16px 44px rgba(0, 0, 0, 0.65);
}

/* 文のまとまりの途中で折り返さない（せまい画面で「生き延び／ろ」のようにならないように） */
.nb {
  display: inline-block;
}

.title-lead {
  max-width: 34em;
  color: var(--text);
  font-size: 16px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.title-keys {
  font-size: 13px;
  color: var(--text-2);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

/* ---------- ホーム ---------- */
.home-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  grid-template-rows: 1fr 1fr auto;
  grid-template-areas:
    'play deck shop'
    'play codex rank'
    'play ach small';
  gap: 14px;
}

.home-play {
  grid-area: play;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 8px;
  padding: 22px;
  border: 3px solid var(--ink);
  border-radius: var(--r-l);
  background:
    radial-gradient(80% 70% at 85% 15%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(160deg, #FFE066 0%, var(--pop) 45%, #FFB23F 100%);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 6px 0 var(--pop-shadow);
  overflow: hidden;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

.home-hero {
  position: absolute;
  right: 1%;
  top: 2%;
  width: min(200px, 58%);
  height: auto;
  aspect-ratio: 1;
  transform: rotate(8deg);
  filter: drop-shadow(0 6px 0 rgba(143, 107, 0, 0.35));
  pointer-events: none;
  user-select: none;
}

.home-play > span {
  position: relative;
}

.home-play:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--pop-shadow);
}

/* 中断した戦いがあるときの「続きから」（色を変えて、いつもの「出撃する」と見分ける） */
.home-play.is-resume {
  background:
    radial-gradient(80% 70% at 85% 15%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(160deg, #B5F2FF 0%, #5FD7FF 45%, #3FB4EE 100%);
  box-shadow: 0 6px 0 #1E7FB2;
}

.home-play.is-resume:active {
  box-shadow: 0 2px 0 #1E7FB2;
}

.home-play-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.1;
}

.home-play-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 14px;
}

.home-play-sub span {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(27, 23, 29, 0.88);
  color: #FFFFFF;
  white-space: nowrap;
}

.home-play-best {
  font-size: 14px;
}

.home-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 2px;
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: var(--r-l);
  background: var(--night-2);
  text-align: left;
  box-shadow: 0 5px 0 var(--night-0);
  transition: transform 0.06s ease, box-shadow 0.06s ease, background-color 0.12s ease;
  overflow: hidden;
  min-height: 0;
}

.home-tile:hover {
  background: var(--night-3);
}

.home-tile:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--night-0);
}

.home-tile::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 6px;
}

.tile-deck { grid-area: deck; }
.tile-shop { grid-area: shop; }
.tile-codex { grid-area: codex; }
.tile-rank { grid-area: rank; }
.tile-deck::after { background: linear-gradient(90deg, var(--weapon), var(--skill), var(--trait)); }
.tile-shop::after { background: var(--pop); }
.tile-codex::after { background: var(--sp); }
.tile-rank::after { background: var(--lav); }

.tile-icon {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 54px;
  height: 54px;
  opacity: 0.95;
}

.tile-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 21px;
  line-height: 1.25;
}

.tile-sub {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
}

.tile-preview {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  min-width: 0;
  max-width: 100%;
}

.mini-icons {
  display: flex;
  gap: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.mini-icons .ico {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}

.tile-badge {
  position: absolute;
  left: 14px;
  top: 16px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--pop);
  color: var(--ink);
  font-size: 12px;
}

/* 実績と記録（横長の小さいタイル） */
.home-tile.tile-ach {
  grid-area: ach;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 14px;
}

.tile-ach::after {
  background: linear-gradient(90deg, #E0A36B, #D9DCE6, var(--pop));
}

.tile-ach-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
}

.tile-ach-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tile-ach .tile-title {
  font-size: 18px;
}

.tile-ach .tile-preview {
  margin-top: 0;
  font-size: 12px;
}

.tile-ach .tile-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-ach .tile-badge {
  left: auto;
  right: 10px;
  top: 10px;
  background: var(--hp);
  color: #FFFFFF;
}

.tile-title-now {
  color: var(--pop);
}

.home-small {
  grid-area: small;
  display: flex;
  gap: 10px;
}

.home-small .btn {
  flex: 1;
}

/* ---------- タブ ---------- */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab {
  flex-shrink: 0;
  min-height: 40px;
  padding: 6px 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--night-2);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 800;
}

.tab[aria-selected='true'] {
  color: var(--ink);
  border-color: var(--ink);
}

.tab-weapon[aria-selected='true'] { background: var(--weapon); }
.tab-skill[aria-selected='true'] { background: var(--skill); }
.tab-trait[aria-selected='true'] { background: var(--trait); }
.tab-enemy[aria-selected='true'] { background: var(--hp); color: #FFFFFF; }
.tab-guide[aria-selected='true'] { background: var(--sp); }

/* ---------- 共通のパネル・カード ---------- */
.panel {
  border: 2px solid var(--line);
  border-radius: var(--r-l);
  background: rgba(40, 30, 64, 0.9);
  padding: 14px;
}

.panel-title {
  font-size: 15px;
  font-weight: 900;
  margin-bottom: 8px;
}

.note {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

.section-note {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-2);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 12px 12px;
  border: 2px solid var(--line);
  border-radius: var(--r-m);
  background: var(--night-2);
  text-align: left;
  overflow: hidden;
  min-width: 0;
}

.card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--cat, var(--line));
}

.card-weapon { --cat: var(--weapon); }
.card-skill { --cat: var(--skill); }
.card-trait { --cat: var(--trait); }
.card-sp { --cat: var(--sp); }
.card-enemy { --cat: var(--hp); }

button.card {
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease, transform 0.06s ease;
}

button.card:hover {
  background: var(--night-3);
}

button.card:active {
  transform: scale(0.98);
}

.card.is-on {
  border-color: var(--cat);
  background: color-mix(in srgb, var(--cat) 16%, var(--night-2));
}

.card.is-locked {
  opacity: 0.55;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.card-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--night-0);
}

.card-icon .ico {
  width: 34px;
  height: 34px;
}

/* 特性のアイコン（主人公の姿）は、枠いっぱいに */
.card-icon.card-icon-hero .ico {
  width: 44px;
  height: 44px;
  margin-top: -2px;
}

.card-name {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.3;
  min-width: 0;
}

.card-meta {
  font-size: 12px;
  color: var(--text-3);
}

.card-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
}

.card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--night-0);
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}

.tag-cat {
  background: color-mix(in srgb, var(--cat) 22%, var(--night-0));
  color: var(--text);
}

.tag-on {
  background: var(--cat);
  color: var(--ink);
}

.pro {
  color: var(--trait);
}

.con {
  color: #FF9BB0;
}

/* ---------- デッキのプリセット ---------- */
.deck-tools {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.trait-head {
  display: flex;
  align-items: flex-start;
  gap: 8px 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.trait-head .section-note {
  flex: 1 1 16em;
  margin-bottom: 0;
}

.sheet-presets {
  width: min(720px, 100%);
}

.preset-lead {
  margin: -4px 0 12px;
}

.preset-list {
  display: grid;
  gap: 8px;
}

.preset {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--night-2);
}

.preset.is-current {
  border-color: var(--pop);
  background: rgba(255, 210, 63, 0.1);
}

.preset.is-empty {
  border-style: dashed;
  background: transparent;
}

.preset-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
}

.preset-no {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--sp);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 15px;
}

.preset.is-empty .preset-no {
  background: var(--night-3);
  color: var(--text-2);
}

.preset-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 900;
}

.preset.is-empty .preset-title {
  color: var(--text-3);
}

.preset-dot {
  color: var(--text-3);
}

.preset-head .tag-on {
  background: var(--pop);
  color: var(--ink);
  font-weight: 900;
}

.preset-cards {
  display: grid;
  gap: 4px;
}

.preset-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.preset-icons .ico {
  width: 26px;
  height: 26px;
}

.preset-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.preset-del {
  color: var(--text-2);
}

/* ---------- デッキ ---------- */
.deck-tray {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -4px -2px 12px;
  padding: 10px 10px 12px;
  border: 2px solid var(--line);
  border-radius: var(--r-l);
  background: rgba(17, 12, 29, 0.96);
}

.deck-tray-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.deck-count {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
}

.deck-count.is-short {
  color: var(--danger);
}

.deck-tray-note {
  flex: 1;
  min-width: 12em;
  font-size: 13px;
  color: var(--text-2);
}

.deck-slots {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
}

.slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 70px;
  padding: 6px 4px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--night-2);
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
  min-width: 0;
}

.slot-icon {
  width: 30px;
  height: 30px;
}

.slot-name {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot.is-starter {
  border-color: var(--pop);
  background: rgba(255, 210, 63, 0.14);
}

.slot-star {
  position: absolute;
  left: 4px;
  top: 2px;
  font-size: 10px;
  color: var(--pop);
}

.slot.is-empty {
  border-style: dashed;
  color: var(--text-3);
}

/* いまの特性では効果のないスキル */
.slot.is-bad {
  border-color: #FF8FA3;
  border-style: dashed;
}

.slot-bad {
  position: absolute;
  left: 4px;
  top: 2px;
  font-size: 10px;
  color: #FF8FA3;
}

.card-warn {
  font-size: 12px;
  line-height: 1.45;
  color: #FFB3C1;
}

.slot-actions {
  display: flex;
  gap: 4px;
  width: 100%;
}

.slot-actions button {
  flex: 1;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--night-0);
  color: var(--text-2);
  font-size: 11px;
}

/* ---------- 特性とSP ---------- */
.trait-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.trait-list {
  display: grid;
  gap: 8px;
}

.trait-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.trait-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.sp-list {
  display: grid;
  gap: 6px;
}

.sp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--night-2);
}

.sp-name {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-name small {
  color: var(--text-3);
  font-size: 12px;
}

.sp-val {
  min-width: 2.4em;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--sp);
}

.sp-btn {
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--night-3);
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 3px 0 var(--ink);
  touch-action: manipulation;
}

.sp-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

.sp-btn.plus {
  background: var(--sp);
  color: var(--ink);
}

.bonus-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.bonus-grid div {
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--night-0);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 図鑑 ---------- */
.codex {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
}

.codex-list {
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-content: start;
  gap: 8px;
  padding: 2px;
  min-height: 0;
}

.codex-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--night-2);
  text-align: left;
  font-size: 14px;
  min-width: 0;
}

.codex-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-item[aria-pressed='true'] {
  border-color: var(--pop);
  background: rgba(255, 210, 63, 0.12);
}

.codex-item.is-locked {
  opacity: 0.6;
}

.codex-detail {
  overflow-y: auto;
  min-height: 0;
}

.codex-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.codex-head .card-icon {
  width: 60px;
  height: 60px;
}

.codex-head .card-icon .ico {
  width: 50px;
  height: 50px;
}

.codex-head .card-icon.card-icon-hero .ico {
  width: 62px;
  height: 62px;
}

.codex-item .ico {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}

.codex-item .enemy-ico {
  width: 30px;
  height: 30px;
}

.codex-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.25;
}

.codex-awaken {
  margin: 10px 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 210, 63, 0.12);
  border: 2px solid rgba(255, 210, 63, 0.5);
  font-size: 14px;
}

.lv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: center;
}

.lv-table th {
  color: var(--text-3);
  font-weight: 800;
  padding: 4px 2px;
  border-bottom: 2px solid var(--line);
}

.lv-table td {
  padding: 4px 2px;
  border-bottom: 1px solid var(--line-soft);
}

.lv-table tr.is-awake td {
  color: var(--pop);
}

.codex-enemy {
  display: flex;
  align-items: center;
  gap: 14px;
}

.enemy-ico.is-portrait {
  width: 132px;
  height: 132px;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 60%, rgba(190, 178, 209, 0.16), rgba(17, 12, 29, 0) 70%);
}

/* 図鑑の「しくみ」（ステータスと状態異常。2026年11月16日） */
.codex-group {
  grid-column: 1 / -1;
  margin: 6px 2px 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-3);
}

.codex-group:first-child {
  margin-top: 0;
}

.guide-sp {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--text-2);
}

.guide-sp b {
  color: var(--sp);
}

.guide-notes {
  margin: 10px 0 0;
  padding-left: 1.2em;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}

.guide-notes li + li {
  margin-top: 4px;
}

.guide-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.guide-chip {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 5px;
  max-width: 100%;
  padding: 3px 9px 3px 6px;
  border-radius: 999px;
  background: var(--night-0);
  font-size: 13px;
}

.guide-chip small {
  color: var(--text-3);
  font-size: 11px;
}

.codex-medals {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-2);
}

/* ---------- 実績と記録 ---------- */
.tab-ach[aria-selected='true'] { background: var(--pop); }

.muted {
  color: var(--text-3);
}

.ach-summary {
  display: grid;
  gap: 8px;
}

.ach-summary-count b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 32px;
  line-height: 1;
  color: var(--pop);
}

.ach-summary-count span {
  margin-left: 6px;
  color: var(--text-2);
}

.ach-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--night-0);
  overflow: hidden;
}

.ach-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pop), #FFB03A);
}

.ach-title-now b {
  color: var(--pop);
}

.ach-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 18px 0 8px;
  font-size: 16px;
  font-weight: 900;
}

.ach-group small {
  font-size: 13px;
  color: var(--text-3);
}

.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr));
  gap: 8px;
}

.ach-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: var(--r-m);
  background: var(--night-2);
}

.ach-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.tag.tag-got {
  background: rgba(255, 210, 63, 0.18);
  color: var(--pop);
}

.ach-on {
  font-size: 12px;
  color: var(--pop);
}

.ach-card.is-got {
  border-color: color-mix(in srgb, var(--pop) 40%, var(--line));
}

.ach-card.is-on {
  border-color: var(--pop);
  background: rgba(255, 210, 63, 0.1);
}

.ach-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--night-0);
}

.ach-icon > .ico,
.ach-icon > .enemy-ico {
  width: 44px;
  height: 44px;
}

.ach-card:not(.is-got) .ach-icon > * {
  filter: grayscale(1) brightness(0.75);
  opacity: 0.5;
}

.ach-name {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
}

.ach-desc {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
}

.ach-reward {
  margin-top: 2px;
  font-size: 12px;
  color: var(--pop);
}

.ach-prog {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.ach-prog .ach-bar {
  flex: 1;
  height: 6px;
}

.ach-prog small {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

.ach-action {
  margin-top: 6px;
}

.tag.tag-new {
  margin-left: 2px;
  padding: 0 7px;
  background: var(--hp);
  color: #FFFFFF;
  font-size: 11px;
  vertical-align: 2px;
}

/* メダル（特性ごとの記録） */
.medals {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

.medals .ico-medal {
  width: 20px;
  height: 20px;
}

.medals.is-large .ico-medal {
  width: 34px;
  height: 34px;
}

.trait-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.medal-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.medal-sum {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.medal-sum .ico-medal-big {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
}

.medal-sum b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  color: var(--pop);
}

.medal-sum small {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
}

.trait-rec-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr));
  gap: 8px;
}

.trait-rec {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-left: 6px solid var(--trait);
  border-radius: var(--r-m);
  background: var(--night-2);
}

.trait-rec.is-locked {
  opacity: 0.55;
}

.trait-rec-text {
  min-width: 0;
}

.trait-rec-stats {
  font-size: 12px;
  color: var(--text-2);
}

/* ---------- ランキング ---------- */
.rank-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.rank-me {
  display: grid;
  gap: 10px;
}

.rank-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--night-0);
}

.rank-card-avatar {
  font-size: 34px;
  line-height: 1;
}

.rank-card-name {
  font-size: 16px;
  font-weight: 900;
  word-break: break-all;
}

.rank-card-title {
  font-size: 12px;
  color: var(--pop);
}

.rank-title-link {
  justify-self: start;
  margin-left: 2px;
  font-size: 13px;
}

.rank-title {
  display: block;
  font-size: 11px;
  line-height: 1.3;
  color: var(--pop);
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-card-x {
  font-size: 12px;
  color: var(--text-3);
}

.field {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--text-2);
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--night-0);
  color: var(--text);
  font-size: 16px;
}

.field input:focus {
  outline: none;
  border-color: var(--pop);
}

.field-error {
  color: #FF9BB0;
  font-size: 12px;
}

.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.avatar-picker button {
  width: 40px;
  height: 40px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--night-0);
  font-size: 22px;
  line-height: 1;
}

.avatar-picker button[aria-pressed='true'] {
  border-color: var(--pop);
  background: rgba(255, 210, 63, 0.18);
}

.rank-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.rank-mine {
  font-size: 13px;
  color: var(--pop);
}

.rank-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.rank-row {
  display: grid;
  grid-template-columns: 2.6em auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--night-2);
  font-size: 14px;
}

.rank-row.is-me {
  border-color: var(--pop);
  background: rgba(255, 210, 63, 0.12);
}

.rank-pos {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--text-2);
}

/* 1〜3位の色（順位で決める。自分の前後の一覧では、上から何番目かと順位がちがうので） */
.rank-row.is-p1 .rank-pos { color: #FFD23F; }
.rank-row.is-p2 .rank-pos { color: #D9DCE6; }
.rank-row.is-p3 .rank-pos { color: #E0A36B; }

/* トップ15／自分の前後（2026年11月13日から） */
.rank-views {
  margin-top: 10px;
}

.rank-loading {
  animation: rank-loading 1.4s ease-in-out infinite;
}

@keyframes rank-loading {
  50% { opacity: 0.45; }
}

.rank-empty small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-3);
}

.rank-retry {
  margin-top: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .rank-loading { animation: none; }
}

.rank-avatar {
  font-size: 22px;
  line-height: 1;
}

.rank-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-name a {
  margin-left: 6px;
  font-size: 11px;
  color: var(--text-2);
  text-decoration: none;
}

.rank-score {
  text-align: right;
  white-space: nowrap;
}

.rank-score b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 16px;
  color: var(--pop);
}

.rank-score small {
  display: block;
  font-size: 11px;
  color: var(--text-3);
}

.rank-empty {
  padding: 26px 8px;
  text-align: center;
  color: var(--text-2);
}

/* ---------- 重ねて出す窓 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(12px + var(--safe-t)) calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l));
  background: rgba(10, 6, 20, 0.7);
  animation: ov-in 0.16s ease-out;
}

@keyframes ov-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay-confirm {
  z-index: 40;
}

.sheet {
  width: min(560px, 100%);
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--night-1);
  box-shadow: 0 8px 0 var(--night-0), 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: sheet-in 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes sheet-in {
  from { transform: translateY(14px) scale(0.98); }
  to { transform: none; }
}

.sheet h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.3;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.sheet-sub {
  margin: 14px 0 8px;
  font-size: 14px;
  color: var(--text-2);
  font-weight: 800;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.sheet-actions .btn {
  flex: 1 1 auto;
}

/* 出撃準備 */
.sheet-prep {
  width: min(640px, 100%);
}

.prep-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.prep-summary div {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--night-0);
  font-size: 13px;
  color: var(--text-2);
  min-width: 0;
}

.prep-summary b {
  display: block;
  color: var(--text);
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prep-warn {
  grid-column: 1 / -1;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(94, 216, 255, 0.12);
  border: 2px solid rgba(94, 216, 255, 0.4);
  font-size: 13px;
}

.link-btn {
  margin-left: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--sp);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prep-boosts {
  display: grid;
  gap: 8px;
}

.boost-tickets {
  display: flex;
  align-items: center;
  gap: 4px 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--night-0);
  font-size: 13px;
}

.boost-tickets b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 17px;
  color: var(--ticket);
}

.boost-group {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 8px;
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 900;
}

.boost-group small {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}

.boost-group-strong {
  color: var(--pop);
}

.boost-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.boost {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    'icon text'
    'act act';
  align-items: center;
  gap: 6px 10px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--night-2);
  text-align: left;
}

.boost-strong {
  border-color: rgba(255, 210, 63, 0.38);
}

.boost.is-on {
  border-color: var(--pop);
  background: rgba(255, 210, 63, 0.12);
}

.boost-icon {
  grid-area: icon;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}

.boost-icon .ico {
  width: 100%;
  height: 100%;
}

.boost-text {
  grid-area: text;
  min-width: 0;
}

.boost-name {
  display: block;
  font-size: 14px;
  font-weight: 900;
}

.boost-desc {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
}

.boost-actions {
  grid-area: act;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.boost-actions .btn {
  min-height: 34px;
  gap: 4px;
}

.boost-ticket.is-on {
  background: var(--pop);
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--pop-shadow);
}

.boost-ready {
  font-size: 12px;
  color: var(--trait);
}

/* そのブーストのチケットの枚数 */
.boost-have {
  margin-right: auto;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
  color: var(--ticket);
}

.boost-have.is-zero {
  color: var(--text-2);
}

/* 出撃準備：「出撃する」は、下へ送らなくてもいつも押せるように窓の下にはりつける */
.sheet-prep .prep-actions {
  position: sticky;
  bottom: -18px;
  z-index: 3;
  margin: 14px -18px -18px;
  padding: 12px 18px 18px;
  border-top: 2px solid var(--line);
  background: var(--night-1);
}

/* 結果・ガチャの結果：ボタンは、下へ送らなくてもいつも押せるように窓の下にはりつける */
.sheet-result .sheet-actions,
.sheet-gacha .sheet-actions {
  position: sticky;
  bottom: -18px;
  z-index: 3;
  margin: 14px -18px -18px;
  padding: 12px 18px 18px;
  border-top: 2px solid var(--line);
  background: var(--night-1);
}

/* 窓そのものにフォーカスを合わせたとき（戦闘の中の窓）は、枠を出さない */
.sheet[tabindex='-1']:focus {
  outline: none;
}

/* いまの特性では使えないブースト */
.boost.is-na {
  opacity: 0.6;
}

.boost-na-note {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-2);
}

/* ---------- ガチャ（ショップ） ---------- */
.tab-gacha[aria-selected='true'] { background: var(--ticket); }
.tab-special[aria-selected='true'] { background: var(--pop); }

/* ---------- 特別ショップ（秘伝書・時の砂時計。2026年10月24日） ---------- */
.card-grid-book {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card-book .card-icon {
  width: 52px;
  height: 52px;
  background: color-mix(in srgb, var(--cat) 18%, var(--night-0));
}

.card-book .card-icon .ico {
  width: 44px;
  height: 44px;
}

.card-book.is-own {
  border-color: color-mix(in srgb, var(--cat) 60%, var(--line));
}

/* 秘伝書の中身（解放ずみは色をつける） */
.book-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.book-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px 2px 4px;
  border-radius: 999px;
  background: var(--night-0);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.4;
}

.book-item .ico-inline {
  width: 18px;
  height: 18px;
}

.book-item.is-have {
  background: color-mix(in srgb, var(--cat) 24%, var(--night-0));
  color: var(--text);
}

.book-state {
  font-size: 12px;
  color: var(--text-3);
}

/* 買う条件（メダルの数）。満たしていると色がつく */
.need {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}

.need b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.need.is-ok {
  color: var(--trait);
}

.codex-book {
  display: flex;
  align-items: center;
  gap: 4px;
}

.gacha-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 10px;
}

.gacha-machine {
  display: grid;
  place-items: center;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  background: var(--night-0);
}

.gacha-art {
  width: 112px;
  height: 112px;
}

.gacha-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.2;
}

.gacha-lead {
  margin: 4px 0 8px;
  font-size: 14px;
  color: var(--text-2);
}

.gacha-lead b {
  color: var(--text);
}

.gacha-have {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 10px;
  font-size: 13px;
}

.gacha-have b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 16px;
}

.gacha-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gacha-btns .btn,
#gachaAgain {
  flex-direction: column;
  gap: 0;
}

.gacha-btns .btn {
  flex: 1 1 150px;
  min-height: 58px;
}

.gacha-btns small,
#gachaAgain small {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.85;
}

.gacha-odds {
  margin-top: 10px;
  font-size: 13px;
}

.gacha-odds summary {
  cursor: pointer;
  color: var(--sp);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.odds-table {
  width: 100%;
  margin: 8px 0;
  border-collapse: collapse;
}

.odds-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.odds-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

.odds-table small {
  display: block;
  color: var(--text-3);
  font-size: 11px;
}

.rarity {
  display: inline-block;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.75;
  white-space: nowrap;
}

.rarity-0 { background: #C3BBD8; }
.rarity-1 { background: #7FD4FF; }
.rarity-2 { background: #B57CFF; color: #FFFFFF; }
.rarity-3 { background: var(--pop); }
.rarity-4 { background: linear-gradient(90deg, #FFB8C8, #FFE6A3, #C3F2C2, #BFE3FF, #E3C9FF); }

/* ブーストごとのチケット（ガチャの画面） */
.ticket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.ticket-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    'icon name n'
    'icon ex ex';
  align-items: center;
  gap: 4px 10px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--night-2);
}

.ticket-strong {
  border-color: rgba(255, 210, 63, 0.38);
}

.ticket-ico {
  grid-area: icon;
  width: 42px;
  height: 42px;
}

.ticket-ico .ico {
  width: 100%;
  height: 100%;
}

.ticket-item.is-zero .ticket-ico {
  opacity: 0.55;
}

.ticket-name {
  grid-area: name;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 900;
}

.ticket-n {
  grid-area: n;
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 17px;
  color: var(--ticket);
}

.ticket-n small {
  margin-left: 2px;
  font-family: inherit;
  font-size: 11px;
  color: var(--text-2);
}

.ticket-item.is-zero .ticket-n {
  color: var(--text-2);
}

/* 下の段：ガチャ1回で出る確率と、かけらでの交換 */
.ticket-foot {
  grid-area: ex;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  min-width: 0;
}

.ticket-ex {
  margin-left: auto;
  min-height: 30px;
}

.ticket-rate {
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
}

/* 縦向きのスマホ：2列にして、名前は折り返す */
@media (max-width: 620px) {
  .ticket-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ticket-item {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      'icon n'
      'name name'
      'ex ex';
    padding: 8px 10px;
  }
  .ticket-ico {
    width: 34px;
    height: 34px;
  }
  .ticket-n {
    justify-self: end;
    font-size: 15px;
  }
  .ticket-name {
    white-space: normal;
    font-size: 12px;
    line-height: 1.35;
  }
  .ticket-foot {
    flex-direction: column;
    align-items: stretch;
  }
  .ticket-ex {
    margin-left: 0;
  }
}

.look-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 18px 0 0;
  font-size: 17px;
  font-weight: 900;
}

.look-head small {
  font-size: 13px;
  color: var(--text-2);
}

.look-note {
  margin-bottom: 8px;
}

.look-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  gap: 10px;
}

.look-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  border: 2px solid var(--line);
  border-radius: var(--r-m);
  background: var(--night-2);
  text-align: center;
}

.look-card.r3 { border-color: rgba(255, 210, 63, 0.5); }
.look-card.r4 { border-color: rgba(255, 127, 184, 0.65); }

.look-card.is-on {
  border-color: var(--pop);
  background: rgba(255, 210, 63, 0.1);
}

.look-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 84px;
}

.look-card.is-locked .look-art > :first-child {
  opacity: 0.4;
}

.look-lock {
  position: absolute;
  top: 0;
  right: 2px;
}

.look-lock .ico {
  width: 20px;
  height: 20px;
}

.look-canvas {
  width: 78px;
  height: 78px;
}

.look-floor-art {
  width: 106px;
  height: 76px;
  border: 2px solid var(--ink);
  border-radius: 10px;
}

.look-ico {
  width: 64px;
  height: 64px;
}

/* デフォルト（何もつけていない見た目） */
.look-none {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 2px dashed var(--line);
  border-radius: 50%;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 800;
}

.look-name {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}

.look-meta {
  line-height: 1;
}

.look-action {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
  margin-top: 4px;
}

.look-on {
  font-size: 12px;
  color: var(--pop);
}

.look-action .link-btn {
  margin-left: 0;
  font-size: 12px;
}

/* ガチャの結果 */
.overlay-gacha {
  z-index: 30;
}

.sheet-gacha {
  width: min(760px, 100%);
}

.gacha-stage {
  display: grid;
  gap: 10px;
  cursor: pointer;
}

.gacha-stage.is-single { grid-template-columns: minmax(0, 1fr); }
.gacha-stage.is-multi { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.gacha-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 156px;
  padding: 8px 6px;
  border-radius: 14px;
  background: var(--night-0);
  overflow: hidden;
}

.is-single .gacha-cell {
  min-height: 270px;
}

.gacha-capsule {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  animation: cap-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
  animation-delay: calc(var(--i) * 0.17s);
}

.gacha-capsule .ico {
  width: 76px;
  height: 76px;
  animation: cap-wobble 0.5s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.17s + 0.42s);
}

.is-single .gacha-capsule .ico {
  width: 150px;
  height: 150px;
}

.gacha-cell.is-open .gacha-capsule {
  animation: cap-pop 0.26s ease-out forwards;
}

.gacha-prize {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  opacity: 0;
  transform: scale(0.6);
}

.gacha-cell.is-open .gacha-prize {
  animation: prize-in 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.3) 0.06s forwards;
}

.gacha-cell.r2.is-open { box-shadow: inset 0 0 0 2px rgba(181, 124, 255, 0.75); }
.gacha-cell.r3.is-open { box-shadow: inset 0 0 0 3px var(--pop); background: rgba(255, 210, 63, 0.14); }
.gacha-cell.r4.is-open {
  box-shadow: inset 0 0 0 3px var(--ticket);
  background: linear-gradient(135deg, rgba(255, 184, 200, 0.24), rgba(255, 230, 163, 0.18), rgba(191, 227, 255, 0.24));
}

@keyframes cap-in {
  from { transform: translateY(-46px) scale(0.6); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes cap-wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-9deg); }
  75% { transform: rotate(9deg); }
}

@keyframes cap-pop {
  to { transform: scale(1.5); opacity: 0; }
}

@keyframes prize-in {
  to { opacity: 1; transform: none; }
}

.prize-art {
  display: grid;
  place-items: center;
}

.prize-art .ico,
.prize-art .look-canvas {
  width: 60px;
  height: 60px;
}

.prize-art .look-floor-art {
  width: 80px;
  height: 57px;
}

.is-single .prize-art .ico,
.is-single .prize-art .look-canvas {
  width: 120px;
  height: 120px;
}

.is-single .prize-art .look-floor-art {
  width: 168px;
  height: 120px;
}

/* ブーストのチケット：ブーストの絵の右下に、チケットの印 */
.prize-ticket {
  position: relative;
}

.prize-ticket-mark {
  position: absolute;
  right: -8px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--night-0);
}

.gacha-cell .prize-art .prize-ticket-mark .ico {
  width: 19px;
  height: 19px;
}

.is-single .prize-ticket-mark {
  width: 42px;
  height: 42px;
}

.is-single .gacha-cell .prize-art .prize-ticket-mark .ico {
  width: 28px;
  height: 28px;
}

.prize-strong {
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--pop);
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
}

.prize-name {
  font-size: 13px;
  font-weight: 900;
  line-height: 1.3;
}

.is-single .prize-name {
  font-size: 20px;
}

.prize-kind {
  font-size: 11px;
  color: var(--text-2);
}

.prize-dupe {
  font-size: 11px;
  color: var(--sp);
}

.gacha-summary {
  min-height: 1.6em;
  margin: 10px 0 0;
  text-align: center;
  font-size: 14px;
}

/* 魔法の祭壇のショップ */
.overlay-shop {
  background: rgba(10, 6, 20, 0.62);
}

.sheet-waveshop {
  width: min(1180px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 14px;
  overflow: hidden;
}

.ws-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 2px solid var(--line);
}

.ws-tip {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text-2);
}

.ws-foot .btn {
  white-space: nowrap;
}

.ws-tip.is-warn {
  color: var(--pop);
}

.ws-foot .btn-pop {
  min-width: 190px;
  font-size: 16px;
}

.ws-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--line);
}

.ws-heading {
  flex: 1;
  min-width: 0;
}

.ws-heading p {
  font-size: 13px;
  color: var(--text-2);
}

.ws-orbs {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 14px;
  border: 2px solid var(--orb);
  border-radius: 999px;
  background: rgba(201, 167, 255, 0.12);
}

.ws-orbs .ico {
  align-self: center;
  width: 24px;
  height: 24px;
}

.ws-orbs b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  color: var(--orb);
}

.ws-orbs small {
  font-size: 12px;
  color: var(--text-2);
}

.ws-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  padding: 12px 0 8px;
  overflow: hidden;
}

.ws-offers {
  overflow-y: auto;
  min-height: 0;
  padding-right: 2px;
}

.ws-row-title {
  margin: 2px 0 8px;
  font-size: 14px;
  font-weight: 900;
}

.ws-row-weapon { color: var(--weapon); }
.ws-row-skill { color: var(--skill); margin-top: 14px; }

.offer-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.offer {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--night-2);
  min-width: 0;
  overflow: hidden;
}

.offer::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--cat);
}

.offer.is-awaken {
  border-color: var(--pop);
  background: linear-gradient(180deg, rgba(255, 210, 63, 0.16), var(--night-2) 60%);
}

.offer.is-bought {
  opacity: 0.45;
}

.offer.is-locked {
  border-color: var(--lav);
}

.offer-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.offer-name {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.3;
}

.offer-lv {
  font-size: 12px;
  color: var(--text-2);
}

.offer-lv b {
  color: var(--pop);
}

.offer-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

/* 祭壇：いまの数字 → 取ったとき（強化したとき）の数字（スキルも武器も。スマホでも出す） */
.offer-now {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
}

.offer-now b {
  color: var(--pop);
}

.offer-now small {
  font-size: 11px;
  color: var(--text-2);
}

/* 上限に届いた・この特性では効果がないスキル（並ぶけれど取れない） */
.offer.is-blocked {
  border-style: dashed;
  background: var(--night-1);
}

.offer.is-blocked .card-icon {
  opacity: 0.6;
  filter: grayscale(0.6);
}

.offer-lv .offer-warn {
  color: #FF8FA3;
}

.offer-note {
  font-size: 12px;
  line-height: 1.45;
  color: #FFB3C1;
}

.offer-foot {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.offer-buy {
  flex: 1;
  min-height: 42px;
  white-space: nowrap;
  padding-left: 8px;
  padding-right: 8px;
}

.offer-lock {
  flex-shrink: 0;
  width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 18px;
}

.offer-lock[aria-pressed='true'] {
  background: var(--lav);
  color: var(--ink);
}

/* 6つの武器がすべて覚醒したあとの「覇者の契約」は、横長の1枚で出す */
.offer.offer-wide {
  grid-column: 1 / -1;
}

/* 「まとめて契約」があるときは、ボタンを2つ並べる（せまいときは2段） */
.offer.offer-wide .offer-foot {
  flex-wrap: wrap;
}

.offer.offer-wide .offer-buy {
  flex: 1 1 140px;
}

/* まとめて買う（特別ショップの「まとめ買いの権利」「自動買いの権利」を持っているときだけ。祭壇の品物の上） */
.ws-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.ws-bulk[hidden] {
  display: none;
}

.ws-bulk-btn {
  flex: 1 1 140px; /* スマホの縦でも2つ横に並ぶ */
  min-height: 40px;
  padding-left: 10px;
  padding-right: 10px;
  font-size: 14px;
  white-space: normal;
}

.ws-bulk-btn .ico {
  width: 18px;
  height: 18px;
  vertical-align: -3px;
}

.offer.offer-wide .offer-desc {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

@media (min-width: 720px) {
  .offer.offer-wide {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr) minmax(150px, 0.7fr);
    align-items: center;
    column-gap: 14px;
  }
  .offer.offer-wide .offer-foot {
    margin-top: 0;
  }
}

.offer-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
  padding: 10px;
}

.ws-build {
  overflow-y: auto;
  min-height: 0;
  padding: 12px;
  border-radius: 14px;
  background: var(--night-0);
  font-size: 13px;
}

.ws-build h5 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text-2);
}

.ws-build h5 + * {
  margin-bottom: 12px;
}

.build-weapons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.build-weapon {
  display: grid;
  place-items: center;
  gap: 0;
  padding: 4px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--night-2);
  font-size: 11px;
  min-height: 52px;
}


.build-weapon.is-awake {
  border-color: var(--pop);
  color: var(--pop);
}

.build-weapon .ico {
  width: 26px;
  height: 26px;
}

.build-weapon.is-empty {
  border-style: dashed;
  color: var(--text-3);
}

.build-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.build-skills span {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--night-2);
  font-size: 12px;
}

.build-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 10px;
  font-size: 12px;
  color: var(--text-2);
}

.build-stats b {
  color: var(--text);
}

/* 一時停止・ステータス */
.sheet-pause {
  width: min(420px, 100%);
  text-align: center;
}

.pause-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0 12px;
}

.pause-grid .btn-wide {
  grid-column: 1 / -1;
}

.pause-grid .btn-danger,
.pause-grid .pause-top {
  grid-column: 1 / -1;
}

.sheet-stats {
  width: min(720px, 100%);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}

.stats-grid div {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--night-0);
  font-size: 13px;
}

.stats-grid b {
  float: right;
}

.dps-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.dps-row small {
  font-size: 12px;
  color: var(--text-2);
}

.dps-bar {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 99px;
  background: var(--night-0);
  overflow: hidden;
}

.dps-bar i {
  display: block;
  height: 100%;
  background: var(--weapon);
}

/* 結果・クリア */
.sheet-result,
.sheet-clear {
  width: min(520px, 100%);
  text-align: center;
}

.res-kicker {
  font-size: 13px;
  color: var(--text-2);
}

.res-title {
  margin-top: 2px;
}

.clear-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(48px, 10vw, 84px) !important;
  color: var(--pop);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink);
  line-height: 1.1;
}

.clear-lead {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-2);
}

.res-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 6px;
}

.res-numbers div {
  padding: 10px;
  border-radius: 12px;
  background: var(--night-0);
}

.res-numbers span {
  display: block;
  font-size: 12px;
  color: var(--text-2);
}

.res-numbers b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  color: var(--pop);
}

.res-rank {
  margin: 6px 0;
  color: var(--pop);
}

.res-numbers b .kp-ad {
  display: block;
  font-family: var(--font);
  font-weight: 700;
  font-size: 12px;
  color: var(--trait);
}

/* 広告を見てKPを2倍（自分から押したときだけ広告が流れる） */
.btn-ad {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  margin: 4px 0 6px;
  padding: 6px 14px;
  border: 2px dashed rgba(255, 210, 63, 0.7);
  border-radius: 14px;
  background: rgba(255, 210, 63, 0.08);
  color: var(--text);
  font-size: 14px;
}

.btn-ad:hover {
  background: rgba(255, 210, 63, 0.16);
}

.btn-ad .ico-ad {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.btn-ad b {
  color: var(--pop);
  white-space: nowrap;
}

/* 結果：達成した実績・とったメダル */
.res-ach {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 10px;
  border: 2px solid rgba(255, 210, 63, 0.45);
  border-radius: 14px;
  background: rgba(255, 210, 63, 0.08);
  text-align: left;
  animation: sheet-in 0.3s 0.2s both cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.res-ach-head {
  font-weight: 900;
  color: var(--pop);
  text-align: center;
}

.res-ach-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.res-ach-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
}

.res-ach-icon > .ico,
.res-ach-icon > .enemy-ico {
  width: 34px;
  height: 34px;
}

.res-ach-text b {
  display: block;
  font-size: 14px;
  line-height: 1.3;
}

.res-ach-text small {
  font-size: 12px;
  color: var(--text-2);
}

.res-ach-kp {
  color: var(--pop);
  white-space: nowrap;
  font-size: 13px;
}

.res-ach-more {
  font-size: 12px;
  color: var(--text-2);
  text-align: center;
}

.res-medal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
}

.res-medal .ico-medal {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.res-medal b {
  color: var(--pop);
}

.res-detail {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-2);
  text-align: left;
}

.res-detail .build-skills {
  justify-content: center;
}

.res-weapons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.res-weapons span {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--night-2);
  color: var(--text);
}

/* 結果をポスト（構成とスコアの画像） */
.sheet-share {
  width: min(640px, 100%);
}

.share-img {
  display: block;
  width: 100%;
  aspect-ratio: 1200 / 630;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--night-2);
}

.share-note {
  margin: 8px 0 0;
  text-align: center;
}

/* 横向きのスマホなど、高さが低い画面：画像を小さくして、ボタンまで1画面に入れる */
@media (max-height: 500px) {
  .share-img {
    width: auto;
    height: 40vh;
    max-width: 100%;
    margin: 0 auto;
  }
}

.share-actions {
  flex-wrap: wrap;
}

.res-stats-btn {
  display: block;
  margin: 10px auto 0;
}

.stats-extra {
  margin: 8px 0 0;
  text-align: center;
}

.stats-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 4px;
}

/* いまのステータス：取ったスキルと、いまの効果の数字（2026年11月16日） */
.sk-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 4px;
}

.sk-card {
  padding: 6px 10px 7px;
  border-radius: 8px;
  background: var(--night-0);
  font-size: 12px;
  min-width: 0;
}

.sk-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  font-size: 13px;
  font-weight: 800;
}

.sk-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.sk-n {
  flex: none;
  color: var(--skill);
}

.sk-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  color: var(--text-2);
  line-height: 1.45;
}

.sk-line span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sk-line b {
  flex: none;
  color: var(--text);
  white-space: nowrap;
}

@media (max-width: 560px) {
  .sk-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

.res-tip {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(94, 216, 255, 0.1);
  border: 2px solid rgba(94, 216, 255, 0.35);
  color: var(--text);
}

.overlay-clear {
  background: radial-gradient(circle at 50% 40%, rgba(255, 210, 63, 0.25), rgba(10, 6, 20, 0.8) 60%);
}

/* 遊び方 */
.sheet-help {
  width: min(600px, 100%);
}

.help-count {
  font-size: 13px;
  color: var(--text-2);
}

.help-page {
  display: grid;
  gap: 10px;
  min-height: 210px;
}

.help-page h4 {
  font-size: 18px;
  font-weight: 900;
}

.help-page p,
.help-page li {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.7;
}

.help-page ul {
  padding-left: 1.2em;
}

.help-page strong {
  color: var(--text);
}

.help-art {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.help-art > .ico,
.help-art > .enemy-ico {
  width: 58px;
  height: 58px;
}

/* 設定 */
.settings-list {
  display: grid;
  gap: 8px;
}

.setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--night-2);
}

.setting-name {
  font-size: 15px;
}

.setting-name small {
  display: block;
  font-size: 12px;
  color: var(--text-3);
}

.seg {
  display: inline-flex;
  border: 2px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.seg button {
  min-height: 36px;
  padding: 4px 12px;
  border: 0;
  background: var(--night-0);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 800;
}

.seg button[aria-pressed='true'] {
  background: var(--pop);
  color: var(--ink);
}

.setting input[type='range'] {
  width: 140px;
  accent-color: var(--pop);
}

/* 確認 */
.sheet-confirm {
  width: min(420px, 100%);
  text-align: center;
}

.sheet-confirm p {
  font-size: 16px;
  line-height: 1.7;
}

/* お知らせ（画面の下） */
.toast-line {
  position: absolute;
  left: 50%;
  bottom: calc(18px + var(--safe-b));
  z-index: 50;
  max-width: min(92vw, 460px);
  padding: 10px 16px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--pop);
  color: var(--ink);
  font-size: 14px;
  text-align: center;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast-line.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* =============================================================
   戦闘中の表示（HUD）
   ============================================================= */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 14px;
}

.hud-exp {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(7px + var(--safe-t));
  background: rgba(17, 12, 29, 0.85);
}

.hud-exp i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 7px;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--lav), var(--pop));
}

.hud-top {
  position: absolute;
  left: calc(10px + var(--safe-l));
  right: calc(10px + var(--safe-r));
  top: calc(14px + var(--safe-t));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.hud-pause {
  pointer-events: auto;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: rgba(40, 30, 64, 0.92);
  box-shadow: 0 3px 0 var(--ink);
}

.hud-pause svg {
  width: 18px;
  height: 18px;
  fill: var(--text);
}

.hud-life {
  width: clamp(130px, 24vw, 280px);
  padding: 5px 8px 7px;
  border-radius: 12px;
  background: rgba(17, 12, 29, 0.78);
}

.hud-life-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  line-height: 1.2;
  margin-bottom: 3px;
}

.hud-lv {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--pop);
  font-size: 14px;
}

.hud-hp-text {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.hud-hp {
  position: relative;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 99px;
  background: #3A1626;
  overflow: hidden;
}

.hud-hp i,
.hud-hp b {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  border-radius: 99px;
}

.hud-hp b {
  background: #FFFFFF;
  opacity: 0.6;
  transition: transform 0.45s ease 0.15s;
}

.hud-hp i {
  z-index: 1;
  background: linear-gradient(90deg, #FF2D5B, #FF7A93);
}

.hud-hp.is-low i {
  animation: hp-low 0.6s ease-in-out infinite alternate;
}

@keyframes hp-low {
  from { filter: brightness(1); }
  to { filter: brightness(1.6); }
}

.hud-center {
  padding: 4px 16px 6px;
  border-radius: 14px;
  background: rgba(17, 12, 29, 0.78);
  text-align: center;
  line-height: 1.15;
}

.hud-wave {
  font-size: 13px;
  color: var(--text-2);
}

.hud-wave b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  color: var(--text);
}

.hud-timer {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--pop);
  font-variant-numeric: tabular-nums;
}

.hud-timer.is-boss {
  color: var(--hp);
  font-size: 14px;
}

/* WAVEの間の休み（次のWAVEまでの秒数） */
.hud-timer.is-break {
  color: #C9A7FF;
  font-size: 13px;
  white-space: nowrap;
}

.hud-right {
  position: relative;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

/* 戦いの速さ（特別ショップの「時の砂時計」を持っているときだけ出る。右上のスコアの下） */
.hud-speed {
  pointer-events: auto;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 54px;
  height: 34px;
  padding: 0 10px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: rgba(40, 30, 64, 0.92);
  box-shadow: 0 3px 0 var(--ink);
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1;
}

.hud-speed.is-fast {
  background: var(--pop);
  color: var(--ink);
}

/* ×3（金の砂時計）・×4（虹の砂時計）は色を変える */
.hud-speed.is-fast[data-speed="3"] {
  background: #FFB03A;
}

.hud-speed.is-fast[data-speed="4"] {
  background: #F07BFF;
}

.hud-orbs,
.hud-score {
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(17, 12, 29, 0.78);
  line-height: 1.15;
  white-space: nowrap;
}

.hud-orbs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 18px;
}

.hud-orbs .ico {
  width: 22px;
  height: 22px;
}

.hud-orbs b {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--orb);
  font-size: 20px;
}

.hud-orbs.is-bump {
  animation: bump 0.35s ease;
}

@keyframes bump {
  40% { transform: scale(1.25); }
}

.hud-score span {
  display: block;
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.08em;
}

.hud-score b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.hud-weapons {
  position: absolute;
  left: calc(10px + var(--safe-l));
  top: calc(72px + var(--safe-t));
  display: flex;
  gap: 4px;
}

.hud-weapon {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--line);
  border-radius: 9px;
  background: rgba(17, 12, 29, 0.8);
  font-size: 17px;
  line-height: 1;
}

.hud-weapon .ico {
  width: 26px;
  height: 26px;
}

.hud-weapon small {
  position: absolute;
  right: -4px;
  bottom: -6px;
  padding: 0 4px;
  border-radius: 6px;
  background: var(--night-3);
  font-size: 10px;
  line-height: 1.4;
}

.hud-weapon.is-awake {
  border-color: var(--pop);
}

.hud-weapon.is-awake small {
  background: var(--pop);
  color: var(--ink);
}

.hud-boss {
  position: absolute;
  left: 50%;
  top: calc(76px + var(--safe-t));
  width: min(560px, 70vw);
  transform: translateX(-50%);
  text-align: center;
}

.hud-boss-name {
  display: inline-block;
  padding: 0 12px;
  border-radius: 8px 8px 0 0;
  background: rgba(17, 12, 29, 0.85);
  font-size: 13px;
  color: #FFC2CF;
}

.hud-boss-bar {
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 99px;
  background: #2A1020;
  overflow: hidden;
}

.hud-boss-bar i {
  display: block;
  height: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, #C04BFF, #FF4D6D);
}

.hud-banner {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  padding: 6px 28px;
  font-family: var(--font-display);
  font-size: clamp(30px, 6vw, 60px);
  color: #FFFFFF;
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink);
  white-space: nowrap;
  text-align: center;
  line-height: 1.15;
  animation: banner 1.8s ease forwards;
}

.hud-banner small {
  display: block;
  font-family: var(--font);
  font-weight: 900;
  font-size: 0.32em;
  -webkit-text-stroke: 0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  color: var(--text);
}

.hud-banner.is-warning {
  color: var(--hp);
}

@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

.hud-hint {
  position: absolute;
  left: 50%;
  bottom: calc(22px + var(--safe-b));
  transform: translateX(-50%);
  max-width: min(90vw, 520px);
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(17, 12, 29, 0.85);
  font-size: 14px;
  text-align: center;
}

/* ダッシュボタン */
.dash-btn {
  pointer-events: auto;
  position: absolute;
  right: calc(18px + var(--safe-r));
  bottom: calc(18px + var(--safe-b));
  display: grid;
  place-items: center;
  align-content: center;
  width: 92px;
  height: 92px;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9EE7FF, #2BA9E0 70%);
  color: var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  touch-action: none;
}

.dash-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--ink);
}

.dash-btn.is-cooling {
  background: radial-gradient(circle at 35% 30%, #5D6F86, #36435A 70%);
  color: #C3CFDD;
}

.dash-ring {
  position: absolute;
  inset: -3px;
  width: calc(100% + 6px);
  height: calc(100% + 6px);
  transform: rotate(-90deg);
  pointer-events: none;
}

.dash-ring circle {
  fill: none;
  stroke: var(--pop);
  stroke-width: 6;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
}

.dash-label {
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
}

.dash-key {
  font-size: 10px;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

/* 固定スティックの場所（ダッシュボタンの反対のすみ。設定で「固定スティック」のとき） */
.joy-anchor {
  position: absolute;
  left: calc(104px + var(--safe-l));
  bottom: calc(104px + var(--safe-b));
  width: 0;
  height: 0;
  pointer-events: none;
}

.battle.dash-left .joy-anchor {
  left: auto;
  right: calc(104px + var(--safe-r));
}

/* ダッシュボタンを左下に（設定） */
.battle.dash-left .dash-btn {
  right: auto;
  left: calc(18px + var(--safe-l));
}

/* スティック */
.joy {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.joy::before {
  content: '';
  position: absolute;
  left: -60px;
  top: -60px;
  width: 120px;
  height: 120px;
  border: 3px solid rgba(245, 240, 255, 0.35);
  border-radius: 50%;
  background: rgba(17, 12, 29, 0.25);
}

.joy-knob {
  position: absolute;
  left: -27px;
  top: -27px;
  width: 54px;
  height: 54px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: rgba(245, 240, 255, 0.85);
}

/* =============================================================
   画面の大きさに合わせる
   ============================================================= */

/* PC（マウス）ではダッシュボタンを小さく、キーの案内を出す */
@media (hover: hover) and (pointer: fine) {
  .dash-btn {
    width: 76px;
    height: 76px;
  }
  .dash-label {
    font-size: 14px;
  }
}

@media (hover: none), (pointer: coarse) {
  .dash-key {
    display: none;
  }
}

/* 横向きのスマホ（高さが低い） */
@media (max-height: 520px) {
  /* 一時停止の窓：高さの低い画面（横向きのスマホ）でも、下の説明まで入るように詰める */
  .sheet-pause {
    padding: 12px 16px;
  }
  .sheet-pause h3 {
    font-size: 18px;
  }
  .pause-grid {
    gap: 8px;
    margin: 10px 0 8px;
  }
  .pause-grid .btn {
    min-height: 38px;
  }
  .sheet-pause .note {
    font-size: 12px;
    line-height: 1.4;
  }
  .is-multi .gacha-cell {
    min-height: 104px;
  }
  .is-single .gacha-cell {
    min-height: 190px;
  }
  .gacha-capsule .ico,
  .prize-art .ico,
  .prize-art .look-canvas {
    width: 46px;
    height: 46px;
  }
  .is-single .gacha-capsule .ico {
    width: 110px;
    height: 110px;
  }
  .gacha-machine {
    width: 96px;
    height: 96px;
  }
  .gacha-art {
    width: 80px;
    height: 80px;
  }
  html,
  body {
    font-size: 14px;
  }
  .screen {
    padding-top: calc(6px + var(--safe-t));
    padding-bottom: calc(6px + var(--safe-b));
  }
  .topbar {
    min-height: 40px;
    margin-bottom: 6px;
  }
  .topbar-title {
    font-size: 17px;
  }
  .pill {
    height: 34px;
  }
  .chip {
    height: 28px;
  }
  .tabs {
    margin-bottom: 6px;
  }
  .tab {
    min-height: 34px;
    padding: 4px 14px;
  }
  .home-grid {
    gap: 10px;
  }
  .home-play {
    padding: 14px 16px;
  }
  .home-play::before {
    width: 170px;
    height: 170px;
  }
  .home-tile {
    padding: 10px 12px;
  }
  .tile-icon {
    width: 38px;
    height: 38px;
    top: 8px;
    right: 8px;
  }
  .tile-title {
    font-size: 17px;
  }
  .tile-sub {
    display: none;
  }
  .home-small .btn {
    min-height: 40px;
  }
  .home-tile.tile-ach {
    padding: 6px 12px;
    gap: 8px;
  }
  .tile-ach-icon {
    width: 34px;
    height: 34px;
  }
  .tile-ach .tile-title {
    font-size: 15px;
  }
  .title-body {
    gap: 10px;
  }
  .logo-a {
    font-size: clamp(30px, 7vw, 64px);
  }
  .logo-b {
    font-size: clamp(42px, 10vw, 92px);
  }
  .title-lead {
    font-size: 14px;
  }
  .btn-huge {
    min-height: 54px;
    font-size: 22px;
  }
  .sheet {
    padding: 12px 14px;
  }
  .sheet-prep .prep-actions,
  .sheet-result .sheet-actions,
  .sheet-gacha .sheet-actions {
    bottom: -12px;
    margin: 10px -14px -12px;
    padding: 8px 14px 12px;
  }
  .sheet h3 {
    font-size: 19px;
  }
  /* 遊び方：絵を省いて横に広げ、ボタンまで1画面に収める */
  .sheet-help {
    width: min(760px, 100%);
  }
  .help-art {
    display: none;
  }
  .help-page {
    min-height: 0;
    gap: 6px;
  }
  .help-page h4 {
    font-size: 16px;
  }
  .help-page p,
  .help-page li {
    font-size: 13px;
    line-height: 1.55;
  }
  .sheet-waveshop {
    padding: 10px;
  }
  .ws-head {
    padding-bottom: 8px;
  }
  .ws-heading p {
    margin-top: 1px;
    font-size: 11px;
    line-height: 1.3;
  }
  .ws-body {
    grid-template-columns: minmax(0, 1fr) 210px;
    padding-top: 8px;
    gap: 10px;
  }
  .offer {
    padding: 8px 10px;
    gap: 4px;
  }
  .offer .card-icon {
    width: 34px;
    height: 34px;
  }
  .offer .card-icon .ico {
    width: 28px;
    height: 28px;
  }
  /* 高さが低い画面でも、説明は切らずに全部出す（カードが縦にのびて、祭壇の中をスクロールする） */
  .offer-desc {
    font-size: 12px;
    line-height: 1.45;
  }
  .offer-buy,
  .offer-lock {
    min-height: 36px;
  }
  .ws-row-skill {
    margin-top: 8px;
  }
  .ws-row-title {
    margin-bottom: 6px;
  }
  .deck-slots {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }
  .slot {
    min-height: 58px;
  }
  .slot-name {
    display: none;
  }
  .hud-top {
    top: calc(11px + var(--safe-t));
  }
  .hud-pause {
    width: 40px;
    height: 40px;
  }
  .hud-wave b {
    font-size: 18px;
  }
  .hud-weapons {
    top: calc(60px + var(--safe-t));
  }
  .hud-weapon {
    width: 30px;
    height: 30px;
  }
  .hud-weapon .ico {
    width: 23px;
    height: 23px;
  }
  .hud-boss {
    top: calc(62px + var(--safe-t));
    width: min(560px, calc(100vw - 2 * (224px + var(--safe-l))));
  }
  .dash-btn {
    width: 80px;
    height: 80px;
  }
}

/* タブレット・小さめのPC */
@media (max-width: 900px) {
  .ws-body {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
    overflow-y: auto;
    align-content: start;
  }
  .ws-offers,
  .ws-build {
    min-height: auto;
    overflow: visible;
  }
  .trait-layout,
  .rank-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .codex {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* 横向きのスマホ（幅は広いが高さが低い）はショップの右側を残す */
@media (max-height: 520px) and (min-width: 700px) {
  .ws-body {
    grid-template-columns: minmax(0, 1fr) 172px;
    grid-auto-rows: minmax(0, 1fr);
    overflow: hidden;
  }
  .ws-offers,
  .ws-build {
    min-height: 0;
    overflow-y: auto;
  }
  .ws-build {
    padding: 8px;
  }
  .build-stats,
  .build-stats-title {
    display: none;
  }
  .build-weapon {
    min-height: 40px;
  }
  .build-weapon .ico {
    width: 22px;
    height: 22px;
  }
  .offer-row {
    gap: 8px;
  }
  .offer-top {
    gap: 8px;
  }
  .offer-name {
    font-size: 14px;
  }
  .offer-type {
    display: none;
  }
  .ws-foot {
    padding-top: 8px;
  }
  .ws-foot .btn {
    min-height: 40px;
  }
  .ws-foot .btn-pop {
    min-width: 150px;
  }
  .ws-tip {
    font-size: 12px;
  }
  .sheet-waveshop {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      'head foot'
      'body body';
    column-gap: 10px;
  }
  .ws-head {
    grid-area: head;
    padding-bottom: 6px;
    border-bottom: 0;
  }
  .ws-head h3 {
    font-size: 17px;
  }
  .ws-foot {
    grid-area: foot;
    padding: 0 0 6px;
    margin: 0;
    border-top: 0;
  }
  .ws-foot .ws-tip {
    display: none;
  }
  .ws-body {
    grid-area: body;
    border-top: 2px solid var(--line);
  }
  .ws-orbs {
    padding: 0 10px;
  }
  .ws-orbs b {
    font-size: 18px;
  }
  .ws-body {
    padding: 6px 0 4px;
  }
  .ws-row-title {
    margin: 0 0 4px;
    font-size: 12px;
  }
  .ws-row-skill {
    margin-top: 6px;
  }
  .ws-bulk {
    margin-bottom: 6px;
    gap: 6px;
  }
  .ws-bulk-btn {
    min-height: 34px;
    font-size: 13px;
  }
  .offer {
    padding: 6px 8px 8px;
    gap: 3px;
    border-radius: 12px;
  }
  .offer::before {
    height: 4px;
  }
  .offer .card-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }
  .offer .card-icon .ico {
    width: 25px;
    height: 25px;
  }
  .offer-lv {
    font-size: 11px;
    line-height: 1.3;
  }
  .offer-buy,
  .offer-lock {
    min-height: 34px;
    font-size: 13px;
  }
  .offer-lock {
    width: 36px;
  }
}

/* 縦向きのスマホ */
@media (max-width: 620px) {
  :root {
    --pad: 12px;
  }
  .topbar {
    gap: 8px;
  }
  /* 見出しは折り返さない。入りきらないときは、右のKP・SPが縦に並ぶ */
  .topbar-title {
    flex-shrink: 0;
    font-size: 17px;
    white-space: nowrap;
  }
  .chips {
    row-gap: 3px;
  }
  .chips .chip {
    height: 25px;
    padding: 0 8px;
    font-size: 12px;
  }
  .chips .chip b {
    font-size: 13px;
  }
  .who {
    display: none;
  }
  .home-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(150px, 1.4fr) 1fr 1fr auto auto;
    grid-template-areas:
      'play play'
      'deck shop'
      'codex rank'
      'ach ach'
      'small small';
    gap: 10px;
  }
  .medal-summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .ach-card {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
  }
  .ach-icon {
    width: 44px;
    height: 44px;
  }
  .ach-icon > .ico,
  .ach-icon > .enemy-ico {
    width: 38px;
    height: 38px;
  }
  .tile-sub {
    display: none;
  }
  .tile-title {
    font-size: 17px;
  }
  .card-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .deck-slots {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .slot {
    min-height: 60px;
  }
  .slot-name {
    display: none;
  }
  .codex {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .codex-list {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    max-height: 34vh;
  }
  .bonus-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .prep-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .boost-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .gacha-panel {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
  }
  .gacha-machine {
    width: 104px;
    height: 104px;
  }
  .gacha-art {
    width: 86px;
    height: 86px;
  }
  .gacha-have {
    justify-content: center;
  }
  .gacha-odds {
    text-align: left;
  }
  .gacha-stage.is-multi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .is-multi .gacha-cell {
    min-height: 128px;
  }
  .look-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .offer-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hud-top {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'left right'
      'center center';
  }
  .hud-left { grid-area: left; }
  .hud-right { grid-area: right; }
  .hud-center {
    grid-area: center;
    justify-self: center;
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 2px 14px;
  }
  .hud-life {
    width: clamp(110px, 38vw, 200px);
  }
  .hud-score span {
    display: none;
  }
  .hud-weapons {
    top: auto;
    bottom: calc(20px + var(--safe-b));
  }
  /* 縦の画面：ダッシュボタンと固定スティックは少し上に（下の武器の列・画面のふちと重ならないように） */
  .dash-btn {
    bottom: calc(92px + var(--safe-b));
  }
  .joy-anchor {
    bottom: calc(132px + var(--safe-b));
  }
  .hud-boss {
    top: calc(110px + var(--safe-t));
    width: 86vw;
  }
  .hud-hint {
    bottom: calc(196px + var(--safe-b));
    font-size: 13px;
  }
  .ws-foot {
    flex-wrap: wrap;
  }
  .ws-tip {
    flex-basis: 100%;
  }
  .ws-foot .btn {
    flex: 1;
    white-space: normal; /* ほかの言語で長い文（「Cerrar y volver al combate」など）が、はみ出して切れないように折り返す */
  }
  .ws-foot .btn-pop {
    min-width: 0;
    flex: 1.4;
    font-size: 15px;
  }
  .ws-orbs {
    padding: 2px 10px;
  }
}

/* せまいスマホ（たて）：ショップの5つのタブが1行に入るように、すき間と左右の余白を小さくする（あまったはばは、タブで分け合う） */
@media (max-width: 460px) {
  .tabs {
    gap: 4px;
  }
  .tab {
    flex: 1 0 auto;
    padding-left: 8px;
    padding-right: 8px;
  }
}

@media (max-width: 350px) {
  .tab {
    padding-left: 5px;
    padding-right: 5px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gacha-capsule,
  .gacha-capsule .ico,
  .gacha-cell.is-open .gacha-prize {
    animation: none;
  }
  .gacha-cell.is-open .gacha-capsule {
    display: none;
  }
  .gacha-cell.is-open .gacha-prize {
    opacity: 1;
    transform: none;
  }
  .overlay,
  .sheet,
  .hud-banner,
  .hud-orbs.is-bump {
    animation: none;
  }
  .hud-banner {
    opacity: 1;
  }
}

/* ---------- ほかの言語（js/i18n.js が html の lang を変える） ----------
   訳した言葉は日本語より長くなりやすいので、入りきらないところは折り返す */
html:not([lang='ja']) .topbar-title {
  flex-shrink: 1;
  white-space: normal; /* 単語のとちゅうでは切らない（空白のところで折り返す） */
  line-height: 1.1;
}

@media (max-width: 620px) {
  html:not([lang='ja']) .topbar-title {
    font-size: 15px;
  }
}

html:not([lang='ja']) .sp-name {
  white-space: normal;
  line-height: 1.2;
}

html:not([lang='ja']) .codex-item span:last-child {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.15;
  font-size: 13px;
}

/* ブーストのチケットの名前：ほかの言語では長いので、2行まで折り返す */
html:not([lang='ja']) .ticket-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.2;
}

/* 特性とSPを合わせた補正：ほかの言語では名前が長いので、数が切れないように折り返す */
html:not([lang='ja']) .bonus-grid div {
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.3;
}

/* 低い画面（スマホ横）：「買えるものあり」がショップの文字に重ならないように、文字の上に並べる */
@media (max-height: 520px) {
  .tile-shop .tile-badge {
    position: static;
    order: -1;
    margin-bottom: 2px;
    font-size: 11px;
  }
  /* 小さいスマホの横では、中身の行が折り返すと上が切れるので、1行ずつにする */
  .tile-shop .tile-preview span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* 出撃の準備：はじめの武器・特性の名前は、ほかの言語では2行まで折り返す */
html:not([lang='ja']) .prep-summary b {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.25;
}

/* サーバーの答えを待っているあいだ（出撃・買う・ガチャ。2026年11月16日から。js は ui.js の econ・startBattle・pullGacha） */
body.sa-busy { cursor: progress; }
body.sa-busy #btnStart,
body.sa-busy [data-act="pullGacha"],
body.sa-busy [data-act="buyUnlock"] { opacity: .65; pointer-events: none; }
