/* ============================================================
   SkyWay Card Battle - Style Sheet (真・究極版)
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 100%);
  color: #e0e0e0;
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* ===== ボタン共通 ===== */
.btn {
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #7c8ff0 0%, #8b5bb6 100%);
}

.btn-secondary {
  background: #444;
  color: #e0e0e0;
  border: 1px solid #667eea;
}

.btn-secondary:hover:not(:disabled) {
  background: #555;
}

.btn-back {
  background: #333;
  color: #ccc;
  padding: 8px 16px;
  font-size: 12px;
}

.btn-choice {
  width: auto;
  /* 幅をテキストに合わせる [cite: 12] */
  min-width: 120px;
  margin-bottom: 0;
}

.btn-dungeon {
  background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
  color: #1a1a2e;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
}

.btn-online {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  color: #1a1a2e;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
}

.btn-icon {
  font-size: 32px;
}

.btn-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.btn-text strong {
  font-size: 16px;
}

.btn-text small {
  font-size: 12px;
  opacity: 0.8;
}

/* ===== メニュー画面 ===== */
.menu-wrap {
  width: 100%;
  max-width: 700px;
}

.menu-card {
  background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
  border: 2px solid #667eea;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
}

.menu-title {
  margin-bottom: 40px;
}

.title-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 16px;
}

.menu-title h1 {
  font-size: 32px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 13px;
  color: #aaa;
  margin-top: 8px;
}

.menu-buttons {
  margin-bottom: 40px;
}

.rules-panel {
  background: rgba(100, 100, 150, 0.1);
  border: 1px solid #667eea;
  border-radius: 12px;
  padding: 20px;
  text-align: left;
}

.rules-panel h3 {
  margin-bottom: 16px;
  font-size: 16px;
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.rule-item {
  display: flex;
  gap: 10px;
  font-size: 12px;
}

.rule-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.rule-item strong {
  display: block;
  margin-bottom: 4px;
}

.rule-item p {
  color: #aaa;
  line-height: 1.4;
}

/* ===== ダンジョン画面 ===== */
.dungeon-wrap {
  width: 100%;
  max-width: 1000px;
}

.dungeon-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 20px;
}

.dungeon-title h2 {
  font-size: 24px;
  margin-bottom: 12px;
}

.room-progress {
  background: rgba(100, 100, 150, 0.15);
  border: 1px solid #667eea;
  border-radius: 8px;
  padding: 12px;
}

.room-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.room-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #444;
  border: 1px solid #667eea;
}

.room-dot.cleared {
  background: #84fab0;
}

.room-dot.current {
  background: #667eea;
  box-shadow: 0 0 8px #667eea;
}

.room-progress p {
  font-size: 12px;
  color: #aaa;
}

.deck-info {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
}

.dungeon-body {
  display: flex;
  flex-direction: column;
  /* 左右から上下に変更 [cite: 32] */
  gap: 20px;
  max-height: none;
  /* 高さ制限を解除 */
}

.dungeon-choices {
  max-width: 500px;
  margin: 0 auto;
  padding: 20px;
  align-items: center;
}

.dungeon-choices h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.dungeon-deck {
  max-height: none;
  background: transparent;
  border: none;
  padding: 0;
}

.dungeon-deck h3 {
  text-align: center;
  margin-bottom: 20px;
}

/* カードを戦闘時と同じグリッドで表示 [cite: 54] */
.deck-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.room-card {
  background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
  border: 2px solid #667eea;
  border-radius: 12px;
  padding: 20px;
}

.room-card h3 {
  margin-bottom: 20px;
  font-size: 18px;
}

.choice-buttons {
  display: flex;
  flex-direction: row;
  /* 横並びにしてコンパクトに [cite: 37] */
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.deck-preview {
  background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
  border: 2px solid #667eea;
  border-radius: 12px;
  padding: 20px;
  max-height: 400px;
  overflow-y: auto;
}

.deck-preview h4 {
  margin-bottom: 15px;
  font-size: 16px;
}

.mini-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-card {
  background: #333;
  border: 1px solid #667eea;
  border-radius: 6px;
  padding: 10px;
  font-size: 11px;
}

.mini-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

/* ===== バトル画面 ===== */
.battle-wrap {
  width: 100%;
  max-width: 1200px;
}

.battle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 20px;
}

