* {
  box-sizing: border-box;
}

body,
html {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  color: #fff;
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  overflow: hidden;
  user-select: none;
  display: flex;
  flex-direction: column;
}

h1 {
  /* 居中 */
  text-align: center;
  margin: 5px 0;

  /* 特效字体：优先使用系统现代中文字体 */
  font-family: "Alibaba PuHuiTi", "Source Han Sans CN", "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  /* 加粗 */
  font-size: 6vh;
  ;
  ;
  /* 响应式可调整 */

  /* 文字渐变色（特效） */
  background: linear-gradient(45deg, #4a6cf7, #8a2be2, #ff6b6b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;

  /* 文字阴影（增强立体感） */
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

  /* 可选：加一点动画 */
  animation: fadeInDown 0.8s ease-out;
}

/* 淡入下滑动画（可选） */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 顶部标签页 */
.tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.0);
  z-index: 10;
  font-family: 'KaiTi', 'Times New Roman';
  /* margin: 0px 0 0px 0; */
}

.tab-btn {
  padding: 1.5vh 3vh;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 2vw;
  font-size: 3vh;
  cursor: pointer;
  transition: all 0.3s;
  --hover-offset: 0.8vh;
  /* 动态偏移量 */
}

.tab-btn.active {
  background: linear-gradient(90deg, #0ea5e9, #00c6ff);
  color: #000000;
  font-weight: bold;
  border: none;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}


.tab-btn:hover {
  background: linear-gradient(90deg, #68dbdb, #426481);
  transform: translateY(calc(-1 * var(--hover-offset)));
}

/* time.css */
.time-display {
  font-family: 'Times New Roman', 'Consolas', monospace;
  font-size: 6vh;
  font-weight: bold;
  color: #ffffff;
  /* 荧光绿 */

  text-align: center;
  width: fit-content;
  margin: 5px auto;
  animation: pulse 1.5s ease-in-out infinite alternate;
}

/* 键盘容器 */
.keyboard-container {
  height: 70vh;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5vh 0 7vh 0 ;
}

.keyboard {
  display: grid;
  gap: 8px;
  width: max-content;
  
}

.row {
  display: flex;
  gap: 8px;
}

.key {
  /* 使用 vw 计算基础尺寸，但限制最小/最大 */
  width: 5.5vw;
  height: 9.8vh;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 3.2vh;
  /* 主字母/符号 */
  ;
  font-weight: bold;
  text-align: center;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.4, 1);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  background: linear-gradient(145deg, #0f5f77, #525252);
  --hover-offset: 0.8vw;
  /* 动态偏移量 */
  white-space: pre-wrap;
}

.key:hover {
  transform: translateY(calc(-1 * var(--hover-offset)));
  box-shadow: 0 7px 15px rgba(0, 0, 0, 0.4);
  border-color: #00c6ff;
}

.key:active,
.key.clicked {
  transform: scale(2.0) translateY(-10px);
  z-index: 10;
  box-shadow: 0 12px 25px rgba(255, 255, 255, 0.3);
}

.key small {
  font-size: 1.4vh;
  /* 辅助说明文字 */
  ;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 2px;
  line-height: 1.2;
  opacity: 0.9;
}

/* ===== 特殊按键：用倍数或比例代替固定像素 ===== */
.backspace {
  width: calc(5.5vw * 2 + 10px);
}

.tab {
  width: calc(5.5vw* 1.5);
}

.caps {
  width: calc(5.5vw * 2);
}

.enter {
  width: calc(5.5vw * 2 + 20px);
}

.shift-left {
  width: calc(5.5vw * 2.5);
}

.shift-right {
  width: calc(5.5vw * 1.5 + 20px);
}

.space {
  width: calc(5.5vw * 5.25 + 45px);
}

.fs {
  width: calc(5.5vw * 1.5 + 10px);
}

/* 功能键 F1~F12 */
.F1,
.F2,
.F3,
.F4,
.F5,
.F6,
.F7,
.F8,
.F9,
.F10,
.F11,
.F12 {
  width: calc(5.5vw + (5.5vw*2 + 20px)/12);
}

/* 底部修饰键 */
.ctrl-left,
.win,
.alt {
  width: calc(5.5vw * 1.25);
}

.altgr,
.menu,
.ctrl-right {
  width: 5.5vw;
}


/* ===== 设置按钮 ===== */

.settings-btn {
  position: fixed;
  top: 0px;
  right: 0px;
  width: auto;
  /* 不固定宽高 */
  height: auto;
  background: none;
  /* 无背景 */
  border: none;
  /* 无边框 */
  color: #64748b;
  /* 灰色文字，可自定义 */
  font-size: 2vh;
  /* 图标大小 */
  cursor: pointer;
  z-index: 10000;
  padding: 4px;
  /* 微小内边距，方便点击 */
  margin: 0;
  outline: none;
  /* 去掉聚焦轮廓（可选） */
  /* 移除所有装饰 */
  border-radius: 0;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.settings-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  color: white;
  transform: scale(1.1);
}

.settings-btn.highlight {
  position: fixed;
  top: 0px;
  right: 0px;
  width: auto;
  /* 不固定宽高 */
  height: auto;
  background: none;
  /* 无背景 */
  border: none;
  /* 无边框 */
  color: #64748b;
  /* 灰色文字，可自定义 */
  font-size: 2.5vh;
  /* 图标大小 */
  cursor: pointer;
  z-index: 10000;
  padding: 4px;
  /* 微小内边距，方便点击 */
  margin: 0;
  outline: none;
  /* 去掉聚焦轮廓（可选） */
  /* 移除所有装饰 */
  border-radius: 0;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


.settings-menu {
  position: fixed;
  top: 4vh;
  right: 1.2vh;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
  padding: 8px;
  z-index: 9999;
  display: none;
  flex-direction: column;
  gap: 4px;
  /* min-width: 180px; 防止文字换行，保持整齐 */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.settings-menu button {
  display: flex;
  align-items: center;
  gap: 1vh;
  padding: 1vh 1.4vh;
  border: none;
  border-radius: 0.8vh;
  background: transparent;
  color: #333;
  font-size: 1.4vh;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  outline: none;
  /* z-index: 10001; */
}

.settings-menu button:hover {
  background: #f0f5ff;
  color: #2563eb;
}

.settings-menu button:active {
  background: #e0ecff;
  transform: scale(0.99);
}

/* 可选：为不同操作加图标颜色区分 */
.settings-menu button:nth-child(1) {
  color: #16a34a;
}

/* 导出 - 绿色 */
.settings-menu button:nth-child(2) {
  color: #0d6efd;
}

/* 导入 - 蓝色 */
.settings-menu button:nth-child(3) {
  color: #dc2626;
}

/* 重置 - 红色 */
.settings-menu button:nth-child(4) {
  color: #dc26dc;
}

/* 重置 - 红色 */
.settings-menu button:nth-child(5) {
  color: #07ce53;
}

/* 提示 */

#toast-container {
  position: fixed;
  top: 8vh;
  right: 2vh;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 1vh;
  pointer-events: none;
  /* 不阻挡点击 */
}

.toast {
  pointer-events: auto;
  /* 但提示本身可点击关闭 */
  /* max-width: 320px; */
  padding: 1.2vh 1.6vh;
  border-radius: 0.8vh;
  color: white;
  font-size: 1.4vh;
  box-shadow: 0 0.4vh 1.2vh rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(0.4vh);
  animation: toast-in 0.3s ease forwards;
  display: flex;
  align-items: center;
  gap: 0.8vh;
}

.toast.success {
  background: rgba(16, 185, 129, 0.95);
  /* 绿色 - 成功 */
}

.toast.error {
  background: rgba(239, 68, 68, 0.95);
  /* 红色 - 错误 */
}

.toast.info {
  background: rgba(59, 130, 246, 0.95);
  /* 蓝色 - 信息 */
}

.toast .close-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: white;
  font-weight: bold;
  cursor: pointer;
  font-size: 1.6vh;
  padding: 0;
  width: 2vh;
  height: 2vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast.hiding {
  animation: toast-out 0.3s ease forwards;
}


/* confirm */
/* 遮罩层 */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 3000;
}

/* 弹窗 */
.confirm-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3001;
}

.confirm-content {
  background: white;
  padding: 2.4vh;
  border-radius: 1.2vh;
  box-shadow: 0 1vh 3vh rgba(0, 0, 0, 0.2);
  width: 20vw;
  height: 22%;
  text-align: center;
}

.confirm-content h3 {
  margin: 0 0 1.2vh;
  color: #1e293b;
  font-size: 2.5vh;
}

.confirm-content p {
  margin: 0 0 2vh;
  color: #475569;
  line-height: 1.5;
  font-size: 2vh;
}

.confirm-buttons {
  display: flex;
  gap: 1.2vh;
  justify-content: center;
}

.confirm-buttons button {
  padding: 1vh 2vh;
  border: none;
  border-radius: 0.6vh;
  font-weight: 500;
  cursor: pointer;
  font-size: 1.8vh;
}

.btn-cancel {
  background: #f1f5f9;
  color: #475569;
}

.btn-cancel:hover {
  background: #e2e8f0;
}

.btn-ok {
  background: #dc2626;
  /* 红色表示危险操作 */
  color: white;
}

.btn-ok:hover {
  background: #b91c1c;
}

/* 帮助遮罩 */
.help-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10001;
  display: none;
}

