/*
 * tarkov-chan-web / app.css
 *
 * Phase 0.5 UI シェル(D38)
 * 世界観: 廃病院 Medical Block の壊れかけ医療モニター(D39)
 * 構造: 2 レイヤー合成 — 背景 webp + Vera 透過 webp(D40)
 *
 * 設計参照: docs/08_web_design.md
 */

/* =============================================================================
 * Color Tokens & Variables
 * =========================================================================== */
:root {
  /* 背景階層 */
  --bg-outer: #050608;
  --bg-monitor: #0a0c0e;
  --bg-card: #1a1e22;
  --border: #2a3040;

  /* アクセント */
  --accent-primary: #c9a84c;
  --accent-primary-bright: #e0bc5e;
  --accent-primary-dim: #8a7235;
  --accent-secondary: #3a7d44;
  --accent-led: #4a9955;
  --accent-error: #c0392b;
  --accent-warn: #d68c2a;

  /* テキスト */
  --text-main: #d4cfc6;
  --text-sub: #8a8a8a;
  --text-disabled: #505050;

  /* サイズ */
  --header-height: 56px;
  --input-height: 84px;
  --status-bar-height: 28px;
  --bezel-width: 12px;

  /* フォント */
  --font-mono: "Share Tech Mono", "Rajdhani", "Courier New", monospace;
  --font-body: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", sans-serif;
}

@media (max-width: 767px) {
  :root {
    --bezel-width: 6px;
    --header-height: 52px;
  }
}

/* =============================================================================
 * Reset
 * =========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg-outer);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

button,
textarea,
select,
input {
  font-family: inherit;
  color: inherit;
}

textarea {
  user-select: text;
}

/* =============================================================================
 * Bezel — 画面外周の金属枠 + 四隅のコーナーブラケット (D39)
 * =========================================================================== */
.bezel {
  position: fixed;
  inset: 0;
  pointer-events: none;
  border: var(--bezel-width) solid #1a1e22;
  box-shadow:
    inset 0 0 0 1px var(--border),
    inset 0 0 80px rgba(0, 0, 0, 0.7),
    0 0 0 1px #050608;
  z-index: 1000;
}

.bezel-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 2px solid var(--accent-primary);
  pointer-events: none;
}

.bezel-corner--tl {
  top: 14px;
  left: 14px;
  border-right: none;
  border-bottom: none;
}
.bezel-corner--tr {
  top: 14px;
  right: 14px;
  border-left: none;
  border-bottom: none;
}
.bezel-corner--bl {
  bottom: 14px;
  left: 14px;
  border-right: none;
  border-top: none;
}
.bezel-corner--br {
  bottom: 14px;
  right: 14px;
  border-left: none;
  border-top: none;
}

@media (max-width: 767px) {
  .bezel-corner {
    width: 16px;
    height: 16px;
    border-width: 1px;
  }
  .bezel-corner--tl,
  .bezel-corner--tr {
    top: 10px;
  }
  .bezel-corner--bl,
  .bezel-corner--br {
    bottom: 10px;
  }
  .bezel-corner--tl,
  .bezel-corner--bl {
    left: 10px;
  }
  .bezel-corner--tr,
  .bezel-corner--br {
    right: 10px;
  }
}

/* =============================================================================
 * App Layout
 * =========================================================================== */
.app {
  position: fixed;
  inset: var(--bezel-width);
  display: grid;
  grid-template-rows:
    var(--header-height)
    1fr
    var(--input-height)
    var(--status-bar-height);
  grid-template-areas:
    "header"
    "stage"
    "input"
    "status";
  background: var(--bg-monitor);
  overflow: hidden;
  animation: boot-fade 800ms ease-out;
}

@keyframes boot-fade {
  0% {
    opacity: 0;
    transform: scale(0.985);
    filter: brightness(0.3);
  }
  60% {
    opacity: 0.6;
    filter: brightness(1.2);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }
}

/* =============================================================================
 * Header
 * =========================================================================== */
