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

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  height: 100dvh;

  display: flex;
  flex-direction: column;

  overflow: hidden;

  background: #f4f4f4;
  color: #222;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", sans-serif;
}

.app-header {
  flex-shrink: 0;

  height: 120px;
  padding: 28px 28px 20px;

  background: #202020;
  color: #fff;

  display: flex;
  align-items: center;
}

.app-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.app-subtitle {
  margin-top: 2px;
  font-size: 14px;
  opacity: 0.9;
}

.input-area {
  flex-shrink: 0;

  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 10px;

  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));

  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid #ddd;
}

#query {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  max-height: 140px;

  padding: 12px 14px;

  border: 1px solid #ccc;
  border-radius: 16px;

  background: #fff;
  color: #222;

  font-size: 18px;
  line-height: 1.4;

  resize: none;
  overflow-y: auto;
  outline: none;
}

#query:focus {
  border-color: #202020;
}

#sendButton {
  height: 68px;
  border: none;
  border-radius: 18px;
  background: #202020;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

#sendButton:active {
  opacity: 0.75;
}

#sendButton {
  height: 54px;

  border: none;
  border-radius: 16px;

  background: #202020;
  color: #fff;

  font-size: 20px;
  font-weight: 800;
}

.chat {
  flex: 1 1 auto;
  min-height: 0;

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  padding: 18px 14px;
}

.message {
  margin: 16px 0;
  padding: 20px 20px;
  border-radius: 20px;
  font-size: 23px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.message.shici {
  background: #fff;
  margin-right: 0;
}

.message.user {
  background: #dce8ff;
  margin-left: 15%;
}

@media (min-width: 800px) {
  body {
    max-width: 760px;
    margin: 0 auto;
    background: #e9e9e9;
  }

  .app-header,
  .input-area {
    max-width: 760px;
    margin: 0 auto;
  }
}