/* 帮助弹窗 */
.help-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10002;
  display: none;
}

.help-content {
  background: white;
  padding: 2.5vh;
  border-radius: 1vh;
  /* max-width: 500px; */
  width: 90%;
  box-shadow: 0 0.4vh 2vh rgba(0, 0, 0, 0.3);
  font-size: 1.4vh;
  color: #000000;
  line-height: 1.6;
}

.help-content h2 {
  margin-top: 0;
  color: #333;
  font-size: 2.2vh;
}

.help-content strong {
  margin-top: 0;
  font-size: 2vh;
}
.help-content ul {
  padding-left: 2vh;
  font-size: 1.8vh;
}

.help-content code {
  background: #f0f0f0;
  padding: 0.2vh 0.4vh;
  border-radius: 0.3vh;
  font-family: monospace;
}

.help-content button {
  margin-top: 1.5vh;
  padding: 0.8vh 1.6vh;
  background: #007acc;
  color: white;
  border: none;
  border-radius: 0.4vh;
  cursor: pointer;
  font-size: 1.4vh;

}

.help-content button:hover {
  background: #005a9e;
}

/* 配置键盘容器 */


/* 键盘容器 */
.keyboard-container-p {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  /* transform: translate(-50%, -50%); */
  justify-content: center;
  align-items: center;
  padding: 0px;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  display: flex;
  z-index: 3000;
}