.header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: linear-gradient(to bottom, #1a1e22, #14171a);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
}

.header::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--accent-primary-dim) 30%,
    var(--accent-primary-dim) 70%,
    transparent
  );
}

.header-brand {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--accent-primary);
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(201, 168, 76, 0.4);
}

.header-brand__bracket {
  color: var(--accent-primary-dim);
  margin: 0 6px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* =============================================================================
 * Tier Selector — カスタムドロップダウン(医療計器風)
 * =========================================================================== */
.tier-selector {
  position: relative;
}

.tier-selector__button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 10px;
  min-width: 160px;
  background: var(--bg-monitor);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  text-transform: uppercase;
  transition: border-color 150ms, background 150ms, color 150ms;
  position: relative;
}

.tier-selector__button:hover,
.tier-selector__button[aria-expanded="true"] {
  border-color: var(--accent-primary);
  background: rgba(201, 168, 76, 0.06);
}

.tier-selector__button:focus-visible {
  outline: 1px solid var(--accent-primary);
  outline-offset: 2px;
}

.tier-selector__label {
  color: var(--text-sub);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.tier-selector__divider {
  color: var(--accent-primary-dim);
  opacity: 0.6;
}

.tier-selector__led {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
  animation: led-pulse 2s ease-in-out infinite;
}

.tier-selector__led[data-tier-led="fast"] {
  background: #6fb7e8;
  color: #6fb7e8;
}

.tier-selector__led[data-tier-led="standard"] {
  background: var(--accent-primary);
  color: var(--accent-primary);
}

.tier-selector__led[data-tier-led="premium"] {
  background: #c9715a;
  color: #c9715a;
}

.tier-selector__value {
  color: var(--accent-primary);
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  text-align: left;
}

.tier-selector__arrow {
  color: var(--accent-primary-dim);
  font-size: 12px;
  transition: transform 180ms;
}

.tier-selector__button[aria-expanded="true"] .tier-selector__arrow {
  transform: rotate(180deg);
  color: var(--accent-primary);
}

/* Dropdown panel */
.tier-selector__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 260px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-primary);
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(201, 168, 76, 0.15);
  z-index: 1100;
  animation: tier-dropdown-in 180ms ease-out;
}

.tier-selector__dropdown[hidden] {
  display: none;
}

.tier-selector__dropdown::before {
  content: "TIER // SELECT";
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--accent-primary);
  padding: 8px 14px 6px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  opacity: 0.8;
}

@keyframes tier-dropdown-in {
  0% {
    opacity: 0;
    transform: translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.tier-selector__option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  color: var(--text-main);
  border-left: 2px solid transparent;
  transition: background 120ms, border-color 120ms;
  position: relative;
}

.tier-selector__option + .tier-selector__option {
  border-top: 1px dashed rgba(42, 48, 64, 0.7);
}

.tier-selector__option:hover,
.tier-selector__option:focus-visible {
  background: rgba(201, 168, 76, 0.08);
  border-left-color: var(--accent-primary);
  outline: none;
}

.tier-selector__option--selected {
  background: rgba(201, 168, 76, 0.1);
  border-left-color: var(--accent-primary);
}

.tier-selector__option-led {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 10px currentColor;
}

.tier-selector__option-led[data-tier-led="fast"] {
  background: #6fb7e8;
  color: #6fb7e8;
}
.tier-selector__option-led[data-tier-led="standard"] {
  background: var(--accent-primary);
  color: var(--accent-primary);
}
.tier-selector__option-led[data-tier-led="premium"] {
  background: #c9715a;
  color: #c9715a;
}

.tier-selector__option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.tier-selector__option-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-main);
  text-transform: uppercase;
}

.tier-selector__option--selected .tier-selector__option-name {
  color: var(--accent-primary);
}

.tier-selector__option-desc {
  font-size: 10px;
  color: var(--text-sub);
  letter-spacing: 0.04em;
}

