@charset "UTF-8";

/* ============================================================
   Design Tokens & CSS Variables
   濃い茶色ベース、白文字統一、スマートフォン操作特化（20px前後）
============================================================ */
:root {
  --bg-primary: #18110b;
  --bg-surface: rgba(38, 25, 17, 0.96);
  --bg-surface-elevated: rgba(52, 35, 24, 0.98);
  --bg-card: rgba(44, 29, 19, 0.94);

  --border-subtle: rgba(217, 119, 6, 0.28);
  --border-medium: rgba(245, 158, 11, 0.45);
  --border-focus: #f59e0b;

  /* 文字を白に統一 */
  --text-main: #ffffff;
  --text-muted: #ffffff;
  --text-faint: #f1f5f9;

  /* 濃い茶色・暗色アクセント（文字がある場所に明るい背景色を使用しない） */
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.4);
  --accent-btn-bg: linear-gradient(135deg, #78350f, #451a03);
  --accent-btn-border: #b45309;
  --accent-btn-active: #9a3412;
  --accent-cyan: #38bdf8;
  --accent-purple: #c084fc;
  --accent-green: #34d399;
  --accent-red: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-card: 0 8px 24px -4px rgba(0, 0, 0, 0.85);
  --font-display: 'Cinzel', serif;
  --font-body: 'Outfit', 'Noto Sans JP', sans-serif;
  --transition-fast: 0.16s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  color: var(--text-main);
}

