* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: #ffffff;
  color: #111111;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* ---------- PIN gate ---------- */

.gate {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.gate-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
  cursor: pointer;
}

.gate-card h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

.gate-sub {
  color: #666666;
  font-size: 14px;
  margin: 0 0 28px;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #cccccc;
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dots span.filled {
  background: #111111;
  border-color: #111111;
}

.dots.shake { animation: shake 0.35s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

.gate-error {
  color: #c0392b;
  font-size: 14px;
  margin: 0 0 8px;
}

.pin-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.gate-hint {
  color: #999999;
  font-size: 13px;
  margin: 0;
}

/* ---------- Chat ---------- */

.chat {
  height: 100dvh;
  max-width: 768px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #eeeeee;
  border-right: 1px solid #eeeeee;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #eeeeee;
  flex-shrink: 0;
}

.chat-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.clear-btn {
  background: none;
  border: 1px solid #e0e0e0;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  color: #555555;
  cursor: pointer;
}

.clear-btn:hover { background: #f5f5f5; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  line-height: 1.55;
}

.msg-user {
  align-self: flex-end;
  background: #f0f0f0;
  color: #111111;
  border-bottom-right-radius: 6px;
}

.msg-bot {
  align-self: flex-start;
  background: transparent;
  color: #111111;
  padding-left: 2px;
  padding-right: 2px;
  max-width: 92%;
}

.typing {
  padding: 0 22px 8px;
  color: #999999;
  font-size: 13px;
  font-style: italic;
}

.composer {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #eeeeee;
  flex-shrink: 0;
}

.composer input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 15px;
  font-family: inherit;
  color: #111111;
  background: #ffffff;
  outline: none;
  min-width: 0;
}

.composer input:focus { border-color: #999999; }

.composer button {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #111111;
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.composer button:hover { background: #333333; }