.tier-selector__option-check {
  color: var(--accent-primary);
  font-size: 10px;
  opacity: 0;
  transition: opacity 120ms;
}

.tier-selector__option--selected .tier-selector__option-check {
  opacity: 1;
}

/* header buttons */
.header-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--bg-monitor);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-transform: uppercase;
  transition: border-color 150ms, color 150ms, background 150ms;
}

.header-button:hover:not(:disabled) {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(201, 168, 76, 0.05);
}

.header-button--disabled,
.header-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 767px) {
  .header {
    padding: 0 12px;
  }
  .header-brand {
    font-size: 14px;
  }
  .tier-selector__button {
    min-width: 0;
    padding: 6px 8px;
  }
  .tier-selector__label {
    display: none;
  }
  .tier-selector__divider {
    display: none;
  }
  .tier-selector__value {
    font-size: 11px;
  }
  .tier-selector__dropdown {
    min-width: 220px;
    right: -4px;
  }
  .header-button__label {
    display: none;
  }
}

/* =============================================================================
 * Character Stage — 中央大写しの主役エリア
 * =========================================================================== */
.character-stage {
  grid-area: stage;
  position: relative;
  overflow: hidden;
  background: var(--bg-outer);
}

/* Layer 1: 背景画像 */
.character-stage__background {
  position: absolute;
  inset: 0;
  background-image: url("/assets/vera-bg-medical-block.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: brightness(0.78) contrast(1.05) saturate(0.85);
  z-index: 1;
}

/* Layer 2: スキャンライン (常時表示) */
.character-stage__scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.18) 3px,
    rgba(0, 0, 0, 0.18) 4px
  );
  mix-blend-mode: multiply;
  z-index: 5;
}

/* Layer 3: グリッチエフェクト */
.character-stage__glitch {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(192, 57, 43, 0.0) 40%,
    rgba(58, 125, 68, 0.0) 60%,
    transparent
  );
  mix-blend-mode: screen;
  opacity: 0;
  z-index: 6;
  animation: glitch-flash 7s infinite;
}

@keyframes glitch-flash {
  0%, 95% {
    opacity: 0;
    transform: translateX(0);
    background: linear-gradient(90deg, transparent, transparent, transparent);
  }
  95.5% {
    opacity: 0.35;
    transform: translateX(-3px);
    background: linear-gradient(
      90deg,
      transparent,
      rgba(192, 57, 43, 0.4) 50%,
      rgba(58, 125, 68, 0.3) 70%,
      transparent
    );
  }
  96.5% {
    opacity: 0.2;
    transform: translateX(2px);
  }
  97.5% {
    opacity: 0.3;
    transform: translateX(-1px);
    background: linear-gradient(
      0deg,
      transparent,
      rgba(201, 168, 76, 0.2) 50%,
      transparent
    );
  }
  100% {
    opacity: 0;
    transform: translateX(0);
  }
}

/* Layer 4: Vera キャラクター(中央大写し) */
.character-stage__character {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 92%;
  width: auto;
  max-width: 90%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.7));
  z-index: 4;
  transition: opacity 80ms;
  user-select: none;
  -webkit-user-drag: none;
}

@media (max-width: 767px) {
  .character-stage__character {
    height: 100%;
    object-fit: cover;
    object-position: top center;
  }
}

/* =============================================================================
 * Chat Log — チャット履歴(ユーザー + Vera)
 * =========================================================================== */

/* Layer 5: チャットログコンテナ(外枠なし、カードだけ浮かべる) */
.chat-log {
  position: absolute;
  right: max(32px, 4%);
  top: 32px;
  bottom: 32px;
  width: min(460px, 42%);
  max-width: 460px;
  padding: 0 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  z-index: 7;
  /* 背景・境界線・ボックスシャドウは持たない(カードだけが浮く) */
  background: transparent;
  border: none;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-primary-dim) transparent;
}