.keyboard-p {
  display: flex;
  gap: 8px;
  width: auto;
  flex-direction: column;
  /* 👈 关键：让 row-p 垂直排列 */
}

.row-p {
  display: flex;
  gap: 8px;
  margin: 8px;
  justify-content: center;
  /* 可选：让每行内部也居中 */
}

.key-p {
  /* 使用 vw 计算基础尺寸，但限制最小/最大 */
  width: 5.5vw;
  height: 9.8vh;
  /* border-radius: 10px; */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 2.4vh;
  /* 主字母/符号 */
  font-weight: bold;
  text-align: center;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.4, 1);
  position: relative;
  border: 1px solid rgb(255, 255, 255);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  background: linear-gradient(145deg, #0f5f77, #525252);
  --hover-offset: 1.4vh;
  /* 动态偏移量 */
  white-space: pre-wrap;
}

.key-p textarea {
  font-size: 1.4vh;
  /* 辅助说明文字 */
  ;
  color: rgba(0, 0, 0, 0.9);
  margin-top: 2px;
  line-height: 1.2;
  opacity: 0.9;
  width: 100%;
  height: 100%;
  text-align: center;
}

/* ===== 特殊按键：用倍数或比例代替固定像素 ===== */
.backspace-p {
  width: calc(5.5vw * 2 + 10px);
}

.tab-p {
  width: calc(5.5vw * 1.5);
}

.caps-p {
  width: calc(5.5vw * 2);
}

.enter-p {
  width: calc(5.5vw * 2 + 20px);
}

.shift-left-p {
  width: calc(5.5vw * 2.5);
}

.shift-right-p {
  width: calc(5.5vw * 1.5 + 20px);
}

.space-p {
  width: calc(5.5vw * 5.25 + 45px);
}

.fs-p {
  width: calc(5.5vw * 1.5 + 10px);
}

/* 功能键 F1~F12 */
.F1-p,
.F2-p,
.F3-p,
.F4-p,
.F5-p,
.F6-p,
.F7-p,
.F8-p,
.F9-p,
.F10-p,
.F11-p,
.F12-p {
  width: calc(5.5vw + (5.5vw * 2 + 20px)/12);
}

