/* ============================================================
   psydoctor — main.css
   达芬奇深绿 × Brutalism × 粉红强调
   粗野主义三栏布局 + 聊天区 + 面板 + 弹窗
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: #0b1a12;
  color: #d8e8e0;
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

.psy-main-body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ===== Header ===== */
.psy-main-header {
  flex-shrink: 0;
  padding: 0.5rem 1.5rem;
  background: #0d1f15;
  border-bottom: 3px solid #2a4a36;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

.psy-main-header h1 {
  font-size: 1.15rem;
  font-weight: 900;
  color: #d8e8e0;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: 2px 2px 0px rgba(255, 107, 157, 0.2);
}

.psy-header-info {
  font-size: 0.8rem;
  color: #8aab98;
  font-weight: 700;
}

/* ===== Main layout ===== */
.psy-main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ===== Pane base ===== */
.psy-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.psy-pane--player {
  width: 300px;
  flex-shrink: 0;
  border-right: 3px solid #2a4a36;
  background: #0e1f16;
}

.psy-pane--chat {
  flex: 1;
  min-width: 0;
  background: #0c1c14;
  border-left: 1px solid #1a3322;
  border-right: 1px solid #1a3322;
}

.psy-pane--npc {
  width: 280px;
  flex-shrink: 0;
  border-left: 3px solid #2a4a36;
  background: #0e1f16;
}

.psy-pane-header {
  flex-shrink: 0;
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  font-weight: 800;
  color: #8aab98;
  border-bottom: 3px solid #2a4a36;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #0d1f15;
}

.psy-pane-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem;
}

/* ===== Player panel (left) ===== */
.psy-player-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.psy-player-world-fixed {
  text-align: center;
  padding: 0.3rem 0;
}

.psy-world-time {
  font-size: 0.78rem;
  color: #5a7a68;
  letter-spacing: 0.06em;
  font-weight: 600;
  font-family: "Consolas", "Courier New", monospace;
  border: 2px solid #1a3322;
  padding: 0.2rem 0.5rem;
  display: inline-block;
}

