@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;
}

/* ============================================================
   基本ボタンスタイル (ブラウザ標準白背景の完全排除)
============================================================ */
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 {
  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;
}

/* 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: 24px 20px;
  text-align: center;
  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;
}

.title-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.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;
  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:100%; height:auto; max-height:130px; object-fit:contain; }
#view-title .title-menu { gap:8px; margin-bottom:12px; }
#view-title .btn-title-menu { padding:8px 18px; line-height:1.2; }
#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;
}

.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:hover {
  background: #362217;
  border-color: #b45309;
  transform: translateY(-2px);
}

.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; }

.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: 96px;
  flex-shrink: 0;
}
.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;
}
.stat-dist-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
}
.stat-name-label {
  width: 44px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: #ffffff;
  font-size: 18px;
}
.stat-val-text {
  width: 32px;
  text-align: right;
  font-weight: 700;
  font-family: monospace;
  color: #ffffff;
  font-size: 19px;
}
.stat-blocks-track {
  flex: 1;
  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;
}
.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;
}

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

.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);
}

.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-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-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;
}
.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;
}

/* ============================================================
   ダンジョン探索画面 (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-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;
}

/* 戦闘：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;
  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;
}

/* 画面全体アリーナステージ空間 (キャラが自由に物理移動する空間) */
.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; }

/* 画面最下部・戦闘ログ（背景透明・探索と履歴共有・下端から1行分上げる） */
.battle-bottom-log {
  position: absolute;
  bottom: 26px;
  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;
}

/* ミニチュア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;
}

/* 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;
  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);
}

@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: center;
  margin: 8px 0 10px;
}

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

.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;
}

/* 報酬リスト表示 */
.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: auto;
  height: auto;
  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 {
  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;
}

.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 {
  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;
}

.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-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;
}

/* 正方形パネルを短い辺いっぱいに等倍表示。説明は画像フチに重ねる */
.tactics-panel-frame {
  position: relative;
  flex: 0 0 auto;
  /* グラフ帯（細線）分を除いた領域いっぱいに拡大 */
  width: min(100cqw, calc(100cqh - 34px));
  height: min(100cqw, calc(100cqh - 34px));
  aspect-ratio: 1 / 1;
  max-width: 100%;
  max-height: calc(100% - 34px);
  container-type: size;
}

.tactics-panel-hint {
  flex-shrink: 0;
  margin: 2px 0 0;
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  max-width: 440px;
  box-sizing: border-box;
}

.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説明：左フチに縦書きで重ねる（補助表示） */
.tactics-row-headers {
  position: absolute;
  left: 0.8%;
  top: 11%;
  width: 9.5%;
  height: 75.25%;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 2.8%;
  align-items: stretch;
  z-index: 2;
  pointer-events: none;
}

.tactics-row-head {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 2px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: clamp(9px, 4.2cqi, 12px);
  font-weight: 700;
  color: #f8fafc;
  text-align: center;
  line-height: 1.05;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 0.95),
    0 1px 2px 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.png 計測: 外枠溝 ≈ L10.5% T10% R10.5% B12.75%、溝幅 ≈ 3% */
.tactics-panel-grid {
  position: absolute;
  left: 11.5%;
  top: 11%;
  width: 77%;
  height: 75.25%;
  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;
}

.modal-slot-target {
  font-size: 15px;
  color: #fbbf24;
  font-weight: 600;
  margin-top: 2px;
}

/* ソートタブ: スクロール外で固定表示、2行折り返し */
.chip-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  overflow-x: hidden;
  margin-bottom: 6px;
  padding-bottom: 0;
  flex-shrink: 0;
}

/* チップ一覧スクロール領域: max-height制限を解除して画面下端まで最大展開 */
.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 {
  flex: 1 1 calc(25% - 6px);
  min-width: 50px;
  text-align: center;
  background: #342014;
  border: 1.5px solid #78350f;
  color: #e2e8f0;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.chip-cat-tab.active {
  background: #78350f;
  border-color: #f59e0b;
  color: #fbbf24;
  font-weight: 800;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

/* チップ一覧グリッド: 画面いっぱいに広がり2列でスクロール表示 */
.palette-chips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.palette-chip-item {
  background: rgba(24, 15, 10, 0.94);
  border: 1.5px solid #78350f;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.palette-chip-item:hover, .palette-chip-item:active {
  background: #451a03;
  border-color: #f59e0b;
}

.palette-chip-item.selected {
  border-color: #10b981;
  background: rgba(6, 78, 59, 0.3);
}

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

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

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

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

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

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

.pchip-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  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;
}

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

.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: 13px;
  color: #cbd5e1;
  line-height: 1.3;
}

/* ボタン類 (閉じるボタンの背景白を防止) */
.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; }
.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;
}
.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: 12px; padding-bottom: 2px; }
#subview-shop > .place-greeting,
#subview-shop > .shop-content-panel { flex-shrink: 0; }
.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-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);
}

.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: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  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-y: auto;
  min-height: 0;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
}
.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;
}

.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);
}

@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-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-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: grid;
  grid-template-columns: 2.6em 4.4em minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 20px;
}
#stat-dist-rows .stat-name-label,
#status-stat-rows .stat-name-label {
  width: 100%;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: #ffffff;
  font-size: 20px;
  text-align: right;
  white-space: nowrap;
}
#stat-dist-rows .stat-val-text,
#status-stat-rows .stat-val-text {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 3px;
  width: 100%;
  font-size: 20px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: left;
}
.status-stat-bonus { font-size: 18px; color: #38bdf8; }
.status-stat-track {
  display: block;
  min-width: 0;
  height: 8px;
  border-radius: 4px;
  background: #392719;
}
.status-stat-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #eaa332;
}

.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-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;
  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: 12px;
  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;
}

.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}
.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}
.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-panels{padding:0;margin:0;list-style:none;font-size:18px;line-height:1.3;overflow-wrap:anywhere}
#temple-panels { display:flex; flex-direction:column; gap:6px; }
.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-status { flex-shrink:0; font-size:16px; color:#e6cfa9; }
#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-tabs{display:flex;flex-wrap:wrap;gap:10px}
.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}
#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, .equip-magic-summary,
#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; }
.equip-magic-summary { color: #e4caff; border-top: 1px solid #785d3b; margin-top: 0.25rem; padding-top: 0.25rem; }

/* 冒険者ギルド：全クエストを縦スクロールで表示。 */
#dungeon-select-panel { min-height:0; height:100%; gap:8px; padding: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; }
.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 { flex:1; min-width:0; }
.quest-card h4 { font-size:20px; line-height:1.15; margin:0 0 6px; overflow-wrap:anywhere; }
.quest-card p { font-size:18px; line-height:1.2; margin:0 0 8px; overflow-wrap:anywhere; }
.quest-card-rewards {
  font-size:16px;
  line-height:1.25;
  color:#fde68a;
  margin:0 0 8px;
  overflow-wrap:anywhere;
}
.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;
}

.shop-category-tabs { display:flex; flex-wrap:wrap; gap:4px; margin-bottom:8px; 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; }
#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 { padding:0; border:0; background:none; flex-shrink:0; }
#temple-item-catalog .shop-item-card { margin-bottom:8px; }
#temple-item-catalog .shop-item-price { 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; }
