* {
  box-sizing: border-box;
}

body {
  background-color: #FBF6E8;
  font-family: Georgia, serif;
  margin: 0;
}

#app-title {
  color: #1E2A33;
  font-size: 22px;
  text-align: center;
  letter-spacing: 1px;
}

#app-subtitle {
  color: #4B5A63;
  font-size: 12.5px;
  font-style: italic;
  text-align: center;
}

#app-title, #app-subtitle {
  margin-top: 0;
  margin-bottom: 4px;
}


.book {
  background-color: #E7DAB4;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

.app-inner {
  width: 100%;
  max-width: 700px;
  height: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.header-fixed {
  flex-shrink: 0;
}

.composer-fixed {
  flex-shrink: 0;
}

.page {
  background: repeating-linear-gradient(
    #FBF6E8,
    #FBF6E8 27px,
    #C9DAE6 28px
  );
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border-radius: 4px;
  padding: 14px 16px 14px 34px;
  margin-top: 14px;
  position: relative;
}

.page::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: #B23A2E;
}

.msg {
  margin-bottom: 14px;
  max-width: 85%;
}

.msg.bot .tag {
  font-weight: bold;
  font-size: 12px;
  text-transform: uppercase;
  color: #B23A2E;
  margin-bottom: 3px;
}

.msg.bot .bubble {
  background-color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14.5px;
  line-height: 1.5;
  color: #1E2A33;
}

.composer {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

#inputBox {
  flex: 1;
  padding: 8px 4px;
  border: none;
  border-bottom: 2px solid #4B5A63;
  background: transparent;
  font-family: Georgia, serif;
  font-size: 15px;
  color: #1E2A33;
}

#inputBox:focus {
  outline: none;
  border-bottom-color: #B23A2E;
}

#sendBtn {
  background-color: #1E6B45;
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: 20px;
  font-family: Georgia, serif;
  font-weight: 600;
  cursor: pointer;
}

.msg.user {
  margin-left: auto;
  text-align: right;
}

.msg.user .bubble {
  display: inline-block;
  text-align: left;
  background-color: #EFE3C4;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14.5px;
  color: #1E2A33;
}

.keyrow {
  margin-top: 10px;
}

#apiKeyInput {
  width: 100%;
  font-family: "Courier New", monospace;
  font-size: 12px;
  padding: 7px 9px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 3px;
  box-sizing: border-box;
}

.voice-toggle {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 4px;
  margin-bottom: 2px;
}

.tick {
  font-size: 12.5px;
  color: #8A7F63;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.tick.active {
  background-color: #1E6B45;
  color: white;
  font-weight: 600;
  border-color: #164F33;
}

.annotation {
  font-family: "Courier New", monospace;
  font-size: 10px;
  color: #8A7F63;
  margin-top: 3px;
  padding-left: 2px;
}

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 3px;
  background-color: #4B5A63;
  border-radius: 50%;
  opacity: 0.4;
  animation: blink 1.2s infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.4; }
  40% { opacity: 1; }
}

@media (max-width: 600px) {
  body {
    padding: 0;
    display: block;
  }

  .book {
    max-width: 100%;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    padding: 16px;
  }
}