:root {
  --wanma-sys-primary: #984062;
  --wanma-sys-secondary: #f2dde2;
  --md-sys-color-secondary-container: #ffd9e3;
  --wanma-sys-text: #2b151c;
  --md-sys-color-outline: #837377;
  --md-sys-color-shadow-rgb: 0 0 0;
  --md-sys-color-surface: #fffbff;
  --md-sys-elevation-1: 0px 3px 1px -2px rgb(var(--md-sys-color-shadow-rgb) / 0.2), 0px 2px 2px 0px rgb(var(--md-sys-color-shadow-rgb) / 0.14), 0px 1px 5px 0px rgb(var(--md-sys-color-shadow-rgb) / 0.12);
}

body,
html {
  height: 100%;
  margin: 0;
  font-family: "Microsoft JhengHei", sans-serif; /* 更改字體 */
  background-color: var(--wanma-sys-secondary);
  color: var(--wanma-sys-text);
}

#chatroom {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 800px;
  margin: auto;
  box-sizing: border-box;
  border-left: 1px solid var(--md-sys-color-outline);
  border-right: 1px solid var(--md-sys-color-outline);
  box-shadow: 0 0px 4px 0 rgba(0, 0, 0, 0.2);
}

#header {
  background-color: var(--wanma-sys-primary);
  color: var(--md-sys-color-surface);
  text-align: center;
  font-size: 24px;
  height: 60px; /* 更新高度 */
  line-height: 60px; /* 新增，用於垂直置中文字 */
  box-shadow: 0 0px 4px 0 rgba(0, 0, 0, 0.2);
  z-index: 1;
}

#messages {
  flex: 1;
  overflow-y: scroll;
  padding: 10px 20px;
  background-color: #fff;
  display: flex;
  flex-direction: column;
}
#messages::-webkit-scrollbar {
  scrollbar-width: thin;
  background: transparent;
  width: 4px;
}

#messages::-webkit-scrollbar-thumb{
  background: var(--md-sys-color-outline);
}

.message {
  position: relative;
  margin-bottom: 35px;
  padding: 10px 15px;
  word-break: break-word;
}
.own-message {
  border-radius: 15px 15px 3px 15px;
  background-color: var(--wanma-sys-secondary);
  color: var(--wanma-sys-text);
  align-self: flex-end;
  max-width: 45%;
}

.other-message {
  border-radius: 15px 15px 15px 3px;
  border: 1px solid var(--md-sys-color-outline);
  background-color: var(--md-sys-color-surface);
  color: var(--wanma-sys-text);
  align-self: flex-start;
  max-width: 45%;
}
.message-timestamp {
  position: absolute;
  bottom: -20px;
  color: var(--md-sys-color-outline);
  font-size: 0.8rem;
  white-space: nowrap;
}
.own-message .message-timestamp {
  right: 2px;
  text-align: right;
}
.other-message .message-timestamp {
  left: 2px;
  text-align: left;
}

#inputArea {
  display: flex;
  flex-direction: column;
  padding: 10px 10px 20px 10px;
  background-color: var(--md-sys-color-surface);
  box-shadow: 0 0px 4px 0 rgba(0, 0, 0, 0.2);
  z-index: 1;
  box-sizing: border-box;
}
.messageInputWrap {
  display: flex;
  padding: 0px 20px 0px 10px;
  font-size: 1.2rem;
  border: 1px solid var(--md-sys-color-outline);
  background-color: white;
  border-radius: 25px;
  outline: none;
}
#messageInput {
  width: 100%;
  background: transparent;
  color: var(--wanma-sys-text);
  border: 0px solid #fff;
  padding: 16px 12px;
  font-size: 1.2rem;
}
#messageInput::placeholder {
  color: var(--md-sys-color-outline);
  opacity: 1; /* Firefox */
}

#messageInput::-ms-input-placeholder { /* Edge 12 -18 */
  color: var(--md-sys-color-outline);
}
#messageInput:focus-visible {
  outline: none;
}
#sendButton {
  margin: auto;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--md-sys-color-outline);
  padding: 9px 10px 7px 10px;
  border-radius: 10px;
  transition-duration: 0.25s;
  transition-property: color, background-color;
}
#sendButton svg {
  width: 20px;
  height: 20px;
}
#sendButton.active {
  background-color: var(--wanma-sys-primary); /* 修改hover顏色 */
  color: white;
}

#sendButton:hover:enabled {
  background-color: var(--wanma-sys-primary); /* 只有当按钮启用时才会变色 */
  color: white;
}

#quickText {
  display: flex;
  gap: 10px;
  padding-bottom: 5px;
  position: relative;
  white-space: nowrap;
  overflow-y: hidden;
  overflow-x: scroll;
  -webkit-overflow-scrolling: touch;
  backface-visibility: hidden;
  will-change: overflow-y;
  margin-bottom: 5px;
  box-sizing: content-box;
}
#quickText::-webkit-scrollbar {
  scrollbar-width: thin;
  background: transparent;
  width: 4px;
  height: 4px;
}

#quickText::-webkit-scrollbar-thumb{
  background: var(--md-sys-color-outline);
}

.quickTextButton {
  padding: 10px 15px; /* 增加填充，使其更易于移动设备上的点击 */
  font-size: 1rem; /* 字体大小与消息一致 */
  border: none;
  border-radius: 10px;
  background-color: var(--wanma-sys-primary); /* 可根据您的主题颜色进行更改 */
  color: white;
  cursor: pointer;
  transition: box-shadow 0.2s ease-in-out 0s;
}

.quickTextButton:hover {
  box-shadow: var(--md-sys-elevation-1);
}

.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

.modal-content {
  background-color: #fefefe;
  margin: 15% auto; /* 15% from the top and centered */
  padding: 20px;
  border: 1px solid #888;
  width: 80%; /* Could be more or less, depending on screen size */
}

.close-button {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close-button:hover,
.close-button:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}