/* カスタムスクロールバー(外枠なしに合わせて控えめに) */
.chat-log::-webkit-scrollbar {
  width: 4px;
}
.chat-log::-webkit-scrollbar-track {
  background: transparent;
}
.chat-log::-webkit-scrollbar-thumb {
  background: var(--accent-primary-dim);
  border-radius: 2px;
}
.chat-log::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* メッセージ 1 件(外枠がないため背景画像との可読性を確保する) */
.chat-message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.62;
  color: var(--text-main);
  background: rgba(10, 12, 14, 0.86);
  border: 1px solid rgba(42, 48, 64, 0.55);
  border-left: 2px solid var(--accent-primary-dim);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: chat-message-in 220ms ease-out;
  word-wrap: break-word;
  overflow-wrap: break-word;
  flex-shrink: 0;
}

.chat-message__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chat-message__label {
  color: var(--accent-primary);
  font-weight: 600;
}

.chat-message__tag {
  color: var(--text-sub);
  opacity: 0.7;
  font-size: 9px;
  padding: 1px 5px;
  border: 1px solid var(--border);
}

.chat-message__content {
  display: block;
}

/*
 * タイピングカーソル
 * 重要: animation は .is-typing がある時だけ起動する。
 * ベース定義で animation を付けると、履歴になったメッセージも
 * 点滅し続けてしまうため(cursor-blink の keyframe が opacity を
 * 上書きしてしまう)。display:none で非表示にすると位置計算にも
 * 影響しないので安全。
 */
.chat-message__cursor {
  display: none;
  margin-left: 2px;
  color: var(--accent-primary);
  font-weight: bold;
}

.chat-message.is-typing .chat-message__cursor {
  display: inline-block;
  animation: cursor-blink 600ms steps(2, start) infinite;
}

/* Vera 発話(左側アクセント = gold) */
.chat-message--vera {
  border-left-color: var(--accent-primary);
  background: rgba(10, 12, 14, 0.88);
}
.chat-message--vera .chat-message__label {
  color: var(--accent-primary);
}
.chat-message--vera .chat-message__tag {
  color: var(--accent-primary-dim);
  border-color: var(--accent-primary-dim);
}

/* Vera エラー応答(左側アクセント = 赤、通信障害 / クォータ枯渇等) */
.chat-message--error {
  border-left-color: #a04040;
}
.chat-message--error .chat-message__content {
  color: #c47070;
}

/* ユーザー発話(左側アクセント = green、少し右寄せで識別) */
.chat-message--user {
  border-left-color: var(--accent-led);
  background: rgba(12, 20, 16, 0.86);
  margin-left: 18px;
}
.chat-message--user .chat-message__label {
  color: var(--accent-led);
}
.chat-message--user .chat-message__tag {
  color: var(--accent-led);
  border-color: rgba(74, 153, 85, 0.4);
  opacity: 0.85;
}

/* 古いメッセージの減衰(最新以外は少しだけ透過して奥行き感) */
.chat-message:not(:last-child) {
  opacity: 0.88;
}

@keyframes chat-message-in {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.is-typing:not(:last-child) {
  opacity: 1;
}

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

/* モバイル: 下部に寄せて幅を広げる */
@media (max-width: 767px) {
  .chat-log {
    right: 12px;
    left: 12px;
    bottom: 12px;
    top: auto;
    width: auto;
    max-width: none;
    max-height: 48%;
    padding: 0 4px 0 0;
    font-size: 13px;
  }
  .chat-message {
    font-size: 13px;
    padding: 8px 10px;
  }
  .chat-message--user {
    margin-left: 12px;
  }
}

/* =============================================================================
 * Input Area
 * =========================================================================== */
.input-area {
  grid-area: input;
  background: linear-gradient(to top, #1a1e22, #14171a);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  position: relative;
  z-index: 10;
}

.input-area::before {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  top: -1px;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--accent-primary-dim) 30%,
    var(--accent-primary-dim) 70%,
    transparent
  );
}

.input-form {
  display: flex;
  gap: 10px;
  height: 100%;
}

