/* ==========================================================================
   汎用パズル攻略アプリ - CSS スタイルシート
   ========================================================================== */

:root {
  --bg-color: #0d1117;
  --bg-card: rgba(22, 27, 34, 0.85);
  --bg-card-border: rgba(48, 54, 61, 0.8);
  --text-main: #f0f6fc;
  --text-sub: #8b949e;
  --primary: #58a6ff;
  --primary-hover: #79c0ff;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --purple: #bc8cff;
  --glass-bg: rgba(33, 38, 45, 0.7);
  --border-radius: 12px;
  --shadow-main: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(circle at top right, #1a2332 0%, var(--bg-color) 60%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ヘッダー */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-main);
  flex-wrap: wrap;
  gap: 12px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  font-size: 2.2rem;
}

.app-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-sub);
}

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

/* ボタン & 入力 */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, #1f6feb 0%, #238636 100%);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 111, 235, 0.4);
}

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

.btn-secondary {
  background: #21262d;
  color: var(--text-main);
  border-color: #30363d;
}

.btn-secondary:hover {
  background: #30363d;
}

.btn-outline {
  background: transparent;
  border-color: #30363d;
  color: var(--text-main);
}

.btn-outline:hover {
  background: #21262d;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.btn-success {
  background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
  color: #ffffff;
  border-color: #3fb950;
  font-weight: 700;
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, #2ea043 0%, #3fb950 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(46, 160, 67, 0.4);
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
}

.btn-text:hover {
  color: var(--text-main);
}

.text-danger {
  color: var(--danger) !important;
}

.select-preset {
  background: #21262d;
  border: 1px solid #30363d;
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}

/* メインレイアウト */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

.pane {
  display: flex;
  flex-direction: column;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow-main);
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #21262d;
  border: 1px solid #30363d;
  color: var(--text-sub);
}

.badge-info {
  background: rgba(88, 166, 255, 0.15);
  border-color: rgba(88, 166, 255, 0.4);
  color: var(--primary);
}

.badge-success {
  background: rgba(63, 185, 80, 0.15);
  border-color: rgba(63, 185, 80, 0.4);
  color: var(--success);
}

.badge-warning {
  background: rgba(210, 153, 34, 0.15);
  border-color: rgba(210, 153, 34, 0.4);
  color: var(--warning);
}

/* アップロードドロップゾーン */
.upload-dropzone {
  border: 2px dashed #30363d;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  background: rgba(13, 17, 23, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--primary);
  background: rgba(88, 166, 255, 0.05);
}

.upload-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 8px;
}

.upload-dropzone p {
  font-size: 0.9rem;
  color: var(--text-main);
}

.upload-dropzone .hint {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-top: 6px;
}

.image-preview-area {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-sub);
}

.image-preview-area img {
  max-height: 200px;
  object-fit: contain;
  border-radius: 4px;
}

/* 盤面ツールバー */
.board-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-hint {
  font-size: 0.78rem;
  color: var(--text-sub);
  margin-left: auto;
}

/* 試験管グリッド (エディタ & ライブビュー) */
.tubes-grid-container {
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 16px;
  overflow-x: auto;
  min-height: 280px;
}

.tubes-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.tubes-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

/* 単一試験管コンポーネント */
.tube-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}

.tube-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 54px;
  padding: 0 1px;
}

.tube-header-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 38px;
  transition: color 0.15s ease;
}

.tube-header-label:hover {
  color: var(--primary);
  text-decoration: underline;
}

.btn-delete-tube {
  background: rgba(248, 81, 73, 0.2);
  border: 1px solid rgba(248, 81, 73, 0.45);
  color: #ff7b72;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  line-height: 1;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-delete-tube:hover {
  color: #ffffff;
  background-color: var(--danger);
  border-color: var(--danger);
  transform: scale(1.18);
  box-shadow: 0 0 8px rgba(248, 81, 73, 0.6);
}

.empty-tubes-prompt {
  grid-column: 1 / -1;
  text-align: center;
  padding: 36px 16px;
  color: var(--text-sub);
  font-size: 0.92rem;
}

