/* ============================================================
   screen-quest.css  ―  クエスト選択画面（ドット絵スタイル）
   index.html で読み込む
   ============================================================ */

/* htmlのzoom: 1.5を考慮し、実表示では画面高の約90%に収める */
.quest-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  width: 90%;
  max-width: 600px;
  max-height: 60vh;
  overflow-y: auto;
  text-align: center;
}

.quest-container h2 {
  font-size: 1.8rem;
  margin-bottom: 12px;
  color: #e94560;
}

.player-info-bar {
  background: #16213e;
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: var(--ui-text-main);
}

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 14px;
}

.quest-card {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  transition: border-color 0.2s;
}

.quest-card:hover {
  border-color: #e94560;
}

.quest-card.locked {
  opacity: 0.5;
  pointer-events: none;
}

.quest-icon {
  font-size: 2.5rem;
  min-width: 50px;
  text-align: center;
}

.quest-info {
  flex: 1;
}

.quest-info h3 {
  font-size: 1.1rem;
  color: var(--ui-text-main);
  margin-bottom: 4px;
}

.quest-info p {
  font-size: 0.85rem;
  color: var(--ui-text-subtle);
  margin-bottom: 2px;
}

.lock-text {
  color: #e94560 !important;
  font-weight: bold;
}

/* --- ドット絵スタイル --- */

/* クエスト画面の背景 */
#screen-quest {
  background: #030312;
  overflow: hidden;
}

/* スキャンライン効果（CRTモニター風） */
#screen-quest::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.08) 3px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  z-index: 10;
}

/* 見出し：RPGウィンドウタイトル風 */
#screen-quest .quest-container h2 {
  font-family: 'DotGothic16', monospace;
  font-size: 1.3rem;
  color: var(--ui-text-main);
  letter-spacing: 4px;
  margin-bottom: 16px;
  /* 装飾ライン */
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

#screen-quest .quest-container h2::before,
#screen-quest .quest-container h2::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, transparent, #888888);
}

#screen-quest .quest-container h2::after {
  background: linear-gradient(to left, transparent, #888888);
}

/* ステータスバー */
#screen-quest .status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  height: 54px;
  background: transparent;
  border-top: 2px solid #3b485d;
  border-bottom: 2px solid #3b485d;
  border-radius: 0;
  margin-bottom: 14px;
}

/* ステータステキスト */
#screen-quest .status-text {
  font-family: 'DotGothic16', monospace;
  font-size: 0.95rem;
  color: var(--ui-text-main);
  letter-spacing: 1px;
  line-height: 1;
}

/* HP/MP表示（バトル・デッキ画面と配色を統一：数値を色付け） */
#screen-quest .status-hp span {
  color: #4ec94e;
}

#screen-quest .status-mp span {
  color: #6ec1ff;
}

/* 特技メニュー項目 */
#screen-quest .skill-button {
  font-family: 'DotGothic16', monospace;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ui-text-subtle);
  letter-spacing: 2px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.1s;
}

#screen-quest .skill-button .icon-wrap {
  position: relative;
  display: inline-block;
  width: 1em;
  height: 1em;
}

#screen-quest .skill-button .icon-normal,
#screen-quest .skill-button .icon-hover {
  position: absolute;
  top: 0;
  left: 0;
}

#screen-quest .skill-button .icon-hover {
  visibility: hidden;
}

#screen-quest .skill-button:hover {
  color: var(--ui-text-main);
}

#screen-quest .skill-button:hover .icon-normal {
  visibility: hidden;
}

#screen-quest .skill-button:hover .icon-hover {
  visibility: visible;
}

/* クエストカード：地域の色を左端と暗い背景に使う */
#screen-quest .quest-card,
#screen-quest .quest-card:hover {
  --quest-accent: #657086;
  --quest-surface: #0b1220;
  background: linear-gradient(105deg, var(--quest-surface), #080d1a 85%);
  box-shadow:
    inset 4px 0 0 var(--quest-accent),
    0 0 0 2px #000000,
    0 0 0 4px #414d63,
    0 0 0 6px #000000;
  border-radius: 0;
  border: none;
  transition: box-shadow 0.1s;
}

/* 既存の挑戦ボタンのクエストIDに対応する地域色 */
#screen-quest .quest-card:has([data-quest-id="grassland"]) {
  --quest-accent: #80ba91;
  --quest-surface: #10221a;
}

#screen-quest .quest-card:has([data-quest-id="forest"]) {
  --quest-accent: #5daba0;
  --quest-surface: #0f2223;
}

#screen-quest .quest-card:has([data-quest-id="cave"]) {
  --quest-accent: #ad96cc;
  --quest-surface: #1c1930;
}

