/* 遊び方のノート。画面例はゲーム本体を動かさず、HTMLで表示する。 */
.help-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  align-self: center;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: var(--ui-text-subtle);
  font: 0.85rem "DotGothic16", monospace;
  cursor: pointer;
}

.help-launcher svg {
  width: 24px;
  height: 24px;
}

.help-launcher:hover {
  color: var(--ui-text-main);
}

.help-launcher:focus-visible,
.help-button:focus-visible,
.help-details summary:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 3px;
}

.help-overlay[hidden],
.help-page[hidden] {
  display: none;
}

.help-overlay {
  padding: 10px;
  background: rgba(0, 0, 8, 0.88);
}

.overlay-content.help-notebook {
  width: 540px;
  min-width: 0;
  max-width: 100%;
  max-height: calc(100vh / var(--ui-scale) - 24px);
  max-height: calc(100dvh / var(--ui-scale) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
  border: 1px solid #7396c4;
  box-shadow: 0 0 0 3px #030312, 0 0 0 4px #414d63;
  background: #080d1a;
  text-align: left;
  scrollbar-gutter: stable;
}

.help-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid #303c52;
  background: #080d1a;
}

.help-notebook .help-header h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 2px;
}

.help-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 72px;
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid #7396c4;
  border-radius: 0;
  color: var(--ui-text-main);
  background: #16263f;
  font: 0.8rem "DotGothic16", monospace;
  cursor: pointer;
}

.help-button:hover:not(:disabled) {
  border-color: var(--ui-focus);
  background: var(--ui-selected-bg);
}

.help-button:disabled {
  border-color: #303c52;
  color: #737f94;
  background: transparent;
  cursor: default;
}

.help-close {
  min-width: 0;
  border-color: transparent;
  background: transparent;
}

.help-close span {
  font: 1.2rem sans-serif;
}

.help-page {
  padding: 16px 24px 18px;
}

.help-notebook .help-step-label {
  margin: 0 0 6px;
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: #a9bedb;
}

.help-notebook .help-page h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  line-height: 1.5;
  letter-spacing: 1px;
}

.help-notebook .help-copy,
.help-notebook .help-tip {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.8;
}

.help-notebook .help-copy {
  color: var(--ui-text-main);
}

.help-key-range {
  margin: 0 3px;
}

.help-example {
  margin: 14px 0 12px;
}

.help-example figcaption {
  margin-bottom: 6px;
  color: var(--ui-text-muted);
  font-size: 0.65rem;
}

.help-demo {
  padding: 14px 16px;
  border: 2px solid #414d63;
  box-shadow: inset 0 0 0 2px #030312;
  background: #030612;
  font-size: 0.75rem;
  line-height: 1.5;
}

.help-demo-heading,
.help-demo-gauge-label,
.help-demo-resource {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.help-demo-heading > span {
  flex-shrink: 0;
  color: var(--ui-text-subtle);
}

.help-demo-skills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.help-demo-skill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #526279;
  background: #10172a;
}

.help-demo-skill b {
  color: var(--ui-text-subtle);
  font-size: 0.9rem;
  font-weight: normal;
}

.help-demo-skill small {
  display: block;
  margin-top: 2px;
  color: var(--ui-text-subtle);
  font-size: 0.62rem;
}

.help-demo-selected {
  border-color: var(--ui-focus);
  background: var(--ui-selected-bg);
  box-shadow: 0 0 0 1px var(--ui-focus);
}

.help-demo-start {
  width: max-content;
  max-width: 100%;
  margin: 12px auto 0;
  padding: 6px 20px;
  border: 1px solid var(--ui-accent);
  color: var(--ui-accent);
}

.help-demo-start span {
  margin-left: 10px;
}

.help-demo-enemy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.help-demo-enemy > div {
  flex: 1;
}

.help-demo-enemy img {
  image-rendering: pixelated;
}

.help-demo-meter {
  height: 8px;
  margin-top: 5px;
  overflow: hidden;
  background: #242c3e;
}

.help-demo-meter > span {
  display: block;
  height: 100%;
}

.help-demo-hp > span { background: #58d888; }
.help-demo-charge > span { background: #f2a54a; }
.help-demo-enemy-gauge > span { background: #b889e3; }

.help-demo-word {
  padding: 8px 0 14px;
  text-align: center;
}

.help-demo-word > span {
  font-size: 1rem;
}

.help-demo-word > div {
  margin-top: 2px;
  font: 1.5rem monospace;
  letter-spacing: 3px;
}

.help-demo-typed {
  color: var(--ui-text-muted);
}

.help-demo-resource {
  color: var(--ui-text-subtle);
  font-size: 0.65rem;
}

.help-demo-resource > :last-child {
  border: 1px solid #526279;
  padding: 2px 5px;
}

.help-tip strong {
  color: var(--ui-text-main);
  font-weight: normal;
}

.help-notebook kbd {
  padding: 1px 4px;
  border: 1px solid #7396c4;
  background: #16263f;
  color: var(--ui-text-main);
  font: inherit;
}

.help-details {
  margin-top: 14px;
  border-top: 1px solid #303c52;
  color: var(--ui-text-subtle);
  font-size: 0.8rem;
  line-height: 1.8;
}

.help-details summary {
  padding: 8px 0 4px;
  color: var(--ui-text-main);
  cursor: pointer;
}

.help-details dt {
  margin-top: 10px;
  color: var(--ui-text-main);
}

.help-details dd {
  margin-top: 2px;
}

.help-navigation {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-top: 1px solid #303c52;
  background: #080d1a;
  color: var(--ui-text-subtle);
  font-size: 0.75rem;
}

@media (max-width: 600px) {
  .help-page { padding: 14px; }
  .help-header, .help-navigation { padding: 10px 12px; }
  .help-notebook .help-page h3 { font-size: 1.05rem; }
  .help-notebook .help-copy, .help-notebook .help-tip { font-size: 0.8rem; }
  .help-demo { padding: 10px; }
  .help-demo-skills { gap: 6px; }
  .help-demo-skill { gap: 6px; padding: 6px; font-size: 0.7rem; }
  .help-demo-resource { flex-wrap: wrap; }
  .help-button { min-width: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  .help-overlay, .help-notebook { transition: none; }
}