.phase-info {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 16px;
}

.battle-field {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.player-panel {
  background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
  border: 2px solid #667eea;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.player-panel.npc {
  border-color: #f5576c;
}

.player-panel.player {
  border-color: #84fab0;
}

.player-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.hp-bar {
  width: 100%;
  height: 24px;
  background: #333;
  border: 1px solid #666;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.hp-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.hp-text {
  font-size: 12px;
  color: #aaa;
}

.battle-log {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
  border: 2px solid #667eea;
  border-radius: 12px;
  padding: 15px;
  max-height: 150px;
  overflow-y: auto;
}

.battle-log-header {
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 14px;
}

.log-entry {
  font-size: 12px;
  color: #ccc;
  padding: 4px 0;
  border-bottom: 1px solid #444;
}

.log-entry:last-child {
  border-bottom: none;
}

/* ===== フェーズパネル ===== */
.phase-panel {
  background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
  border: 2px solid #667eea;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.phase-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.phase-panel>p {
  font-size: 13px;
  color: #aaa;
  margin-bottom: 15px;
}

.hand-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

/* ===== カード（手札・バトル用）===== */
.hand-card {
  background: linear-gradient(135deg, #3d3d5c 0%, #2a2a42 100%);
  border: 2px solid #667eea;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 240px;
  display: flex;
  flex-direction: column;
}

.hand-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
  border-color: #8b9ff0;
}

/* 選択状態のスタイル */
.hand-card.selected {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #fff;
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.8), inset 0 0 10px rgba(255, 255, 255, 0.1);
  transform: translateY(-6px) scale(1.02);
}

.hand-card.selected::before {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  background: #84fab0;
  color: #1a1a2e;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

.card-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #fff;
  word-break: break-word;
}

/* ===== カード内の3つの効果セクション（横長・縦積み） ===== */
.card-trinity {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  flex: 1;
}

.trinity-section {
  background: rgba(100, 100, 150, 0.2);
  border: 1px solid rgba(102, 126, 234, 0.5);
  border-radius: 6px;
  padding: 8px;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 6px;
  align-items: start;
  font-size: 10px;
}

.trinity-section h4 {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trinity-section-content {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trinity-section p {
  color: #ddd;
  line-height: 1.3;
  margin: 0;
  font-size: 9px;
}

.trinity-section strong {
  color: #84fab0;
  font-size: 10px;
}

.trinity-section.active-effect {
  background: rgba(132, 250, 176, 0.2);
  border-color: #84fab0;
  box-shadow: inset 0 0 10px rgba(132, 250, 176, 0.2);
}

/* コンパクト版（ダンジョン画面用） */
.card-trinity-compact {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  font-size: 10px;
}

.card-trinity-compact span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ccc;
}

/* ===== 属性バッジ ===== */
.attr-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  margin-left: 4px;
}

.attr-badge.slash {
  background: #ff6b6b;
  color: white;
}

.attr-badge.strike {
  background: #ffd93d;
  color: #1a1a2e;
}

.attr-badge.thrust {
  background: #6bcf7f;
  color: white;
}

/* ===== フェーズボタン ===== */
.phase-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.phase-buttons .btn {
  flex: 1;
  min-width: 150px;
}