.tube-container {
  width: 54px;
  height: 160px;
  border: 2.5px solid rgba(240, 246, 252, 0.4);
  border-top: none;
  border-radius: 0 0 24px 24px;
  background: rgba(22, 27, 34, 0.8);
  display: flex;
  flex-direction: column-reverse; /* 下からスロット0, 1, 2, 3 */
  padding: 3px;
  gap: 3px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6);
  position: relative;
  transition: all 0.2s ease;
}

.tube-container.tube-source {
  border-color: var(--warning);
  box-shadow: 0 0 16px rgba(210, 153, 34, 0.7), inset 0 0 10px rgba(210, 153, 34, 0.3);
  transform: translateY(-4px);
}

.tube-container.tube-target {
  border-color: var(--success);
  box-shadow: 0 0 16px rgba(63, 185, 80, 0.7), inset 0 0 10px rgba(63, 185, 80, 0.3);
}

.tube-container.tube-completed {
  border-color: #ffd700;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

/* スロット (タイル) */
.tube-slot {
  width: 100%;
  height: 34px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.tube-slot:hover {
  filter: brightness(1.2);
  transform: scale(1.05);
}

.tube-slot.slot-empty {
  background: rgba(48, 54, 61, 0.2);
  border: 1px dashed rgba(240, 246, 252, 0.1);
  color: transparent;
}

.tube-slot.slot-hidden {
  background: #333338;
  border: 1px solid #55555e;
  color: #ffcc00;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.8);
}

/* タイル集計カード */
.tiles-summary-card {
  background: rgba(13, 17, 23, 0.4);
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px;
}

.tiles-summary-card h3 {
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.tiles-count-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tile-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  background: #21262d;
  border: 1px solid #30363d;
}

.tile-badge.exact {
  border-color: var(--success);
  color: var(--success);
}

.tile-badge.mismatch {
  border-color: var(--warning);
  color: var(--warning);
}

/* アラートバナー */
.alert-banner {
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(210, 153, 34, 0.15);
  border: 1px solid rgba(210, 153, 34, 0.4);
  color: var(--warning);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 統計バー */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  background: rgba(13, 17, 23, 0.5);
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-sub);
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

/* 現在の手大型カード */
.current-move-card {
  background: linear-gradient(135deg, rgba(31, 111, 235, 0.15) 0%, rgba(13, 17, 23, 0.8) 100%);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.move-step-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.move-instruction {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
}

.move-detail-sub {
  font-size: 0.88rem;
  color: var(--text-sub);
}

/* コントローラー */
.player-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.btn-control {
  background: #21262d;
  border: 1px solid #30363d;
  color: var(--text-main);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-control:hover:not(:disabled) {
  background: #30363d;
  color: #ffffff;
}

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

.btn-play {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  min-width: 100px;
}

.btn-play:hover:not(:disabled) {
  background: var(--primary-hover);
}

/* ライブ盤面 */
.live-board-wrapper {
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 14px;
}

.live-board-title {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-bottom: 10px;
}

/* 手順リスト */
.steps-list-wrapper {
  background: rgba(13, 17, 23, 0.4);
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px;
  max-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.steps-list-wrapper h3 {
  font-size: 0.85rem;
  color: var(--text-sub);
}

.steps-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-row {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  background: rgba(22, 27, 34, 0.6);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.step-row:hover {
  background: #21262d;
}

.step-row.active {
  background: rgba(88, 166, 255, 0.2);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
}

.step-num {
  width: 32px;
  font-weight: bold;
  color: var(--text-sub);
}

.step-desc {
  flex-grow: 1;
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  display: inline-block;
}

.empty-steps-hint {
  font-size: 0.85rem;
  color: var(--text-sub);
  text-align: center;
  padding: 16px;
}

/* モーダル */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-dialog {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: var(--border-radius);
  padding: 24px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-dialog-highlight {
  border-color: var(--warning);
  box-shadow: 0 0 30px rgba(210, 153, 34, 0.4);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-badge-icon {
  font-size: 2.2rem;
}

.modal-header h3 {
  font-size: 1.15rem;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-sub);
  cursor: pointer;
}

.symbol-palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.symbol-palette-lg {
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.palette-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 4px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: #21262d;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 600;
  gap: 4px;
}

.palette-btn:hover {
  filter: brightness(1.25);
  transform: scale(1.05);
}

.palette-btn.selected {
  border-color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

.palette-btn .icon {
  font-size: 1.3rem;
}

.palette-btn .name {
  font-size: 0.72rem;
  color: #dddddd;
}

.palette-special {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-palette-special {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  background: #21262d;
  border: 1px solid #30363d;
  color: var(--text-main);
  cursor: pointer;
  font-weight: 600;
}

.btn-palette-special:hover {
  background: #30363d;
}

.reveal-select-hint {
  font-size: 0.88rem;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 推測特定カード */
.deduction-card {
  background: linear-gradient(135deg, rgba(210, 153, 34, 0.2) 0%, rgba(13, 17, 23, 0.9) 100%);
  border: 1px solid rgba(210, 153, 34, 0.6);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(210, 153, 34, 0.25);
  animation: fadeIn 0.3s ease;
}

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

.deduction-icon {
  font-size: 1.6rem;
}

.deduction-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffd700;
}

.deduction-desc {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-top: 2px;
}

.deduction-tile-display {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.deduction-tile-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* 場合分け攻略カード */
.case-branch-card {
  background: linear-gradient(135deg, rgba(188, 140, 255, 0.18) 0%, rgba(13, 17, 23, 0.9) 100%);
  border: 1px solid rgba(188, 140, 255, 0.5);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(188, 140, 255, 0.2);
  animation: fadeIn 0.3s ease;
}

.case-branch-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.case-branch-icon {
  font-size: 1.6rem;
}

.case-branch-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--purple);
}

.case-branch-desc {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-top: 2px;
}

.case-select-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.case-select-label {
  font-size: 0.82rem;
  color: var(--text-main);
  font-weight: 600;
}

.case-select {
  padding: 8px 12px;
  border-radius: 8px;
  background: #161b22;
  border: 1px solid var(--purple);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.case-select:focus {
  box-shadow: 0 0 0 2px rgba(188, 140, 255, 0.4);
}

.case-assignment-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 10px;
  border-radius: 6px;
}

.case-assignment-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #ffffff;
}

.common-moves-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(63, 185, 80, 0.2);
  border: 1px solid var(--success);
  color: var(--success);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* 開錠マイルストーンバナー */
.case-probe-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.22) 0%, rgba(31, 111, 235, 0.12) 100%);
  border: 1px solid rgba(88, 166, 255, 0.6);
  border-radius: 8px;
  padding: 10px 14px;
}

.probe-info-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.probe-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.probe-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
}

.btn-accent {
  background: linear-gradient(135deg, #1f6feb 0%, #388bfd 100%);
  border: 1px solid #58a6ff;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(31, 111, 235, 0.4);
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-accent:hover {
  background: linear-gradient(135deg, #388bfd 0%, #58a6ff 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(88, 166, 255, 0.5);
}

/* 開錠時のタイル分岐ガイド */
.case-outcomes-guide {
  background: rgba(13, 17, 23, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.outcomes-header {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-sub);
}

.outcomes-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.outcome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  border: 1px solid transparent;
}

.outcome-row.outcome-success {
  background: rgba(46, 160, 67, 0.15);
  border-color: rgba(46, 160, 67, 0.4);
  color: #e6edf3;
}

.outcome-row.outcome-info {
  background: rgba(88, 166, 255, 0.12);
  border-color: rgba(88, 166, 255, 0.4);
  color: #e6edf3;
}

.outcome-row.outcome-warning {
  background: rgba(210, 153, 34, 0.15);
  border-color: rgba(210, 153, 34, 0.4);
  color: #e6edf3;
}

.outcome-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.78rem;
  color: #ffffff;
  white-space: nowrap;
}

.outcome-text-area {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.outcome-title {
  font-weight: 700;
  font-size: 0.82rem;
}

.outcome-instruction {
  font-size: 0.78rem;
  color: var(--text-sub);
}

/* モーダル内のクイック選択肢 */
.quick-choices-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.quick-choices-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-choice-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #161b22;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.quick-choice-btn:hover {
  transform: translateY(-1px);
  border-color: #58a6ff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.quick-choice-btn.primary-match {
  background: linear-gradient(135deg, rgba(46, 160, 67, 0.2) 0%, rgba(22, 27, 34, 0.9) 100%);
  border-color: #2ea043;
}

.quick-choice-btn.primary-match:hover {
  background: linear-gradient(135deg, rgba(46, 160, 67, 0.35) 0%, rgba(22, 27, 34, 0.9) 100%);
  border-color: #3fb950;
}

.quick-choice-btn.alt-match {
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.18) 0%, rgba(22, 27, 34, 0.9) 100%);
  border-color: #388bfd;
}

.quick-choice-tile-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-choice-tile-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  color: #ffffff;
}

.quick-choice-action-text {
  font-size: 0.8rem;
  color: var(--text-sub);
}

.reveal-select-divider {
  display: flex;
  align-items: center;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-sub);
  margin: 14px 0 8px 0;
}

.reveal-select-divider::before,
.reveal-select-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #30363d;
}