/* クエスト名 */
#screen-quest .quest-info h3 {
  font-family: 'DotGothic16', monospace;
  font-size: 1.05rem;
  color: var(--ui-text-main);
}

/* クエスト説明テキスト */
#screen-quest .quest-info p {
  font-family: 'DotGothic16', monospace;
  font-size: 0.85rem;
  color: var(--ui-text-subtle);
}

/* 挑戦するボタン（ピクセルウィンドウ枠） */
#screen-quest .btn-primary {
  font-family: 'DotGothic16', monospace;
  font-size: 0.95rem;
  background: #161e2e;
  color: var(--ui-text-main);
  border: none;
  border-radius: 0;
  box-shadow:
    0 0 0 2px #000000,
    0 0 0 4px #657086,
    0 0 0 6px #000000;
  padding: 8px 20px 8px 30px;
  letter-spacing: 2px;
  transition: background-color 0.1s, box-shadow 0.1s;
}

#screen-quest .btn-primary:hover,
#screen-quest .btn-primary:focus-visible {
  background: #233149;
}

/* タイトルへ戻るボタン（ピクセルメニュー項目風） */
#screen-quest .btn-secondary {
  font-family: 'DotGothic16', monospace;
  font-size: 1rem;
  background: transparent;
  border: none;
  color: var(--ui-text-main);
  letter-spacing: 2px;
  cursor: pointer;
  padding: 8px 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  transition: color 0.1s;
}

/* 戻る操作もトップと同じく、フォーカス中だけ穏やかに明滅するカーソルで示す。 */
#btn-quest-back .pixel-cursor {
  visibility: hidden;
  animation: none;
}

#btn-quest-back:focus .pixel-cursor {
  visibility: visible;
  animation: var(--menu-cursor-animation);
}

#btn-quest-back:focus-visible {
  outline: none;
}

#screen-quest .btn-secondary:hover {
  border-color: transparent;
  color: var(--ui-text-main);
}

/* クエスト画面フッターのボタン配置 */
.quest-footer-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin-top: 12px;
  padding: 12px 0 4px;
  background: #030312;
}

/* 難易度モードセレクタ（easy/normal/hard/extreme） */
#screen-quest .difficulty-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  /* 外側6pxの装飾枠を両側に描いても、隣のボタンと重ならない余白を取る。 */
  gap: 16px;
  margin-bottom: 14px;
}

#screen-quest .difficulty-label {
  font-family: 'DotGothic16', monospace;
  font-size: 0.85rem;
  color: var(--ui-text-subtle);
  letter-spacing: 2px;
}

/* 各難易度ボタンは文字数によらず同じ幅・高さに揃える */
#screen-quest .difficulty-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 110px;
  height: 40px;
  flex-shrink: 0;
  font-family: 'DotGothic16', monospace;
  font-size: 0.9rem;
  background: transparent;
  color: var(--ui-text-subtle);
  border: none;
  border-radius: 0;
  box-shadow:
    0 0 0 2px #000000,
    0 0 0 4px #555555,
    0 0 0 6px #000000;
  /* 幅と高さは揃えたまま、左側に操作カーソルの場所を確保する。 */
  padding: 0 6px 0 26px;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: 1px;
  cursor: pointer;
  transition: color 0.1s, box-shadow 0.1s;
}

#screen-quest .difficulty-button:hover {
  color: var(--ui-text-main);
}

/* 選択中の難易度は枠・背景・文字で示す */
#screen-quest .difficulty-button.active {
  color: var(--ui-text-main);
  background: #16263f;
  box-shadow:
    0 0 0 2px #000000,
    0 0 0 4px #7396c4,
    0 0 0 6px #000000;
}

#screen-quest .btn-primary:focus-visible,
#screen-quest .difficulty-button:focus-visible {
  outline: none;
}

/* PCでは1.5倍表示と外側の装飾枠を考慮し、4ボタンを同じ行に収める。 */
@media (min-width: 641px) {
  #screen-quest .difficulty-selector {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 500px;
    margin-right: auto;
    margin-left: auto;
    padding: 0 6px 6px;
  }

  #screen-quest .difficulty-label {
    grid-column: 1 / -1;
  }

  #screen-quest .difficulty-selector button.difficulty-button {
    width: 100%;
    min-width: 0;
    padding: 0 4px 0 20px;
    font-size: clamp(0.625rem, 1.5vw, 0.9rem);
    letter-spacing: 0.5px;
  }

  #screen-quest .difficulty-button .menu-cursor {
    left: 4px;
    font-size: 0.85em;
  }
}