.input-textarea {
  flex: 1;
  min-height: 44px;
  max-height: 100px;
  padding: 12px 14px;
  background: var(--bg-monitor);
  border: 1px solid var(--border);
  resize: none;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}

.input-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px rgba(201, 168, 76, 0.3);
}

.input-textarea::placeholder {
  color: var(--text-disabled);
}

.input-textarea:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.input-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 22px;
  background: var(--accent-primary);
  color: var(--bg-monitor);
  border: none;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 150ms;
}

.input-button:hover:not(:disabled) {
  background: var(--accent-primary-bright);
}

.input-button:disabled {
  background: var(--text-disabled);
  cursor: not-allowed;
}

.input-button__icon {
  font-size: 16px;
}

@media (max-width: 767px) {
  .input-area {
    padding: 10px 12px;
  }
  .input-button__label {
    display: none;
  }
  .input-button {
    padding: 0 16px;
  }
}

/* =============================================================================
 * Status Bar (LED + Serial Plate) — D39
 * =========================================================================== */
.status-bar {
  grid-area: status;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-sub);
  letter-spacing: 0.08em;
  position: relative;
  z-index: 10;
}

.status-bar__led {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-bar__led-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-led);
  box-shadow: 0 0 8px var(--accent-led);
  animation: led-pulse 2s ease-in-out infinite;
}

@keyframes led-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

.status-bar__serial {
  text-shadow: 0 0 2px rgba(201, 168, 76, 0.25);
  color: var(--accent-primary-dim);
}

@media (max-width: 767px) {
  .status-bar {
    padding: 0 12px;
    font-size: 9px;
  }
  .status-bar__serial {
    font-size: 9px;
  }
}

/* =============================================================================
 * Help Modal — D38 Q2-B
 * =========================================================================== */
.help-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modal-in 200ms ease-out;
}

.help-modal[hidden] {
  display: none;
}

.help-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.help-modal__panel {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-primary);
  width: min(640px, 92vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.help-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.help-modal__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.16em;
  color: var(--accent-primary);
  text-transform: uppercase;
  font-weight: 600;
}

.help-modal__close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-sub);
  width: 32px;
  height: 32px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms, border-color 150ms;
}

.help-modal__close:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.help-modal__tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.help-modal__tab {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-sub);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-transform: uppercase;
  transition: color 150ms, border-color 150ms;
}

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

.help-modal__tab--active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.help-modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  font-size: 13px;
  line-height: 1.75;
}

.help-modal__panel-content[hidden] {
  display: none;
}

.help-modal__panel-content h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--accent-primary);
  text-transform: uppercase;
  margin-top: 18px;
  margin-bottom: 8px;
  border-left: 2px solid var(--accent-primary);
  padding-left: 10px;
}

.help-modal__panel-content p {
  margin: 0 0 12px;
}

.help-modal__panel-content ul {
  margin: 0 0 12px;
  padding-left: 20px;
}

.help-modal__panel-content li {
  margin-bottom: 4px;
}

.help-modal__panel-content kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--bg-monitor);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-primary);
}

.help-modal__panel-content strong {
  color: var(--accent-primary);
  font-weight: 600;
}

.help-modal__note {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-sub);
  font-style: italic;
}

@keyframes modal-in {
  0% {
    opacity: 0;
    transform: scale(0.96);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 767px) {
  .help-modal__panel {
    width: 94vw;
    max-height: 86vh;
  }
  .help-modal__header {
    padding: 14px 18px;
  }
  .help-modal__body {
    padding: 18px 20px;
    font-size: 12.5px;
  }
}

/* =============================================================================
 * Reduced Motion 対応
 * =========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .character-stage__glitch,
  .status-bar__led-dot,
  .tier-selector__led,
  .tier-selector__option-led,
  .chat-message__cursor,
  .app {
    animation: none !important;
  }
  .chat-message,
  .tier-selector__dropdown {
    animation: none !important;
  }
}
