/* ============================================================
   Title screen styles
   ============================================================ */

#screen-title {
  background: #030312;
  overflow: hidden;
}

#screen-title::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;
}

.pixel-title-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  padding: 20px;
}

.pixel-logo-area {
  display: flex;
  align-items: center;
  gap: 40px;
}

.pixel-sprite {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  width: 96px;
  height: 96px;
}

.pixel-monster-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: pixel-float 2s ease-in-out infinite alternate;
}

.pixel-monster-box:last-child {
  animation-delay: 1s;
}

.pixel-monster-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.4rem;
  color: #555;
  letter-spacing: 2px;
}

@keyframes pixel-float {
  from { transform: translateY(0px); }
  to { transform: translateY(-8px); }
}

.pixel-logo-text {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pixel-title-en {
  font-family: 'Press Start 2P', monospace;
  font-size: 2.4rem;
  color: var(--ui-text-main);
  text-shadow: 4px 4px 0 #26314a;
  letter-spacing: 4px;
}

.pixel-title-ja {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.65rem;
  color: var(--ui-text-main);
  letter-spacing: 4px;
}

.pixel-character-area {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  background: rgba(0, 0, 8, 0.7);
  box-shadow:
    0 0 0 2px #000000,
    0 0 0 4px #888888;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

.pixel-character-area:hover,
.pixel-character-area:focus-visible {
  box-shadow:
    0 0 0 2px #000000,
    0 0 0 4px var(--ui-focus);
  outline: none;
}

.pixel-character-frame {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pixel-character-image {
  width: 80px;
  height: 80px;
  display: block;
}

.pixel-character-area.is-empty .pixel-character-image {
  display: none;
}

.pixel-character-placeholder {
  font-family: 'Press Start 2P', monospace;
  font-size: 2.4rem;
  color: var(--ui-text-subtle);
  display: none;
}

.pixel-character-area.is-empty .pixel-character-placeholder {
  display: block;
}

.pixel-character-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pixel-character-name {
  font-family: 'DotGothic16', monospace;
  font-size: 1rem;
  color: var(--ui-text-main);
  letter-spacing: 1px;
}

.pixel-character-role {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5rem;
  color: var(--ui-text-subtle);
  letter-spacing: 2px;
}

.pixel-menu-box {
  background: rgba(0, 0, 8, 0.88);
  box-shadow:
    0 0 0 2px #000000,
    0 0 0 4px #cccccc,
    0 0 0 6px #000000;
  padding: 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pixel-menu-item {
  font-family: 'DotGothic16', monospace;
  font-size: 1.1rem;
  color: var(--ui-text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 2px;
  transition: color 0.1s;
  padding: 6px 0;
  background: transparent;
  border: none;
  text-align: left;
}

.pixel-menu-item:hover {
  color: var(--ui-text-subtle);
}

.pixel-menu-box > button {
  position: relative;
}

/* タイトルの選択位置は四角い枠ではなく、同じ左端に置いたカーソルで示す。 */
.pixel-menu-box > button:focus-visible {
  outline: none;
}

.pixel-menu-box .pixel-cursor {
  visibility: hidden;
  animation: none;
}

.pixel-menu-box > button:focus .pixel-cursor {
  visibility: visible;
  animation: var(--menu-cursor-animation);
}

.pixel-menu-box > .help-launcher {
  align-self: stretch;
}

.pixel-menu-box > .help-launcher .pixel-cursor {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  font-size: 1.1rem;
}

#menu-start-game,
#menu-start-game:hover {
  color: var(--ui-accent);
}

.pixel-cursor {
  color: inherit;
  display: inline-block;
  min-width: 1em;
}

.pixel-cursor-dummy {
  display: inline-block;
  min-width: 1em;
}

/* 既存リンク1行の高さを保ち、ゲームガイドをポリシーの左隣に置く。 */
.title-page-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* 両リンクのカーソル幅を常に確保し、フォーカスで文字を動かさない。 */
.title-privacy-link,
.title-guide-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: var(--ui-text-subtle);
  font: 0.7rem/1.6 'DotGothic16', monospace;
  text-decoration: none;
  white-space: nowrap;
}

.title-privacy-link:hover,
.title-guide-link:hover {
  color: var(--ui-text-main);
}

.title-privacy-link .pixel-cursor,
.title-guide-link .pixel-cursor {
  visibility: hidden;
  animation: none;
}

.title-privacy-link:focus .pixel-cursor,
.title-guide-link:focus .pixel-cursor {
  visibility: visible;
  animation: var(--menu-cursor-animation);
}

.title-privacy-link:focus-visible,
.title-guide-link:focus-visible {
  outline: none;
}

.pixel-catchcopy {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.45rem;
  color: #555555;
  text-align: center;
  letter-spacing: 1px;
  line-height: 2.5;
}

.pixel-footer {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem;
  color: var(--ui-text-subtle);
  letter-spacing: 3px;
}

.pixel-audio-controls {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 12;
  display: flex;
}

.pixel-volume-control {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 54px;
  padding: 10px 8px;
  border: 1px solid #343c50;
  background: rgba(3, 3, 18, 0.94);
}

.pixel-volume-control[hidden] {
  display: none;
}

/* アイコンとパネルの隙間もホバー領域に含める */
.pixel-volume-control::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 0;
  right: 0;
  height: 5px;
}

.pixel-volume-control output {
  min-width: 4ch;
  font-family: 'DotGothic16', monospace;
  font-size: 0.7rem;
  text-align: center;
  color: var(--ui-text-subtle);
}

.pixel-volume-track {
  position: relative;
  width: 24px;
  height: 112px;
}

.pixel-volume-slider {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 112px;
  height: 24px;
  margin: 0;
  /* 横向きの標準スライダーを回転し、上を最大音量にする */
  transform: translate(-50%, -50%) rotate(-90deg);
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.pixel-volume-slider::-webkit-slider-runnable-track {
  height: 6px;
  background: linear-gradient(to right, var(--ui-text-main) var(--bgm-volume, 100%), #343c50 var(--bgm-volume, 100%));
}

.pixel-volume-slider::-moz-range-track {
  height: 6px;
  background: #343c50;
}

.pixel-volume-slider::-moz-range-progress {
  height: 6px;
  background: var(--ui-text-main);
}

.pixel-volume-slider::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -4px;
  border: 2px solid #030312;
  border-radius: 0;
  -webkit-appearance: none;
  background: var(--ui-text-main);
}

.pixel-volume-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid #030312;
  border-radius: 0;
  background: var(--ui-text-main);
}

.pixel-volume-slider:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 2px;
}

.pixel-audio-toggle {
  width: 44px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: var(--ui-text-subtle);
  opacity: 0.7;
  cursor: pointer;
  transition:
    opacity 0.2s ease,
    color 0.2s ease,
    filter 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.pixel-audio-toggle:hover {
  opacity: 1;
  color: var(--ui-text-main);
  background: rgba(0, 0, 8, 0.12);
}

.pixel-audio-toggle:focus-visible {
  opacity: 1;
  outline: 2px solid var(--ui-focus);
  outline-offset: 2px;
}

.pixel-audio-toggle svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  stroke: none;
  shape-rendering: crispEdges;
  image-rendering: pixelated;
}

.pixel-audio-toggle .audio-wave,
.pixel-audio-toggle .audio-slash {
  transition: opacity 0.2s ease;
}

.pixel-audio-toggle .audio-slash {
  opacity: 0;
}

.pixel-audio-toggle.is-muted {
  opacity: 0.48;
  color: #7c8696;
  box-shadow: none;
  background: transparent;
}

.pixel-audio-toggle.is-muted .audio-wave {
  opacity: 0;
}

.pixel-audio-toggle.is-muted .audio-slash {
  opacity: 1;
}

@media (max-width: 700px) {
  .pixel-title-en {
    font-size: 1.6rem;
  }

  .pixel-logo-area {
    gap: 20px;
  }

  .pixel-sprite {
    width: 72px;
    height: 72px;
  }

  .pixel-menu-box {
    padding: 20px 32px;
  }
}

@media (max-width: 480px) {
  .pixel-title-en {
    font-size: 1.2rem;
    letter-spacing: 2px;
  }

  .pixel-logo-area {
    flex-direction: column;
    gap: 12px;
  }

  .pixel-logo-text {
    order: -1;
  }

  .pixel-menu-item {
    font-size: 0.65rem;
  }

  .pixel-audio-toggle {
    width: 38px;
    height: 34px;
  }

  .pixel-audio-toggle svg {
    width: 15px;
    height: 15px;
  }
}
