@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;600&display=swap");

/* ── ページ全体 ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  background: #f5f5f5;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-family: "JetBrains Mono", "Courier New", monospace;
}
.tp-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 24px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── ロゴヘッダー ── */
.tp-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 24px;
  margin-bottom: 20px;
  user-select: none;
}
.tp-logo-bracket {
  color: #2aaa92;
  font-size: 22px;
  font-weight: 600;
}
.tp-logo-text {
  color: #1a1a1a;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.tp-logo-cursor {
  display: inline-block;
  width: 10px;
  height: 20px;
  background: #2aaa92;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: tp-blink 1.1s step-end infinite;
}

/* ── ターミナルブロック ── */
.tp-block * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
.tp-block {
  font-family: "JetBrains Mono", "Courier New", monospace;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.tp-block .tp-win {
  background: #0f1117;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #23262f;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35), 0 2px 12px rgba(0, 0, 0, 0.15);
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.tp-block .tp-bar {
  background: #181b24;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid #23262f;
  user-select: none;
}
.tp-block .tp-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tp-block .tp-dot-r {
  background: #ff5f56;
}
.tp-block .tp-dot-y {
  background: #ffbd2e;
}
.tp-block .tp-dot-g {
  background: #27c93f;
}
.tp-block .tp-bartitle {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: #454a5a;
  letter-spacing: 0.1em;
}
.tp-block .tp-scroll-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #3a3f50 transparent;
}
.tp-block .tp-scroll-area::-webkit-scrollbar {
  width: 6px;
}
.tp-block .tp-scroll-area::-webkit-scrollbar-track {
  background: transparent;
}
.tp-block .tp-scroll-area::-webkit-scrollbar-thumb {
  background: #3a3f50;
  border-radius: 3px;
}
.tp-block .tp-scroll-area::-webkit-scrollbar-thumb:hover {
  background: #4ec9b0;
}
.tp-block .tp-screen {
  padding: 20px 24px 4px;
  font-size: 13px;
  line-height: 1.8;
  color: #b8bcc8;
  white-space: pre-wrap;
  word-break: break-all;
}
.tp-block .tp-typing-row,
.tp-block .tp-input-row {
  display: flex;
  align-items: center;
  padding: 0 24px 20px;
}
.tp-block .tp-typing-prompt,
.tp-block .tp-prompt-label {
  color: #4ec9b0;
  font-size: 13px;
  font-family: "JetBrains Mono", "Courier New", monospace;
  white-space: pre;
  flex-shrink: 0;
}
.tp-block .tp-typing-text {
  color: #f8f8f2;
  font-size: 13px;
  font-family: "JetBrains Mono", "Courier New", monospace;
}
.tp-block .tp-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: #4ec9b0;
  vertical-align: text-bottom;
  animation: tp-blink 1.1s step-end infinite;
}
.tp-block .tp-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
}
.tp-block .tp-input {
  background: transparent;
  border: none;
  min-width: 2px;
  outline: none;
  color: #f8f8f2;
  font-size: 13px;
  font-family: "JetBrains Mono", "Courier New", monospace;
  caret-color: transparent;
  line-height: 1.8;
}
@keyframes tp-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}
/* テキストカラー */
.tp-block .tp-p  { color: #4ec9b0; } /* プロンプト   */
.tp-block .tp-cm { color: #f8f8f2; } /* コマンド     */
.tp-block .tp-d  { color: #555b70; } /* 薄い・補足   */
.tp-block .tp-k  { color: #c0a060; } /* キー・ラベル */
.tp-block .tp-s  { color: #7dbb6e; } /* 文字列・OK   */
.tp-block .tp-n  { color: #ce9178; } /* 数値         */
.tp-block .tp-h  { color: #569cd6; } /* ハイライト   */
.tp-block .tp-w  { color: #e06c75; } /* 警告         */
.tp-block .tp-hl { color: #dcdcaa; } /* 強調         */
.tp-block .tp-err { color: #e06c75; } /* エラー       */
.tp-block .tp-skill-row {
  display: flex;
  align-items: baseline;
  gap: 0;
  padding-left: 2ch;
}
.tp-block .tp-skill-name {
  width: 13em;
  flex-shrink: 0;
  color: #c0a060;
}
.tp-block .tp-skill-bar {
  color: #7dbb6e;
}
.tp-block .tp-skill-lv {
  color: #ce9178;
}

/* オーバーレイ共通 */
.tp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
}
.tp-overlay.active {
  display: flex;
}

/* exitオーバーレイ */
.tp-exit-overlay {
  background: #dfe0e4;
  z-index: 9998;
}
.tp-terminal-icon {
  width: 128px;
  height: 128px;
  border-radius: 28px;
  background: linear-gradient(160deg, #2a2a2a 0%, #000 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.32),
    0 6px 18px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: tp-icon-drop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tp-terminal-icon:hover {
  transform: scale(1.08);
  box-shadow:
    0 32px 72px rgba(0, 0, 0, 0.38),
    0 8px 24px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.tp-terminal-icon:active {
  transform: scale(0.95);
}
.tp-terminal-icon-prompt {
  color: #f0f0f0;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 38px;
  font-weight: 600;
  letter-spacing: -0.02em;
  user-select: none;
}
@keyframes tp-icon-drop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ゲームオーバーレイ */
.tp-game-overlay {
  background: #000;
  z-index: 9999;
  flex-direction: column;
}
.tp-game-exit {
  position: absolute;
  top: 16px;
  right: 20px;
  background: transparent;
  border: 1px solid #3a3f50;
  color: #b8bcc8;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
  border-radius: 4px;
  letter-spacing: 0.1em;
}
.tp-game-exit:hover {
  border-color: #4ec9b0;
  color: #4ec9b0;
}

/* ── モバイル対応 ── */
@media (max-width: 600px) {
  .tp-page {
    padding: 0 10px 10px;
  }

  .tp-header {
    padding-top: 12px;
    margin-bottom: 10px;
    gap: 4px;
  }
  .tp-logo-bracket {
    font-size: 15px;
  }
  .tp-logo-text {
    font-size: 13px;
  }
  .tp-logo-cursor {
    width: 8px;
    height: 14px;
  }

  .tp-block .tp-win {
    border-radius: 8px;
  }
  .tp-block .tp-bar {
    padding: 8px 10px;
  }
  .tp-block .tp-screen {
    padding: 12px 10px 4px;
    font-size: 11px;
  }
  .tp-block .tp-typing-row,
  .tp-block .tp-input-row {
    padding: 0 10px 12px;
  }
  .tp-block .tp-typing-prompt,
  .tp-block .tp-prompt-label,
  .tp-block .tp-typing-text {
    font-size: 11px;
  }
  /* iOS Safari の自動ズーム防止: font-size >= 16px が必要 */
  .tp-block .tp-input {
    font-size: 16px;
  }
  .tp-block .tp-cursor {
    width: 6px;
    height: 12px;
  }
}