/* ===== イベント・結果画面 ===== */
.event-wrap {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.event-card {
  background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
  border: 2px solid #667eea;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  width: 100%;
}

.event-card h2 {
  font-size: 24px;
  margin-bottom: 20px;
}

.event-desc {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 20px;
}

.reward-card-display {
  background: linear-gradient(135deg, #3d3d5c 0%, #2a2a42 100%);
  border: 2px solid #667eea;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.reward-card-display.discarded {
  opacity: 0.6;
  border-color: #f5576c;
}

.card-header {
  margin-bottom: 15px;
}

.card-name-big {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.reward-section {
  margin-top: 20px;
}

.reward-section h3 {
  margin-bottom: 15px;
  font-size: 16px;
}

.reward-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.reward-card {
  background: linear-gradient(135deg, #3d3d5c 0%, #2a2a42 100%);
  border: 2px solid #667eea;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reward-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
  border-color: #8b9ff0;
}

.card-select-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.selectable-card {
  background: linear-gradient(135deg, #3d3d5c 0%, #2a2a42 100%);
  border: 2px solid #667eea;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.selectable-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
  border-color: #8b9ff0;
}

/* 選択状態のスタイル */
.selectable-card.selected {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #fff;
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.8), inset 0 0 10px rgba(255, 255, 255, 0.1);
  transform: translateY(-6px) scale(1.02);
}

.selectable-card.selected::before {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  background: #84fab0;
  color: #1a1a2e;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

.discard-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #f5576c;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.selectable-card:hover .discard-overlay {
  opacity: 1;
}

/* カード獲得画面用スタイル */
.card-trinity-full {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  flex: 1;
}

.trinity-section-full {
  background: rgba(100, 100, 150, 0.2);
  border: 1px solid rgba(102, 126, 234, 0.5);
  border-radius: 6px;
  padding: 8px;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 6px;
  align-items: start;
  font-size: 10px;
}

.trinity-section-full h4 {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trinity-section-full-content {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trinity-section-full p {
  color: #ddd;
  line-height: 1.3;
  margin: 0;
  font-size: 9px;
}

.trinity-section-full strong {
  color: #84fab0;
  font-size: 10px;
}

.reward-selection-info {
  font-size: 13px;
  color: #aaa;
  margin-bottom: 15px;
  text-align: center;
}

.reward-selection-counter {
  font-weight: 600;
  color: #667eea;
}

/* ===== 結果画面 ===== */
.result-wrap {
  width: 100%;
  max-width: 600px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.result-card {
  background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
  border: 3px solid #667eea;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  width: 100%;
}

.result-card.victory {
  border-color: #84fab0;
}

.result-card.defeat {
  border-color: #f5576c;
}

.result-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.result-card h2 {
  font-size: 28px;
  margin-bottom: 15px;
}

.result-card p {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 20px;
}

.result-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

/* ===== セットアップ画面 ===== */
.setup-wrap {
  width: 100%;
  max-width: 500px;
}

.setup-card {
  background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
  border: 2px solid #667eea;
  border-radius: 16px;
  padding: 30px;
}

.setup-card h2 {
  margin-bottom: 10px;
  font-size: 24px;
}

.setup-desc {
  font-size: 13px;
  color: #aaa;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 15px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #ccc;
}

.form-group input {
  width: 100%;
  padding: 10px;
  background: #333;
  border: 1px solid #667eea;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 14px;
}

.form-group input:focus {
  outline: none;
  border-color: #8b9ff0;
  box-shadow: 0 0 8px rgba(102, 126, 234, 0.3);
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.button-row .btn {
  flex: 1;
}

/* ===== ローディング ===== */
.loading-wrap {
  width: 100%;
  max-width: 400px;
}

.loading-card {
  background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
  border: 2px solid #667eea;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
}

.loading-card p {
  font-size: 16px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* ===== エラー画面 ===== */
.error-screen {
  background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
  border: 2px solid #f5576c;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  max-width: 500px;
}

.error-screen p {
  color: #f5576c;
  font-size: 16px;
}

/* ===== 効果選択モーダル ===== */
.effect-choice-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.effect-choice-content {
  background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
  border: 3px solid #667eea;
  border-radius: 16px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  text-align: center;
}

.effect-choice-content h3 {
  font-size: 20px;
  margin-bottom: 20px;
  color: #fff;
}

.effect-choice-content p {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 25px;
}

.effect-choice-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.effect-choice-btn {
  padding: 15px;
  border: 2px solid #667eea;
  border-radius: 10px;
  background: linear-gradient(135deg, #3d3d5c 0%, #2a2a42 100%);
  color: #e0e0e0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.effect-choice-btn:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.effect-choice-btn.attack-btn {
  border-color: #ff6b6b;
}

.effect-choice-btn.attack-btn:hover {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff5252 100%);
}

.effect-choice-btn.event-btn {
  border-color: #84fab0;
}

.effect-choice-btn.event-btn:hover {
  background: linear-gradient(135deg, #84fab0 0%, #5fe3b0 100%);
  color: #1a1a2e;
}

/* ===== 蓄積ダメージ・防御表示 ===== */
.accumulation-display {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 20px;
  padding: 15px;
  background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
  border: 2px solid #667eea;
  border-radius: 12px;
}

.accumulation-item {
  text-align: center;
}

.accumulation-label {
  font-size: 12px;
  color: #aaa;
  margin-bottom: 8px;
  font-weight: 600;
}

.accumulation-value {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  font-family: 'Courier New', monospace;
}

.accumulation-attrs {
  font-size: 11px;
  color: #ffaa44;
  margin-top: 4px;
  font-weight: 600;
}

.accumulation-item.damage .accumulation-value {
  color: #ff6b6b;
}

.accumulation-item.defense .accumulation-value {
  color: #84fab0;
}

.accumulation-item.final {
  grid-column: 1 / -1;
  border-top: 2px solid #667eea;
  padding-top: 12px;
  margin-top: 8px;
}

.accumulation-item.final .accumulation-label {
  font-size: 13px;
}

.accumulation-item.final .accumulation-value {
  color: #ffd93d;
  font-size: 32px;
}

/* ===== レスポンシブ ===== */
@media (max-width: 768px) {
  #app {
    padding: 10px;
  }

  .hand-cards {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .dungeon-body {
    grid-template-columns: 1fr;
  }

  .battle-field {
    grid-template-columns: 1fr;
  }

  .rules-grid {
    grid-template-columns: 1fr;
  }

  .menu-card {
    padding: 20px;
  }

  .menu-title h1 {
    font-size: 24px;
  }

  .btn-dungeon,
  .btn-online {
    flex-direction: column;
    text-align: center;
  }

  .phase-buttons {
    flex-direction: column;
  }

  .phase-buttons .btn {
    max-width: 100%;
  }

  .reward-cards {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .card-select-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dungeon-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .hand-cards {
    grid-template-columns: 1fr;
  }

  .hand-card {
    min-height: 200px;
  }

  .card-select-grid {
    grid-template-columns: 1fr;
  }

  .selectable-card {
    min-height: 240px;
  }

  .card-trinity {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .trinity-section {
    padding: 6px;
    grid-template-columns: 1fr;
  }

  .trinity-section h4 {
    grid-column: 1;
    grid-row: 1;
    margin-bottom: 4px;
  }

  .trinity-section-content {
    grid-column: 1;
  }

  .phase-title {
    font-size: 16px;
  }

  .menu-card {
    padding: 15px;
  }

  .result-card {
    padding: 20px;
  }

  .result-icon {
    font-size: 48px;
  }

  .result-card h2 {
    font-size: 20px;
  }
}


/* ===== NPC手番表示 ===== */
.phase-panel.npc-turn {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff5252 100%);
  border-color: #ff6b6b;
  text-align: center;
  padding: 40px 20px;
}

.phase-panel.npc-turn h3 {
  color: #fff;
  font-size: 20px;
  margin-bottom: 20px;
}

.phase-panel.npc-turn>p {
  color: #fff !important;
  font-size: 16px;
  margin-bottom: 20px;
}

.npc-action-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.npc-action-indicator p {
  color: #fff;
  font-size: 14px;
  margin: 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ボタンを横に並べてコンパクトにする */
.dungeon-choices-compact {
  border: 1px solid #444;
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  display: inline-block; /* 外枠をコンテンツ幅に合わせる */
  margin: 0 auto 20px auto;
  text-align: center;
}

.choice-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-choice-item {
  width: 130px; /* ボタンの横幅を制限 */
  padding: 8px;
}

/* 下側のデッキ表示エリア */
.dungeon-main-ui {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dungeon-deck-bottom {
  width: 100%;
  border-top: 1px solid #333;
  padding-top: 20px;
}

.dungeon-deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
  justify-items: center;
}