/* 适配所有手机屏幕 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", sans-serif; /* 老人熟悉的字体 */
  }
  
  body {
    background-color: #F5F5F5;
    padding: 15px;
    min-height: 100vh;
  }
  
  .title {
    font-size: 28px; /* 大字体 */
    font-weight: bold;
    text-align: center;
    margin: 30px 0;
    color: #333;
  }
  
  /* 语音按钮（大尺寸，易触摸） */
  .voice-btn {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background-color: #FFD700;
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.1s;
    -webkit-tap-highlight-color: transparent;
  }
  
  .voice-btn:active {
    transform: scale(0.95);
    background-color: #FFA500;
  }
  
  .voice-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
    color: #333;
  }
  
  .btn-text {
    font-size: 18px;
    font-weight: bold;
    color: #333;
  }
  
  .input-switch {
      text-align: center;
      margin-bottom: 30px;
  }
  
  .text-link {
      background: none;
      border: none;
      color: #0066CC;
      font-size: 16px;
      text-decoration: underline;
      padding: 10px;
  }

  .text-input-area {
      margin: 20px 0;
      text-align: center;
  }

  #textInput {
      width: 100%;
      height: 100px;
      padding: 10px;
      border: 1px solid #ddd;
      border-radius: 8px;
      font-size: 18px;
      margin-bottom: 15px;
      resize: none;
  }

  .confirm-btn {
      background-color: #3CB371;
      color: white;
      border: none;
      padding: 12px 30px;
      border-radius: 25px;
      font-size: 18px;
  }
  
  .quick-choice {
    margin-top: 30px;
  }
  
  .choice-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 25px;
    color: #333;
    text-align: center;
  }
  
  /* 一键选择按钮（响应式，自动换行） */
  .choice-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
  }
  
  .choice-btn {
    background-color: #FFFFFF;
    color: #333;
    border: 2px solid #FFD700;
    border-radius: 12px;
    padding: 15px 25px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  }
  
  .choice-btn:active {
    background-color: #FFF8DC;
  }
  
  .guide-link {
    display: block;
    text-align: center;
    font-size: 18px;
    color: #0066CC;
    margin-top: 50px;
    text-decoration: none;
    padding: 15px;
  }
  
  /* 适配小屏手机 */
  @media (max-width: 375px) {
    .title {
      font-size: 24px;
    }
    .voice-btn {
      width: 130px;
      height: 130px;
    }
    .choice-btn {
      padding: 12px 18px;
      font-size: 16px;
    }
  }

  /* 模态框样式 */
  .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.6);
      z-index: 1000;
      display: flex;
      justify-content: center;
      align-items: center;
      opacity: 0;
      transition: opacity 0.3s;
      pointer-events: none;
  }
  
  .modal-overlay.active {
      opacity: 1;
      pointer-events: auto;
  }
  
  .modal-content {
      background: white;
      width: 100%; /* 撑满宽度 */
      height: 100%; /* 撑满高度 */
      max-width: none; /* 移除最大宽度限制 */
      border-radius: 0; /* 移除圆角，因为撑满了 */
      padding: 20px;
      box-shadow: none; /* 全屏不需要阴影 */
      transform: translateY(100%); /* 从底部滑入 */
      transition: transform 0.3s;
      display: flex;
      flex-direction: column;
      max-height: none; /* 移除最大高度限制 */
  }
  
  .modal-overlay.active .modal-content {
      transform: translateY(0);
  }

  /* 标题栏，模拟原生APP */
  .modal-header {
      display: flex;
      justify-content: center;
      align-items: center;
      padding-bottom: 15px;
      border-bottom: 1px solid #eee;
      margin-bottom: 10px;
      font-size: 18px;
      font-weight: bold;
      color: #333;
      position: relative;
  }
  
  /* 将原来的关闭按钮移到左上角作为“返回” */
  .modal-back-btn {
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
      background: none;
      border: none;
      font-size: 24px;
      padding: 10px;
      cursor: pointer;
      color: #333;
  }

  /* 隐藏原来的底部关闭按钮 */
  .modal-close-btn {
      display: none !important; 
  }
  .chat-history {
      flex: 1;
      overflow-y: auto;
      margin-bottom: 20px;
      padding: 10px 0; /* 减少左右 padding */
      display: flex;
      flex-direction: column;
      gap: 20px; /* 增加消息间距 */
  }

  .chat-message {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      max-width: 100%;
  }

  .chat-message.user {
      flex-direction: row-reverse;
  }

  .chat-avatar {
      width: 40px; /* 稍大一点 */
      height: 40px;
      border-radius: 50%;
      background: #eee;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
      flex-shrink: 0;
      /* 靠边 */
      margin-top: 2px;
  }

  .chat-bubble {
      background: #f0f0f0;
      padding: 12px 18px; /* 增加内边距 */
      border-radius: 18px;
      border-top-left-radius: 2px;
      font-size: 17px; /* 稍大字体 */
      line-height: 1.6;
      color: #333;
      word-break: break-word;
      /* 限制最大宽度，让文字更居中感 */
      max-width: 85%; 
  }

  .chat-message.user .chat-bubble {
      background: #FFD700; 
      border-top-left-radius: 18px;
      border-top-right-radius: 2px;
      text-align: right; /* 用户文字右对齐 */
  }

  .chat-status {
      font-size: 12px;
      color: #999;
      margin-top: 5px;
      text-align: left;
  }

  /* 隐藏原来的居中元素 */
  .modal-icon, .modal-text {
      display: none; 
  }
  
  /* 底部输入栏 */
  .modal-input-bar {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px solid #eee;
  }

  .modal-icon-btn {
      background: none;
      border: none;
      font-size: 24px;
      cursor: pointer;
      padding: 5px;
  }

  .modal-voice-btn {
      flex: 1;
      background-color: #FFD700;
      border: none;
      border-radius: 25px;
      padding: 12px;
      font-size: 16px;
      font-weight: bold;
      color: #333;
      cursor: pointer;
      /* 禁止文本选中 */
      user-select: none;
      -webkit-user-select: none;
  }

  .modal-voice-btn:active {
      background-color: #FFA500;
  }

  .modal-text-container {
      flex: 1;
      display: flex;
      gap: 10px;
  }

  .modal-text-input {
      flex: 1;
      padding: 10px 15px;
      border: 1px solid #ddd;
      border-radius: 20px;
      font-size: 16px;
      outline: none;
  }

  .modal-send-btn {
      background-color: #3CB371;
      color: white;
      border: none;
      padding: 0 20px;
      border-radius: 20px;
      font-size: 16px;
      cursor: pointer;
      /* 保持不换行 */
      white-space: nowrap;
      flex-shrink: 0; 
  }

  .modal-close-btn {
      background-color: transparent;
      color: #999;
      border: 1px solid #eee;
      padding: 8px 20px;
      border-radius: 20px;
      font-size: 14px;
      cursor: pointer;
      margin-top: 10px;
      align-self: center;
  }

  /* TTS 播放动画 */
  .tts-wave {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 20px;
      margin-top: 10px;
      gap: 3px;
      align-self: center;
  }
  
  .tts-bar {
      width: 4px;
      background-color: #FFD700;
      border-radius: 2px;
      animation: sound 0s infinite ease-in-out alternate;
  }
  
  .tts-wave.playing .tts-bar {
      animation-duration: 0.4s;
  }
  
  .tts-bar:nth-child(1) { height: 10px; animation-delay: -0.2s; }
  .tts-bar:nth-child(2) { height: 16px; animation-delay: -0.1s; }
  .tts-bar:nth-child(3) { height: 20px; animation-delay: 0s; }
  .tts-bar:nth-child(4) { height: 16px; animation-delay: -0.3s; }
  .tts-bar:nth-child(5) { height: 10px; animation-delay: -0.4s; }
  
  @keyframes sound {
      0% { height: 4px; }
      100% { height: 20px; }
  }
