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

:root {
  --black: #000000;
  --white: #ffffff;
  --green: #00ff88;
  --grey: #888888;
  --red: #ff4444;
  --font: 'Press Start 2P', monospace;
}

/* ── Full-viewport single column, centred ── */
html, body {
  background: var(--black);
  color: var(--white);
  font-family: var(--font);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem 1rem;
}

/* ── Name ── */
header {
  text-align: center;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
  width: 100%;
}

.name-line1 {
  font-size: clamp(1.5rem, 6vw, 3rem);
  letter-spacing: 0.15em;
}

.name-line2 {
  font-size: clamp(2.5rem, 10vw, 5.5rem);
  letter-spacing: 0.1em;
}

/* ── Photo: takes all remaining height ── */
.photo-section {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
}

#photo-canvas {
  display: block;
  max-height: 100%;
  width: auto;
  max-width: 100%;
  image-rendering: pixelated;
}

/* ── Chat: pinned at bottom ── */
.chat-container {
  width: 100%;
  max-width: 700px;
  flex-shrink: 0;
  margin-top: 0.75rem;
}

.chat-log {
  min-height: 60px;
  max-height: 22vh;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scroll-behavior: smooth;
}

.chat-log::-webkit-scrollbar { width: 4px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--grey); }

.msg {
  font-size: 0.6rem;
  line-height: 1.8;
}

.msg.user {
  color: var(--white);
}

.msg.user::before {
  content: '> ';
  color: var(--grey);
}

.msg.assistant {
  color: var(--green);
}

.msg.assistant::before {
  content: '✓ ';
}

/* ── Input bar ── */
.input-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--grey);
  padding: 0.6rem 0.75rem;
}

.prompt-symbol {
  color: var(--green);
  font-size: 0.65rem;
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--white);
  font-family: var(--font);
  font-size: 0.6rem;
  caret-color: var(--green);
}

#chat-input::placeholder { color: var(--grey); }
#chat-input:disabled    { color: var(--grey); }

#send-btn {
  background: transparent;
  border: none;
  color: var(--green);
  font-family: var(--font);
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0 0.25rem;
  flex-shrink: 0;
}

#send-btn:hover    { color: var(--white); }
#send-btn:disabled { color: var(--grey); cursor: not-allowed; }

/* ── Status ── */
.status-msg {
  font-size: 0.5rem;
  color: var(--grey);
  margin-top: 0.4rem;
  min-height: 1.2em;
  text-align: center;
}

.status-msg.error { color: var(--red); }

/* ── Mobile: allow scroll if content overflows ── */
@media (max-width: 480px) {
  html, body {
    height: auto;
    overflow: visible;
  }

  .chat-log {
    max-height: 35vh;
  }
}
