body {
    background-color: #f8f9fa;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    padding: 20px;
}

#brain-container {
    display: grid;
    grid-template-rows: auto 1fr auto;
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 1200px;
    height: 95%;
    position: relative;
}

.flex-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

#clear-button {
    position: absolute;
    top: 10px;
    left: 10px;
    cursor: pointer;
    color: #007bff;
    background: none;
    border: none;
    font-size: 20px;
    outline: none;
}

#brain-box {
    overflow-y: auto;
    padding-bottom: 0px;
}

.brain-message {
    margin-bottom: 15px;
    background-color: #D6EAF8;
    font-family: "LXGW WenKai TC", "Roboto Slab", serif;
    padding: 5px;
    margin-right: 20px;
}

.brain-message.user {
    background-color: #D1F2EB;
    margin-right: 0;
    margin-left: 20px;
}

#brain-form {
    display: flex;
}

#message {
    flex-grow: 1;
    margin-right: 10px;
    resize: none;
    height: auto;
    min-height: 38px;
    /* Minimum height */
    max-height: 92px;
    /* Maximum height (about 4 lines) */
    overflow-y: auto;
    /* Show scrollbar if content exceeds max height */
}

@media (max-width: 768px) {
    #brain-container {
        width: 100%;
        height: 100vh;
        padding: 10px;
    }

    #brain-form {
        flex-direction: column;
    }

    #message {
        margin-right: 0;
        margin-bottom: 0px;
    }
}

@media (min-width: 1200px) {
    #brain-container {
        width: 75%;
    }
}

.lxgw-wenkai-tc-regular {
    font-family: "LXGW WenKai TC", cursive;
    font-weight: 400;
    font-style: normal;
}

.roboto-slab-400 {
    font-family: "Roboto Slab", serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
}

.switch {
    position: relative;
    display: inline-block;
    width: 2em;
    height: 1em;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: hsl(207, 90%, 58%);
    transition: 0.4s;
    border-radius: 1em;
}

.slider:before {
    position: absolute;
    content: "";
    height: 0.8em;
    width: 0.8em;
    left: 0.1em;
    bottom: 0.1em;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: hsl(122, 39%, 49%);
}

input:checked + .slider:before {
    transform: translateX(1em);
}


.form-check-input:checked + .btn {
    background-color: rgba(0, 123, 255, 0.5); /* 改變背景顏色 */
    color: white; /* 改變文字顏色 */
}

.btn-custom {
    padding: 3px 6px; /* 調整按鈕內部邊界 */
    font-size: 0.6em; /* 調整按鈕字體大小 */
}
/* 隱藏原本的 radio 按鈕 */
input[type="radio"] {
    display: none;
  }
  
  /* 按鈕樣式，全部方角，縮小一半 */
  label.btn {
    padding: 4px 9px;           /* 由 8px 18px 縮小一半 */
    cursor: pointer;
    display: inline-block;
    margin: 0 4px 4px 0;        /* 間距也縮小一半 */
    text-align: center;
    border-radius: 0;           /* 完全方角 */
    background-color: #f0f0f0;
    border: 2px solid #ccc;
    font-weight: 600;
    font-size: 0.8rem;          /* 縮小字體 */
    color: #555;
    user-select: none;
    transition: all 0.3s ease;
    min-width: 24px;            /* 由 48px 縮小一半 */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }
  
  /* 滑鼠懸停效果 */
  label.btn:hover {
    background-color: #d9f0d9;
    border-color: #28a745;
    color: #28a745;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
  }
  
  /* 按下時的按鈕效果 */
  label.btn:active {
    background-color: #1e7e34;
    border-color: #1e7e34;
    color: white;
    box-shadow: none;
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
  
  /* 當 radio 被選中時，變更按鈕的樣式 */
  input[type="radio"]:checked + label {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
    box-shadow: 0 3px 6px rgba(40, 167, 69, 0.5);
    font-weight: 700;
    transform: scale(1.05);
    transition: all 0.3s ease;
  }