/* HN Retro Terminal — green phosphor CRT style
 * 固定ページ本文に .hnr-terminal を含むときだけ enqueue される
 * (functions.php の wp_enqueue_scripts フック参照)
 */

.hnr-terminal {
  background: #000;
  color: #33ff33;
  font-family: "Courier New", Courier, "Andale Mono", "Liberation Mono", monospace;
  font-size: 12pt;
  line-height: 1.55;
  padding: 22px 26px;
  margin: 20px 0;
  border: 1px solid #1f4d1f;
  text-shadow: 0 0 1px #33ff33, 0 0 5px rgba(51, 255, 51, 0.35);
  /* スキャンライン (控えめ) */
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.22) 3px
  );
  background-attachment: local;
  overflow-x: auto;
  cursor: text;
}

.hnr-terminal a,
.hnr-terminal a:link {
  color: #7cff7c;
  text-decoration: underline;
}
.hnr-terminal a:visited { color: #4ec74e; }
.hnr-terminal a:hover { color: #ffffff; text-shadow: 0 0 4px #ffffff; }

.hnr-terminal hr {
  border: 0;
  border-top: 1px dashed #1f4d1f;
  margin: 10px 0;
}

.hnr-terminal p { margin: 0 0 6px 0; }
.hnr-terminal .prompt { color: #7cff7c; }
.hnr-terminal .dim    { color: #1aaf1a; }
.hnr-terminal .warn   { color: #ffea7c; }
.hnr-terminal h1,
.hnr-terminal h2,
.hnr-terminal h3 {
  font-family: inherit;
  font-weight: bold;
  font-size: 12pt;
  margin: 14px 0 6px 0;
  color: #c8ffc8;
}

/* タイプ中・タイプ後の点滅カーソル (▌) */
.hnr-terminal [data-typewriter]::after {
  content: "\2588";
  display: inline-block;
  margin-left: 2px;
  color: #33ff33;
  animation: hnr-blink 1.05s steps(2) infinite;
  text-shadow: 0 0 6px #33ff33;
}

@keyframes hnr-blink {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* prefers-reduced-motion: 点滅も停止 */
@media (prefers-reduced-motion: reduce) {
  .hnr-terminal [data-typewriter]::after {
    animation: none;
    opacity: 1;
  }
}

/* スマホ */
@media (max-width: 800px) {
  .hnr-terminal {
    font-size: 11pt;
    padding: 16px 18px;
  }
}

/* ============================================================
   Interactive Prompt (prompt.js が動的に注入)
   ============================================================ */

/* タイプライタが終わったら末尾カーソルを消す (プロンプトに譲る) */
.hnr-terminal [data-typewriter].is-typed::after {
  display: none;
}

.hnr-prompt {
  margin-top: 16px;
}

.hnr-prompt-output {
  white-space: pre-wrap;
  word-break: break-word;
}
.hnr-prompt-output > div {
  margin: 0;
}
.hnr-prompt-echo {
  color: #c8ffc8;
}

.hnr-prompt-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}
.hnr-prompt-prefix {
  color: #7cff7c;
  white-space: nowrap;
  flex-shrink: 0;
}
.hnr-prompt-input {
  flex: 1;
  min-width: 8em;
  background: transparent;
  border: 0;
  outline: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  padding: 0;
  margin: 0;
  caret-color: #33ff33;
  text-shadow: inherit;
}
.hnr-prompt-input::placeholder {
  color: rgba(51, 255, 51, 0.4);
}
.hnr-prompt-input::-webkit-input-placeholder {
  color: rgba(51, 255, 51, 0.4);
}

/* ============================================================
   入力待ちカーソル (点滅) — 訪問者に「ここに入力できる」を視覚的に示す
   フォーカス時はネイティブキャレットに引き継ぐ
   ============================================================ */
.hnr-prompt-blinker {
  display: inline-block;
  color: #33ff33;
  margin: 0 4px 0 0;
  text-shadow: 0 0 6px #33ff33;
  animation: hnr-blink 1.05s steps(2) infinite;
  pointer-events: none;
  user-select: none;
}
.hnr-prompt-line:focus-within .hnr-prompt-blinker {
  display: none;
}
/* 入力待ちカーソルは UI 機能 (装飾ではない) として常時点滅させる */
/* prefers-reduced-motion でも止めない: 「ここに入力できる」のサインなので */
.hnr-terminal.amber-mode .hnr-prompt-blinker {
  color: #ffb000;
  text-shadow: 0 0 6px #ffb000;
}

/* コマンド出力内 <pre> ブロック (help テーブル / whois / weather など) */
.hnr-prompt-block {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.15; /* 罫線が連結するよう詰める */
  color: inherit;
  white-space: pre;
  overflow-x: auto;
}

/* ============================================================
   ★ テーマ衝突防御 (header.php の article.single .content pre/code/a
      による白背景・小フォント・黒リンク等を打ち消す)
   ============================================================ */
.hnr-terminal pre,
.hnr-terminal code {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
  color: inherit !important;
}
.hnr-terminal a,
.hnr-terminal a:link {
  color: #7cff7c !important;
  text-decoration: underline !important;
}
.hnr-terminal a:visited { color: #4ec74e !important; }
.hnr-terminal a:hover   { color: #ffffff !important; text-shadow: 0 0 4px #ffffff !important; }
.hnr-terminal img { display: inline !important; }

/* ============================================================
   コマンドメニュー表 (typewriter 内に組み込み、boot に続いてタイプされる)
   ============================================================ */
.hnr-cheatsheet {
  margin: 14px 0 0 0 !important;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.15 !important; /* 罫線が連結するよう詰める */
  color: inherit;    /* .hnr-terminal の緑を継承、amber-mode 時もアンバーを継承 */
  background: transparent; /* .hnr-terminal の黒地を透過 */
  white-space: pre;
  overflow-x: auto;
  text-shadow: inherit;
}
.hnr-prompt-block { line-height: 1.15 !important; }

/* コマンド出力内のリンク */
.hnr-prompt-output a,
.hnr-prompt-output a:link {
  color: #7cff7c;
  text-decoration: underline;
}
.hnr-prompt-output a:visited { color: #4ec74e; }
.hnr-prompt-output a:hover   { color: #ffffff; text-shadow: 0 0 4px #ffffff; }

/* エラー出力 (赤) */
.hnr-err {
  color: #ff7c7c;
  text-shadow: 0 0 1px #ff7c7c, 0 0 5px rgba(255, 124, 124, 0.35);
}

/* ローディング/ヒント等の暗めの行 */
.hnr-dim {
  color: #1aaf1a;
}

/* ============================================================
   Amber Mode (konami コマンドで切替)
   ============================================================ */
.hnr-terminal.amber-mode {
  color: #ffb000;
  text-shadow: 0 0 1px #ffb000, 0 0 5px rgba(255, 176, 0, 0.35);
  border-color: #4d3500;
}
.hnr-terminal.amber-mode a,
.hnr-terminal.amber-mode a:link    { color: #ffd66b; }
.hnr-terminal.amber-mode a:visited { color: #c98c00; }
.hnr-terminal.amber-mode a:hover   { color: #ffffff; text-shadow: 0 0 4px #ffffff; }
.hnr-terminal.amber-mode hr        { border-top-color: #4d3500; }
.hnr-terminal.amber-mode .prompt   { color: #ffd66b; }
.hnr-terminal.amber-mode .dim      { color: #b07700; }
.hnr-terminal.amber-mode .hnr-prompt-prefix { color: #ffd66b; }
.hnr-terminal.amber-mode .hnr-prompt-echo   { color: #ffe7a8; }
.hnr-terminal.amber-mode .hnr-prompt-input  { caret-color: #ffb000; }
.hnr-terminal.amber-mode .hnr-prompt-input::placeholder { color: rgba(255, 176, 0, 0.4); }
.hnr-terminal.amber-mode [data-typewriter]::after { color: #ffb000; text-shadow: 0 0 6px #ffb000; }
.hnr-terminal.amber-mode .hnr-prompt-output a,
.hnr-terminal.amber-mode .hnr-prompt-output a:link { color: #ffd66b; }
.hnr-terminal.amber-mode .hnr-prompt-output a:visited { color: #c98c00; }
.hnr-terminal.amber-mode .hnr-prompt-output a:hover { color: #ffffff; text-shadow: 0 0 4px #ffffff; }
.hnr-terminal.amber-mode .hnr-err { color: #ffa566; text-shadow: 0 0 1px #ffa566, 0 0 5px rgba(255, 165, 102, 0.35); }
.hnr-terminal.amber-mode .hnr-dim { color: #b07700; }

/* 起動シーケンス (boot) の強調スタイル */
.hnr-terminal .boot-ok    { color: #c8ffc8; font-weight: bold; }
.hnr-terminal .boot-banner{ color: #c8ffc8; }
.hnr-terminal .boot-ready { color: #ffea7c; font-weight: bold; text-shadow: 0 0 4px #ffea7c; }
.hnr-terminal.amber-mode .boot-ok    { color: #ffe7a8; }
.hnr-terminal.amber-mode .boot-banner{ color: #ffe7a8; }
.hnr-terminal.amber-mode .boot-ready { color: #ffffff; text-shadow: 0 0 4px #ffffff; }
/* .hnr-cheatsheet は color: inherit のため amber-mode の親色を自動継承 */