html, body {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #120c08;
  background-image: radial-gradient(circle at 50% 10%, rgba(180, 83, 9, 0.18) 0%, #100a06 70%);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 1.45;
  display: flex;
  justify-content: center;
  align-items: center;
  /* スマホ長押し選択・「検索する」等を出さない */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ============================================================
   基本ボタンスタイル (ブラウザ標準白背景の完全排除)
============================================================ */
button {
  background: #342014;
  color: #ffffff;
  border: 1.5px solid #78350f;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-sizing: border-box;
  transition: all 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

button:hover {
  background: #451a03;
  border-color: #f59e0b;
}

/* プライマリボタン (決定・探索開始・購入など) */
.btn-primary {
  background: linear-gradient(180deg, #d97706 0%, #b45309 100%) !important;
  border: 1.5px solid #f59e0b !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.4);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%) !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.65) !important;
  color: #ffffff !important;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled,
.btn-primary:disabled:hover,
.btn-primary:disabled:active {
  background: #4b5563 !important;
  border-color: #6b7280 !important;
  color: #d1d5db !important;
  box-shadow: none !important;
  text-shadow: none !important;
  cursor: not-allowed;
  transform: none;
  opacity: 1;
}

.btn-secondary:disabled,
.btn-secondary:disabled:hover,
.btn-secondary:disabled:active,
.btn-primary.is-friend-busy,
.btn-secondary.is-friend-busy {
  background: #374151 !important;
  border-color: #4b5563 !important;
  color: #9ca3af !important;
  box-shadow: none !important;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

/* セカンダリボタン (戻る・閉じる・一時停止など) */
.btn-secondary {
  background: #261911 !important;
  border: 1.5px solid #78350f !important;
  color: #fbbf24 !important;
  font-weight: 700 !important;
}

.btn-secondary:hover {
  background: #3d2516 !important;
  border-color: #f59e0b !important;
  color: #ffffff !important;
}

/* アクションボタン (探索画面などの主要操作ボタン) */
.btn-action {
  flex: 1;
  min-height: 48px;
  padding: 10px 16px;
  font-size: 17px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  cursor: pointer;
  box-sizing: border-box;
}

/* ============================================================
   480×720 スマートフォン縦型固定コンテナ（ブラウザ自動スケール）
============================================================ */
.mobile-viewport-container {
  width: 480px;
  height: 720px;
  min-width: 480px;
  max-width: 480px;
  min-height: 720px;
  max-height: 720px;
  background: var(--bg-primary);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.95), 0 0 2px 1px var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: absolute;
  transform-origin: center center;
  overflow: hidden;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* 名前入力・セーブ移行コードなど、選択が必要な要素のみ許可 */
input,
textarea,
select,
.save-transfer-code {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* View Switching */
.view-section {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  overflow-y: auto;
  box-sizing: border-box;
}

.view-section.active {
  display: flex;
  flex-direction: column;
}

/* App Shell（ヘッダー上部・メイン領域下部の縦並びレイアウト） */
.app-shell {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}

.sub-view {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  box-sizing: border-box;
}

.sub-view.active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   タイトル画面 (Title Screen)
============================================================ */
#view-title {
  align-items: center;
  justify-content: center;
  padding: 16px 20px 12px;
  text-align: center;
  background: #000;
  overflow: hidden;
}

.title-container {
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  box-sizing: border-box;
}

.title-logo-badge {
  font-size: 46px;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 14px var(--accent-gold));
}

.title-main-heading {
  width: 100%;
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

.title-sub-heading {
  font-size: 18px;
  color: #ffffff;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 6px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

.title-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin-left: auto;
  margin-right: auto;
  object-fit: contain;
}
#view-title .title-main-heading {
  flex: 0 1 auto;
  max-height: 28%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#view-title .title-menu {
  flex: 0 0 auto;
  gap: 6px;
  margin-bottom: 8px;
}
#view-title .btn-title-menu { padding: 8px 18px; line-height: 1.2; min-height: 48px; }
#view-title .title-footer { flex-shrink: 0; }
#btn-menu-ranking { text-decoration:none; }
#loading-screen:not([hidden]) { position:absolute; inset:0; z-index:10000; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:16px; padding:24px; background:#150d08; color:#fff0d4; font-size:20px; text-align:center; }
#loading-text { margin:0; overflow-wrap:anywhere; }
#loading-close { font:inherit; padding:10px 20px; background:#542c13; color:#fff; border:1px solid #b45309; border-radius:8px; }

.title-flavor-text {
  font-size: 17px;
  color: #ffffff;
  margin-bottom: 22px;
}

.title-menu {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

/* メイン2本の下に、ボタン1行分の空き */
.title-menu-spacer {
  flex: 0 0 auto;
  min-height: 48px;
  height: 6.5%;
}

.title-menu-half-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  width: 100%;
}

.btn-title-menu {
  background: #261911;
  border: 1.5px solid #78350f;
  border-radius: var(--radius-md);
  color: #ffffff;
  padding: 14px 18px;
  font-size: 19px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: var(--transition-fast);
  min-height: 56px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.btn-title-menu-half {
  flex: 1 1 0;
  min-width: 0;
  width: 50%;
  box-sizing: border-box;
  padding: 10px 10px;
  gap: 8px;
  font-size: 17px;
}

.btn-title-menu-half .btn-icon { font-size: 20px; }
.btn-title-menu-half .btn-text small { font-size: 13px; }

.btn-title-menu:hover {
  background: #362217;
  border-color: #b45309;
  transform: translateY(-2px);
}

.btn-title-menu:disabled,
.btn-title-menu:disabled:hover,
.btn-title-menu:disabled:active {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

.btn-title-menu .btn-icon { font-size: 24px; }
.btn-title-menu .btn-text { flex: 1; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.btn-title-menu .btn-text small { font-size: 15px; color: #f1f5f9; font-weight: 400; }

.modal-save-transfer-box {
  width: min(92vw, 420px);
  max-height: 85%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
}
.save-transfer-lead {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
  color: #ffedd5;
}
.save-transfer-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid rgba(245, 158, 11, 0.35);
}
.save-transfer-heading {
  margin: 0;
  font-size: 18px;
  color: #fde68a;
  font-weight: 700;
}
.save-transfer-hint {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  color: #e7e5e4;
}
.save-transfer-label {
  font-size: 16px;
  color: #fef3c7;
}
.save-transfer-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 20px;
  line-height: 1.3;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #b45309;
  background: #1c1410;
  color: #fff7ed;
  letter-spacing: 0.06em;
}
.save-transfer-input::placeholder {
  color: #a8a29e;
}
.save-transfer-result {
  padding: 10px;
  border-radius: 8px;
  background: #261910;
  border: 1px solid #926037;
}
.save-transfer-code-label {
  margin: 0 0 4px;
  font-size: 15px;
  color: #fcd34d;
}
.save-transfer-code {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #ffffff;
  text-align: center;
  -webkit-user-select: all;
  user-select: all;
}
.save-transfer-expiry {
  margin: 6px 0 0;
  font-size: 15px;
  color: #e7e5e4;
  text-align: center;
}
.save-transfer-status {
  margin: 0;
  min-height: 1.4em;
  font-size: 16px;
  line-height: 1.35;
  color: #fde68a;
  white-space: pre-wrap;
}
.save-transfer-status.is-error {
  color: #fca5a5;
}
.save-transfer-status.is-ok {
  color: #86efac;
}

.btn-primary-glow {
  background: linear-gradient(135deg, #78350f, #451a03);
  border-color: #b45309;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.btn-editor-accent {
  border-color: #78350f;
  background: #341e12;
}

.title-footer { font-size: 15px; color: #ffffff; }

/* ============================================================
   キャラメイク画面
============================================================ */
#view-charmake {
  padding: 16px;
  overflow-y: auto;
  background: var(--bg-primary);
}

.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.step-indicator { font-size: 18px; font-weight: 700; opacity: 0.6; color: #ffffff; }
.step-indicator.active { opacity: 1; color: #ffffff; text-shadow: 0 0 10px rgba(245, 158, 11, 0.6); }
.step-divider { width: 30px; height: 2px; background: #78350f; }

.wizard-header h2 { font-size: 22px; margin-bottom: 6px; color: #ffffff; }
.wizard-header p { font-size: 17px; color: #ffffff; margin-bottom: 14px; }

.name-input-box { display: flex; gap: 8px; margin-bottom: 14px; }
.large-text-input {
  flex: 1;
  background: rgba(24, 15, 10, 0.92);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: #ffffff;
  font-size: 20px;
  min-height: 50px;
}
.large-text-input:focus {
  border-color: #b45309;
  outline: none;
}

.btn-icon-square {
  width: 50px;
  height: 50px;
  background: #3d2516;
  border: 1.5px solid #78350f;
  border-radius: var(--radius-sm);
  font-size: 22px;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-hero-card,
.birth-hero-showcase,
.soul-status-card {
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

/* フラッシュ召喚演出オーバーレイ */
.charmake-flash-overlay {
  position: fixed;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.5s ease;
}
.charmake-flash-overlay.flashing {
  animation: flashAnim 0.65s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}
@keyframes flashAnim {
  0% { opacity: 0; }
  25% { opacity: 0.95; background: #ffffff; }
  60% { opacity: 0.7; background: #fef08a; }
  100% { opacity: 0; }
}

.summon-flavor-box {
  background: rgba(30, 18, 12, 0.92);
  border: 1.5px dashed #78350f;
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  margin-bottom: 16px;
}
.flavor-icon { font-size: 28px; margin-bottom: 4px; }
.flavor-text { font-size: 17px; color: #ffffff; font-style: italic; }

.soul-status-card {
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
}
.soul-avatar-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 128px;
  flex-shrink: 0;
}
.soul-avatar-box .birth-avatar-large {
  width: 128px;
  height: 128px;
}
.soul-avatar-box .character-avatar-img {
  width: 128px;
  height: 128px;
  object-fit: contain;
}
.soul-name-badge {
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  word-break: break-all;
}
.soul-total-badge {
  font-size: 16px;
  background: #451a03;
  color: #ffffff;
  border: 1px solid #9a3412;
  padding: 2px 8px;
  border-radius: 4px;
}

.soul-stats-container {
  flex: 1;
  min-width: 0;
}
.bonus-points-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 18px;
  color: #ffffff;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #78350f;
}
.bonus-points-val {
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
}
.bonus-unit { font-size: 16px; color: #ffffff; }

.stat-dist-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
/* キャラメイク／能力：ラベル・数値を列揃え、バーは残り幅いっぱいに伸ばす */
.stat-dist-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 20px;
  min-width: 0;
  width: 100%;
}
.stat-name-label {
  flex: 0 0 3.4em;
  width: 3.4em;
  box-sizing: border-box;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: #ffffff;
  font-size: 18px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
.stat-val-text {
  flex: 0 0 2.6em;
  width: 2.6em;
  box-sizing: border-box;
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 2px;
  text-align: right;
  font-weight: 700;
  font-family: monospace;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  font-size: 20px;
  white-space: nowrap;
}
.stat-blocks-track {
  flex: 1 1 0;
  min-width: 0;
  font-family: monospace;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--accent-gold);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
}
.stat-bonus-val {
  font-size: 17px;
  color: #ffffff;
  min-width: 20px;
}
.stat-point-btns {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}
.btn-point-adj {
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #451a03;
  border: 1.5px solid #9a3412;
  border-radius: 4px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}
.btn-point-adj:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Step 3: 職業選択 */
.charmake-char-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 8px;
}
.summary-avatar {
  width: 128px;
  height: 128px;
  min-width: 128px;
  border-radius: 6px;
  border: 1.5px solid #b45309;
  background: rgba(20, 12, 8, 0.95);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.summary-avatar img,
.summary-avatar .character-avatar-img {
  width: 128px;
  height: 128px;
  object-fit: contain;
}
.summary-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.summary-name {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0;
}
.summary-stats-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.sum-stat-pill {
  font-size: 14px;
  background: #341e12;
  border: 1px solid #78350f;
  padding: 2px 7px;
  border-radius: 4px;
  color: #ffffff;
}

.job-selection-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
  max-height: 290px;
  overflow-y: auto;
  padding-right: 2px;
}
.job-card {
  background: rgba(38, 25, 17, 0.92);
  border: 1.5px solid #542c13;
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.job-card:hover {
  background: #3d2516;
  border-color: #78350f;
}
.job-card.selected {
  border-color: #d97706;
  background: rgba(84, 44, 19, 0.95);
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.3);
}
.job-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.job-card-name { font-size: 19px; font-weight: 700; color: #ffffff; }
.job-card-weapon { font-size: 15px; color: #ffffff; background: #26160d; border: 1px solid #78350f; padding: 2px 6px; border-radius: 3px; }
.job-card-desc { font-size: 16px; color: #ffffff; line-height: 1.3; }
.job-card-skill {
  margin-top: 3px;
  padding-top: 4px;
  border-top: 1px dashed #78350f;
  font-size: 17px;
  color: #ffffff;
}
.job-card-skill-name { font-weight: 700; color: #ffffff; }
.job-card-skill-desc { font-size: 15px; color: #f1f5f9; margin-top: 2px; }

/* Step 4: 命名・最終サマリー */
.final-hero-preview-card {
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.final-avatar-wrap {
  width: 128px;
  height: 128px;
  min-width: 128px;
  border-radius: 6px;
  border: 1.5px solid #b45309;
  background: rgba(20, 12, 8, 0.95);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.final-avatar-wrap img,
.final-avatar-wrap .character-avatar-img {
  width: 128px;
  height: 128px;
  object-fit: contain;
}
.final-meta-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.final-job-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 15px;
  background: #451a03;
  border: 1px solid #9a3412;
  color: #fbbf24;
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 2px;
  font-weight: 700;
}
.final-title-text {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  word-break: break-all;
}
.final-skill-box { font-size: 17px; color: #ffffff; margin-top: 4px; }

.final-stats-table {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.final-stat-cell {
  background: rgba(24, 15, 10, 0.9);
  border: 1px solid #78350f;
  border-radius: 4px;
  padding: 6px 2px;
  text-align: center;
}
.final-stat-label { font-size: 16px; color: #ffffff; font-weight: 600; }
.final-stat-val { font-size: 20px; color: #ffffff; font-weight: 800; font-family: monospace; }

.preview-avatar,
.birth-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: #26160d;
  border: 1.5px solid #b45309;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-details,
.birth-info { flex: 1; }
.preview-title, .birth-title { font-size: 17px; color: #ffffff; font-weight: 700; }
.preview-job { font-size: 20px; font-weight: 700; color: #ffffff; }
.preview-skill, .birth-skill-box { font-size: 17px; color: #ffffff; }

.preview-stat-row,
.birth-stats-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.mini-stat-badge {
  background: rgba(45, 29, 19, 0.9);
  border: 1px solid #78350f;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 16px;
  color: #ffffff;
}
.mini-stat-badge b { color: #ffffff; }

.wizard-actions { display: flex; gap: 10px; margin-top: 10px; }

.btn-back, .btn-next {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 19px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  min-height: 48px;
}
.btn-back { background: #3d2516; border: 1.5px solid #78350f; color: #ffffff; }
.btn-next { flex: 1; background: linear-gradient(135deg, #78350f, #451a03); border: 1.5px solid #b45309; color: #ffffff; }

/* ============================================================
   常時ヘッダー
============================================================ */
.app-main-header {
  width: 100%;
  height: 64px;
  min-height: 64px;
  flex-shrink: 0;
  background: #261911;
  border-bottom: 1.5px solid #78350f;
  padding: 6px 14px;
  z-index: 50;
  box-sizing: border-box;
}

.header-inner {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.char-summary-widget {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.header-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.header-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #18110b;
  border: 1.5px solid #b45309;
  overflow: hidden;
  flex-shrink: 0;
}

/* 行動AI 3×3 色マーク（8pxマス + 2px隙間） */
.tactics-color-mark {
  display: grid;
  grid-template-columns: repeat(3, 8px);
  grid-template-rows: repeat(3, 8px);
  gap: 2px;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.tcm-cell {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  box-sizing: border-box;
}
.tcm-attack { background: #ef4444; }
.tcm-magic { background: #c084fc; }
.tcm-move-forward { background: #38bdf8; }
.tcm-move-back { background: #1d4ed8; }
.tcm-skill { background: #facc15; }
.tcm-item { background: #4ade80; }
.tcm-other { background: #94a3b8; }

.header-char-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.header-name-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  line-height: 1.2;
  min-width: 0;
  width: 100%;
}
.app-main-header { padding-inline: 0.4rem; }
.char-summary-widget { gap: 0.3rem; }
.header-inner { gap: 0.3rem; }
.header-name { min-width: 0; flex: 1 1 auto; }
.progress-badge { flex-shrink: 0; font-size: 0.9rem; font-weight: 700; line-height: 1.15; color: #8cdeff; font-variant-numeric: tabular-nums; }
.fame-badge { color: #fcd9a8; }

.header-name {
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.header-gauges {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.gauge-tag {
  font-size: 15px;
  font-weight: 700;
  color: #f59e0b;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.gauge-track-mini {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: 10px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #78350f;
}

.gauge-fill-mini {
  height: 100%;
  transition: width 0.25s ease;
}

#header-hp-bar,
.fill-hp {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}
#header-hp-bar.is-mid,
.fill-hp.is-mid {
  background: linear-gradient(90deg, #d97706, #eab308);
}
#header-hp-bar.is-low,
.fill-hp.is-low {
  background: linear-gradient(90deg, #dc2626, #ef4444);
}

.gauge-num {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  font-family: monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

/* HP 30%未満の点滅アピール */
@keyframes hp-critical-bar {
  0%, 100% { opacity: 1; filter: brightness(1); }
  50% { opacity: 0.45; filter: brightness(1.55); }
}
@keyframes hp-critical-num {
  0%, 100% { color: #fecaca; opacity: 1; }
  50% { color: #ef4444; opacity: 0.55; }
}
.header-gauges.hp-critical .gauge-track-mini {
  border-color: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.55);
}
.header-gauges.hp-critical .fill-hp {
  background: linear-gradient(90deg, #991b1b, #f87171);
  animation: hp-critical-bar 0.65s ease-in-out infinite;
}
.gauge-num.hp-critical-text {
  animation: hp-critical-num 0.65s ease-in-out infinite;
  font-weight: 800;
}

.header-right-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-gold-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
  line-height: 1.05;
}

.header-level {
  font-size: 15px;
  font-weight: 800;
  color: #fcd34d;
  white-space: nowrap;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.gold-pill {
  background: rgba(30, 18, 11, 0.92);
  border: 1.5px solid #78350f;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  color: #ffffff;
  line-height: 1.15;
}

.btn-header-hub {
  background: linear-gradient(135deg, #78350f, #451a03);
  border: 1.5px solid #b45309;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.btn-header-subtle {
  background: #3d2516;
  border: 1px solid #78350f;
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 17px;
  cursor: pointer;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Main Views Container */
.main-views-container {
  flex: 1;
  width: 100%;
  height: calc(720px - 64px);
  max-height: calc(720px - 64px);
  padding: 10px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.4) 0%, rgba(15, 23, 42, 0.65) 100%), url('images/Dungeon/dungeon (29).webp') center center / cover no-repeat;
}

/* ============================================================
   メイン拠点画面 (Home Hub)
============================================================ */
.home-hub-header { margin-bottom: 6px; flex-shrink: 0; }
.hub-title { font-size: 20px; color: #ffffff; margin-bottom: 2px; font-weight: 700; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9); }
.hub-desc { font-size: 14px; color: #e2e8f0; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); }

#subview-home.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  margin: -10px -12px;
  padding: 10px 12px;
  height: calc(100% + 20px);
}

/* クエスト：地図（画像と同じ枠）＋クランPt表示。ボタンは別途下に維持 */
#subview-quest.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  margin: -10px -12px;
  padding: 10px 12px;
  height: calc(100% + 20px);
  gap: 6px;
}
#subview-quest .quest-hub-grid {
  flex: 1;
  min-height: 0;
}
#subview-quest .hub-card.is-clan-joined {
  border-color: #fbbf24;
  box-shadow: 0 0 0 0.15em rgba(251, 191, 36, 0.45);
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.55), rgba(30, 41, 59, 0.9));
}
#subview-quest .clan-joined-badge {
  flex: 0 0 auto;
  align-self: center;
  margin: 0 0.15em 0 auto;
  padding: 0.1em 0.45em;
  border-radius: 0.35em;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  color: #1c1917;
  background: #fbbf24;
  border: 1px solid #f59e0b;
}
#subview-quest .clan-joined-badge[hidden] {
  display: none !important;
}
#subview-quest .hub-card.is-clan-joined .card-arrow {
  margin-left: 0.15em;
}
.quest-map-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1.5px solid #78350f;
  overflow: hidden;
  background: #1a1410;
  line-height: 0;
}
.quest-map-img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.quest-map-pt {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  padding: 0.25em 0.45em;
  border: 1px solid #fbbf24;
  border-radius: 0.35em;
  background: rgba(15, 23, 42, 0.82);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05em;
  line-height: 1.15;
}
.quest-map-pt-name {
  font-size: 14px;
  font-weight: 700;
  color: #fde68a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
.quest-map-pt-val {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
.quest-map-pt-val::before {
  content: 'Pt ';
  font-size: 0.85em;
  color: #94a3b8;
  font-weight: 600;
}
/* 地図画像座標 ※枠＝画像 */
.quest-map-pt-maou { left: 16%; top: 16%; }
.quest-map-pt-romancia { left: 84%; top: 16%; }
.quest-map-pt-a { left: 28%; top: 46%; }
.quest-map-pt-centria { left: 50%; top: 52%; }
.quest-map-pt-b { left: 72%; top: 46%; }
.quest-map-pt-c { left: 50%; top: 72%; }

.hub-menu-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.hub-footer {
  flex-shrink: 0;
  margin-top: 6px;
  padding: 0 4px 2px;
}

.hub-card {
  background: #261911;
  border: 1.5px solid #78350f;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
  min-height: 56px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.hub-card:hover {
  background: #362217;
  border-color: #b45309;
  transform: translateX(3px);
}

.hub-card.card-place {
  background: #261911;
  border: 1.5px solid #059669;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.hub-card.card-place:hover {
  background: #362217;
  border-color: #34d399;
}

.hub-card.card-place .card-icon {
  border-color: #059669;
}

.hub-card .card-icon {
  font-size: 20px;
  width: 44px;
  height: 44px;
  background: #1b120c;
  border: 1px solid #78350f;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.hub-card .card-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.hub-card .card-content h3 { font-size: 18px; color: #ffffff; margin-bottom: 1px; }
.hub-card .card-content p { font-size: 13px; color: #e2e8f0; }
.hub-card .card-arrow { font-size: 18px; color: #ffffff; }

.place-greeting {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 8px;
  padding: 8px 10px;
  background: rgba(20, 12, 8, 0.75);
  border: 1px solid #78350f;
  border-radius: 8px;
  flex-shrink: 0;
}

.place-greeting[hidden] { display: none !important; }

.place-npc-image {
  width: auto;
  height: auto;
  max-width: 100%;
  flex-shrink: 0;
  object-fit: contain;
  image-rendering: auto;
  border-radius: 8px;
  border: 1.5px solid #b45309;
  background: #1a1410;
}

.place-npc-image[hidden] { display: none !important; }

.place-greeting-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.place-greeting-title-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.place-greeting-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: #ffffff;
}

.place-greeting-title-row .place-greeting-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-greeting-title-row .btn-secondary {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 4px 10px;
  font-size: 14px;
}

.buddy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.buddy-header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.buddy-note {
  font-size: 14px;
  line-height: 1.35;
  color: #cbd5e1;
  margin: 6px 0 8px;
}
.buddy-section-title {
  font-size: 16px;
  color: #fbbf24;
  margin: 10px 0 6px;
}
.buddy-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.buddy-empty {
  font-size: 14px;
  color: #94a3b8;
  margin: 0;
}
.buddy-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1.5px solid #78350f;
  border-radius: 8px;
  background: rgba(38, 25, 17, 0.92);
}
.buddy-card.is-active {
  border-color: #38bdf8;
}
.buddy-side {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 6px;
  flex-shrink: 0;
}
.buddy-face {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  flex-shrink: 0;
  background: #0f172a;
  border: 2px solid #b45309;
  display: block;
}
.bond-face-wrap {
  position: relative;
  width: 128px;
  height: 128px;
  flex-shrink: 0;
}
.bond-face-wrap .buddy-face,
.bond-face-wrap .pvp-card-avatar {
  width: 100%;
  height: 100%;
}
.bond-mark {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 1.65em;
  height: 1.65em;
  min-width: 0;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid rgba(15, 23, 42, 0.85);
  background: var(--bond-color, #f472b6);
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.buddy-card.is-active .buddy-face {
  border-color: #38bdf8;
}
.buddy-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.buddy-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.buddy-name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  color: #fef3c7;
  line-height: 1.2;
}
.buddy-dismiss-btn {
  flex-shrink: 0;
  min-height: 28px;
  padding: 2px 8px;
  font-size: 13px;
  line-height: 1.2;
}
.buddy-dismiss-btn.is-busy {
  opacity: 0.75;
  cursor: wait;
}
.buddy-sub {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.25;
}
.buddy-gear {
  margin-top: 2px;
  font-size: 16px;
  line-height: 1.3;
  color: #fde68a;
  overflow-wrap: anywhere;
}
.buddy-badge-newbie {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 13px;
  font-weight: 700;
  color: #fef08a;
  background: #854d0e;
  border: 1px solid #eab308;
  border-radius: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  vertical-align: middle;
}
.buddy-badge-regular {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 13px;
  font-weight: 700;
  color: #bfdbfe;
  background: #1e3a8a;
  border: 1px solid #3b82f6;
  border-radius: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  vertical-align: middle;
}
.buddy-phrase {
  font-size: 13px;
  color: #7dd3fc;
  margin-top: 2px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.buddy-tactics {
  margin: 0;
  align-self: flex-start;
  flex-shrink: 0;
}
.buddy-hire-btn {
  margin-top: 6px;
  width: 100%;
  min-height: 34px;
  font-size: 14px;
  padding: 4px 8px;
}
.buddy-hire-btn.is-busy {
  opacity: 0.75;
  cursor: wait;
}
#buddy-claim {
  width: 100%;
  min-height: 42px;
  margin-bottom: 4px;
  font-size: 16px;
}
.buddy-reward-list {
  flex: 0 0 auto;
  box-sizing: border-box;
  min-height: calc(1.3em + 18px);
  list-style: none;
  margin: 0 0 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid #b45309;
  border-radius: 8px;
  background: #1a120c;
  color: #fff7ed;
  font-size: 20px;
  line-height: 1.3;
}
.buddy-reward-list > li {
  flex: 0 0 auto;
  overflow-wrap: anywhere;
}
.buddy-reward-list[hidden] { display: none !important; }
.buddy-message,
#buddy-message {
  font-size: 14px;
  line-height: 1.35;
  color: #fde68a;
  min-height: 1.35em;
  margin: 0 0 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(30, 20, 12, 0.75);
  border: 1px solid #78350f;
}
#subview-arena > #arena-message {
  flex-shrink: 0;
  overflow: hidden;
}
#subview-arena > .buddy-section-title {
  flex-shrink: 0;
}

/* ペバディ */
.pebuddy-message {
  font-size: 14px;
  line-height: 1.35;
  color: #fde68a;
  min-height: 1.2em;
  margin: 0 0 6px;
}
.pebuddy-message.is-error { color: #fecaca; }
.pebuddy-egg-caption {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 700;
  color: #fde68a;
  text-shadow: 0 1px 2px #0f172a;
  pointer-events: none;
}
.pebuddy-stage-egg { position: relative; }
.pebuddy-crystal-stock b {
  color: #fde68a;
  font-size: 1.1em;
}
.pebuddy-name-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 16px;
  color: #e2e8f0;
  margin: 6px 0;
}
.pebuddy-name-input {
  font-size: 20px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #f8fafc;
  width: 100%;
  box-sizing: border-box;
}
.pebuddy-name-input::placeholder {
  color: #94a3b8;
}
.pebuddy-root {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  flex: 1;
  overflow: auto;
}
.pebuddy-root:has(.pebuddy-shop-panel) {
  overflow: hidden;
}
#pebuddy-root:has(#pebuddy-name-input) { overflow: hidden; }
.pebuddy-panel:has(#pebuddy-name-input) {
  flex: 1;
  min-height: 0;
  gap: 0.2em;
  padding: 0.3em;
  font-size: 20px;
  line-height: 1.1;
}
.pebuddy-panel:has(#pebuddy-name-input) > .pebuddy-stage {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
  aspect-ratio: auto;
  max-width: none;
}
.pebuddy-panel:has(#pebuddy-name-input) > :not(.pebuddy-stage) { flex-shrink: 0; }
.pebuddy-panel:has(#pebuddy-name-input) .pebuddy-title,
.pebuddy-panel:has(#pebuddy-name-input) .pebuddy-desc,
.pebuddy-panel:has(#pebuddy-name-input) .pebuddy-sub,
.pebuddy-panel:has(#pebuddy-name-input) .pebuddy-name-label,
.pebuddy-panel:has(#pebuddy-name-input) .pebuddy-actions button { font-size: 1em; line-height: 1.1; }
.pebuddy-panel:has(#pebuddy-name-input) .pebuddy-name-label {
  flex-direction: row;
  align-items: center;
  margin: 0;
}
.pebuddy-panel:has(#pebuddy-name-input) .pebuddy-name-input { flex: 1; min-width: 0; }
.pebuddy-panel:has(#pebuddy-name-input) #pebuddy-fullname-preview:empty { display: none; }
#subview-pebuddy:has(#pebuddy-name-input) .place-greeting { margin-bottom: 0; }
.pebuddy-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px;
  border: 1.5px solid #78350f;
  border-radius: 8px;
  background: rgba(38, 25, 17, 0.92);
}
.pebuddy-shop-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.pebuddy-shop-head {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pebuddy-shop-foot {
  flex: 0 0 auto;
  margin-top: 2px;
}
.pebuddy-title {
  margin: 0;
  font-size: 18px;
  color: #fef3c7;
}
.pebuddy-food-queue {
  margin: 0.4em 0 0.6em;
  padding: 0.45em 0.55em;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.35);
}
.pebuddy-food-queue .pebuddy-sub,
.pebuddy-food-queue .pebuddy-note {
  margin: 0.2em 0;
}
.pebuddy-desc, .pebuddy-note, .pebuddy-sub {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  color: #e2e8f0;
}
.pebuddy-note { color: #94a3b8; }
.pebuddy-list {
  margin: 0;
  padding-left: 1.2em;
  font-size: 14px;
  color: #e2e8f0;
}
.pebuddy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pebuddy-slot-row {
  width: 100%;
}
.pebuddy-slot-btn {
  flex: 1 1 30%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 6px 8px;
  line-height: 1.25;
}
.pebuddy-slot-label {
  font-size: 15px;
  font-weight: 700;
  color: #fef3c7;
}
.pebuddy-slot-sub {
  font-size: 13px;
  color: #cbd5e1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.pebuddy-acc-tip {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  margin-top: 2px;
}
.pebuddy-actions .btn-primary,
.pebuddy-actions .btn-secondary,
.pebuddy-acc-list .btn-primary,
.pebuddy-acc-list .btn-secondary,
.pebuddy-train-row .btn-primary {
  font-size: 15px;
  min-height: 36px;
}
.pebuddy-slot-btn.is-active {
  border-color: #38bdf8;
  color: #e0f2fe;
}
.pebuddy-acc-list .btn-primary {
  text-align: left;
  justify-content: flex-start;
  align-items: flex-start;
  flex-direction: column;
  height: auto;
  min-height: 40px;
  padding: 8px 10px;
}
.pebuddy-acc-list,
.pebuddy-train-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pebuddy-train-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pebuddy-train-name {
  font-size: 16px;
  font-weight: 700;
  color: #fef3c7;
}
.pebuddy-bar {
  height: 10px;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid #475569;
  overflow: hidden;
}
.pebuddy-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ea580c, #fbbf24);
}
.pebuddy-shop-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pebuddy-shop-tab.is-active {
  border-color: #38bdf8;
  color: #e0f2fe;
}
.pebuddy-shop-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.pebuddy-shop-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #475569;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
}
.pebuddy-shop-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 6px;
  background: #1e293b;
}
.pebuddy-shop-thumb-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 6px;
  overflow: hidden;
  background: #1e293b;
}
.pebuddy-shop-thumb-wrap .pebuddy-shop-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.pebuddy-shop-tint {
  position: absolute;
  inset: 0;
  mix-blend-mode: color;
  opacity: 0.9;
  pointer-events: none;
}
.pebuddy-shop-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #94a3b8;
}
.pebuddy-shop-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pebuddy-shop-name {
  font-size: 15px;
  font-weight: 700;
  color: #fef3c7;
}
.pebuddy-shop-sub {
  font-size: 13px;
  color: #cbd5e1;
}
.pebuddy-shop-desc {
  font-size: 12px;
  line-height: 1.3;
  color: #94a3b8;
}
.pebuddy-shop-buy {
  flex: 0 0 auto;
  align-self: center;
  min-height: 36px;
  font-size: 15px;
}
.pebuddy-stage {
  position: relative;
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 10px;
  border: 1px solid #475569;
  background: #0f172a;
  overflow: hidden;
}
.pebuddy-base {
  position: absolute;
  inset: 8%;
  width: 84%;
  height: 84%;
  object-fit: contain;
}
.pebuddy-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
}
.pebuddy-acc-wrap {
  position: absolute;
  width: 36%;
  height: 36%;
  pointer-events: none;
}
.pebuddy-acc-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pebuddy-acc-tint {
  position: absolute;
  inset: 0;
  mix-blend-mode: color;
  opacity: 0.9;
  pointer-events: none;
}

/* クエストクリア後：卵選択 */
#modal-pebuddy-egg-choice { padding: 0.25em; }
#modal-pebuddy-egg-choice > .pebuddy-egg-choice-box {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  display: flex;
  flex-direction: column;
  padding: 0.5em;
}
#modal-pebuddy-egg-choice .pebuddy-egg-choice-grid {
  flex: 1;
  min-height: 0;
  grid-template-rows: repeat(4, minmax(0, 1fr));
}
#modal-pebuddy-egg-choice .pebuddy-egg-choice-card { min-width: 0; }
#modal-pebuddy-egg-choice .pebuddy-egg-choice-img,
#modal-pebuddy-egg-choice .pebuddy-egg-choice-ph {
  flex: 1;
  width: 100%;
  height: 0;
  min-height: 0;
}
#modal-pebuddy-egg-choice .pebuddy-egg-choice-name,
#modal-pebuddy-egg-choice .pebuddy-egg-choice-title,
#modal-pebuddy-egg-choice .pebuddy-egg-choice-lead,
#pebuddy-egg-choice-leave { flex-shrink: 0; }
.pebuddy-egg-choice-box {
  width: min(92%, 420px);
  max-height: 88%;
  overflow: hidden;
  padding: 14px 12px 12px;
  background: #1a120c;
  color: #f1f5f9;
  border: 1.5px solid #b45309;
}
.pebuddy-egg-choice-title {
  margin: 0 0 6px;
  font-size: 20px;
  color: #fde68a;
}
.pebuddy-egg-choice-lead {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.1;
  color: #e2e8f0;
}
.pebuddy-egg-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.2em;
}
.pebuddy-egg-choice-card {
  font-size: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1em;
  padding: 0.15em;
  background: #24180f;
  border: 1.5px solid #78350f;
  border-radius: 8px;
  color: #f8fafc;
  cursor: pointer;
  min-height: 0;
}
.pebuddy-egg-choice-card:active {
  border-color: #fbbf24;
}
.pebuddy-egg-choice-img,
.pebuddy-egg-choice-ph {
  width: 2em;
  height: 2em;
  object-fit: contain;
  display: block;
}
.pebuddy-egg-choice-ph,
.pebuddy-egg-choice-ph-lg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: #0f172a;
  border-radius: 8px;
}
.pebuddy-egg-choice-ph-lg {
  width: 96px;
  height: 96px;
  font-size: 48px;
  margin: 0 auto;
}
.pebuddy-egg-choice-img-lg {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.pebuddy-egg-choice-preview { max-width: 100%; }
.pebuddy-egg-choice-name {
  font-size: 20px;
  line-height: 1.05;
  text-align: center;
  color: #fef3c7;
  word-break: break-all;
}
.pebuddy-egg-choice-confirm {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.pebuddy-egg-choice-ask {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #fff7ed;
  text-align: center;
  line-height: 1.35;
}
#pebuddy-egg-choice-leave { width: 100%; margin-top: 0.3em; font-size: 20px; }
.pebuddy-egg-choice-confirm[hidden], .pebuddy-egg-choice-grid[hidden], #pebuddy-egg-choice-leave[hidden] { display: none; }
.pebuddy-egg-choice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
}

/* バディ・フレンド：タブ＋フレンド詳細 */
.party-friends-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 6px;
  flex-shrink: 0;
}
.party-friends-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: auto;
}
.party-friends-panel[hidden] {
  display: none !important;
}
.friends-message {
  font-size: 14px;
  line-height: 1.35;
  color: #fde68a;
  min-height: 1.2em;
  margin: 0 0 6px;
}
.friends-message.is-error {
  color: #fecaca;
}
.friends-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  flex-shrink: 0;
}
.friends-count-label {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}
.friends-sync-note {
  font-size: 13px;
  line-height: 1.35;
  color: #cbd5e1;
  margin: 0 0 8px;
}
.friends-request-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.friends-request-input {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #78350f;
  background: #1e293b;
  color: #f8fafc;
}
.friends-request-input::placeholder {
  color: #94a3b8;
}
.friend-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}
.friend-card-actions .btn-primary,
.friend-card-actions .btn-secondary {
  font-size: 14px;
  padding: 4px 8px;
  min-height: 32px;
}
.friend-status-label {
  font-size: 14px;
  color: #94a3b8;
  white-space: nowrap;
}
.friend-detail {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #475569;
  background: rgba(15, 23, 42, 0.72);
}
.friend-detail-line {
  font-size: 13px;
  line-height: 1.4;
  color: #e2e8f0;
  margin: 0 0 2px;
}
.friend-detail-phrase {
  font-size: 14px;
  color: #fde68a;
  margin-top: 4px;
}

.status-catchphrase-panel {
  margin: 8px 0 10px;
  padding: 8px 10px;
  border: 1px solid #475569;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.65);
}
.status-catchphrase-panel label {
  display: block;
  font-size: 14px;
  color: #e2e8f0;
  margin-bottom: 4px;
}
#status-catchphrase {
  width: 100%;
  box-sizing: border-box;
  min-height: 40px;
  font-size: 16px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #64748b;
  background: #0f172a;
  color: #f8fafc;
}
.status-catchphrase-note {
  font-size: 12px;
  color: #94a3b8;
  margin: 4px 0 0;
  line-height: 1.3;
}
.explore-walker-party {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}
.explore-walker-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 128px;
}
.explore-walker-slot[hidden] {
  display: none !important;
}
.place-greeting-text {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  color: #fff7ed;
  overflow-wrap: anywhere;
}

#pebuddy-greeting-next {
  align-self: flex-end;
  margin-top: 6px;
  min-height: 36px;
  padding: 4px 14px;
  font-size: 18px;
}

#subview-pebuddy.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  gap: 6px;
}
#subview-pebuddy > .place-greeting,
#subview-pebuddy > #pebuddy-message {
  flex-shrink: 0;
  margin-bottom: 0;
}
#subview-pebuddy > #pebuddy-message:empty { display: none; }
#subview-pebuddy > .pebuddy-root {
  flex: 1 1 auto;
  min-height: 0;
}

/* ============================================================
   ダンジョン探索画面 (Dungeon Exploration)
   探索地の美麗アート + 進行バー (0%〜100%)
============================================================ */
.dungeon-select-bar { margin-bottom: 8px; }
.dungeon-cards-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dungeon-card {
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
}
.dungeon-card:hover { border-color: #b45309; background: #3d2516; }
.dungeon-card.active { border-color: #d97706; background: rgba(84, 44, 19, 0.95); }
.dungeon-card .dungeon-icon { font-size: 22px; }
.dungeon-card .dungeon-name { font-size: 18px; font-weight: 700; color: #ffffff; margin-top: 2px; }
.dungeon-card .dungeon-diff { font-size: 15px; margin-top: 2px; }
.diff-easy { color: #ffffff; background: #143520; border: 1px solid #16a34a; padding: 1px 4px; border-radius: 3px; }
.diff-mid { color: #ffffff; background: #451a03; border: 1px solid #d97706; padding: 1px 4px; border-radius: 3px; }
.diff-hard { color: #ffffff; background: #450a0a; border: 1px solid #dc2626; padding: 1px 4px; border-radius: 3px; }

/* 探索ステージカード (画像 + 進行バー) */
.exploration-stage-card {
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
}

.explore-art-frame {
  position: relative;
  width: 100%;
  height: 180px;
  background: #000;
  overflow: hidden;
}

.explore-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 進行度枠は縦帯のみ：拡大して一部だけ見せる（ホバー等で動かさない） */
  object-position: center 38%;
  transform: scale(1.65);
  transform-origin: center 36%;
  display: block;
  pointer-events: none;
  image-rendering: auto;
}

.explore-art-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 40%, rgba(20, 12, 8, 0.9) 100%);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 12px;
}

.explore-location-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(24, 15, 10, 0.9);
  border: 1.5px solid #78350f;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  pointer-events: auto;
}

.explore-floor-tag {
  background: #542c13;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid #b45309;
}

.explore-floor-select-wrap {
  display: inline-flex;
  align-items: center;
  pointer-events: auto;
}

.explore-floor-select {
  background: #542c13;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1.5px solid #d97706;
  outline: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: border-color 0.2s, opacity 0.2s;
  pointer-events: auto;
  user-select: none;
  touch-action: manipulation;
}

.explore-floor-select:hover:not(:disabled) {
  border-color: #fbbf24;
}

.explore-floor-select:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  border-color: #78350f;
}

.explore-status-pill {
  font-size: 17px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
  background: #3d2516;
  border: 1px solid #78350f;
  color: #ffffff;
}
.explore-status-pill.exploring {
  background: #542c13;
  color: #ffffff;
  border: 1.5px solid #d97706;
  animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(217, 119, 6, 0.4); }
  50% { box-shadow: 0 0 14px rgba(217, 119, 6, 0.8); }
}

/* 探索進行バー */
.explore-progress-section {
  padding: 10px 12px;
  background: rgba(24, 15, 10, 0.95);
  border-top: 1px solid #78350f;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 17px;
  margin-bottom: 6px;
}
.progress-title { color: #ffffff; font-weight: 600; }
.progress-percentage { color: #ffffff; font-weight: 800; font-size: 20px; }

.explore-progress-track {
  width: 100%;
  height: 14px;
  background: rgba(18, 11, 7, 0.9);
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid #78350f;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
}

.explore-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #9a3412, #d97706);
  border-radius: 7px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(217, 119, 6, 0.5);
}

/* 探索イベントログ（7行・スクロールバー非表示） */
.explore-log-box {
  box-sizing: border-box;
  background: rgba(24, 15, 10, 0.92);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-sm);
  height: 210px;
  flex-shrink: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 8px 10px;
  font-size: 17px;
  font-family: monospace;
  line-height: 1.4;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #ffffff;
}
.explore-log-box::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.explore-log-box .log-entry {
  flex-shrink: 0;
  font-size: 17px;
  line-height: 1.4;
  color: #ffffff;
  word-break: break-all;
}
.explore-log-box.is-briefing {
  font-family: sans-serif;
}
.explore-briefing {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-height: 0;
  width: 100%;
}
.explore-briefing-portrait {
  width: 28%;
  max-width: 96px;
  height: auto;
  max-height: 180px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #b45309;
  background: #1a1410;
  flex-shrink: 0;
}
.explore-briefing-portrait.is-placeholder {
  object-fit: cover;
}
.explore-briefing-body {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.explore-briefing-body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.explore-briefing-desc {
  font-size: 17px;
  line-height: 1.35;
  color: #ffffff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  margin-bottom: 8px;
}
.explore-briefing-rewards.quest-card-rewards {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  color: #fde68a;
}

.explore-actions { display: flex; gap: 8px; }

.explore-actions { display: flex; gap: 8px; }

/* ============================================================
   ⚔️ 特別な専用戦闘画面 (Dedicated Battle Screen)
   画面全体（480×720px）が丸ごと上から見下ろした地面アリーナになり、
   AIパネルの指示に応じて敵・プレイヤーが実際に物理的に移動・突撃する
============================================================ */
.dedicated-battle-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 480px;
  height: 720px;
  z-index: 100;
  background-color: #120c08;
  background-image: url('images/Dungeon/dungeon%20(27).webp');
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
  container-type: size;
}

/* アリーナ最終戦→賞品など：戦闘画面の暗転 */
.battle-blackout {
  position: absolute;
  inset: 0;
  z-index: 250; /* リザルトカード(200)より上で最終戦→賞品の暗転を覆う */
  background: #000;
  opacity: 0;
  display: none;
  pointer-events: none;
}

/* 戦闘：480×720全面にフィット（素材も2:3なので全体が見える） */
.arena-fullscreen-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  z-index: 0;
  image-rendering: auto;
}

/* 戦闘背景を暗くし、キャンバス上のキャラを引き立てる（キャラ描画より下のレイヤー） */
.arena-vignette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0.18) 0%, rgba(0, 0, 0, 0.42) 100%),
    rgba(8, 4, 2, 0.28);
  pointer-events: none;
}

/* 上部オーバーレイヘッダー (ガラスモーフィズム浮遊バー) */
.battle-overlay-header {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 5px;
  background: linear-gradient(180deg, rgba(24, 15, 10, 0.96) 0%, rgba(24, 15, 10, 0.88) 100%);
  border-bottom: 1.5px solid #78350f;
  backdrop-filter: none;
  box-sizing: border-box;
}

.battle-title-box {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.battle-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 10px var(--accent-red);
  animation: pulseDot 1s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.battle-screen-title {
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-escape-battle {
  background: #450a0a;
  border: 1.5px solid #dc2626;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  white-space: nowrap;
}
.btn-escape-battle:hover {
  background: #7f1d1d;
}

/* スキル・アクション告知バナー (アリーナ上部にポップ) */
.arena-action-banner {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 40;
  background: rgba(38, 25, 17, 0.96);
  border: 2px solid #b45309;
  color: #ffffff;
  padding: 6px 16px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.9), 0 0 16px rgba(217, 119, 6, 0.5);
  backdrop-filter: none;
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
  max-width: 92%;
  box-sizing: border-box;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.arena-action-banner.banner-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.action-banner-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.action-banner-text {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 戦闘フィールド右上・ターン数（ヘッダー直下） */
.battle-turn-count {
  position: absolute;
  top: 52px;
  right: 10px;
  z-index: 40;
  pointer-events: none;
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: #f8fafc;
  background: transparent;
  border: none;
  padding: 0;
  box-sizing: border-box;
}
.battle-turn-label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(248, 250, 252, 0.55);
  line-height: 1.2;
}
.battle-turn-num {
  flex: 0 0 auto;
  min-width: 3ch;
  text-align: right;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: #f8fafc;
}

/* 画面全体アリーナステージ空間 (キャラが自由に物理移動する空間) */
.arena-stage-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  overflow: hidden;
}

/* 物理演算おはじき・ビリヤードキャンバス */
.physics-battle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 18;
  pointer-events: none;
}

/* Canvas物理演算モード時のDOMスプライト自動調整 */
.arena-stage-field.physics-active .battle-upper-enemies,
.arena-stage-field.physics-active .battle-lower-player {
  opacity: 0;
  pointer-events: none;
}

/* =========== 敵ユニット群 (上部〜中上部エリア) =========== */
.battle-upper-enemies {
  position: absolute;
  top: 14%;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 16px;
  z-index: 10;
  transition: top 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 敵が前進した位置 */
.arena-stage-field.enemy-forward .battle-upper-enemies {
  top: 25%;
}

.enemy-unit-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.85));
}
.enemy-unit-card.is-dead,
.enemy-unit-card.is-ko {
  animation: enemyKnockoutLaunch 0.85s cubic-bezier(0.12, 0.85, 0.25, 1) forwards;
  pointer-events: none;
}

.enemy-unit-card.is-dead .enemy-hp-fill,
.enemy-unit-card.is-ko .enemy-hp-fill {
  width: 0% !important;
  transition: width 0.05s ease !important;
}

@keyframes enemyKnockoutLaunch {
  0% {
    transform: scale(1.15) translateY(0) rotate(0deg);
    opacity: 1;
    filter: brightness(2.0) drop-shadow(0 0 20px #ef4444);
  }
  20% {
    transform: scale(1.0) translateY(-60px) rotate(90deg);
    opacity: 1;
  }
  100% {
    transform: scale(0.25) translateY(-900px) rotate(720deg);
    opacity: 0;
    filter: brightness(1.0);
  }
}

/* 敵HPバー (アバターの上に配置) */
.enemy-hp-bar-wrap {
  width: 90px;
  margin-bottom: 5px;
}

.enemy-unit-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle, #3d140a 0%, #1a0804 100%);
  border: 2.5px solid var(--accent-red);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.5);
  position: relative;
}

.enemy-unit-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.enemy-unit-name {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.95), 0 0 8px rgba(0,0,0,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
  text-align: center;
  margin-top: 4px;
}

/* =========== 間合いインジケーター (敵ユニット直下・フィールド中央) =========== */
.battle-mid-lane {
  position: absolute;
  top: 172px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  pointer-events: none;
  white-space: nowrap;
}

.distance-pill {
  font-size: 18px;
  font-weight: 700;
  padding: 6px 20px;
  border-radius: 16px;
  backdrop-filter: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  transition: all 0.3s ease;
  color: #ffffff;
}
.state-near { background: rgba(80, 20, 15, 0.95); color: #ffffff; border: 2px solid #ef4444; }
.state-mid { background: rgba(80, 45, 15, 0.95); color: #ffffff; border: 2px solid #f59e0b; }
.state-far { background: rgba(60, 25, 75, 0.95); color: #ffffff; border: 2px solid #c084fc; }
.state-idle { background: rgba(45, 29, 19, 0.9); color: #ffffff; border: 1.5px solid #78350f; }

/* =========== プレイヤースプライト (動的Y座標で移動する主役) =========== */
.battle-lower-player {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: bottom 0.18s ease-out, transform 0.35s ease;
}

/* 距離・AIチップに応じた動的ポジション */
.battle-lower-player.pos-far { bottom: 20%; }
.battle-lower-player.pos-mid { bottom: 34%; }
.battle-lower-player.pos-near { bottom: 48%; }
.battle-lower-player.pos-retreat { bottom: 12%; }

.battle-lower-player.is-moving {
  animation: moveRunBounce 0.25s infinite alternate ease-in-out;
}
@keyframes moveRunBounce {
  from { transform: translateX(-50%) translateY(0); }
  to   { transform: translateX(-50%) translateY(-5px); }
}

.battle-lower-player.player-lunge-strike {
  animation: playerLungeStrike 0.45s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
@keyframes playerLungeStrike {
  0%   { transform: translateX(-50%) translateY(0); }
  35%  { transform: translateX(-50%) translateY(-65px) scale(1.08); }
  60%  { transform: translateX(-50%) translateY(-70px) scale(1.1); }
  100% { transform: translateX(-50%) translateY(0) scale(1); }
}

.enemy-lunge-strike {
  animation: enemyLungeStrike 0.45s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
@keyframes enemyLungeStrike {
  0%   { transform: translateY(0); }
  35%  { transform: translateY(55px) scale(1.08); }
  60%  { transform: translateY(60px) scale(1.1); }
  100% { transform: translateY(0) scale(1); }
}

.battle-lower-player.player-backstep {
  animation: playerBackstepAnim 0.4s cubic-bezier(0.22, 1, 0.36, 1) !important;
}
@keyframes playerBackstepAnim {
  0%   { transform: translateX(-50%) translateY(0); }
  30%  { transform: translateX(-50%) translateY(15px) scale(0.94); }
  100% { transform: translateX(-50%) translateY(0) scale(1); }
}

.player-facing-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.85));
}

.player-battle-avatar-box {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle, #3d2516 0%, #18110b 100%);
  border: 3px solid #b45309;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 24px rgba(217, 119, 6, 0.5);
  transition: transform 0.2s ease;
}

.player-battle-avatar-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-battle-info-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 6px;
  width: 120px;
}

.player-hp-wrap {
  width: 100%;
  margin-bottom: 4px;
}

.pbattle-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.95), 0 0 8px rgba(0,0,0,0.8);
}
.pbattle-job { font-size: 16px; color: #ffffff; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }

/* 上部エリア (ヘッダー ＋ 上部文字ログ ＋ AIモニター) */
.battle-top-area {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}

.battle-top-area .battle-overlay-header,
.battle-top-area .arena-action-banner {
  pointer-events: auto;
}

#pvp-status { font-size: 14px; line-height: 1.2; color: #fde047; overflow-wrap: anywhere; }
#pvp-results-modal .modal-box { max-height: 90%; display: flex; flex-direction: column; }
.pvp-result-list { overflow-y: auto; min-height: 0; font-size: 18px; line-height: 1.3; }

/* 画面最下部・戦闘ログ（背景透明・探索と履歴共有・HP帯の上） */
.battle-bottom-log {
  position: absolute;
  bottom: 36px;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 0 14px;
  background: none;
  border: none;
  box-shadow: none;
  pointer-events: auto;
  z-index: 80;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
  height: 95px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.battle-bottom-log::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.battle-bottom-log .log-entry {
  flex-shrink: 0;
  font-size: 13px;
  line-height: 1.35;
  color: #ffffff !important;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 2px 6px rgba(0, 0, 0, 0.9);
  word-break: break-all;
  white-space: normal;
  display: block;
}

/* 戦闘最下部：HP帯 A／B／C */
.battle-engagement-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  z-index: 2; /* 背景・ビネットの上、arena-stage-field(5)より下。他レイヤー順は維持 */
  pointer-events: none;
  background: #15803d;
  border: none;
  box-shadow: none;
  overflow: hidden;
}

/* 満タン側〜現在HPまで黒く消す（親と同寸・insetで高さ一致） */
.battle-engagement-hp-spent {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  height: auto;
  box-sizing: border-box;
  background: #0a0a0a;
  z-index: 3;
  pointer-events: none;
  transition: width 0.15s ease;
}

/* 幅・アクティブ判定用。色は親バーの一本グラデに任せる */
.battle-engagement-seg {
  height: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  min-width: 0;
  background: transparent;
  border: none;
  position: relative;
  z-index: 0;
  transition: width 0.25s ease;
}
.battle-engagement-seg.is-active {
  /* 境界を汚さないよう薄い明るさのみ */
  outline: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.08);
}

/* ミニチュアAIパネル */
.mini-tactics-monitor {
  background: rgba(28, 16, 10, 0.96);
  border: 1.5px solid #b45309;
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
  height: 48px;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.mini-tactics-label {
  font-size: 11px;
  color: #fbbf24;
  font-weight: 700;
  white-space: nowrap;
}

/* 戦闘ヘッダー内: 行動AI 3×3（フレームなし・ランキング同サイズ） */
.battle-ai-panel {
  position: relative;
  flex-shrink: 0;
  pointer-events: none;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.battle-ai-mark.tactics-color-mark {
  grid-template-columns: repeat(3, 8px);
  grid-template-rows: repeat(3, 8px);
  gap: 2px;
  width: 28px;
  height: 28px;
}
.battle-ai-mark .tcm-cell {
  width: 8px;
  height: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0.42;
  box-sizing: border-box;
  transition: opacity 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.battle-ai-mark .tcm-cell.is-used {
  opacity: 1;
  box-shadow: 0 0 4px 1px rgba(255, 255, 255, 0.8), inset 0 0 2px rgba(255, 255, 255, 0.45);
}
.battle-ai-mark .tcm-cell.is-active {
  border-color: #ffffff;
  opacity: 1;
  box-shadow: 0 0 5px 1px rgba(255, 255, 255, 0.95), inset 0 0 2px rgba(255, 255, 255, 0.55);
}

/* HP ゲージ (共通) */
.hp-gauge-wrapper {
  position: relative;
  height: 16px;
  background: rgba(18, 11, 7, 0.9);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #78350f;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.8);
}

.fill-hp { background: linear-gradient(90deg, #16a34a, #22c55e); }
.fill-hp.is-mid { background: linear-gradient(90deg, #d97706, #eab308); }
.fill-hp.is-low { background: linear-gradient(90deg, #dc2626, #ef4444); }
.hp-text-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}

/* =========== 戦闘シェイク＆ダメージポップ (改善版) =========== */
.hit-shake {
  animation: hitShake 0.3s ease !important;
}
@keyframes hitShake {
  0%   { transform: translate(0, 0); }
  15%  { transform: translate(-5px, -3px); }
  30%  { transform: translate(5px, 3px); }
  45%  { transform: translate(-4px, 2px); }
  60%  { transform: translate(3px, -1px); }
  75%  { transform: translate(-2px, 1px); }
  100% { transform: translate(0, 0); }
}

.hit-shake-strong {
  animation: hitShakeStrong 0.4s ease !important;
}
@keyframes hitShakeStrong {
  0%   { transform: translateX(-50%) translate(0, 0); }
  15%  { transform: translateX(-50%) translate(-8px, -5px); }
  30%  { transform: translateX(-50%) translate(8px, 5px); }
  45%  { transform: translateX(-50%) translate(-6px, 3px); }
  60%  { transform: translateX(-50%) translate(4px, -2px); }
  100% { transform: translateX(-50%) translate(0, 0); }
}

/* ===== ダメージポップアップ (改善: 浮き上がり＋消失) ===== */
.damage-popup {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 800;
  z-index: 100;
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 1px;
}
.popup-damage {
  color: #ffffff;
  font-size: 22px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.9), 0 0 3px rgba(255,255,255,0.3);
  animation: dmgPopNormal 0.9s ease-out forwards;
}
.popup-crit {
  color: #fbbf24;
  font-size: 30px;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.8), 0 2px 8px rgba(0,0,0,0.9);
  animation: dmgPopCrit 1.0s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}
.popup-heal {
  color: #34d399;
  font-size: 24px;
  text-shadow: 0 0 8px rgba(52, 211, 153, 0.6), 0 2px 4px rgba(0,0,0,0.8);
  animation: dmgPopHeal 1.0s ease-out forwards;
}
.popup-miss {
  color: #f1f5f9;
  font-size: 18px;
  font-style: italic;
  animation: dmgPopNormal 0.7s ease-out forwards;
}

@keyframes dmgPopNormal {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0) scale(0.8); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(-12px) scale(1.1); }
  40%  { opacity: 1; transform: translateX(-50%) translateY(-25px) scale(1.0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-45px) scale(0.7); }
}

@keyframes dmgPopCrit {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0) scale(0.5); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(-8px) scale(1.5); }
  25%  { opacity: 1; transform: translateX(-50%) translateY(-16px) scale(1.15); }
  40%  { opacity: 1; transform: translateX(-50%) translateY(-24px) scale(1.25); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-50px) scale(0.8); }
}

@keyframes dmgPopHeal {
  0%   { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.8); }
  20%  { opacity: 1; transform: translateX(-50%) translateY(-5px) scale(1.1); }
  50%  { opacity: 1; transform: translateX(-50%) translateY(-20px) scale(1.0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-40px) scale(0.9); }
}

/* ===== アリーナ全体エフェクトレイヤー ===== */
.arena-effect-layer {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 25;
  pointer-events: none;
  overflow: hidden;
}

.fx-slash {
  position: absolute;
  width: 100%; height: 100%;
  animation: fxSlashAnim 0.35s ease-out forwards;
}
.fx-slash::before,
.fx-slash::after {
  content: '';
  position: absolute;
  top: 20%; left: 30%;
  width: 45%;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.9) 30%, rgba(200,220,255,0.95) 60%, transparent 100%);
  border-radius: 2px;
  box-shadow: none;
  transform-origin: center;
}
.fx-slash::before { transform: rotate(-35deg); }
.fx-slash::after  { transform: rotate(25deg); top: 35%; left: 25%; animation-delay: 0.06s; }

@keyframes fxSlashAnim {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  60%  { opacity: 0.8; }
  100% { opacity: 0; }
}

.fx-fire {
  position: absolute;
  width: 100%; height: 100%;
  background: radial-gradient(circle at 50% 40%, rgba(251,146,60,0.35) 0%, transparent 55%);
  animation: fxFireAnim 0.45s ease-out forwards;
}
.fx-fire-particle {
  display: none;
}

@keyframes fxFireAnim {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes fireRise {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-60px) scale(0.3); opacity: 0; }
}

.fx-aoe {
  position: absolute;
  width: 100%; height: 100%;
  background: radial-gradient(circle at 50% 35%, rgba(251,191,36,0.35) 0%, rgba(244,63,94,0.2) 40%, transparent 70%);
  animation: fxAoeAnim 0.5s ease-out forwards;
}
.fx-aoe::after {
  content: '';
  position: absolute;
  top: 30%; left: 50%;
  width: 200px; height: 200px;
  transform: translate(-50%, -50%) scale(0);
  border: 2px solid rgba(251,191,36,0.6);
  border-radius: 50%;
  animation: fxAoeRing 0.6s ease-out forwards;
}
@keyframes fxAoeAnim {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes fxAoeRing {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* 回復演出は Canvas の収束円＋白フラッシュに統一（帯エフェクト廃止） */
.fx-heal,
.fx-heal::before,
.fx-heal-particle {
  display: none !important;
}
@keyframes healFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(0.4); }
}

.fx-charge {
  position: absolute;
  width: 100%; height: 100%;
  animation: fxChargeAnim 0.5s ease-out forwards;
}
.fx-charge::before {
  content: '';
  position: absolute;
  bottom: 25%; left: 50%;
  width: 80px; height: 80px;
  transform: translate(-50%, 50%) scale(0);
  border: 3px solid rgba(250, 204, 21, 0.7);
  border-radius: 50%;
  animation: chargeRing 0.6s ease-out forwards;
}
.fx-charge::after {
  content: '';
  position: absolute;
  bottom: 25%; left: 50%;
  width: 50px; height: 50px;
  transform: translate(-50%, 50%);
  background: radial-gradient(circle, rgba(250, 204, 21, 0.45) 0%, transparent 70%);
  border-radius: 50%;
  animation: chargePulse 0.5s ease-out forwards;
}
@keyframes fxChargeAnim {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes chargeRing {
  0%   { transform: translate(-50%, 50%) scale(0); opacity: 1; border-width: 3px; }
  100% { transform: translate(-50%, 50%) scale(2.5); opacity: 0; border-width: 1px; }
}
@keyframes chargePulse {
  0%   { transform: translate(-50%, 50%) scale(0.5); opacity: 0.8; }
  100% { transform: translate(-50%, 50%) scale(3); opacity: 0; }
}

.fx-defend {
  position: absolute;
  width: 100%; height: 100%;
  animation: fxDefendAnim 0.6s ease-out forwards;
}
.fx-defend::before {
  content: '';
  position: absolute;
  bottom: 15%; left: 50%;
  width: 90px; height: 90px;
  transform: translate(-50%, 30%);
  border: 2px solid rgba(56,189,248,0.5);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56,189,248,0.15) 0%, rgba(56,189,248,0.05) 60%, transparent 100%);
  box-shadow: 0 0 20px rgba(56,189,248,0.3);
  animation: defendPulse 0.6s ease-out forwards;
}
@keyframes fxDefendAnim {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 0.7; }
  100% { opacity: 0; }
}
@keyframes defendPulse {
  0%   { transform: translate(-50%, 30%) scale(0.5); opacity: 0; }
  30%  { transform: translate(-50%, 30%) scale(1.0); opacity: 1; }
  100% { transform: translate(-50%, 30%) scale(1.2); opacity: 0; }
}

.fx-dash {
  position: absolute;
  width: 100%; height: 100%;
  animation: fxDashAnim 0.4s ease-out forwards;
}
.fx-dash-line {
  position: absolute;
  width: 3px;
  background: linear-gradient(180deg, transparent 0%, rgba(56,189,248,0.6) 40%, rgba(56,189,248,0.3) 60%, transparent 100%);
  border-radius: 2px;
  animation: dashLine 0.35s ease-out forwards;
}
@keyframes fxDashAnim {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes dashLine {
  0%   { height: 0; opacity: 1; }
  40%  { height: 80px; opacity: 0.8; }
  100% { height: 120px; opacity: 0; }
}

.arena-move-flash {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
}
.arena-move-flash.flash-active {
  animation: moveFlash 0.35s ease-out;
}
@keyframes moveFlash {
  0% { opacity: 0.5; background: rgba(56, 189, 248, 0.2); }
  100% { opacity: 0; background: transparent; }
}

.arena-move-flash.flash-damage {
  animation: damageFlash 0.25s ease-out;
}
@keyframes damageFlash {
  0% { opacity: 0.4; background: rgba(244, 63, 94, 0.3); }
  100% { opacity: 0; background: transparent; }
}

.arena-move-flash.flash-fire {
  animation: fireFlash 0.4s ease-out;
}
@keyframes fireFlash {
  0% { opacity: 0.5; background: rgba(251, 146, 60, 0.25); }
  50% { opacity: 0.3; background: rgba(239, 68, 68, 0.15); }
  100% { opacity: 0; background: transparent; }
}

.arena-move-flash.flash-victory {
  animation: victoryFlash 0.5s ease-out;
}
@keyframes victoryFlash {
  0% { opacity: 0; background: rgba(251, 191, 36, 0.3); }
  30% { opacity: 0.6; background: rgba(251, 191, 36, 0.25); }
  100% { opacity: 0; background: transparent; }
}

.player-attack-lunge {
  animation: playerLunge 0.3s ease-out !important;
}
@keyframes playerLunge {
  0%   { transform: translateX(-50%) translateY(0); }
  35%  { transform: translateX(-50%) translateY(-18px); }
  100% { transform: translateX(-50%) translateY(0); }
}

.enemy-attack-lunge {
  animation: enemyLunge 0.3s ease-out !important;
}
@keyframes enemyLunge {
  0%   { transform: translateY(0); }
  35%  { transform: translateY(15px); }
  100% { transform: translateY(0); }
}

/* 戦闘リザルトカード（縦長内容でも確定ボタンを画面内に残す） */
.battle-result-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 94%;
  max-width: 450px;
  max-height: calc(720px * 0.92);
  background: rgba(30, 18, 12, 0.98);
  border: 2px solid #d97706;
  border-radius: var(--radius-md);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.95), 0 0 20px rgba(217, 119, 6, 0.4);
  padding: 14px 14px;
  text-align: center;
  z-index: 200;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.battle-result-card .result-card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.battle-result-card > .result-actions-wrap,
.battle-result-card > .btn-primary {
  flex-shrink: 0;
  margin-top: 8px;
}

@keyframes popIn {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.result-badge {
  font-size: 22px;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 2px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8), 0 0 12px rgba(251, 191, 36, 0.5);
  margin-bottom: 2px;
}

#result-title {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 6px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* パーティ3枚横並び画像 */
.result-party-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: flex-end;
  margin: 8px 0 10px;
}

.result-party-slot {
  flex: 1;
  max-width: 130px;
  min-width: 0;
  background: rgba(18, 10, 6, 0.85);
  border: 2px solid #78350f;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 2px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7);
}

.result-party-figure {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.result-party-slot.is-player {
  border-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35), inset 0 0 8px rgba(0,0,0,0.7);
}

.result-party-slot.is-buddy {
  border-color: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3), inset 0 0 8px rgba(0,0,0,0.7);
}

.result-party-slot.is-empty {
  border-style: dashed;
  border-color: #473528;
  opacity: 0.35;
}

.result-party-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* アリーナ勝利：自分画像下の現在HP（探索バディと同型） */
.result-party-hp {
  width: 100%;
  flex-shrink: 0;
  margin-top: 3px;
  box-sizing: border-box;
}

/* 報酬リスト表示 */
.result-rewards {
  margin: 6px 0 10px;
  font-size: 15px;
  color: #ffffff;
  text-align: left;
  background: rgba(14, 8, 4, 0.85);
  border: 1px solid #78350f;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.6);
}

.result-reward-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.result-reward-label {
  font-size: 15px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 4px;
}

.result-reward-value {
  font-size: 17px;
  color: #fbbf24;
  font-weight: 800;
}

.result-levelup-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 3px 8px;
  background: linear-gradient(90deg, rgba(147, 51, 234, 0.3), rgba(236, 72, 153, 0.3));
  border: 1px solid #c084fc;
  border-radius: 6px;
  color: #f3e8ff;
  font-size: 14px;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.result-drop-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.result-drop-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(30, 58, 138, 0.4);
  border: 1px solid #3b82f6;
  border-radius: 4px;
  font-size: 13px;
  color: #bfdbfe;
  font-weight: 600;
}

.result-bonus-section {
  margin-top: 4px;
  padding: 5px 8px;
  background: rgba(30, 24, 10, 0.65);
  border: 1px solid #d97706;
  border-radius: 6px;
}

.result-bonus-label {
  font-size: 14px;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.result-bonus-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.result-bonus-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid #f59e0b;
  border-radius: 4px;
  font-size: 13px;
  color: #fef3c7;
  font-weight: 700;
}

/* ボタン群レイアウト */
.result-actions-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.result-auto-timer-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: -4px;
}

.result-auto-timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
  border-radius: 2px;
}

.result-actions-wrap #btn-result-confirm {
  width: 100%;
  min-height: 42px;
  font-size: 17px;
  font-weight: 800;
  padding: 8px 16px;
}

.result-sub-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.btn-result-half {
  flex: 1;
  min-height: 38px;
  font-size: 15px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(40, 24, 16, 0.9);
  border: 1px solid #78350f;
  color: #f1f5f9;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

.btn-result-half:active {
  transform: scale(0.97);
}

.btn-result-half.is-active {
  background: linear-gradient(180deg, #b45309, #78350f);
  border-color: #fbbf24;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.dungeon-clear-thanks {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 0 4px;
  padding: 10px;
  background: rgba(20, 12, 8, 0.75);
  border: 1px solid #78350f;
  border-radius: 8px;
  text-align: left;
}
.dungeon-clear-requester {
  width: 72px;
  max-width: 28%;
  height: auto;
  max-height: 96px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #b45309;
  background: #1a1410;
  flex-shrink: 0;
}
.dungeon-clear-thanks-text {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  color: #fff7ed;
  overflow-wrap: anywhere;
}

#btn-result-confirm,
#btn-dungeon-clear-confirm,
#btn-quest-loop-end-confirm {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  box-sizing: border-box;
}

/* 周回まとめ（クリア／停止／敗北の別枠）。カード本体のスクロールに任せる */
.quest-loop-summary-box {
  margin: 8px 0 10px;
  padding: 10px 12px;
  text-align: left;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid #334155;
  border-radius: 8px;
}
.quest-loop-summary-title {
  font-size: 16px;
  font-weight: 700;
  color: #fbbf24;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.quest-loop-summary-body {
  font-size: 18px;
  line-height: 1.35;
  color: #e2e8f0;
}
.quest-loop-summary-body .qls-clears {
  font-weight: 800;
  color: #fef08a;
  margin-bottom: 4px;
}
.quest-loop-summary-body .qls-exp { color: #a3e635; }
.quest-loop-summary-body .qls-gold { color: #fbbf24; }
.quest-loop-summary-body .qls-fame { color: #38bdf8; }
.quest-loop-summary-body .qls-clan { color: #f472b6; }
.quest-loop-summary-body .qls-items {
  color: #67e8f9;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.quest-loop-summary-body .qls-empty {
  font-size: 16px;
  color: #94a3b8;
}

.quest-reward-got .result-reward-value { color: #a3e635; font-weight: 700; }
.quest-reward-miss .result-reward-value { color: #94a3b8; font-weight: 700; }
.quest-reward-miss { opacity: 0.85; }

/* 探索結果まとめ：画面全体の上に別枠 */
.quest-loop-end-overlay {
  position: absolute;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 12px;
  box-sizing: border-box;
}
.quest-loop-end-overlay .quest-loop-end-card-inner {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  margin: 0;
  animation: none;
}

.auto-explore-toggle {
  position: relative;
  display: block;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  margin: 0;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.auto-explore-box {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.auto-explore-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 2px solid #78350f;
  border-radius: 8px;
  background: #1e130b;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  z-index: 1;
}

.auto-explore-box:checked + .auto-explore-face {
  border-color: #f59e0b;
  background: #78350f;
  color: #fff7ed;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35);
}

.auto-explore-box:focus-visible + .auto-explore-face {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}
.log-entry { line-height: 1.4; font-size: 16px; color: #ffffff; }
.log-time { color: #fbbf24; font-size: 14px; margin-right: 4px; }
.log-entry.log-action { color: #38bdf8; }
.log-entry.log-enemy { color: #f87171; }
.log-entry.log-damage { color: #fb7185; }
.log-entry.log-heal { color: #4ade80; }
.log-entry.log-victory { color: #fbbf24; font-weight: 700; }
.log-entry.log-defeat { color: #ef4444; font-weight: 700; }
.log-entry.log-system { color: #e2e8f0; }

/* ============================================================
   3×3 タクティカルボード（panel.png にはめ込み）
============================================================ */
#subview-tactics {
  padding: 3px 8px 4px;
  overflow-y: hidden;
  display: none;
  flex-direction: column;
  gap: 2px;
  box-sizing: border-box;
}

#subview-tactics.active {
  display: flex;
}

#subview-tactics .subview-header {
  flex-shrink: 0;
}

#subview-tactics .subview-header h3 {
  font-size: 15px;
  margin: 0;
  line-height: 1.15;
}

#subview-tactics .subview-header p {
  font-size: 11.5px;
  margin: 0;
  line-height: 1.15;
  color: #cbd5e1;
}

#btn-start-training-battle,
#btn-tactics-hp-slider-reset {
  flex: 0 0 auto !important;
  width: auto !important;
  height: 28px !important;
  min-height: 0 !important;
  padding: 0 10px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 26px !important;
  white-space: nowrap !important;
  border-radius: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  cursor: pointer;
  box-sizing: border-box !important;
  font-family: inherit !important;
}

.tactics-board-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  position: relative;
  container-type: size;
  container-name: tactics-board;
}

.tactics-unable-action-bar {
  /* 選択UI一時非表示（行動不能時は常に近づく）。復活時は display:flex に戻す */
  display: none !important;
  position: absolute;
  left: 50%;
  bottom: 1.2%;
  transform: translateX(-50%);
  z-index: 6;
  width: max-content;
  max-width: 92%;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.5cqw;
  margin: 0;
  box-sizing: border-box;
  padding: 0.35cqh 0.8cqw;
  border-radius: 6px;
  background: rgba(12, 8, 6, 0.82);
  border: 1.5px solid rgba(251, 191, 36, 0.55);
  pointer-events: auto;
}
.tactics-unable-action-label {
  flex: 0 0 auto;
  font-size: clamp(13px, 3.4cqw, 16px);
  font-weight: 800;
  line-height: 1.1;
  color: #fde68a;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
.tactics-unable-action-btns {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4cqw;
  flex: 0 0 auto;
}
.tactics-unable-action-btn {
  flex: 0 0 auto;
  /* 「なにもしない」＋余白に3ボタンとも揃える */
  width: 6.5em;
  box-sizing: border-box;
  padding: 0.32em 0;
  margin: 0;
  border: 2px solid #b45309;
  border-radius: 5px;
  background: rgba(28, 16, 8, 0.95);
  color: #fff7ed;
  font-size: clamp(13px, 3.2cqw, 15px);
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8);
}
.tactics-unable-action-btn.is-selected {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px #38bdf8, 0 0 8px rgba(56, 189, 248, 0.35);
  color: #e0f2fe;
  background: rgba(8, 40, 64, 0.98);
}
.tactics-unable-action-btn:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

/* 自動アイテム帯: panel.webp 下部3枠に重ねる。回数ボタンは枠外・直下（画像上） */
.tactics-auto-items {
  position: absolute;
  left: 11.5%;
  /* 400x435 計測: アイテム石枠 y≈352〜388 */
  top: 80.9%;
  width: 77%;
  height: 16.5%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.8%;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  min-width: 0;
  z-index: 4;
  pointer-events: none;
}
.tactics-auto-item-col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  height: 100%;
  pointer-events: none;
}
.tactics-auto-item-slot {
  position: relative;
  /* アイテム石枠の高さ分（残りは回数ボタン） */
  flex: 0 0 50%;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  margin: 0;
  /* 長方形＋角丸（％角丸は横に伸びて見えるので固定量）／黒半透明 */
  border: 2px solid #64748b;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  padding: 2px 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #f8fafc;
  font-size: clamp(10px, 3.8cqi, 13px);
  font-weight: 700;
  line-height: 1.15;
  pointer-events: auto;
}
.tactics-auto-item-icon {
  display: none;
}
.tactics-auto-item-name {
  position: relative;
  z-index: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: none;
  pointer-events: none;
}
.tactics-auto-item-controls {
  display: flex;
  justify-content: center;
  gap: 0.2em;
  width: 100%;
  min-width: 0;
}
.tactics-auto-item-band,
.tactics-auto-item-uses {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 1.35em;
  height: 1.35em;
  min-width: 0;
  max-width: none;
  min-height: 0;
  margin: 2px 0 0;
  padding: 0;
  border: 1px solid #334155;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
  font-size: clamp(18px, 7cqi, 24px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: auto;
  transition: none;
}
/* 使用帯ABC: A緑 / B橙 / C赤・白文字 */
.tactics-auto-item-band.band-high {
  background: #16a34a;
  border-color: #15803d;
  color: #ffffff;
}
.tactics-auto-item-band.band-mid {
  background: #ea580c;
  border-color: #c2410c;
  color: #ffffff;
}
.tactics-auto-item-band.band-low {
  background: #dc2626;
  border-color: #b91c1c;
  color: #ffffff;
}
.tactics-auto-item-slot.is-empty .tactics-auto-item-name {
  color: #cbd5e1;
}
.tactics-auto-item-uses.is-off {
  color: #64748b;
  background: #f1f5f9;
}
/* 枠・帯・回数: ホバー／押下で見た目を変えない（グローバル button:hover を打ち消し） */
.tactics-auto-item-slot:hover,
.tactics-auto-item-slot:active,
.tactics-auto-item-slot:focus,
.tactics-auto-item-slot:focus-visible {
  background: rgba(0, 0, 0, 0.55);
  border-color: #64748b;
  color: #f8fafc;
  outline: none;
  box-shadow: none;
  filter: none;
  opacity: 1;
}
.tactics-auto-item-uses:hover,
.tactics-auto-item-uses:active,
.tactics-auto-item-uses:focus,
.tactics-auto-item-uses:focus-visible {
  background: #ffffff;
  border-color: #334155;
  color: #0f172a;
  outline: none;
  box-shadow: none;
  filter: none;
  opacity: 1;
}
.tactics-auto-item-uses.is-off:hover,
.tactics-auto-item-uses.is-off:active,
.tactics-auto-item-uses.is-off:focus,
.tactics-auto-item-uses.is-off:focus-visible {
  background: #f1f5f9;
  border-color: #334155;
  color: #64748b;
}
.tactics-auto-item-band.band-high:hover,
.tactics-auto-item-band.band-high:active,
.tactics-auto-item-band.band-high:focus,
.tactics-auto-item-band.band-high:focus-visible {
  background: #16a34a;
  border-color: #15803d;
  color: #ffffff;
  outline: none;
  box-shadow: none;
  filter: none;
  opacity: 1;
}
.tactics-auto-item-band.band-mid:hover,
.tactics-auto-item-band.band-mid:active,
.tactics-auto-item-band.band-mid:focus,
.tactics-auto-item-band.band-mid:focus-visible {
  background: #ea580c;
  border-color: #c2410c;
  color: #ffffff;
  outline: none;
  box-shadow: none;
  filter: none;
  opacity: 1;
}
.tactics-auto-item-band.band-low:hover,
.tactics-auto-item-band.band-low:active,
.tactics-auto-item-band.band-low:focus,
.tactics-auto-item-band.band-low:focus-visible {
  background: #dc2626;
  border-color: #b91c1c;
  color: #ffffff;
  outline: none;
  box-shadow: none;
  filter: none;
  opacity: 1;
}

/* HP判定: プリセットは下。スライダーはチップボード左に細く差し込み（重なり可） */
.tactics-hp-band-panel {
  display: none;
  flex: 0 0 auto;
  width: 100%;
  max-width: min(100%, 440px);
  margin: 2px 0 0;
  padding: 4px 8px;
  box-sizing: border-box;
  background: rgba(20, 12, 8, 0.88);
  border: 1.5px solid #78350f;
  border-radius: 6px;
  color: #fde68a;
}
.tactics-hp-band-title {
  font-size: clamp(13px, 3.2cqw, 15px);
  font-weight: 800;
  color: #fde68a;
  margin-bottom: 3px;
}
.tactics-hp-band-presets {
  display: none;
  gap: 4px;
  margin-bottom: 2px;
}
.tactics-hp-preset-btn {
  flex: 1;
  min-height: 30px;
  font-size: clamp(13px, 3.2cqw, 15px);
  font-weight: 700;
  border: 1.5px solid #b45309;
  border-radius: 5px;
  background: rgba(28, 16, 8, 0.95);
  color: #fff7ed;
  padding: 3px 6px;
}
.tactics-hp-preset-btn.is-selected {
  background: #78350f;
  border-color: #fbbf24;
  color: #fffbeb;
}
.tactics-hp-band-readout {
  margin-top: 2px;
  font-size: clamp(11px, 2.8cqw, 13px);
  color: #e2e8f0;
  line-height: 1.2;
  text-align: center;
}

/* チップボード左端に縦スライダー（3×3チップ行のみ。アイテム行は含まない） */
.tactics-hp-band-track-wrap {
  position: absolute;
  left: 5.2%;
  top: 11%;
  width: 3.6%;
  /* panel.webp 400x435: チップ3行 ≈ top11%〜height68% */
  height: 68%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1%;
  pointer-events: auto;
}
.tactics-hp-band-lock {
  flex: 0 0 auto;
  font-size: clamp(8px, 3.2cqi, 10px);
  font-weight: 800;
  color: #fde68a;
  text-align: center;
  line-height: 1.1;
  text-shadow: 0 0 3px #000, 0 1px 2px #000;
}
.tactics-hp-band-track {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border-radius: 3px;
  /* 上段緑・中段橙・下段赤（位置は JS で更新） */
  background: linear-gradient(180deg, #166534 0%, #166534 33.3%, #ea580c 33.3%, #ea580c 66.7%, #b91c1c 66.7%, #b91c1c 100%);
  border: 1px solid #fbbf24;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.75);
  touch-action: none;
  user-select: none;
}
.tactics-hp-band-abs.high,
.tactics-hp-band-abs.low {
  display: none;
}
.tactics-hp-band-mid {
  position: absolute;
  left: 0;
  right: 0;
  background: transparent;
  border: none;
  pointer-events: none;
  box-sizing: border-box;
}
/* ▶形ハンドル：左に大きめヒット領域（見た目は右向き三角） */
.tactics-hp-band-handle {
  position: absolute;
  left: 0;
  width: 40px;
  height: 40px;
  margin-left: -40px;
  margin-top: -20px;
  border: none !important;
  border-radius: 0;
  padding: 0;
  background: transparent !important;
  color: #fde68a;
  clip-path: none;
  z-index: 3;
  cursor: grab;
  box-shadow: none !important;
  filter: none;
  transition: none !important;
  transform: none !important;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
  outline: none;
}
.tactics-hp-band-handle::before {
  content: '';
  position: absolute;
  right: 1px;
  top: 50%;
  width: 18px;
  height: 22px;
  margin-top: -11px;
  background: #ffffff;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  filter: drop-shadow(0 0 1.5px #fde68a) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.75));
  pointer-events: none;
}
.tactics-hp-band-handle::after {
  content: none;
}
.tactics-hp-band-handle:hover,
.tactics-hp-band-handle:active,
.tactics-hp-band-handle:focus,
.tactics-hp-band-handle:focus-visible {
  background: transparent !important;
  border: none !important;
  color: #fde68a !important;
  box-shadow: none !important;
  outline: none;
  transform: none !important;
  filter: none;
  cursor: grabbing;
}

.tactics-formation-section {
  flex-shrink: 0;
  width: 100%;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tactics-formation-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.1;
  color: #fde68a;
  text-align: center;
}
.tactics-formation-bar {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
}
.tactics-formation-btn {
  flex: 0 0 auto;
  width: 69px;
  height: auto;
  padding: 0 0 2px;
  margin: 0;
  box-sizing: content-box;
  border: 2px solid #78350f;
  border-radius: 6px;
  background: rgba(20, 14, 10, 0.92);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.15;
}
.tactics-formation-btn img {
  width: 69px;
  height: 50px;
  object-fit: contain;
  display: block;
  pointer-events: none;
  flex-shrink: 0;
}
.tactics-formation-name {
  display: block;
  width: 100%;
  padding: 0 2px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  color: #fef3c7;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  pointer-events: none;
}
.tactics-formation-btn.is-selected {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px #38bdf8;
}
.tactics-formation-btn.is-selected .tactics-formation-name {
  color: #7dd3fc;
}
.tactics-formation-btn:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

/* panel.webp (400×435): 3×3＋下部アイテム枠。比率維持で等倍表示 */
.tactics-panel-frame {
  position: relative;
  flex: 0 0 auto;
  aspect-ratio: 400 / 435;
  width: min(100cqw, calc((100cqh - 34px) * 400 / 435));
  height: auto;
  max-width: 100%;
  max-height: calc(100cqh - 34px);
  container-type: size;
}

.tactics-panel-hint {
  flex-shrink: 0;
  margin: 4px 0 0;
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: min(100cqw, calc((100cqh - 34px) * 400 / 435));
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
}

.tactics-graph-row {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  height: 10px;
}

.tactics-graph-label {
  flex: 0 0 28px;
  font-size: 10px;
  font-weight: 700;
  text-align: right;
  line-height: 1;
  white-space: nowrap;
}

.tactics-graph-track {
  position: relative;
  flex: 1 1 auto;
  height: 6px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 2px;
  overflow: hidden;
  display: flex;
}

.tactics-graph-seg {
  height: 100%;
  box-sizing: border-box;
}

.tactics-graph-seg.seg-near {
  background: #991b1b;
  border-right: 1px solid rgba(0, 0, 0, 0.6);
}

.tactics-graph-seg.seg-mid {
  background: #166534;
  border-right: 1px solid rgba(0, 0, 0, 0.6);
}

.tactics-graph-seg.seg-far {
  background: #1e40af;
}

.tactics-graph-ticks {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  pointer-events: none;
  z-index: 2;
}

.tactics-graph-ticks span {
  flex: 1 0 10%;
  border-right: 1px dashed rgba(255, 255, 255, 0.35);
  box-sizing: border-box;
}

.tactics-graph-ticks span:last-child {
  border-right: none;
}

.tactics-graph-axis-row {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  height: 10px;
}

.tactics-graph-legend {
  flex: 0 0 28px;
  font-size: 9px;
  font-weight: 700;
  color: #94a3b8;
  text-align: right;
  line-height: 1;
  white-space: nowrap;
}

.tactics-graph-axis {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  justify-content: space-between;
  font-size: 8.5px;
  color: #94a3b8;
  line-height: 1;
  padding: 0 1px;
}

.tactics-panel-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* 距離説明：上フチ（蔦枠）に重ねる */
.tactics-col-headers {
  position: absolute;
  left: 11.5%;
  top: 1.2%;
  width: 77%;
  height: 8.5%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.8%;
  align-items: center;
  z-index: 2;
  pointer-events: none;
}

.tactics-col-head {
  font-size: clamp(10px, 4.8cqi, 14px);
  font-weight: 800;
  color: #fffef5;
  text-align: center;
  line-height: 1.05;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 0.95),
    0 1px 2px rgba(0, 0, 0, 0.9),
    0 0 8px rgba(0, 0, 0, 0.6);
}

/* HP%ラベル：スライダー帯の前面（3×3チップ行のみ） */
.tactics-row-headers {
  position: absolute;
  left: 5.2%;
  top: 11%;
  width: 3.6%;
  height: 68%;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 2.8%;
  align-items: stretch;
  z-index: 6;
  pointer-events: none;
}

.tactics-row-head {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: clamp(8px, 3.4cqi, 11px);
  font-weight: 800;
  color: #fffef5;
  text-align: center;
  line-height: 1.05;
  letter-spacing: 0.04em;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 1),
    0 1px 2px rgba(0, 0, 0, 1),
    0 0 6px rgba(0, 0, 0, 0.9);
}

.tactics-row-head .row-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  writing-mode: horizontal-tb;
}

/* panel.webp 計測: 3×3チップ領域 L11.5% T11% W77% H68%（アイテム行は含まない） */
.tactics-panel-grid {
  position: absolute;
  left: 11.5%;
  top: 11%;
  width: 77%;
  height: 68%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2.8%;
  box-sizing: border-box;
  z-index: 1;
}

.chip-slot {
  background: transparent;
  border: 2px solid transparent;
  /* 石タイルに合わせた角丸正方形 */
  border-radius: 14%;
  clip-path: none;
  min-height: 0;
  padding: 2px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-sizing: border-box;
  overflow: hidden;
}

.chip-slot:hover {
  background: transparent;
  filter: brightness(1.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.chip-slot.selected {
  background: transparent;
  box-shadow:
    0 0 0 2px #fbbf24,
    0 0 10px rgba(251, 191, 36, 0.55);
  filter: none;
}

.chip-slot.slot-fired {
  box-shadow:
    0 0 0 2px #f59e0b,
    0 0 12px rgba(245, 158, 11, 0.65);
}

.chip-slot.has-chip {
  box-shadow: none;
}

/* ボード上のチップ: 背景なし・色は縁取りのみ */
.chip-slot.chip-color-attack {
  border: 2px solid #ef4444 !important;
  background: transparent !important;
}
.chip-slot.chip-color-magic {
  border: 2px solid #c084fc !important;
  background: transparent !important;
}
.chip-slot.chip-color-move-forward {
  border: 2px solid #38bdf8 !important;
  background: transparent !important;
}
.chip-slot.chip-color-move-back {
  border: 2px solid #60a5fa !important;
  background: transparent !important;
}
.chip-slot.chip-color-skill {
  border: 2px solid #facc15 !important;
  background: transparent !important;
}
.chip-slot.chip-color-item {
  border: 2px solid #4ade80 !important;
  background: transparent !important;
}
.chip-slot.chip-color-other {
  border: 2px solid #94a3b8 !important;
  background: transparent !important;
}

/* パレット一覧は従来どおり塗り＋縁 */
.palette-chip-item.chip-color-attack {
  border: 2px solid #ef4444 !important;
  background: rgba(127, 29, 29, 0.88) !important;
}
.palette-chip-item.chip-color-magic {
  border: 2px solid #c084fc !important;
  background: rgba(88, 28, 135, 0.88) !important;
}
.palette-chip-item.chip-color-move-forward {
  border: 2px solid #38bdf8 !important;
  background: rgba(12, 74, 110, 0.88) !important;
}
.palette-chip-item.chip-color-move-back {
  border: 2px solid #1d4ed8 !important;
  background: rgba(15, 23, 72, 0.92) !important;
}
.palette-chip-item.chip-color-skill {
  border: 2px solid #facc15 !important;
  background: rgba(113, 63, 18, 0.88) !important;
}
.palette-chip-item.chip-color-item {
  border: 2px solid #4ade80 !important;
  background: rgba(20, 83, 45, 0.88) !important;
}
.palette-chip-item.chip-color-other {
  border: 2px solid #94a3b8 !important;
  background: rgba(30, 41, 59, 0.88) !important;
}

.chip-slot.chip-color-attack.selected,
.chip-slot.chip-color-magic.selected,
.chip-slot.chip-color-move-forward.selected,
.chip-slot.chip-color-move-back.selected,
.chip-slot.chip-color-skill.selected,
.chip-slot.chip-color-item.selected,
.chip-slot.chip-color-other.selected {
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 10px rgba(255, 255, 255, 0.45);
}

.tactics-panel-grid .slot-chip-effect,
.tactics-panel-grid .slot-chip-icon-text {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.05;
  color: #ffffff;
  max-width: 100%;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  word-break: break-all;
  letter-spacing: -0.04em;
}

.tactics-panel-grid .slot-chip-icon {
  font-size: 26px;
  line-height: 1;
}

.tactics-panel-grid .slot-chip-name {
  font-size: 18px;
  font-weight: 700;
  color: #fef3c7;
  line-height: 1.05;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  word-break: break-all;
  letter-spacing: -0.04em;
}

.chip-slot.empty .slot-empty-text {
  font-size: clamp(10px, 11cqi, 13px);
  color: rgba(255, 255, 255, 0.55);
  font-style: normal;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

.slot-chip-icon-text,
.pchip-icon-text {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  color: #ffffff;
  max-width: 100%;
  word-break: break-word;
}

.slot-empty-text {
  font-size: 15px;
  color: #94a3b8;
  font-style: italic;
}

.slot-chip-icon {
  font-size: 24px;
  line-height: 1;
}

.slot-chip-name {
  font-size: 14px;
  font-weight: 700;
  color: #fef3c7;
  line-height: 1.2;
}

.slot-chip-cd {
  font-size: 13px;
  font-weight: 700;
  color: #f59e0b;
}

.row-status-dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-green { background: #22c55e; }
.dot-yellow { background: #f59e0b; }
.dot-red { background: #ef4444; }

/* ============================================================
   チップ選択モーダル (タップで一覧表示・装着) — エディター風
============================================================ */
#modal-chip-select {
  padding: 4px;
}

.modal-chip-select-box {
  width: 100%;
  max-width: 472px;
  height: 98.5%;
  max-height: 98.5%;
  display: flex;
  flex-direction: column;
  padding: 8px 10px 6px;
  box-sizing: border-box;
  background: #1e130c;
  border: 2px solid #d97706;
  border-radius: 12px;
}

.modal-chip-select-box .modal-header {
  background: #2b1a10;
  border-bottom: 1.5px solid #78350f;
  margin: -8px -10px 8px;
  padding: 10px 12px;
  border-radius: 10px 10px 0 0;
}

.modal-chip-select-box .modal-header h3 {
  color: #fbbf24;
  font-size: 18px;
  margin: 0;
}

.modal-slot-target {
  font-size: 14px;
  color: #ffffff;
  font-weight: 600;
  margin-top: 3px;
}

/* ソートタブ: エディター同様の横並び（折り返し可） */
.chip-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  overflow-x: hidden;
  margin-bottom: 6px;
  padding-bottom: 0;
  flex-shrink: 0;
}

.chip-subcategory-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: -2px 0 8px;
  flex-shrink: 0;
}

.chip-subcategory-tabs[hidden] {
  display: none !important;
}

/* チップ一覧スクロール領域 */
.modal-chip-body {
  flex: 1;
  min-height: 0;
  max-height: none !important;
  height: auto !important;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
  margin-bottom: 4px;
}

.chip-cat-tab,
.chip-sub-tab {
  flex: 1 1 calc(25% - 6px);
  min-width: 48px;
  text-align: center;
  background: #261911;
  border: 1.5px solid #78350f;
  color: #e2e8f0;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.chip-sub-tab {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 13px;
  padding: 5px 8px;
  background: #1a120c;
  border-color: #92400e;
  color: #fde68a;
}

.chip-cat-tab.active,
.chip-sub-tab.active {
  background: #d97706;
  border-color: #fbbf24;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.35);
}

/* チップ一覧グリッド: エディター風コンパクトカード */
.palette-chips-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.palette-chip-item {
  background: #261911;
  border: 1.5px solid #78350f;
  border-radius: 8px;
  padding: 8px 9px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.palette-chip-item:hover, .palette-chip-item:active {
  background: #451a03;
  border-color: #fbbf24;
  transform: translateY(-1px);
}

.palette-chip-item.selected {
  border-color: #10b981;
  background: rgba(6, 78, 59, 0.35);
  box-shadow: 0 0 0 1px #10b981;
}

.palette-chip-item.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.palette-chip-item.is-disabled:hover,
.palette-chip-item.is-disabled:active {
  transform: none;
  background: #261911;
  border-color: #78350f;
}

.pchip-header {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex-wrap: wrap;
}

.pchip-title-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pchip-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.pchip-name,
.pchip-effect {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.pchip-meta {
  font-size: 12px;
  color: #fbbf24;
  line-height: 1.25;
  word-break: break-all;
}

.pchip-chip-name {
  font-size: 13px;
  font-weight: 700;
  color: #fde68a;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.pchip-weapon {
  font-size: 12px;
  font-weight: 600;
  color: #93c5fd;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.pchip-element {
  font-size: 12px;
  font-weight: 700;
  color: #e9d5ff;
  line-height: 1.25;
  margin-top: 1px;
}

.pchip-rules {
  font-size: 12px;
  font-weight: 600;
  color: #fde68a;
  line-height: 1.3;
}

.pchip-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.pchip-badge.is-equipped {
  background: #065f46;
  color: #6ee7b7;
}

.pchip-badge.is-blocked {
  background: #7f1d1d;
  color: #fecaca;
}

.pchip-badge.is-transform {
  background: #713f12;
  color: #fde68a;
  border: 1px solid #f59e0b;
  margin-left: 0;
}

.pchip-use-limit {
  font-size: 12px;
  font-weight: 700;
  color: #86efac;
}

.inv-item-tag.is-transform {
  background: #713f12;
  color: #fde68a;
  border: 1px solid #f59e0b;
}

.inv-item-tag.is-combine-ok {
  background: #14532d;
  color: #bbf7d0;
  border: 1px solid #22c55e;
  padding: 1px 6px;
  border-radius: 4px;
}

.inv-item-tag.is-combine-no {
  background: #1e130b;
  color: #a8a29e;
  border: 1px solid #57534e;
  padding: 1px 6px;
  border-radius: 4px;
}

.pchip-cd-badge {
  font-size: 12px;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(120, 53, 15, 0.5);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #78350f;
  margin-left: auto;
}

.pchip-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.3;
}

.pchip-desc.pchip-cost {
  font-size: 13px;
  font-weight: 700;
  color: #fde68a;
}

/* ボタン類 (閉じるボタンの背景白を防止) */
.btn-secondary {
  background: #342014;
  border: 1.5px solid #78350f;
  color: #fbbf24;
  font-size: 16px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover, .btn-secondary:active {
  background: #451a03;
  border-color: #f59e0b;
  color: #ffffff;
}

.btn-danger-subtle {
  background: #450a0a;
  border: 1.5px solid #b91c1c;
  color: #fca5a5;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger-subtle:hover, .btn-danger-subtle:active {
  background: #7f1d1d;
  color: #ffffff;
  border-color: #ef4444;
}

.modal-chip-select-box .modal-footer {
  margin-top: 4px;
  padding: 0;
  flex-shrink: 0;
}

/* 装備選択モーダル */
#modal-equip-select {
  padding: 6px;
}

.modal-equip-select-box {
  width: 100%;
  max-width: 472px;
  height: 94%;
  max-height: 94%;
  display: flex;
  flex-direction: column;
  padding: 10px 12px 8px;
  box-sizing: border-box;
}

.modal-equip-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  margin: 8px 0;
  padding-right: 2px;
}

.modal-equip-select-box .modal-footer {
  margin-top: 4px;
  padding: 0;
  flex-shrink: 0;
}

.equip-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.equip-picker-item {
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.15s ease;
}

.equip-picker-item:hover {
  background: #3d2516;
  border-color: #b45309;
}

.equip-picker-item-info {
  flex: 1;
  min-width: 0;
}

.equip-picker-item-name {
  font-weight: 700;
  color: #ffffff;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.equip-picker-item-desc {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 3px;
}

/* 性能バッジは .item-stat-badges / .item-stat-badge に統一（下部定義） */

/* ============================================================
   装備・アイテム・ショップ
============================================================ */
.subview-header { margin-bottom: 12px; border-bottom: 1.5px solid #78350f; padding-bottom: 8px; }
.subview-header h3 { font-size: 22px; color: #ffffff; font-weight: 700; }
.subview-header.flex-between { display: flex; justify-content: space-between; align-items: center; }

.equipment-layout { flex: 1; min-height: 0; }
.equipment-help { font-size: 20px; line-height: 1.2; color: #fff; }
.equipment-chip-notice {
  margin: 6px 0 0;
  padding: 8px 10px;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  color: #fff7ed;
  background: #7c2d12;
  border: 1.5px solid #f59e0b;
  border-radius: 8px;
}
.equipment-chip-notice[hidden] { display: none; }
#subview-equipment .subview-header { margin-bottom: 8px; padding-bottom: 6px; }
.equip-slots-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.equip-slot {
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-sm);
  padding: 8px;
  min-width: 0;
  cursor: pointer;
}
.equip-slot-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 28px;
  margin-bottom: 6px;
}
.equip-slot-label { font-size: 18px; line-height: 1.1; color: #fcd9a8; }
.equip-slot .btn-unequip-slot { padding: 3px 8px; font-size: 18px; line-height: 1.1; }
.equip-slot-content { display: flex; align-items: center; gap: 8px; min-height: 68px; }
.equip-slot .equip-slot-item-name {
  font-size: 20px;
  line-height: 1.15;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  min-width: 0;
}
#modal-equip-select .equip-picker-item-name { font-size: 20px; line-height: 1.2; }
#modal-equip-select .equip-picker-item-desc,
#modal-equip-select .item-stat-badges,
#modal-equip-select .inv-item-stats,
#modal-equip-select .modal-slot-target { font-size: 18px; line-height: 1.25; }
#modal-equip-select .item-stat-badge { font-size: 16px; }
#modal-equip-select .equip-picker-item { flex-wrap: wrap; }
#modal-equip-select .equip-picker-item > button { margin-left: auto; }
.equip-slot:hover {
  background: #3d2516;
  border-color: #b45309;
}
.equip-slot.is-blocked {
  opacity: 0.72;
  border-color: #64748b;
  background: rgba(30, 41, 59, 0.55);
  pointer-events: none;
}
.equip-slot-blocked .equip-slot-item-name {
  color: #94a3b8;
}
.palette-chip-item.is-disabled {
  opacity: 0.45;
  filter: grayscale(0.35);
  cursor: not-allowed;
}
.equip-slot.selected {
  border-color: #d97706;
  background: rgba(84, 44, 19, 0.95);
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.3);
}
.equip-slot-tag {
  font-size: 16px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  background: #451a03;
  color: #ffffff;
  border: 1px solid #9a3412;
  min-width: 52px;
  text-align: center;
}
.equip-slot-tag.tag-defense {
  background: #342014;
  color: #ffffff;
  border: 1px solid #78350f;
}
.equip-slot-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.equip-slot-item-name {
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.equip-slot-item-meta {
  font-size: 16px;
  color: #ffffff;
}
.equip-slot-arrow {
  font-size: 18px;
  color: #ffffff;
}

.equip-stats-col {
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-sm);
  padding: 12px;
}
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
.stat-pill { background: rgba(24, 15, 10, 0.9); border: 1px solid #78350f; padding: 6px 2px; text-align: center; border-radius: 4px; }
.stat-pill .label { font-size: 15px; color: #ffffff; font-weight: 600; }
.stat-pill .value { font-size: 19px; font-weight: 700; color: #ffffff; }

.equip-selector-panel {
  border-top: 1.5px dashed #78350f;
  padding-top: 10px;
  margin-top: 6px;
}
.equip-selector-panel h4 {
  font-size: 19px;
  color: #ffffff;
  margin-bottom: 8px;
  font-weight: 700;
}
.equip-item-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.picker-item-row {
  background: rgba(24, 15, 10, 0.9);
  border: 1.5px solid #78350f;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 48px;
}
.picker-item-row:hover {
  background: #3d2516;
  border-color: #b45309;
}
.picker-item-name { font-weight: 700; color: #ffffff; font-size: 19px; }
.picker-item-stats { font-size: 16px; color: #ffffff; }

.inventory-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
#subview-inventory.active { display:flex; flex-direction:column; min-height:0; overflow:hidden; }
.inventory-tabs { flex-shrink:0; }
.inventory-tabs button { flex:1; min-width:0; font-size:20px; }
#inventory-items-container { flex:1; min-height:0; overflow-y:auto; align-content:start; grid-auto-rows:max-content; }
.inventory-empty { font-size:20px; color:#fff; }
.inventory-card {
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 74px;
}
.inv-item-info {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.inv-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.inv-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.inv-item-name {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-count-badge {
  background: #0284c7;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  border: 1px solid #38bdf8;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
}
.inv-item-tag {
  font-size: 12px;
  color: var(--accent-cyan);
  font-weight: 600;
}
.item-stat-badges,
.inv-item-stats,
.equip-performance,
.equip-picker-item-stats {
  font-size: 13.5px;
  color: #fde047;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  line-height: 1.2;
  margin-top: 4px;
}
.item-stat-badge,
.equip-stat-badge,
.inv-item-stats > span:not(.equip-stat-delta) {
  font-size: 13px;
  font-weight: 700;
  color: #fde68a;
  background: rgba(0, 0, 0, 0.45);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid #78350f;
  white-space: nowrap;
}
/* 装飾の属性・性能タグ（よろず屋など） */
.acc-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  line-height: 1.2;
}
.acc-tag {
  font-size: 12.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  border: 1px solid #78350f;
}
.acc-tag-elem {
  color: #fde68a;
  background: rgba(120, 53, 15, 0.55);
  border-color: #b45309;
}
.acc-tag-elem.is-empty {
  color: #94a3b8;
  background: rgba(30, 41, 59, 0.55);
  border-color: #475569;
}
.acc-tag-boost {
  color: #e0f2fe;
  background: rgba(30, 58, 138, 0.55);
  border-color: #3b82f6;
}
.inv-item-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.inv-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.btn-inv-equip, .btn-inv-sell, .btn-inv-sell-all {
  padding: 6px 12px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.btn-inv-equip { background: #78350f; border: 1.5px solid #b45309; color: #ffffff; }
.btn-inv-sell  { background: #3d2516; border: 1.5px solid #78350f; color: #fed7aa; }
.btn-inv-sell-all { background: #451a03; border: 1.5px solid #d97706; color: #fef08a; font-size: 12.5px; }

.shop-tabs { display: flex; flex-wrap: wrap; flex-shrink: 0; gap: 6px; margin-bottom: 4px; padding-bottom: 0; }
#subview-shop > .place-greeting,
#subview-shop > .shop-tabs { flex-shrink: 0; }
#subview-shop.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  gap: 4px;
}
#subview-shop > .shop-content-panel.active {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#shop-tab-items .shop-items-grid,
#shop-tab-chips .shop-chips-grid,
#shop-tab-sell .inventory-grid {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
#subview-magic-shop.active { display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
#subview-magic-shop > .place-greeting,
#subview-magic-shop > .shop-category-tabs { flex-shrink: 0; }
#subview-magic-shop > .shop-chips-grid { flex: 1; min-height: 0; overflow-y: auto; }
.shop-tab { background: #342014; border: 1px solid #78350f; color: #ffffff; padding: 7px 14px; font-size: 16px; font-weight: 700; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.shop-tab.active { background: #78350f; border-color: #b45309; color: #ffffff; }
.shop-content-panel { display: none; }
.shop-content-panel.active { display: flex; flex-direction: column; gap: 10px; }
.shop-card, .shop-item-card {
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 74px;
}
.shop-item-info {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.shop-item-thumb-wrap {
  position: relative;
  flex-shrink: 0;
  width: fit-content;
  line-height: 0;
}
.shop-unequippable-mark {
  position: absolute;
  top: 1px;
  left: 1px;
  z-index: 1;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: rgba(127, 29, 29, 0.92);
  border: 1px solid #fca5a5;
  color: #fee2e2;
  font-size: 12px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
  pointer-events: none;
}
.shop-equipped-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(21, 128, 61, 0.85);
  border: 1px solid #86efac;
  color: #ecfdf5;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  vertical-align: middle;
}
.shop-stat-delta,
.equip-stat-delta {
  display: inline-block;
  background: rgba(0, 0, 0, 0.45);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid #78350f;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}
.shop-stat-delta.is-up,
.equip-stat-delta.is-up {
  color: #86efac;
  border-color: #166534;
}
.shop-stat-delta.is-down,
.equip-stat-delta.is-down {
  color: #fca5a5;
  border-color: #991b1b;
}
.shop-stat-delta.is-same,
.equip-stat-delta.is-same {
  color: #cbd5e1;
  font-weight: 600;
}
.shop-card-title { font-size: 18px; font-weight: 700; color: #ffffff; }
.shop-card-desc { font-size: 14px; color: #cbd5e1; }
.shop-item-price { font-size: 14px; font-weight: 700; color: #facc15; }
.shop-item-owned { font-size: 14px; font-weight: 700; color: #fde68a; margin-top: 2px; }
.shop-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

/* ============================================================
   マスターデータエディター (Game Master Editor)
============================================================ */
.editor-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 12px;
  padding-bottom: 4px;
}

.editor-tab {
  background: #342014;
  border: 1.5px solid #78350f;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.editor-tab.active {
  background: #78350f;
  border-color: #b45309;
  color: #ffffff;
}

.editor-content-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

.editor-item-card {
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-item-img {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  background: #18110b;
  border: 1.5px solid #b45309;
  object-fit: cover;
}

.editor-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
}

.editor-field-row label {
  width: 110px;
  color: #ffffff;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 600;
}

.editor-input {
  flex: 1;
  background: rgba(24, 15, 10, 0.9);
  border: 1.5px solid #78350f;
  border-radius: 6px;
  padding: 8px 10px;
  color: #ffffff;
  font-size: 18px;
  min-height: 44px;
}
.editor-input:focus {
  border-color: #b45309;
  outline: none;
}

.editor-select {
  flex: 1;
  background: #261911;
  border: 1.5px solid #78350f;
  border-radius: 6px;
  padding: 8px 10px;
  color: #ffffff;
  font-size: 18px;
  min-height: 44px;
}

/* ============================================================
   モーダル (Modals)
============================================================ */
.modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(18, 12, 8, 0.88);
  backdrop-filter: none;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* 別タブ排他：操作・保存停止オーバーレイ */
#session-lock-blocker {
  position: absolute;
  inset: 0;
  z-index: 30000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 6, 4, 0.92);
  pointer-events: auto;
}
#session-lock-blocker[hidden] {
  display: none !important;
}
.session-lock-blocker-inner {
  max-width: 360px;
  text-align: center;
}
.session-lock-blocker-title {
  font-size: 20px;
  font-weight: 700;
  color: #fef3c7;
  margin: 0 0 10px;
  line-height: 1.3;
}
.session-lock-blocker-text {
  font-size: 16px;
  color: #e2e8f0;
  margin: 0 0 18px;
  line-height: 1.4;
}

.modal-box {
  background: #261911;
  border: 2px solid #b45309;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 440px;
  padding: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.95);
}

.news-modal-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  text-align: center;
}
.news-modal-box h3 {
  margin: 0;
  font-size: 22px;
  color: #fde68a;
  font-weight: 700;
}
.news-comment {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  color: #fff7ed;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
  max-height: 240px;
  overflow-y: auto;
}
.news-login-bonus {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid #9a6a3a;
  border-radius: 8px;
  background: #1a120c;
  text-align: left;
}
.news-login-bonus.empty {
  justify-content: center;
  color: #c4b5a0;
  font-size: 17px;
}
.news-login-bonus.claimed {
  filter: brightness(0.45);
  opacity: 0.85;
}
.news-login-bonus img,
.news-bonus-thumb-empty {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
  background: #2a1c14;
  border: 1px solid #7c5a3a;
  border-radius: 6px;
}
.news-bonus-thumb-empty {
  display: grid;
  place-items: center;
  font-size: 24px;
}
.news-bonus-meta {
  min-width: 0;
  flex: 1;
}
.news-bonus-name,
.news-bonus-qty {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  color: #fff7ed;
  overflow-wrap: anywhere;
}
.news-bonus-qty {
  margin-top: 4px;
  color: #fde68a;
}
#btn-news-close {
  min-height: 44px;
  font-size: 20px;
}

.modal-app-message-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  max-width: 360px;
}
.modal-app-message-box h3 {
  margin: 0;
  font-size: 22px;
  color: #fff7ed;
  font-weight: 700;
}
.app-message-text {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
  color: #ffedd5;
  white-space: pre-wrap;
}
.modal-app-message-box .btn-secondary {
  align-self: center;
  min-width: 8em;
  font-size: 20px;
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-header h3 { font-size: 22px; color: #ffffff; font-weight: 700; }
.btn-modal-close { background: transparent; border: none; color: #ffffff; font-size: 22px; cursor: pointer; }
.modal-body { font-size: 18px; line-height: 1.5; color: #ffffff; max-height: 380px; overflow-y: auto; margin-bottom: 14px; }
.modal-footer { display: flex; justify-content: flex-end; }

.modal-claimed-rewards-box {
  max-height: 85%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.modal-claimed-rewards-body {
  flex: 0 1 auto;
  min-height: auto;
  max-height: 320px;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.claimed-rewards-summary {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  color: #fde68a;
  flex-shrink: 0;
  overflow-wrap: anywhere;
}
.claimed-rewards-empty {
  margin: 0;
  font-size: 16px;
  color: #94a3b8;
  flex-shrink: 0;
}
.claimed-rewards-empty[hidden] { display: none !important; }
.claimed-rewards-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: visible;
  min-height: auto;
  max-height: none;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.claimed-rewards-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #78350f;
  border-radius: 8px;
  background: rgba(30, 20, 12, 0.9);
}
.claimed-rewards-item-thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid #b45309;
  background: #1a1410;
  object-fit: contain;
}
.claimed-rewards-item-thumb.is-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.claimed-rewards-item-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.claimed-rewards-item-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff7ed;
  line-height: 1.25;
  overflow-wrap: anywhere;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.claimed-rewards-item-sub {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.2;
}

/* ============================================================
   物理演算おはじき・ビリヤードバトルアリーナ (Physics Canvas)
============================================================ */
.physics-battle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: block;
}

.arena-stage-field.physics-active .battle-upper-enemies,
.arena-stage-field.physics-active .battle-lower-player,
.arena-stage-field.physics-active .battle-mid-lane {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.arena-stage-field.impact-shake {
  animation: arenaImpactShake 0.25s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes arenaImpactShake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, 1px); }
  80% { transform: translate(1px, -1px); }
  100% { transform: translate(0, 0); }
}

/* ============================================================
   ダンジョン探索画面 (Dungeon Exploration & Active View)
============================================================ */
#subview-dungeon {
  position: relative;
  padding: 0;
  display: none;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

#subview-dungeon.active {
  display: flex;
}

/* --- 1. ダンジョン選択画面 (グリッド表示) --- */
.dungeon-select-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeIn 0.25s ease;
}

.dungeon-select-header {
  margin-bottom: 2px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.dungeon-select-header-main {
  flex: 1;
  min-width: 0;
}
.dungeon-select-back {
  flex-shrink: 0;
  margin-top: 2px;
  padding: 6px 14px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: #f8fafc;
  background: #334155;
  border: 1.5px solid #64748b;
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.dungeon-select-header h3 {
  font-size: 22px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.dungeon-select-header p {
  font-size: 17px;
  color: #ffffff;
  margin-top: 2px;
}

.dungeon-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.dungeon-card {
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.dungeon-card:hover {
  transform: translateY(-2px);
  border-color: #b45309;
  background: #3d2516;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
}

.dungeon-card-thumb {
  position: relative;
  width: 100%;
  height: 90px;
  overflow: hidden;
}

.dungeon-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.dungeon-card:hover .dungeon-card-thumb img {
  transform: scale(1.06);
}

.dungeon-badge-diff {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 15px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  backdrop-filter: none;
  color: #ffffff;
}

.dungeon-card-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.dungeon-card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dungeon-card-title-row .dungeon-icon {
  font-size: 20px;
}

.dungeon-card-title-row .dungeon-name {
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
}

.dungeon-card-info .dungeon-desc {
  font-size: 16px;
  color: #ffffff;
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-select-dungeon {
  background: linear-gradient(135deg, #78350f, #451a03);
  border: 1.5px solid #b45309;
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 10px 12px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  width: 100%;
  margin-top: auto;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dungeon-card:hover .btn-select-dungeon {
  background: linear-gradient(135deg, #9a3412, #542c13);
  border-color: #d97706;
}

/* --- 2. 探索地決定後の専用画面 --- */
.dungeon-active-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeIn 0.3s ease;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.active-dungeon-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.btn-change-dungeon {
  background: #3d2516;
  border: 1.5px solid #78350f;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
  transition: var(--transition-fast);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-change-dungeon:hover {
  background: #542c13;
  border-color: #b45309;
}

/* 決定した探索地の前面カード */
.exploration-stage-card {
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.explore-art-frame {
  position: relative;
  width: 100%;
  height: 175px;
  overflow: hidden;
  background: #000;
  transition: height 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* 探索開始時にマップ画像を広げる（ログ7行＋下部ボタンが720内に収まる高さ） */
.explore-art-frame.is-exploring {
  height: 220px;
}

/* マップ画像上で上下に歩行演出するキャラクター */
.explore-walker-wrap {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.3s ease;
}

.explore-walker-party {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}

.explore-walker-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 128px;
}

.explore-walker-slot[hidden] {
  display: none !important;
}

.explore-walker-figure {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.explore-walker-img {
  width: 128px;
  height: 128px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.85));
  position: relative;
  z-index: 2;
}

.explore-walker-wrap.walking .explore-walker-img {
  animation: char-walking-bobbing 0.55s ease-in-out infinite alternate;
}

.explore-walker-shadow {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 14px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 72%);
  border-radius: 50%;
  z-index: 1;
  pointer-events: none;
}

.explore-walker-wrap.walking .explore-walker-shadow {
  animation: char-shadow-bobbing 0.55s ease-in-out infinite alternate;
}

/* 探索中バディ：画像直下のHPバー（画像幅に収める） */
.explore-walker-hp {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  height: 14px;
  margin-top: 2px;
  background: rgba(18, 11, 7, 0.9);
  border: 1px solid #78350f;
  border-radius: 6px;
  overflow: hidden;
  z-index: 3;
}
.explore-walker-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  transition: width 0.25s ease;
}
.explore-walker-hp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
}
.explore-walker-hp.is-mid .explore-walker-hp-fill {
  background: linear-gradient(90deg, #d97706, #eab308);
}
.explore-walker-hp.is-low .explore-walker-hp-fill {
  background: linear-gradient(90deg, #dc2626, #ef4444);
}
.explore-walker-slot.is-loading .explore-walker-img {
  opacity: 0.55;
}
.explore-walker-hp.is-loading .explore-walker-hp-fill {
  width: 0% !important;
  background: #334155;
}
.explore-walker-hp.is-loading .explore-walker-hp-text {
  color: #fde68a;
  font-size: 10px;
  letter-spacing: 0.02em;
}

@keyframes char-walking-bobbing {
  0% { transform: translateY(0); }
  100% { transform: translateY(-10px); }
}

@keyframes char-shadow-bobbing {
  0% { transform: translateX(-50%) scale(1); opacity: 0.7; }
  100% { transform: translateX(-50%) scale(0.75); opacity: 0.35; }
}

.explore-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
  transform: scale(1.65);
  transform-origin: center 36%;
  pointer-events: none;
  image-rendering: auto;
}

.explore-art-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 40%, rgba(20, 12, 8, 0.9) 100%);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 12px;
  pointer-events: none;
}

.explore-location-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(24, 15, 10, 0.9);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid #78350f;
  backdrop-filter: none;
  pointer-events: auto;
}

#explore-loc-icon { font-size: 20px; }
#explore-loc-name {
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}
.explore-floor-tag {
  background: #542c13;
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #b45309;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.explore-status-pill {
  font-size: 17px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  background: #3d2516;
  color: #ffffff;
  border: 1.5px solid #78350f;
  backdrop-filter: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  transition: all 0.3s ease;
}

.explore-status-pill.exploring {
  background: #542c13;
  color: #ffffff;
  border-color: #d97706;
  box-shadow: 0 0 12px rgba(217, 119, 6, 0.5);
}

/* 探索進行度セクション */
.explore-progress-section {
  padding: 10px 12px 12px;
  background: rgba(24, 15, 10, 0.95);
  border-top: 1.5px solid #78350f;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.progress-title {
  font-size: 17px;
  font-weight: 600;
  color: #ffffff;
}

.progress-percentage {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  font-family: var(--font-display);
}

.explore-progress-track {
  width: 100%;
  height: 14px;
  background: rgba(18, 11, 7, 0.9);
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid #78350f;
}

.explore-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #9a3412, #d97706);
  border-radius: 7px;
  transition: width 0.5s ease;
  box-shadow: 0 0 8px rgba(217, 119, 6, 0.5);
}

/* 探索ログボックス（上部 .explore-log-box 定義を使用） */

/* アクションボタン (探索画面) */
.explore-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-bottom: 2px;
  width: 100%;
  flex-shrink: 0;
}

.explore-actions #btn-explore-toggle {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.explore-actions #btn-explore-toggle[hidden] {
  display: none !important;
}

.explore-actions #btn-quest-loop {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 17px;
  font-weight: 700;
  border-radius: 8px;
}

.explore-actions #btn-quest-loop[hidden] {
  display: none !important;
}

.explore-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.explore-action-row[hidden] {
  display: none !important;
}

.explore-action-row #btn-explore-recovery {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 17px;
  font-weight: 700;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
  padding: 8px 10px;
}

.explore-action-row .auto-explore-toggle {
  margin-left: auto;
}

.explore-secondary-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.explore-secondary-actions .btn-secondary {
  flex: 1;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
}

/* 64x64基準アイテム・装備サムネイル画像表示 */
.item-card-thumb {
  width: 64px;
  height: 64px;
  min-width: 64px;
  min-height: 64px;
  border-radius: 6px;
  border: 0;
  outline: 1px solid var(--accent-gold);
  background: rgba(0, 0, 0, 0.55);
  object-fit: contain;
  image-rendering: auto;
  flex-shrink: 0;
}

.item-card-thumb-dummy {
  width: 64px;
  height: 64px;
  min-width: 64px;
  min-height: 64px;
  border-radius: 6px;
  border: 1px dashed #78350f;
  background: rgba(20, 12, 8, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #94a3b8;
  flex-shrink: 0;
}
.item-card-thumb-dummy small {
  font-size: 9px;
  color: #64748b;
  margin-top: 2px;
}

/* ============================================================
   能力画面 (Character Status & Point Allocation)
============================================================ */
.status-view-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-hero-card {
  flex-wrap: wrap;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(38, 25, 17, 0.95);
  border: 1.5px solid #78350f;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.status-job-levels {
  flex-basis: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.15em 0.3em;
  font-size: 20px;
  line-height: 1.15;
  color: #f1e5d5;
}
.status-job-levels > span { white-space: nowrap; }

.status-character-description {
  flex-basis: 100%;
  margin: 0;
  color: #f1e5d5;
  font-size: 18px;
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.status-avatar-box {
  width: auto;
  height: auto;
  min-width: 0;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1.5px solid var(--accent-gold);
  background: rgba(20, 12, 8, 0.9);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-avatar-box img,
.status-avatar-box .character-avatar-img {
  width: auto;
  height: auto;
  max-width: none;
  object-fit: contain;
}

.status-meta-box {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#stat-dist-rows .stat-dist-row,
#status-stat-rows .stat-dist-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  width: 100%;
  font-size: 20px;
}
#stat-dist-rows .stat-name-label,
#status-stat-rows .stat-name-label {
  flex: 0 0 3.4em;
  width: 3.4em;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: #ffffff;
  font-size: 18px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
#stat-dist-rows .stat-val-text,
#status-stat-rows .stat-val-text {
  flex: 0 0 2.6em;
  width: 2.6em;
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 2px;
  font-size: 20px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 700;
  color: #ffffff;
}
.status-stat-bonus { font-size: 15px; color: #38bdf8; flex-shrink: 0; }
#stat-dist-rows .status-stat-track,
#status-stat-rows .status-stat-track,
.status-stat-track {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: 10px;
  border-radius: 4px;
  background: #6b4423;
  box-shadow: inset 0 0 0 1px #8b5a2b;
  overflow: hidden;
}
.status-stat-fill {
  display: block;
  height: 100%;
  min-width: 0;
  flex: 0 0 auto;
  box-sizing: border-box;
}
.status-stat-fill-base {
  background: #eaa332;
  border-radius: 4px 0 0 4px;
}
.status-stat-fill-base.is-alone {
  border-radius: 4px;
}
.status-stat-fill-equip {
  background: #22c55e;
  border-radius: 0 4px 4px 0;
}

.status-hero-name {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: baseline;
}
.status-hero-title {
  font-size: 13px;
  font-weight: 500;
  color: #fbbf24;
  margin-left: 8px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.status-hero-sub-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.status-hero-sub-row > .status-hero-job-pill,
.status-hero-sub-row > .status-hero-level,
.status-hero-sub-row > .status-hero-fame {
  flex: 1 1 0;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.2;
  text-align: center;
  padding: 4px 6px;
  border: 1px solid #785d3b;
  border-radius: 4px;
  background: #211810;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-hero-job-pill {
  color: #fbbf24;
}

.status-hero-level {
  color: #38bdf8;
}

.status-hero-fame {
  color: #fcd9a8;
}

.status-exp-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin-top: 2px;
  min-width: 0;
  width: 100%;
}

.status-exp-track {
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 8px;
  background: rgba(20, 12, 8, 0.9);
  border: 1px solid #78350f;
  border-radius: 4px;
  overflow: hidden;
}

.status-exp-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  transition: width 0.3s ease;
}

.status-exp-text {
  font-size: 12px;
  color: #cbd5e1;
  font-family: monospace;
  white-space: nowrap;
  line-height: 1.2;
}

.status-hero-trait {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: #7dd3fc;
  overflow-wrap: anywhere;
}

.status-hero-trait[hidden] {
  display: none !important;
}

.status-bonus-panel {
  background: rgba(45, 26, 12, 0.95);
  border: 1.5px solid #d97706;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  box-shadow: 0 0 12px rgba(217, 119, 6, 0.2);
}

.status-bonus-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-bonus-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.status-bonus-val {
  font-size: 24px;
  font-weight: 900;
  color: #fbbf24;
  font-family: monospace;
}

.status-bonus-unit {
  font-size: 18px;
  font-weight: 700;
  color: #fbbf24;
}

.status-bonus-note {
  font-size: 13px;
  color: #fde047;
  margin: 4px 0 0 0;
}

/* ====================================================
   🏰 拠点メニュー: 放置戦闘ボタン & 通知ポップアップ
==================================================== */
.hub-card.card-pvp {
  background: #261911;
  border: 1.5px solid #a855f7;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.25);
}

.hub-card.card-pvp:hover {
  background: #362217;
  border-color: #c084fc;
}

.hub-card.card-pvp .card-icon {
  border-color: #a855f7;
}

.hub-card.card-arena.is-coming-soon {
  background: #1c1612;
  border: 1.5px solid #57534e;
  opacity: 0.85;
  cursor: pointer;
}

.hub-card.card-place.is-coming-soon {
  background: #1a1f28;
  border: 1.5px solid #475569;
  opacity: 0.88;
  cursor: default;
  pointer-events: none;
}

/* バディ・フレンド／ペバディ：オレンジ枠 */
.hub-card.hub-frame-orange.card-place {
  border-color: #ea580c;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.28);
}
.hub-card.hub-frame-orange.card-place:hover {
  border-color: #fb923c;
}
.hub-card.hub-frame-orange .card-icon {
  border-color: #ea580c;
}
.hub-card.hub-frame-orange.card-place.is-coming-soon {
  border-color: #ea580c;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.2);
}

.pebuddy-preview-actions {
  display: flex;
  flex-direction: column;
  gap: 1.2cqh;
  padding: 1.2cqh 2cqw 2cqh;
}
.pebuddy-preview-actions .btn-primary,
.pebuddy-preview-actions .btn-secondary {
  width: 100%;
  font-size: 20px;
  padding: 1.4cqh 2cqw;
}

/* クラン決戦：赤枠 */
.hub-card.hub-frame-red.card-place {
  border-color: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.28);
}
.hub-card.hub-frame-red.card-place:hover {
  border-color: #f87171;
}
.hub-card.hub-frame-red .card-icon {
  border-color: #dc2626;
}

.hub-card.card-place.is-coming-soon .hub-soon-label {
  font-size: 14px;
  font-weight: 700;
  color: #fbbf24;
  margin-left: auto;
  flex-shrink: 0;
}

.hub-card.card-arena.is-coming-soon:hover {
  background: #261911;
  border-color: #78716c;
}

.hub-card.card-arena .hub-soon-label {
  font-size: 14px;
  font-weight: 700;
  color: #fbbf24;
}

.hub-card.card-arena .card-icon {
  border-color: #d97706;
}

.arena-fee {
  margin-top: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fbbf24;
  line-height: 1.2;
}

.arena-empty-note {
  color: #94a3b8;
  font-size: 18px;
  line-height: 1.35;
  padding: 1cqh 0;
}

.arena-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 2cqw;
}

.arena-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15cqh;
  order: 2;
}

.arena-card-body .buddy-card-title {
  font-size: 18px;
  font-weight: 700;
  color: #fef3c7;
  line-height: 1.2;
  margin: 0;
}

.arena-card-body .buddy-card-sub {
  font-size: 16px;
  color: #e2e8f0;
  line-height: 1.2;
  margin: 0;
}

.arena-card-mark-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.5cqw;
  min-height: 0;
}

.arena-card-mark-row .buddy-card-marks {
  flex-shrink: 0;
}

.arena-card-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1cqh;
  min-width: 0;
}

.arena-card-lv {
  font-size: 18px;
  font-weight: 700;
  color: #fef3c7;
  line-height: 1.2;
  white-space: nowrap;
}

.arena-card-lv-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em;
  min-width: 0;
  line-height: 1.15;
}

.arena-card-rank {
  display: inline-block;
  flex-shrink: 0;
  box-sizing: border-box;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
  padding: 1px 5px;
  color: #fbbf24;
  background: #0a0a0a;
  border: 1px solid #b45309;
  border-radius: 3px;
  white-space: nowrap;
  vertical-align: middle;
}

.buddy-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25em;
  margin: 0.2em 0 0.1em;
  line-height: 1.2;
}

.arena-card-meta .buddy-card-sub {
  font-size: 16px;
  color: #e2e8f0;
  line-height: 1.2;
  margin: 0;
}

.arena-card-face {
  order: 1;
  width: 22cqw;
  height: 22cqw;
  max-width: 128px;
  max-height: 128px;
  flex-shrink: 0;
}

.arena-challenge-btn {
  margin-top: 0.25cqh;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  touch-action: manipulation;
  position: relative;
  z-index: 2;
}
.arena-challenge-btn.is-busy {
  opacity: 0.85;
  cursor: wait;
}

.arena-catchphrase {
  font-size: 16px;
  color: #7dd3fc;
  line-height: 1.25;
  margin: 0;
}

.arena-gacha-box {
  text-align: center;
}

.arena-gacha-label {
  font-size: 22px;
  font-weight: 800;
  color: #f8fafc;
  min-height: 2.2em;
  margin: 2cqh 0 3cqh;
}

.arena-gacha-label.is-rare {
  color: #fbbf24;
  text-shadow: 0 0 0.8cqw rgba(251, 191, 36, 0.45);
}

.pvp-notify-popup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, #581c87, #312e81);
  border: 2px solid #eab308;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(234, 179, 8, 0.35);
  animation: pvpPulseGlow 1.8s infinite alternate ease-in-out;
}

@keyframes pvpPulseGlow {
  0% { box-shadow: 0 0 8px rgba(234, 179, 8, 0.3); border-color: #ca8a04; }
  100% { box-shadow: 0 0 18px rgba(234, 179, 8, 0.65); border-color: #fef08a; }
}

.pvp-popup-body {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pvp-popup-icon {
  font-size: 22px;
}

.pvp-popup-msg {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.pvp-popup-action-btn {
  background: #eab308;
  color: #1e1b4b;
  font-weight: 800;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.pvp-popup-action-btn:hover {
  background: #facc15;
}

/* ====================================================
   ⚔️ サブ画面: 放置戦闘 (subview-pvp)
==================================================== */
#subview-pvp {
  display: none;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
  padding: 8px;
  overflow: hidden;
}

#subview-pvp.active {
  display: flex;
}

/* タブ切り替えバー */
.pvp-tab-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.pvp-tab {
  flex: 1;
  padding: 7px 4px;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 6px;
  color: #cbd5e1;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pvp-tab.active {
  background: #4338ca;
  border-color: #818cf8;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(129, 140, 248, 0.4);
}

/* タブコンテンツパネル */
.pvp-view-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* 結果カード一覧（長いときはスクロール） */
.pvp-matches-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  justify-content: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* 最大5個順番に表示されるフレーム (誰と・結果・報酬・名声) */
.pvp-match-card {
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.96);
  border-radius: 8px;
  padding: 8px 10px;
  border: 1.5px solid #334155;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  line-height: 1.3;
}

.pvp-match-card.is-win {
  border-color: #eab308;
  background: linear-gradient(90deg, rgba(30, 27, 75, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
}

.pvp-match-card.is-lose {
  border-color: #ef4444;
  background: linear-gradient(90deg, rgba(69, 10, 10, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
}

.pvp-match-main {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.pvp-match-opponent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.pvp-fighter-portrait {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 6px;
  flex-shrink: 0;
}

.pvp-card-avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 2px solid #64748b;
  background: #0f172a;
  display: block;
  flex-shrink: 0;
}

.pvp-match-card.is-win .pvp-card-avatar {
  border-color: #eab308;
}

.pvp-match-card.is-lose .pvp-card-avatar {
  border-color: #ef4444;
}

.pvp-card-avatar-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
  color: #94a3b8;
}

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

.pvp-match-topline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.pvp-target-name {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pvp-target-lvl {
  font-size: 13px;
  color: #94a3b8;
}

.pvp-catchphrase {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.3;
  color: #7dd3fc;
  overflow-wrap: anywhere;
}

.pvp-history-info .pvp-catchphrase {
  margin-top: 2px;
}

.pvp-match-badge-win {
  font-size: 14px;
  font-weight: 800;
  color: #fef08a;
  background: #854d0e;
  padding: 1px 8px;
  border-radius: 4px;
  border: 1px solid #facc15;
  white-space: nowrap;
}

.pvp-match-badge-lose {
  font-size: 14px;
  font-weight: 800;
  color: #fca5a5;
  background: #7f1d1d;
  padding: 1px 8px;
  border-radius: 4px;
  border: 1px solid #f87171;
  white-space: nowrap;
}

.pvp-match-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  padding-top: 4px;
  margin-top: 4px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.pvp-match-time {
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.2;
}

.pvp-match-loot {
  color: #a7f3d0;
  font-weight: 700;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.pvp-match-fame {
  color: #fde047;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1.3;
}

/* 報酬受け取りバー */
.pvp-claim-bar {
  margin-top: 6px;
  flex-shrink: 0;
}

.pvp-btn-claim {
  width: 100%;
  padding: 9px;
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(180deg, #eab308 0%, #ca8a04 100%);
  color: #0f172a;
  border: 1px solid #fef08a;
  border-radius: 6px;
  cursor: pointer;
}

.pvp-btn-claim:hover {
  background: linear-gradient(180deg, #facc15 0%, #d97706 100%);
}

.pvp-sync-msg {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.3;
  color: #e2e8f0;
  min-height: 1.2em;
}

/* 戦歴コンテナ */
.pvp-history-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.pvp-history-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 10px;
}

.pvp-history-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.pvp-history-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.pvp-history-topline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.pvp-history-name {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pvp-history-lvl {
  font-size: 13px;
  color: #94a3b8;
}

.pvp-history-time {
  font-size: 12px;
  color: #64748b;
}

.pvp-history-result {
  flex-shrink: 0;
  padding-top: 2px;
}

.pvp-history-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  color: #cbd5e1;
  margin-bottom: 2px;
}

.pvp-history-summary strong {
  color: #fbbf24;
  font-size: 16px;
}

.pvp-badge-side-attack {
  font-size: 12px;
  font-weight: 800;
  color: #93c5fd;
  background: rgba(30, 58, 138, 0.8);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid #3b82f6;
  white-space: nowrap;
}

.pvp-badge-side-defense {
  font-size: 12px;
  font-weight: 800;
  color: #fde047;
  background: rgba(113, 63, 18, 0.8);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid #eab308;
  white-space: nowrap;
}

.pvp-empty-note {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1.5;
  padding: 30px 10px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 6px;
  border: 1px dashed #334155;
}


.weapon-magic-summary { cursor: default; }
.weapon-magic-name { font-size: 20px; font-weight: 700; line-height: 1.1; margin: 4px 0; overflow-wrap: anywhere; }
.weapon-magic-detail { font-size: 18px; line-height: 1.15; color: #fcd9a8; }

/* 寺院：ゲーム全体の480×720比率に従って拡縮する。 */
#subview-temple{font-size:20px;line-height:1.2;overflow:hidden}
#subview-temple.active{display:flex;flex-direction:column;gap:8px;min-height:0;overflow:hidden}
.temple-section h4,#subview-temple p{margin:0}
.temple-section{display:flex;flex-direction:column;gap:7px;border:1px solid #785d3b;border-radius:8px;padding:10px;background:#261b15;min-width:0;min-height:0}
.temple-section p{font-size:18px;color:#e5d8c6}
#subview-temple button,#subview-temple select{font:inherit;max-width:100%;padding:7px;border:1px solid #947348;border-radius:6px;background:#38271a;color:#fff0d4;min-width:0}
#subview-temple button:disabled{color:#b9afa2;background:#24201c}
#temple-reward-panel:not([hidden]) {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#temple-panels{
  padding:0;
  margin:0;
  list-style:none;
  font-size:18px;
  line-height:1.3;
  overflow-wrap:anywhere;
  display:flex;
  flex-direction:column;
  gap:6px;
  flex:1;
  min-height:0;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
.temple-panel-card { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px; border:1px solid #785d3b; border-radius:6px; background:#17110d; }
.temple-panel-card > span:first-child { min-width:0; }
.temple-panel-actions { display:flex; flex-direction:column; align-items:flex-end; gap:4px; flex-shrink:0; }
.temple-panel-status { flex-shrink:0; font-size:16px; color:#e6cfa9; }
.temple-panel-actions .btn-primary { font-size:16px; padding:6px 10px; white-space:nowrap; }
#temple-reward-panel > p, #temple-pagination { flex-shrink:0; }
#temple-pagination:not([hidden]){display:flex;align-items:center;justify-content:space-between}
#temple-message{font-size:18px;color:#f7d894}

.temple-section[hidden]{display:none}
.temple-gacha-explain { margin: 0 0 8px; font-size: 18px; line-height: 1.35; color: #e6cfa9; }
.temple-gacha-cost { margin: 0 0 10px; font-size: 18px; color: #f4c878; }
#temple-gacha-pull { font-size: 20px; padding: 10px 14px; width: 100%; }
#temple-gacha-panel:not([hidden]) { flex: 1; }
#temple-gacha-prizes { margin-top: auto; padding-top: 6px; display: flex; flex-direction: column; gap: 4px; font-size: 20px; line-height: 1.2; }
.temple-gacha-prize-row { display: grid; grid-template-columns: 2.2em 1.5em minmax(0, 1fr) 1.5em; align-items: center; gap: 4px; min-width: 0; color: #fff0d4; }
.temple-gacha-prize-row strong { color: #f4c878; }
.temple-gacha-prize-name { white-space: nowrap; text-align: center; }
#subview-temple .temple-gacha-prize-row button { padding: 4px 0; line-height: 1.2; }

.temple-tabs button{flex:1 1 calc((100% - 20px) / 3);min-width:0;padding:10px 4px}
#subview-temple .temple-tabs button[aria-pressed="true"]{border-color:#f4c878;background:#66421d}
#subview-temple .temple-tabs button:disabled,
#subview-temple .temple-tabs button:disabled[aria-pressed="true"],
#subview-temple .temple-tabs button:disabled:hover,
#subview-temple .temple-tabs button:disabled:active {
  color: #7a7168;
  background: #1a1714;
  border-color: #3a342e;
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}
#temple-gacha-pull:disabled,
#temple-gacha-pull:disabled:hover,
#temple-gacha-pull:disabled:active {
  color: #7a7168;
  background: #1a1714;
  border-color: #3a342e;
  opacity: 0.55;
  cursor: default;
}
#temple-name-panel input{width:100%;box-sizing:border-box;font-size:20px}
.hub-card .card-content{line-height:1.2}

/* 装備スロット一覧を画面内に収める。 */
#subview-equipment .equip-slot { padding: 6px; }
#subview-equipment .equip-slot-heading { min-height: 24px; margin-bottom: 3px; }
#subview-equipment .equip-slot-content { min-height: 40px; }
#subview-equipment .item-card-thumb,
#subview-equipment .item-card-thumb-dummy { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }

/* 装備欄の内部だけを縦スクロールさせる。 */
#subview-equipment .equipment-layout { display: flex; flex-direction: column; gap: 0.4rem; }
#subview-equipment .equip-slots-col { display: flex; flex-direction: column; gap: 0.4rem; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
#subview-equipment .equip-slot { flex-shrink: 0; }
#subview-equipment .equip-slot[hidden] { display: none; }
#subview-equipment .equip-slot { padding: 0.4rem; }
.equip-performance, .equip-description,
#subview-equipment .item-stat-badges { font-size: 0.9rem; line-height: 1.15; overflow-wrap: anywhere; }
#subview-equipment .item-stat-badges { color: #fde68a; margin-top: 0.2rem; }
.equip-performance { color: #91dbff; margin-top: 0.2rem; }
.equip-description { color: #fff0d9; margin: 0.25rem 0 0; }

/* 冒険者ギルド：全クエストを縦スクロールで表示。 */
#dungeon-select-panel { min-height:0; height:100%; gap:8px; padding:0; }
#dungeon-select-panel .place-greeting { flex-shrink:0; }
#dungeon-select-panel .dungeon-select-header { flex-shrink:0; margin:0; padding:0; }
#dungeon-select-panel .dungeon-select-header h3 { font-size:22px; }
#dungeon-select-panel .dungeon-select-header p { font-size:18px; line-height:1.2; }
#dungeon-select-panel .quest-list { display:flex; flex-direction:column; flex:1; min-height:0; gap:8px; overflow-y:auto; }
.clan-rename-list-btn {
  flex-shrink: 0;
  width: 100%;
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.25;
  padding: 10px 12px;
}
.quest-card { display:flex; flex-shrink:0; align-items:flex-start; gap:8px; padding:10px; border:1px solid #926037; border-radius:8px; background:#261b15; color:#fff; }
.quest-card.is-locked { border-color:#4a3a2e; background:#1a1510; opacity:0.92; }
.quest-card-portrait { width:22%; flex-shrink:0; display:flex; flex-direction:column; align-items:center; gap:4px; }
.quest-card-portrait img { width:100%; aspect-ratio:1; object-fit:cover; border-radius:4px; border:1px solid #78350f; background:#1a1410; }
.quest-card-portrait img.is-placeholder { object-fit:contain; }
.quest-cleared-mark {
  width:100%;
  text-align:center;
  font-size:14px;
  font-weight:700;
  line-height:1.2;
  color:#fef08a;
  background:rgba(69, 26, 3, 0.92);
  border:1px solid #d97706;
  border-radius:4px;
  padding:2px 4px;
}
.quest-card > div:last-child,
.quest-card-info { flex:1; min-width:0; display:flex; flex-direction:column; gap:0; }
.quest-card h4 { font-size:20px; line-height:1.15; margin:0 0 6px; overflow-wrap:anywhere; }
.quest-card p,
.quest-card-desc {
  font-size:18px;
  line-height:1.2;
  margin:0 0 8px;
  overflow-wrap:anywhere;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  overflow:hidden;
}
.quest-card-rewards {
  font-size:16px;
  line-height:1.25;
  color:#fde68a;
  margin:0 0 8px;
  overflow-wrap:anywhere;
  display:flex;
  flex-direction:column;
  gap:2px;
  flex-shrink:0;
}
.quest-card-reward-line { overflow-wrap:anywhere; white-space:normal; }
.quest-card-reward-item { color:#fde68a; }
.quest-card-reward-chip { color:#7dd3fc; font-weight:700; }
.quest-card button { width:100%; font-size:18px; padding:8px 4px; }
.quest-card button:disabled,
.quest-card button.is-locked {
  background:#1a1410 !important;
  border-color:#3f342a !important;
  color:#6b5e54 !important;
  opacity:1;
  cursor:not-allowed;
  box-shadow:none;
}
.quest-chest-box { font-size:20px; color:#fff; background:#261b15; }
.quest-chest-box h3, .quest-chest-box p { margin:0 0 16px; }
.quest-chest-actions { display:flex; gap:10px; }
.quest-chest-actions button { flex:1; font-size:20px; padding:12px 8px; }
.explore-actions [hidden], .quest-chest-box [hidden] { display: none; }
.explore-status-pill[hidden] { display: none; }
.quest-paused * { animation-play-state: paused !important; }
.quest-cancel-box { font-size: 1rem; line-height: 1.3; color: #fff0d9; background: #261b15; }
#modal-quest-cancel { z-index: 10001; }
.chest-art { position: relative; height: 8rem; overflow: hidden; margin-bottom: 0.5rem; }
.chest-art img { width: 100%; height: 100%; object-fit: contain; }
#chest-content-image { position: absolute; width: 40%; height: 50%; left: 30%; top: 0; }
#chest-insight { color: #fbd784; }
#chest-continue {
  width: 100%;
  font-size: 20px;
  padding: 12px 8px;
  font-weight: 700;
  margin-top: 8px;
}
.quest-chest-box { max-height: 90%; overflow-y: auto; }
.recovery-box { display: flex; flex-direction: column; gap: 0.6rem; max-height: 85%; font-size: 1rem; color: #fff0d9; background: #261b15; }
.recovery-box h3, .recovery-box p { margin: 0; }
.recovery-party-hp {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid #785d3b;
  border-radius: 6px;
  padding: 8px 10px;
}
.recovery-party-member {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.recovery-member-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  line-height: 1.2;
}
.recovery-member-name {
  font-weight: 700;
  color: #fef3c7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}
.recovery-member-hp-val {
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}
.recovery-member-hp-bar {
  width: 100%;
  height: 6px;
  background: #334155;
  border-radius: 3px;
  overflow: hidden;
}
.recovery-member-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  border-radius: 3px;
  transition: width 0.2s ease;
}
.recovery-member-hp-fill.is-mid {
  background: linear-gradient(90deg, #d97706, #eab308);
}
.recovery-member-hp-fill.is-low {
  background: linear-gradient(90deg, #dc2626, #ef4444);
}
#recovery-items { min-height: 0; overflow-y: auto; }
.recovery-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0; }
.recovery-item span { flex: 1; overflow-wrap: anywhere; line-height: 1.2; font-size: 16px; }
.recovery-item button { flex-shrink: 0; font-size: 1rem; }

#subview-compound { gap:8px; font-size:20px; color:#fff; min-height:0; overflow:hidden; }
#subview-compound > .place-greeting { flex-shrink:0; }
#subview-compound h4, #subview-compound p { margin:0; line-height:1.2; overflow-wrap:anywhere; }
#compound-materials { display:flex; flex-direction:column; gap:8px; }
.compound-section { padding:10px; border:1px solid #785d3b; border-radius:8px; display:flex; flex-direction:column; gap:6px; }
.compound-result-section { background:#292016; border-color:#b88946; }
.compound-fee-section { background:#1c2530; border-color:#576b80; }
.compound-material-section { background:#211a14; }
#subview-compound .compound-section h4 { font-size:18px; color:#edcf9c; }
.compound-material-caption { font-size:16px; font-weight:400; color:#d4c7b6; }
#compound-materials p + p { border-top:1px solid #493b2c; padding-top:5px; }
#subview-compound button { font-size:20px; padding:8px; }
.compound-nav { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.compound-nav[hidden] { display:none; }
#compound-message { min-height:1.2em; }
.compound-list-panel,
.compound-detail-panel {
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.compound-list-panel[hidden],
.compound-detail-panel[hidden] { display:none !important; }
.compound-recipe-list {
  flex:1;
  min-height:0;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:8px;
  -webkit-overflow-scrolling:touch;
}
.compound-list-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:8px 10px;
  background:rgba(38, 25, 17, 0.95);
  border:1.5px solid #78350f;
  border-radius:8px;
  flex-shrink:0;
}
.compound-list-info {
  display:flex;
  align-items:center;
  gap:8px;
  flex:1;
  min-width:0;
}
.compound-list-thumb { flex-shrink:0; line-height:0; }
.compound-list-thumb .item-card-thumb,
.compound-list-thumb .item-card-thumb-dummy,
.compound-list-thumb > div {
  width:40px !important;
  height:40px !important;
  min-width:40px;
  min-height:40px;
}
.compound-list-text { min-width:0; display:flex; flex-direction:column; gap:2px; }
.compound-list-name {
  font-size:20px;
  font-weight:700;
  color:#fff;
  line-height:1.2;
  overflow-wrap:anywhere;
}
.compound-list-price { font-size:18px; color:#fde68a; line-height:1.2; }
.compound-list-actions {
  display:flex;
  align-items:center;
  gap:6px;
  flex-shrink:0;
}
.compound-craftable-mark {
  color:#fbbf24;
  font-size:22px;
  font-weight:800;
  line-height:1;
}
.compound-synth-btn {
  white-space:nowrap;
  padding:8px 12px;
  min-height:40px;
}
.compound-detail-panel { overflow-y:auto; -webkit-overflow-scrolling:touch; }
.compound-detail-actions {
  display:flex;
  align-items:stretch;
  gap:8px;
  flex-shrink:0;
}
.compound-detail-actions > button { flex:1; min-width:0; }
#compound-exchange:disabled,
#compound-exchange:disabled:hover,
#compound-exchange:disabled:active {
  background:#4b5563 !important;
  border-color:#6b7280 !important;
  color:#d1d5db !important;
  box-shadow:none !important;
  text-shadow:none !important;
  opacity:1;
  cursor:not-allowed;
  transform:none;
}

#subview-smith.active { display:flex; flex-direction:column; gap:6px; font-size:20px; color:#fff; min-height:0; overflow:hidden; }
#subview-smith > .place-greeting { flex-shrink: 0; }
#subview-smith p { margin:0; line-height:1.2; overflow-wrap:anywhere; }
.smith-tabs button { flex:1; font-size:20px; }
.smith-body { flex:1; min-height:0; display:flex; flex-direction:column; gap:6px; }
.smith-list {
  flex:1;
  min-height:0;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:6px;
  -webkit-overflow-scrolling:touch;
}
.smith-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:6px 8px;
  background:rgba(38, 25, 17, 0.95);
  color:#fff;
  border:1.5px solid #78350f;
  border-radius:8px;
  flex-shrink:0;
}
.smith-row-info { display:flex; align-items:center; gap:8px; flex:1; min-width:0; }
.smith-row-thumb { flex-shrink:0; line-height:0; }
.smith-row-thumb .item-card-thumb,
.smith-row-thumb .item-card-thumb-dummy,
.smith-row-thumb > div { width:40px !important; height:40px !important; min-width:40px; min-height:40px; }
.smith-row-text { min-width:0; display:flex; flex-direction:column; gap:2px; }
.smith-row-name { font-size:20px; font-weight:700; color:#fff; line-height:1.2; overflow-wrap:anywhere; }
.smith-row-sub { font-size:18px; color:#d4c7b6; line-height:1.2; }
.smith-row-elem { font-size:18px; color:#93c5fd; line-height:1.2; }
.smith-row-desc { font-size:16px; color:#d4c7b6; line-height:1.25; overflow-wrap:anywhere; }
.smith-row-price { font-size:18px; color:#fde68a; line-height:1.2; }
.smith-action-btn { flex-shrink:0; white-space:nowrap; font-size:18px; padding:6px 12px; min-height:40px; }
.smith-target { flex-shrink:0; }
.smith-enchant-effect { font-size:20px; color:#fde68a; line-height:1.2; }
.smith-tabs button { min-width:0; padding-left:2px; padding-right:2px; }
.smith-info { flex-shrink:0; padding:6px 8px; background:#1c2530; color:#fff; border:1px solid #576b80; border-radius:8px; display:flex; flex-direction:column; gap:4px; }
.smith-info-sub { font-size:18px; color:#d4c7b6; }
.smith-chip-row {
  display:flex;
  align-items:center;
  gap:6px;
  padding:4px 8px;
  background:#211a14;
  color:#fff;
  border:1px solid #785d3b;
  border-radius:8px;
  flex-shrink:0;
}
.smith-chip-icon { font-size:24px; flex-shrink:0; }
.smith-chip-text { flex:1; min-width:0; display:flex; flex-direction:column; }
.smith-chip-name { font-size:19px; color:#fff; line-height:1.2; overflow-wrap:anywhere; }
.smith-chip-sub { font-size:16px; color:#d4c7b6; line-height:1.2; }
.smith-count-btn { flex-shrink:0; font-size:20px; min-width:40px; min-height:40px; padding:0; }
.smith-chip-count { min-width:28px; text-align:center; font-size:20px; font-weight:700; color:#fde68a; }
.smith-actions { display:flex; flex-shrink:0; }
.smith-actions > button { flex:1; }
.smith-action-btn:disabled,
.smith-count-btn:disabled,
.smith-stat-btn:disabled {
  background:#4b5563 !important;
  border-color:#6b7280 !important;
  color:#d1d5db !important;
  box-shadow:none !important;
  cursor:not-allowed;
}
.smith-stat-row {
  display:flex;
  flex-direction:column;
  gap:2px;
  padding:4px 8px;
  background:#1c2530;
  color:#fff;
  border:1px solid #576b80;
  border-radius:8px;
  flex-shrink:0;
}
.smith-stat-head { display:flex; justify-content:flex-start; align-items:baseline; gap:8px; line-height:1.2; }
.smith-stat-name { font-size:19px; font-weight:700; color:#fff; }
.smith-stat-value { font-size:18px; color:#fde68a; white-space:nowrap; }
.smith-info p { margin:0; font-size:18px; color:#fff; }
.smith-stat-body { display:flex; align-items:center; gap:6px; }
.smith-stat-meta { font-size:18px; color:#fde68a; line-height:1.2; }
.smith-stat-ops { display:flex; align-items:center; gap:8px; }
.smith-stat-ops .smith-stat-line { flex:1; min-width:0; }
.smith-stat-line { display:flex; align-items:center; justify-content:space-between; gap:4px; }
.smith-stat-line span { flex:1; min-width:0; font-size:18px; color:#fff; line-height:1.2; white-space:nowrap; }
.smith-stat-btn { flex:0 0 auto; font-size:18px; min-height:36px; padding:4px 8px; line-height:1.2; }
.smith-gauge { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.smith-gauge-row { display:flex; gap:2px; }
.smith-gauge-cell { flex:1; min-width:0; height:14px; border-radius:2px; box-sizing:border-box; }
.smith-gauge-cell.is-filled { background:#f59e0b; border:1px solid #fde68a; }
.smith-gauge-cell.is-open { background:#0f172a; border:1px solid #cbd5e1; }
.smith-gauge-cell.is-locked { background:#374151; border:1px solid #374151; opacity:0.45; }
.smith-empty { font-size:18px; color:#cbd5e1; padding:16px 8px; text-align:center; background:rgba(30,20,12,0.6); border:1px dashed #78350f; border-radius:8px; }
.smith-message { min-height:0; flex-shrink:0; color:#fde68a; }

.shop-category-tabs { display:flex; flex-wrap:wrap; gap:4px; margin-bottom:4px; flex-shrink:0; }
.shop-category-tabs button { background:#342014; border:1px solid #78350f; color:#fff; border-radius:6px; font-size:18px; line-height:1.2; padding:7px 6px; }
.shop-category-tabs button[aria-pressed="true"] { background:#78350f; border-color:#f4c878; }
.shop-acc-filter-block,
.equip-acc-filter-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.shop-acc-filter-block[hidden],
.equip-acc-filter-block[hidden] { display: none !important; }
.acc-filter-select-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.acc-filter-select-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 140px;
  min-width: 0;
  font-size: 16px;
  color: #d4c7b6;
  font-weight: 700;
}
.acc-filter-select {
  width: 100%;
  box-sizing: border-box;
  font-size: 18px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #78350f;
  background: #1e130b;
  color: #ffffff;
  min-height: 40px;
}
.shop-acc-filter-label {
  font-size: 16px;
  line-height: 1.2;
  color: #fde68a;
  font-weight: 700;
}
.shop-acc-filter-tabs { margin-bottom: 0; }
.shop-acc-filter-tabs button { font-size: 16px; padding: 5px 6px; }
#modal-equip-select .equip-acc-filter-block { margin-bottom: 8px; }
#subview-temple .temple-tabs button { min-width:0; padding:10px 4px; font-size:18px; line-height:1.2; }
#temple-item { width:100%; min-width:0; }

#temple-potion-panel:not([hidden]),
#temple-potion-shop-panel:not([hidden]) {
  padding: 0;
  border: 0;
  background: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#temple-item-catalog {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
#temple-item-catalog .shop-item-card { margin-bottom:8px; }
#temple-item-catalog .shop-item-price { font-size:18px; }
#temple-item-catalog .shop-item-owned { font-size:18px; }
#temple-item-catalog .shop-card-actions button { padding:8px 12px; font-size:18px; white-space:nowrap; }
#subview-temple > .place-greeting, #subview-temple > .temple-tabs, #subview-temple > p { flex-shrink:0; }

/* プレイヤー合成。既存の480×720ビューポートと一緒に拡縮する。 */
.composition-box { width: 100%; max-height: 100%; display: flex; flex-direction: column; gap: .4em; padding: .6em; box-sizing: border-box; background: #261911; color: #fff3db; border: 2px solid #b45309; font-size: 20px; line-height: 1.15; }
.composition-box header, .composition-box nav, .composition-row { display: flex; align-items: center; gap: .3em; }
.composition-box header strong, .composition-row span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.composition-box input { width: 100%; box-sizing: border-box; background: #fff3db; color: #261911; font-size: 1em; padding: .25em; }
.composition-box button { font-size: 1em; line-height: 1.15; padding: .3em; background: #58321a; color: #fff3db; border: 1px solid #d99b54; border-radius: .2em; }
.composition-box button:disabled { opacity: .45; }
.composition-row { min-height: 2.25em; border-bottom: 1px solid #765436; }
.composition-row span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.composition-candidates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3em; min-height: 4.8em; }
.composition-candidates button { overflow-wrap: anywhere; }
.composition-candidates p { grid-column: 1 / -1; margin: 0; }
.composition-box nav { justify-content: space-between; }
.composition-message { min-height: 1.15em; color: #fca5a5; overflow-wrap: anywhere; }
.tcm-composed { position: relative; }
.tcm-composed::after { content: ''; position: absolute; width: 1px; height: 1px; left: 50%; top: 50%; background: #fff; }

.tactics-header-actions{display:flex;flex-direction:row;align-items:center;gap:6px;flex-shrink:0}.tactics-header-actions #btn-compose-chip{font-size:20px;line-height:1.1;padding:4px 8px;min-height:0}
.composition-candidates{grid-auto-rows:2.5em}.composition-candidates button{overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}

/* 道場・チップ合成（active 時のみ表示。常時 display はメニューに食い込む） */
#subview-dojo {
  padding: 0;
  box-sizing: border-box;
  min-height: 0;
  overflow: hidden;
}
#subview-dojo.active {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow: hidden;
}
#subview-dojo > .place-greeting { flex-shrink: 0; }
.dojo-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dojo-hub-actions { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.dojo-hub-actions .btn-primary { font-size: 20px; padding: 10px; }
.dojo-kumite-switch {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 2px 0;
  font-size: 15px;
  line-height: 1.2;
  color: #e2e8f0;
  flex-shrink: 0;
}
.dojo-kumite-switch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}
.dojo-kumite-switch-row label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  color: #f8fafc;
}
.dojo-kumite-nbtns {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
}
.dojo-kumite-nbtn {
  min-width: 1.85em;
  min-height: 1.85em;
  padding: 2px 6px;
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 6px;
  cursor: pointer;
}
.dojo-kumite-nbtn.is-on {
  color: #1e130b;
  background: #fbbf24;
  border-color: #f59e0b;
}
.dojo-kumite-nbtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.dojo-box-browse {
  gap: 6px;
}
.dojo-box-browse > .dojo-hint {
  flex-shrink: 0;
  margin: 0;
  font-size: 16px;
  color: #cbd5e1;
  line-height: 1.25;
}
.dojo-box-browse > .dojo-browse-tabs { flex-shrink: 0; }
.dojo-box-browse > .dojo-browse-catalog {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.dojo-box-browse > .dojo-message { flex-shrink: 0; min-height: 1.2em; }
.dojo-box-browse > .dojo-footer { flex-shrink: 0; }
.dojo-box {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  box-sizing: border-box;
  background: #1e293b;
  color: #f8fafc;
  border: 2px solid #64748b;
  font-size: 20px;
  line-height: 1.15;
  overflow: hidden;
}
.dojo-box header { display: flex; align-items: center; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.dojo-box header strong { flex: 0 1 auto; min-width: 0; }
.dojo-master-name {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 18px;
  color: #fde68a;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.dojo-chip-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.dojo-box-name {
  justify-content: flex-start;
}
.dojo-name-top {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
}
.dojo-name-top > header {
  flex-shrink: 0;
  align-self: stretch;
}
.dojo-name-bottom {
  margin-top: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
}
.dojo-name-preview {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding-top: 2px;
  padding-bottom: 2px;
}
.dojo-name-chip {
  position: relative;
  width: 128px;
  height: 128px;
  flex: 0 0 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.dojo-name-chip-bg {
  position: absolute;
  left: 0;
  top: 0;
  width: 128px;
  height: 128px;
  max-width: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 0;
}
.dojo-name-chip-label {
  position: relative;
  z-index: 1;
  max-width: 78%;
  padding: 0 4px;
  text-align: center;
  font-size: 18px;
  line-height: 1.15;
  color: #f8fafc;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  text-shadow:
    0 0 3px #000,
    0 1px 2px #000,
    1px 1px 0 #000,
    -1px -1px 0 #000;
}
.dojo-inventor {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: 18px;
  line-height: 1.2;
  color: #fde68a;
  overflow-wrap: anywhere;
}
.dojo-fee-line {
  margin: 0;
  text-align: right;
  font-size: 16px;
  line-height: 1.15;
  color: #fde68a;
}
.dojo-hint-after-jobs {
  margin-top: 1.15em;
}
.dojo-hint-sequence {
  margin-top: 0;
  overflow-wrap: anywhere;
}
.dojo-name-spacer {
  height: 1.15em;
  flex-shrink: 0;
}
.dojo-notice {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  color: #fca5a5;
  overflow-wrap: anywhere;
  flex-shrink: 0;
}
.dojo-chip-tile {
  width: min(42%, 7.5em);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  box-sizing: border-box;
  background: #0f172a;
  border: 2px solid #94a3b8;
  border-radius: 8px;
  color: #f8fafc;
}
.dojo-chip-tile-icon { font-size: 28px; line-height: 1; }
.dojo-chip-tile-name {
  max-width: 100%;
  text-align: center;
  font-size: 16px;
  line-height: 1.15;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.dojo-box header button,
.dojo-footer button:not(.btn-primary),
.dojo-list-item {
  font-size: 20px;
  line-height: 1.15;
  padding: 6px 8px;
  background: #334155;
  color: #f8fafc;
  border: 1px solid #94a3b8;
  border-radius: 4px;
}
.dojo-box header button:disabled,
.dojo-footer button:disabled,
.dojo-list-item:disabled { opacity: 0.45; }
.dojo-hint { margin: 0; font-size: 18px; color: #cbd5e1; line-height: 1.2; flex-shrink: 0; }
.dojo-box-craft {
  gap: 4px;
  padding: 4px 6px;
}
.dojo-box-craft > .dojo-footer {
  flex-shrink: 0;
}
/* 合成枠4つを縦に収めてすべて表示（空き高さに合わせて縮小、最大128px・正方形） */
.dojo-box-craft > .dojo-craft-main {
  flex: 1 1 auto;
  min-height: 0;
}
.dojo-craft-main {
  --dojo-slot-gap: 4px;
  --dojo-slot-max: 128px;
  --dojo-slots-stack: calc(var(--dojo-slot-max) * 4 + var(--dojo-slot-gap) * 3);
  container-type: size;
  width: 100%;
  height: auto;
  max-height: var(--dojo-slots-stack);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  overflow: hidden;
  align-items: stretch;
}
.dojo-slots-col {
  --dojo-slot-size: min(var(--dojo-slot-max), calc((100cqh - var(--dojo-slot-gap) * 3) / 4));
  box-sizing: border-box;
  height: calc(var(--dojo-slot-size) * 4 + var(--dojo-slot-gap) * 3);
  width: var(--dojo-slot-size);
  max-height: 100%;
  display: grid;
  grid-template-rows: repeat(4, var(--dojo-slot-size));
  gap: var(--dojo-slot-gap);
  align-content: start;
  justify-items: stretch;
  overflow: visible;
  border: none;
  background: transparent;
  padding: 0;
}
.dojo-square {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--dojo-slot-size);
  height: var(--dojo-slot-size);
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  padding: 12% 10%;
  margin: 0;
  border: none !important;
  border-radius: 0;
  background: transparent !important;
  color: #f8fafc;
  font-size: 18px;
  line-height: 1.15;
  cursor: default;
  box-shadow: none !important;
  outline: none !important;
  transform: none !important;
  transition: none !important;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  overflow: hidden;
}
.dojo-square-bg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 0;
}
.dojo-square.is-filled:not(:disabled),
.dojo-square.is-filled:not(:disabled):hover,
.dojo-square.is-filled:not(:disabled):focus,
.dojo-square.is-filled:not(:disabled):active {
  cursor: pointer;
}
button.dojo-square:is(:hover, :focus, :active, :focus-visible),
button.dojo-square:disabled:is(:hover, :focus, :active) {
  background: transparent !important;
  border: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  transform: none !important;
  filter: none;
  opacity: 1;
}
.dojo-square.is-flash .dojo-square-bg {
  animation: dojo-slot-flash 0.45s ease-out;
}
@keyframes dojo-slot-flash {
  0% { filter: brightness(1); }
  55% { filter: brightness(1.25); }
  100% { filter: brightness(1); }
}
.dojo-square.is-locked,
button.dojo-square.is-locked:is(:hover, :focus, :active, :focus-visible) {
  opacity: 1 !important;
  cursor: default !important;
  background: transparent !important;
}
.dojo-square.is-locked .dojo-square-bg,
button.dojo-square.is-locked:is(:hover, :focus, :active) .dojo-square-bg {
  filter: brightness(0.32) grayscale(0.5);
}
.dojo-square-label {
  position: relative;
  z-index: 1;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  text-align: center;
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.15;
  color: #f8fafc;
  pointer-events: none;
  text-shadow:
    0 0 3px #000,
    0 1px 2px #000,
    1px 1px 0 #000,
    -1px -1px 0 #000;
}
.dojo-side-col {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  container-type: size;
}
.dojo-side-head {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
  text-align: right;
}
.dojo-side-title {
  font-size: 20px;
  line-height: 1.15;
  color: #f8fafc;
}
.dojo-side-col .dojo-master-name {
  flex: 0 0 auto;
  width: 100%;
  text-align: right;
  font-size: 16px;
}
.dojo-side-label {
  display: block;
  font-size: 16px;
  line-height: 1.15;
  color: #fde68a;
  flex-shrink: 0;
}
.dojo-desc {
  flex-shrink: 0;
  min-height: 0;
}
.dojo-desc-text {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.2;
  color: #e2e8f0;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dojo-list-col {
  /* 切替回数（全枠）を隠さないよう所持一覧の上限を抑える */
  flex: 1 1 auto;
  min-height: min(5.5em, 18cqh);
  max-height: min(10em, 30cqh);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  border: 1px solid #475569;
  border-radius: 6px;
  background: #0f172a;
  padding: 4px;
}
.dojo-list-col > .dojo-side-label {
  padding: 0 2px;
}
.dojo-reset-btn {
  flex-shrink: 0;
  width: 100%;
  font-size: 18px;
  line-height: 1.15;
  padding: 6px 8px;
  background: #334155;
  color: #f8fafc;
  border: 1px solid #94a3b8;
  border-radius: 4px;
}
.dojo-reset-btn:disabled {
  opacity: 0.45;
}
button.dojo-reset-btn:is(:hover, :focus, :active):not(:disabled) {
  background: #3f4f63;
  border-color: #94a3b8;
  box-shadow: none;
  transform: none;
}
.dojo-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #1e293b;
}
.dojo-list::-webkit-scrollbar {
  width: 10px;
}
.dojo-list::-webkit-scrollbar-track {
  background: #1e293b;
  border-radius: 4px;
}
.dojo-list::-webkit-scrollbar-thumb {
  background: #64748b;
  border-radius: 4px;
  border: 2px solid #1e293b;
}
.dojo-list::-webkit-scrollbar-thumb:active {
  background: #94a3b8;
}
.dojo-list-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  flex-shrink: 0;
}
.dojo-list-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.dojo-qty { flex-shrink: 0; color: #fde68a; font-size: 18px; }
.dojo-empty { margin: 4px; color: #cbd5e1; font-size: 18px; }
.dojo-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 18px;
  color: #e2e8f0;
  line-height: 1.2;
  flex-shrink: 0;
  overflow-wrap: anywhere;
  min-width: 0;
}
.dojo-needs {
  font-size: 16px;
  color: #cbd5e1;
  line-height: 1.2;
  overflow-wrap: anywhere;
  flex-shrink: 0;
  min-height: 1.2em;
}
.dojo-message {
  min-height: 1.15em;
  color: #fca5a5;
  overflow-wrap: anywhere;
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1.15;
}
.dojo-footer {
  display: grid;
  gap: 6px;
  flex-shrink: 0;
}
.dojo-footer-craft { grid-template-columns: 1fr 1.4fr; }
.dojo-footer-name {
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}
.dojo-footer-name > button {
  width: 100%;
  min-height: 2.6em;
  box-sizing: border-box;
  font-size: 20px;
  line-height: 1.15;
  padding: 10px 8px;
}
.dojo-name-label { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.dojo-name-label input {
  width: 100%;
  box-sizing: border-box;
  font-size: 20px;
  padding: 8px;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #94a3b8;
  border-radius: 4px;
}
.dojo-cat-attack { border-color: #f87171 !important; }
.dojo-cat-move { border-color: #60a5fa !important; }
.dojo-cat-magic { border-color: #c084fc !important; }
.dojo-cat-buff { border-color: #fbbf24 !important; }
.dojo-cat-item { border-color: #4ade80 !important; }
.dojo-cat-guard { border-color: #38bdf8 !important; }
.dojo-cat-skill { border-color: #facc15 !important; }
.dojo-box .btn-primary { font-size: 20px; padding: 10px; }

/* ============================================================
   ナゴミ瓶 強化UI & 戦闘インジケーター
============================================================ */
.temple-nagomi-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid #334155;
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.temple-nagomi-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nagomi-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 19px;
  color: #f1f5f9;
}
.nagomi-label {
  color: #94a3b8;
}
.nagomi-val {
  font-weight: 700;
  color: #38bdf8;
}
.temple-nagomi-actions button {
  width: 100%;
  font-size: 20px;
  padding: 12px 10px;
}

.battle-nagomi-indicator {
  position: absolute;
  left: 8px;
  bottom: 22px;
  z-index: 90;
  display: flex;
  align-items: center;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  pointer-events: none;
}
.battle-nagomi-dots {
  display: flex;
  gap: 2px;
  align-items: flex-end;
}
.nagomi-bottle {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  flex-shrink: 0;
}

.boss-rush-dialogue { display: flex; flex-direction: column; gap: 0.5em; max-height: 90%; }
.boss-rush-dialogue img { max-width: 100%; max-height: 180px; object-fit: contain; align-self: center; }
.boss-rush-dialogue img[hidden] { display: none; }
.boss-rush-dialogue p { white-space: pre-wrap; color: #fff0d4; font-size: 20px; line-height: 1.15; margin: 0; }
.boss-rush-dialogue button { flex-shrink: 0; font-size: 20px; }

.pebuddy-body-tint {
  position: absolute;
  inset: 8%;
  pointer-events: none;
}
/* ペバディ：既存480×720コンテナの拡縮に合わせる */
#pebuddy-root:has(.pebuddy-grid-panel),
#pebuddy-root:has(.pebuddy-equip-select),
#pebuddy-root:has(.pebuddy-food-select) { overflow: hidden; container-type: inline-size; }
.pebuddy-grid-panel { flex: 1; min-height: 0; gap: .25em; padding: .35em; font-size: 4.4cqw; line-height: 1.05; }
.pebuddy-grid-panel p, .pebuddy-food-select p { margin: 0; }
.pebuddy-grid-panel .pebuddy-title { font-size: 1em; margin: 0; }
.pebuddy-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: .3em; }
.pebuddy-grid > div { min-width: 0; min-height: 0; padding: .2em; border: 1px solid #78350f; background: #261911; }
.pebuddy-grid-image { display: flex; flex-direction: column; }
.pebuddy-grid-image .pebuddy-stage { flex: 1; width: 100%; max-width: none; height: auto; min-height: 0; aspect-ratio: auto; margin: 0; }
.pebuddy-grid-image .pebuddy-base { inset: 0; width: 100%; height: 100%; }
.pebuddy-grid-image .pebuddy-body-tint { inset: 0; }
.pebuddy-grid-image > p { flex-shrink: 0; }
.pebuddy-grid-stats { display: grid; grid-template-rows: repeat(6, 1fr); gap: .12em; }
.pebuddy-stat { display: grid; grid-template-columns: 1fr auto; align-content: center; gap: .1em; }
.pebuddy-stat > span { white-space: nowrap; }
.pebuddy-stat .pebuddy-bar { grid-column: 1 / -1; height: .25em; margin: 0; }
.pebuddy-grid-lower { display: flex; flex-direction: column; gap: .25em; }
.pebuddy-grid-lower .pebuddy-food-queue { display: grid; grid-template-rows: auto repeat(5, minmax(0, 1fr)); flex: 1; min-height: 0; margin: 0; padding: 0; gap: .12em; }
.pebuddy-food-card { display: flex; align-items: center; gap: .2em; min-height: 0; border: 1px solid #785332; padding: .12em; background: #3a2619; }
.pebuddy-food-card img { width: 1.5em; height: 1.5em; object-fit: contain; }
.pebuddy-food-card span { min-width: 0; overflow-wrap: anywhere; }
.pebuddy-grid-bond { display: flex; flex-direction: column; justify-content: center; gap: .65em; }
.pebuddy-grid-slot { flex: 1; min-height: 0; padding: .25em; font-size: 1em; line-height: 1.05; }
.pebuddy-grid-slot span { display: block; }
.pebuddy-grid-actions { display: flex; gap: .25em; flex-shrink: 0; }
.pebuddy-grid-actions button { flex: 1; font-size: 1em; padding: .3em .1em; }
.pebuddy-food-select { flex: 1; min-height: 0; font-size: 20px; }
.pebuddy-food-select > h4 { margin: 0; flex-shrink: 0; }
.pebuddy-food-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .25em; }
.pebuddy-food-row { display: grid; grid-template-columns: 2.5em minmax(0,1fr) auto; align-items: center; gap: .3em; padding: .25em; border: 1px solid #785332; flex-shrink: 0; }
.pebuddy-food-row img { width: 2.5em; height: 2.5em; object-fit: contain; }
.pebuddy-food-row p { overflow-wrap: anywhere; }
.pebuddy-food-select > button { flex-shrink: 0; }
.pebuddy-food-select button { font-size: 1em; }

.pebuddy-equip-select { flex: 1; min-height: 0; overflow: hidden; font-size: 4.4cqw; }
.pebuddy-equip-select p { margin: 0; }
.pebuddy-equip-select button { font-size: 1em; }