.reveal-select-divider::before {
  margin-right: 10px;
}

.reveal-select-divider::after {
  margin-left: 10px;
}

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

/* ==========================================================================
   スマホ最適化 (Mobile First & Responsive Layouts)
   ========================================================================== */

.version-tag {
  font-size: 0.65rem;
  padding: 2px 6px;
  background: rgba(88, 166, 255, 0.2);
  color: var(--primary);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 4px;
}

/* PCではスマホ用タブと下部バーを非表示 */
.mobile-tab-nav {
  display: none;
}

.mobile-sticky-bar {
  display: none;
}

/* スマホ表示 (画面幅 768px 以下) */
@media (max-width: 768px) {
  body {
    padding-bottom: 74px; /* 下部スティッキーバー用の余白 */
  }

  .app-container {
    padding: 8px 8px 80px 8px;
    gap: 10px;
  }

  /* ヘッダーのコンパクト化 */
  .app-header {
    padding: 10px 12px;
    gap: 8px;
  }

  .logo-icon {
    font-size: 1.6rem;
  }

  .app-header h1 {
    font-size: 1.1rem;
    letter-spacing: -0.3px;
  }

  .subtitle {
    display: none; /* スマホではタイトルをすっきり1行化 */
  }

  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .header-actions a.btn,
  .header-actions .select-preset,
  .header-actions button.btn {
    width: 100%;
    font-size: 0.8rem;
    padding: 7px 8px;
  }

  .header-actions #btnStartSolve {
    grid-column: 1 / -1; /* 幅いっぱいに配置 */
    padding: 10px;
    font-size: 0.95rem;
  }

  /* スマホ用タブナビゲーション */
  .mobile-tab-nav {
    display: flex;
    gap: 8px;
    background: rgba(22, 27, 34, 0.95);
    backdrop-filter: blur(14px);
    border: 1px solid var(--bg-card-border);
    border-radius: 12px;
    padding: 5px;
    position: sticky;
    top: 6px;
    z-index: 80;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  }

  .mobile-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-sub);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
  }

  .mobile-tab-btn.active {
    background: #21262d;
    color: #ffffff;
    border-color: #388bfd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  }

  .mobile-tab-btn .tab-icon {
    font-size: 1.15rem;
  }

  .tab-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3fb950;
    box-shadow: 0 0 6px #3fb950;
  }

  /* タブ切替時のペイン非表示 */
  .pane.mobile-hidden {
    display: none !important;
  }

  .card {
    padding: 14px 12px;
    gap: 12px;
    border-radius: 12px;
  }

  .card-header h2 {
    font-size: 1.05rem;
  }

  /* ツールバーのスマホ最適化 */
  .board-toolbar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .board-toolbar .btn-sm {
    padding: 7px 4px;
    font-size: 0.76rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .toolbar-hint {
    grid-column: 1 / -1;
    font-size: 0.72rem;
    margin-left: 0;
    text-align: center;
    color: var(--text-sub);
  }

  /* 試験管グリッド (スマホ: 6本が1行にぴったり収まるゲーム再現構成) */
  .tubes-grid-container {
    padding: 10px 4px;
    min-height: auto;
    overflow-x: hidden;
  }

  .tubes-grid {
    gap: 8px;
    width: 100%;
  }

  .tubes-row {
    gap: 4px;
    width: 100%;
    margin-bottom: 6px;
  }

  .tube-card {
    gap: 3px;
  }

  .tube-container {
    width: 50px;
    height: 146px;
    padding: 2.5px;
    gap: 2.5px;
    border-width: 2px;
    border-radius: 0 0 16px 16px;
  }

  .tube-slot {
    height: 32px;
    font-size: 0.95rem;
    border-radius: 5px;
  }

  .tube-header-bar {
    width: 50px;
  }

  .tube-header-label {
    font-size: 0.72rem;
    max-width: 32px;
  }

  .btn-delete-tube {
    width: 16px;
    height: 16px;
    font-size: 0.72rem;
    border-radius: 3px;
  }

  /* タイル集計 (スマホ) */
  .tiles-count-grid {
    gap: 5px;
  }

  .tile-badge {
    padding: 2px 6px;
    font-size: 0.72rem;
  }

  /* 攻略ナビ統計バー (スマホ) */
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  .stat-value {
    font-size: 1rem;
  }

  /* 現在の手カード (スマホ) */
  .current-move-card {
    padding: 14px;
  }

  .move-step-num {
    font-size: 0.85rem;
  }

  .move-instruction {
    font-size: 1.45rem;
    margin: 4px 0;
  }

  .move-detail-sub {
    font-size: 0.88rem;
  }

  /* 再生コントロール (スマホ) */
  .player-controls {
    gap: 8px;
  }

  .btn-control {
    min-height: 48px;
    font-size: 1.25rem;
  }

  .btn-play {
    font-size: 1rem;
    padding: 0 18px;
  }

  /* スマホ用 スティッキー下部アクションバー */
  .mobile-sticky-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: rgba(13, 17, 23, 0.96);
    backdrop-filter: blur(14px);
    border-top: 1px solid #30363d;
    z-index: 90;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
  }

  .btn-mobile-action {
    width: 100%;
    padding: 13px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 10px;
    letter-spacing: 0.5px;
  }

  /* タイル選択モーダル（ボトムシート風スライドアップ） */
  .modal {
    align-items: flex-end;
  }

  .modal-dialog {
    max-width: 100%;
    width: 100%;
    margin: 0;
    border-radius: 18px 18px 0 0;
    max-height: 85vh;
    padding: 18px 14px;
    box-shadow: 0 -8px 36px rgba(0, 0, 0, 0.85);
    animation: slideUp 0.25s ease-out;
  }

  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .symbol-palette {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .palette-btn {
    height: 46px;
    padding: 4px;
    font-size: 0.8rem;
    gap: 2px;
  }

  .palette-btn .icon {
    font-size: 1.15rem;
  }

  .palette-btn .name {
    font-size: 0.68rem;
  }

  .palette-special {
    gap: 8px;
    margin-top: 12px;
  }

  .btn-palette-special {
    padding: 12px;
    font-size: 0.95rem;
    border-radius: 8px;
  }

  @media (max-width: 370px) {
    .tubes-row {
      gap: 2.5px;
    }
    .tube-container {
      width: 46px;
      height: 136px;
    }
    .tube-slot {
      height: 30px;
      font-size: 0.88rem;
    }
    .tube-header-bar {
      width: 46px;
    }
    .tube-header-label {
      font-size: 0.68rem;
      max-width: 28px;
    }
  }
}