.psy-player-name-vertical {
  font-size: 1.2rem;
  font-weight: 900;
  color: #d8e8e0;
  text-align: center;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.psy-level-line {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #ff6b9d;
  margin-bottom: 0.5rem;
  border-top: 2px solid #1a3322;
  border-bottom: 2px solid #1a3322;
  padding: 0.3rem 0;
}

/* ===== Stat rows ===== */
.psy-stat-pair-row {
  display: flex;
  gap: 0.4rem;
}

.psy-stat-cell {
  flex: 1;
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0.5rem;
  background: #0d1f15;
  border: 2px solid #1a3322;
}

.psy-stat-k {
  font-size: 0.75rem;
  color: #5a7a68;
  font-weight: 700;
  text-transform: uppercase;
}

.psy-stat-v {
  font-size: 0.78rem;
  font-weight: 800;
  color: #d8e8e0;
}

/* ===== Progress bars ===== */
.psy-bar {
  width: 100%;
  height: 12px;
  background: #0d1f15;
  border: 2px solid #2a4a36;
  overflow: hidden;
  margin: 0.2rem 0;
}

.psy-bar-fill {
  height: 100%;
  transition: width 0.4s ease;
}

.psy-bar-fill--clinical { background: #4ecb71; }
.psy-bar-fill--alliance { background: #ff6b9d; }
.psy-bar-fill--fatigue  { background: #ffaa44; }

/* ===== Attribute section ===== */
.psy-attr-section-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #5a7a68;
  padding: 0.5rem 0 0.3rem;
  border-bottom: 3px solid #2a4a36;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.psy-attr-section-title--first {
  border-top: 3px solid #2a4a36;
  padding-top: 0.6rem;
}

/* ===== Book shelf grid ===== */
.psy-bookshelf-grid,
.psy-tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.psy-bookshelf-slot,
.psy-tool-slot {
  aspect-ratio: 3/4;
  background: #0d1f15;
  border: 2px solid #1a3322;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #3a5e46;
  cursor: pointer;
  transition: all 0.1s;
  text-align: center;
  padding: 0.2rem;
  gap: 0.2rem;
}

.psy-bookshelf-slot:hover,
.psy-tool-slot:hover {
  border-color: #ff6b9d;
  background: rgba(255, 107, 157, 0.08);
}

.psy-bookshelf-slot--empty,
.psy-tool-slot--empty {
  color: #1a3322;
  cursor: default;
}

.psy-bookshelf-icon,
.psy-tool-icon {
  font-size: 1rem;
}

.psy-bookshelf-name,
.psy-tool-name {
  color: #8aab98;
  font-weight: 600;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Chat pane ===== */
.psy-chat-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.psy-chat-pane-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: #8aab98;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.psy-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.psy-chat-placeholder {
  text-align: center;
  color: #3a5e46;
  font-size: 0.9rem;
  margin-top: 3rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ===== Chat messages ===== */
.psy-chat-msg {
  max-width: 85%;
  padding: 0.8rem 1rem;
  font-size: 0.88rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.psy-chat-msg--user {
  align-self: flex-end;
  background: #0d1f15;
  border: 3px solid #ff6b9d;
  color: #d8e8e0;
  font-weight: 600;
  box-shadow: 4px 4px 0px rgba(255, 107, 157, 0.12);
}

.psy-chat-msg--assistant {
  align-self: flex-start;
  background: #112218;
  border: 3px solid #2a4a36;
  color: #c8d8d0;
  box-shadow: 4px 4px 0px rgba(0,0,0,0.4);
}

.psy-chat-msg--system {
  align-self: center;
  background: transparent;
  border: 2px solid #3a5e46;
  color: #5a7a68;
  font-size: 0.8rem;
  max-width: 90%;
  text-align: center;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.psy-chat-msg--client {
  align-self: flex-start;
  background: #1a1a12;
  border: 3px solid #5a4a3a;
  border-left: 6px solid #7a6a5a;
  color: #c8b8a8;
  box-shadow: 4px 4px 0px rgba(0,0,0,0.3);
}

/* ===== Chat input area ===== */
.psy-chat-input-wrap {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-top: 3px solid #2a4a36;
  background: #0d1f15;
}

.psy-chat-input {
  flex: 1;
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  background: #0b1a12;
  border: 3px solid #2a4a36;
  color: #d8e8e0;
  outline: none;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  font-family: inherit;
  font-weight: 600;
  transition: border-color 0.1s;
}

.psy-chat-input:focus {
  border-color: #ff6b9d;
}

.psy-chat-input::placeholder { color: #3a5e46; }

.psy-chat-send-btn {
  padding: 0.7rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 800;
  background: #1a2d22;
  border: 3px solid #3a5e46;
  color: #d8e8e0;
  cursor: pointer;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all 0.1s;
  box-shadow: 3px 3px 0px rgba(0,0,0,0.4);
}

.psy-chat-send-btn:hover:not(:disabled) {
  background: #ff6b9d;
  border-color: #d6336c;
  color: #000;
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0px rgba(0,0,0,0.5);
}

.psy-chat-send-btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px rgba(0,0,0,0.4);
}

.psy-chat-send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ===== Action suggestions ===== */
.psy-chat-suggestions {
  flex-shrink: 0;
  display: flex;
  gap: 0.3rem;
  padding: 0.4rem 1rem 0;
  flex-wrap: wrap;
}

.psy-suggestion-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 700;
  border: 2px solid;
  background: #0d1f15;
  cursor: pointer;
  transition: all 0.1s;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.psy-suggestion-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.3);
}

.psy-suggestion-btn--aggressive {
  border-color: #ff6b9d;
  color: #ffa0c0;
}

.psy-suggestion-btn--neutral {
  border-color: #4ecb71;
  color: #8aab98;
}

.psy-suggestion-btn--cautious {
  border-color: #ffaa44;
  color: #ffcc66;
}

.psy-suggestion-btn--veryCautious {
  border-color: #a080c0;
  color: #c0a0e0;
}

/* ===== Checkpoint 4: 个案会话干预按钮 ===== */
.psy-intervention-btn {
  flex: 1;
  min-width: 5rem;
  padding: 0.5rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  border: 2px solid #4ecb71;
  background: #0d1f15;
  color: #8aab98;
  cursor: pointer;
  transition: all 0.12s;
  text-transform: none;
  letter-spacing: 0.02em;
  white-space: normal;
  line-height: 1.3;
}

.psy-intervention-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.3);
  border-color: #6aeb91;
  color: #b0d0b8;
}

.psy-intervention-btn:active {
  transform: translateY(0);
}

.psy-intervention-btn--end {
  border-color: #cc5555;
  color: #cc8888;
}

.psy-intervention-btn--end:hover {
  border-color: #ee7777;
  color: #eeaaaa;
}

/* ===== 禁用的聊天输入 ===== */
.psy-chat-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.psy-chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== NPC pane (right) ===== */
.psy-npc-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.psy-npc-card,
.psy-client-card {
  padding: 0.6rem 0.7rem;
  background: #0d1f15;
  border: 2px solid #1a3322;
  cursor: pointer;
  transition: all 0.1s;
}

.psy-npc-card:hover,
.psy-client-card:hover {
  border-color: #3a5e46;
  background: #112218;
}

.psy-client-status {
  display: flex;
  gap: 0.5rem;
  font-size: 0.68rem;
  color: #5a7a68;
  margin-top: 0.15rem;
  font-weight: 600;
}

/* ===== Status line ===== */
.psy-chat-status {
  flex-shrink: 0;
  padding: 0.3rem 1rem;
  font-size: 0.75rem;
  text-align: center;
  min-height: 1.4em;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.psy-chat-status--idle { color: #3a5e46; }
.psy-chat-status--busy {
  color: #ff6b9d;
  animation: psy-pulse 1.2s ease-in-out infinite;
}

@keyframes psy-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== AI process log ===== */
.psy-ai-process-log-wrap {
  flex-shrink: 0;
  padding: 0 1rem 0.2rem;
}

.psy-ai-process-log {
  display: flex;
  gap: 1rem;
  font-size: 0.7rem;
  color: #3a5e46;
  font-weight: 600;
  font-family: "Consolas", "Courier New", monospace;
}

/* ===== Bootstrap gate overlay ===== */
#psy-bootstrap-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(8, 16, 12, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
}

#psy-bootstrap-gate.hidden { display: none; }

.psy-gate-content {
  width: 90%;
  max-width: 560px;
  text-align: center;
}

.psy-gate-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: #d8e8e0;
  margin-bottom: 2rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 3px 3px 0px rgba(255, 107, 157, 0.2);
}

.psy-gate-phases {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.psy-gate-phase {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1.2rem;
  background: #112218;
  border: 3px solid #2a4a36;
  text-align: left;
  transition: border-color 0.2s;
}

.psy-gate-phase--waiting  { color: #3a5e46; border-color: #1a3322; }
.psy-gate-phase--executing { color: #ffa0c0; border-color: #ff6b9d; box-shadow: 0 0 12px rgba(255, 107, 157, 0.15); }
.psy-gate-phase--success  { color: #4ecb71; border-color: #4ecb71; }
.psy-gate-phase--failed   { color: #ff4466; border-color: #ff4466; }

.psy-gate-phase-icon { font-size: 1.3rem; width: 32px; text-align: center; flex-shrink: 0; font-weight: 900; }
.psy-gate-phase-label { font-size: 0.9rem; font-weight: 700; }
.psy-gate-phase-time { font-size: 0.7rem; margin-left: auto; color: #5a7a68; font-family: "Consolas","Courier New",monospace; }

.psy-gate-error {
  font-size: 0.8rem;
  color: #ff4466;
  margin-bottom: 0.8rem;
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-weight: 600;
  border: 2px solid rgba(255, 68, 102, 0.3);
  padding: 0.5rem;
}

.psy-gate-retry-btn {
  padding: 0.7rem 1.8rem;
  font-size: 0.95rem;
  font-weight: 800;
  border: 3px solid #ffaa44;
  background: rgba(255, 170, 68, 0.1);
  color: #ffcc66;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all 0.1s;
  box-shadow: 3px 3px 0px rgba(0,0,0,0.4);
}

.psy-gate-retry-btn:hover {
  background: #ffaa44;
  color: #000;
  transform: translate(-1px, -1px);
}

/* ===== Modals ===== */
.psy-modal-root {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.psy-modal-root.hidden { display: none; }

.psy-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.psy-modal {
  position: relative;
  background: #112218;
  border: 3px solid #2a4a36;
  padding: 1.8rem 2rem;
  width: 90%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1;
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.6);
}

.psy-modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: #5a7a68;
  font-size: 1.5rem;
  font-weight: 900;
  cursor: pointer;
  transition: color 0.1s;
}

.psy-modal-close:hover { color: #ff6b9d; }

.psy-modal-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: #d8e8e0;
  margin-bottom: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 3px solid #ff6b9d;
  display: inline-block;
  padding-bottom: 0.3rem;
}

/* ===== Countertransference indicator ===== */
.psy-ct-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.psy-ct-indicator--low      { background: rgba(78, 203, 113, 0.15); color: #4ecb71; border: 2px solid rgba(78, 203, 113, 0.3); }
.psy-ct-indicator--medium   { background: rgba(255, 170, 68, 0.15); color: #ffaa44; border: 2px solid rgba(255, 170, 68, 0.3); }
.psy-ct-indicator--high     { background: rgba(255, 107, 157, 0.15); color: #ff6b9d; border: 2px solid rgba(255, 107, 157, 0.3); }
.psy-ct-indicator--critical { background: rgba(255, 68, 102, 0.15); color: #ff4466; border: 2px solid rgba(255, 68, 102, 0.4); }

/* ===== Ethics dilemma modal ===== */
.psy-ethics-scene {
  font-size: 0.95rem;
  color: #d8e8e0;
  line-height: 1.7;
  margin-bottom: 0.8rem;
  padding: 0.8rem;
  background: rgba(30, 20, 15, 0.3);
  border-left: 5px solid #ffaa44;
}

.psy-ethics-context {
  font-size: 0.82rem;
  color: #8aab98;
  margin-bottom: 1rem;
  font-style: italic;
}

.psy-ethics-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.psy-ethics-btn {
  text-align: left;
  padding: 0.8rem 1rem;
  background: #0d1f15;
  border: 3px solid #2a4a36;
  cursor: pointer;
  transition: all 0.1s;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  box-shadow: 3px 3px 0px rgba(0,0,0,0.4);
}

.psy-ethics-btn:hover {
  border-color: #ff6b9d;
  background: rgba(255, 107, 157, 0.06);
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0px rgba(255, 107, 157, 0.1);
}

.psy-ethics-btn-label {
  font-size: 0.9rem;
  font-weight: 800;
  color: #d8e8e0;
}

.psy-ethics-btn-desc {
  font-size: 0.78rem;
  color: #5a7a68;
}

/* ===== Career event list ===== */
.psy-event-item {
  padding: 0.5rem 0.6rem;
  background: #0d1f15;
  border: 2px solid #1a3322;
  font-size: 0.78rem;
}

.psy-event-type {
  font-weight: 800;
  color: #d8e8e0;
  font-size: 0.82rem;
}

.psy-event-desc { color: #8aab98; font-size: 0.72rem; }
.psy-event-deadline { color: #ffaa44; font-size: 0.7rem; font-weight: 700; }

/* ===== NPC / Client card details ===== */
.psy-npc-name {
  font-weight: 800;
  font-size: 0.85rem;
  color: #d8e8e0;
}

.psy-npc-role { font-size: 0.72rem; color: #5a7a68; font-weight: 600; text-transform: uppercase; }
.psy-npc-theory { font-size: 0.72rem; color: #8aab98; }
.psy-client-name { font-weight: 800; font-size: 0.85rem; color: #c8b8a8; }
.psy-client-meta { font-size: 0.72rem; color: #5a7a68; }

/* ===== Mobile panel toggles ===== */
.psy-mobile-open-btn {
  display: none;
  background: #0d1f15;
  border: 2px solid #2a4a36;
  color: #8aab98;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
}

.psy-mobile-panel-close {
  display: none;
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  background: none;
  border: none;
  color: #5a7a68;
  font-size: 1.5rem;
  font-weight: 900;
  cursor: pointer;
  z-index: 10;
}

.psy-mobile-panel-close:hover { color: #ff6b9d; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(11, 26, 18, 0.5); }
::-webkit-scrollbar-thumb { background: #2a4a36; }
::-webkit-scrollbar-thumb:hover { background: #3a5e46; }

/* ===== Utility ===== */
.hidden { display: none !important; }

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .psy-pane--player,
  .psy-pane--npc {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 500;
    transition: transform 0.3s ease;
  }
  .psy-pane--player { left: 0; transform: translateX(-100%); }
  .psy-pane--player.psy-mobile-open { transform: translateX(0); }
  .psy-pane--npc { right: 0; transform: translateX(100%); }
  .psy-pane--npc.psy-mobile-open { transform: translateX(0); }
  .psy-pane--chat { width: 100%; }
  .psy-mobile-open-btn { display: inline-block; }
  .psy-mobile-panel-close { display: block; }
  .psy-chat-msg { max-width: 92%; }
  .psy-bookshelf-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 480px) {
  .psy-bookshelf-grid { grid-template-columns: repeat(2, 1fr); }
  .psy-chat-suggestions { flex-direction: column; gap: 0.25rem; }
}