/* 底部修饰键 */
.ctrl-left-p,
.win-p,
.alt-p {
  width: calc(5.5vw * 1.25);
}

.altgr-p,
.menu-p,
.ctrl-right-p {
  width: 5.5vw;
}

/* 撇配置顶部标签页 */
.tabs-p {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.0);
  z-index: 10;
  font-family: 'KaiTi', 'Times New Roman';
  /* margin: 0px 0 0px 0; */
}

.tab-btn-p {
  padding: 2.4vh 5vh;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3.5vh;
  font-size: 2vh;
  ;
  cursor: pointer;
  transition: all 0.3s;
  --hover-offset: 1.2vw;
  /* 动态偏移量 */
}

.tab-btn-p.active {
  background: linear-gradient(90deg, #0ea5e9, #00c6ff);
  color: #000000;
  font-weight: bold;
  border: none;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}


.tab-btn:hover {
  background: linear-gradient(90deg, #68dbdb, #426481);
  transform: translateY(calc(-1 * var(--hover-offset)));
}

/* 确认保存配置按钮容器 */
.buttons-p {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 24px;
  /* 与上方内容保持间距 */
  padding: 0 20px;
  /* 防止在小屏贴边 */
}

.buttons-p button {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.8vh;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* 取消按钮 - 中性灰 */
.cancel-btn-p {
  background: #64748b;
  color: white;
}

.cancel-btn-p:hover {
  background: #475569;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

/* 取消按钮 - 默认 */
.reset-btn-p {
  background: #64748b;
  color: white;
}

.reset-btn-p:hover {
  background: #475569;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

/* 删除按钮 - 警告红 */
.del-btn-p {
  background: #ef4444;
  /* Tailwind red-500 */
  color: white;
}

.del-btn-p:hover {
  background: #dc2626;
  /* Tailwind red-600 */
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
}

/* 保存按钮 - 成功绿（你原用红色，但“保存”应是安全操作！）*/
.save-btn-p {
  background: #10b981;
  /* emerald-500，清新绿色 */
  color: white;
}

.save-btn-p:hover {
  background: #059669;
  /* emerald-600 */
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

/* 添加按钮 - 同样用绿色，但稍亮 */
.add-btn-p {
  background: #34d399;
  /* emerald-400 */
  color: #ffffff;
}

.add-btn-p:hover {
  background: #10b981;
  /* emerald-500 */
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(52, 211, 153, 0.4);
}

/* 按钮聚焦时的无障碍支持 */
.buttons-p button:focus {
  outline: 2px solid #ffffff55;
  outline-offset: 2px;
}

/* 全局模态框基础样式 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

.modal-dialog {
  position: relative;
  background: white;
  border-radius: 0.8vh;
  box-shadow: 0 0.4vh 1.2vh rgba(0, 0, 0, 0.15);
  padding: 2vh;
  max-width: 90%;
  width: 18vw;
  margin: auto;
  top: 50%;
  transform: translateY(-50%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-sizing: border-box;
}

.modal-title {
  margin: 0 0 1.2vh;
  font-size: 1.6vh;
  color: #333;
}

.modal-message {
  margin: 0 0 1.6vh;
  font-size: 1.4vh;
  color: #666;
}

.modal-input {
  width: 100%;
  padding: 0.8vh 1vh;
  border: 1px solid #ccc;
  border-radius: 0.4vh;
  font-size: 1.4vh;
  box-sizing: border-box;
}

.modal-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 0.2vh rgba(0, 123, 255, 0.25);
}

.modal-buttons {
  margin-top: 1.6vh;
  text-align: right;
}

.modal-btn {
  padding: 0.6vh 1.2vh;
  border: 0.1vh solid transparent;
  border-radius: 0.4vh;
  font-size: 1.4vh;
  cursor: pointer;
  margin-left: 0.8vh;
}

.modal-btn-cancel {
  background: #f0f0f0;
  color: #333;
  border-color: #ddd;
}

.modal-btn-cancel:hover {
  background: #e0e0e0;
}

.modal-btn-ok {
  background: #007bff;
  color: white;
  border: none;
}

.modal-btn-ok:hover {
  background: #0069d9;
}