/* ============================
   GLOBAL
============================ */
body {
  margin: 0;
  padding: 20px;
  font-family: "Courier New", monospace;
  background: url('https://i.pinimg.com/1200x/bf/97/c1/bf97c16704567d42c616d2fd6a376072.jpg');
  background-size: 1700px;
  color: #4a2b2b;
  min-height: 100vh;
}

a {
  color: #5a1a4a;
  font-weight: bold;
  text-decoration: none;
  margin-right: 10px;
}

/* ============================
   PIXEL BORDER
============================ */
.pixel-border {
  border: 4px solid #ffb7d5;
  box-shadow: 0 0 0 4px #ffddea, 0 0 0 8px #ffb7d5;
  border-radius: 12px;
}

/* ============================
   CHARACTER GRID
============================ */
.grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin-top: 20px;
}

.charCard {
  width: 150px;
  padding: 10px;
  background: #fbceb1;
  cursor: pointer;
  text-align: center;
  border-radius: 12px;
  transition: 0.2s;
  border: 3px solid #ffb7d5;
  box-shadow: 0 4px #ff8fb8;
}

.charCard:hover {
  transform: translateY(-4px);
  background: #ffd59a;
}

/* ============================
   CHAT BOX
============================ */
#chatBox {
  max-width: 650px;
  margin: 30px auto;
  padding: 20px;
  background: linear-gradient(135deg, #ffb6cf, #c9a0dc, #e5e2eb);
  border-radius: 20px;
  border: 4px solid #ffb7d5;
  box-shadow: 0 0 0 4px #ffddea;
  overflow: hidden;
}

#chatHeader {
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 15px;
}

#portrait {
  width: 140px;
  border-radius: 10px;
  border: 3px solid #ffb7d5;
  transition: opacity 0.2s;
}

/* ============================
   CHAT LOG
============================ */
#chatLog {
  clear: both;
  min-height: 160px;
  max-height: 340px;
  overflow-y: auto;
  margin-top: 10px;
  margin-bottom: 14px;
  font-size: 0.95rem;
  padding-right: 4px;
}

#chatLog p {
  margin: 6px 0;
  line-height: 1.5;
}

.msg-user {
  color: #5a1a4a;
}

.msg-char {
  color: #2a1a5a;
}

.msg-error {
  color: #a00;
  font-size: 0.85em;
}

.msg-thinking {
  color: #888;
  font-style: italic;
}

/* ============================
   INPUT AREA
============================ */
.inputRow {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inputRow input {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 3px solid #ffb7d5;
  background: #fff0f6;
  font-family: "Courier New", monospace;
}

button {
  padding: 10px 15px;
  border-radius: 10px;
  border: 3px solid #ffb7d5;
  background: #ffe0ef;
  cursor: pointer;
  font-weight: bold;
  font-family: "Courier New", monospace;
  box-shadow: 0 3px #ff8fb8;
  transition: 0.1s;
}

button:active {
  transform: translateY(2px);
  box-shadow: 0 1px #ff8fb8;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

/* Clear button */
#clearBtn {
  margin-top: 10px;
  font-size: 0.8rem;
  background: #ffe0ef88;
  box-shadow: none;
  border: 2px solid #ffb7d5;
  padding: 6px 10px;
}
