/* ===== Shell & global ===== */

#simple-keytest {
  max-width: 1000px; /* 控制整体宽度，方便一屏展示 */
  margin: 24px auto;
  padding: 20px 20px 22px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, #43c2ff, #1b83ff);
  color: #ffffff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-sizing: border-box;
}

#simple-keytest * {
  box-sizing: border-box;
}

.kb-inner {
  max-width: 940px;
  margin: 0 auto;
}

/* 标题 + 信息栏 */

.kb-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

.kb-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  margin-bottom: 10px;
}

.kb-info span {
  white-space: nowrap;
}

.kb-last {
  font-weight: 600;
}

#kt-reset {
  padding: 4px 12px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #1160c7;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

#kt-reset:hover {
  background: #ffffff;
}

.kb-note {
  margin-top: 12px;
  font-size: 11px;
  opacity: 0.9;
  text-align: center;
}

/* ===== Keyboard layout ===== */

.kt-keyboard {
  margin-top: 8px;
  padding: 14px 16px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: radial-gradient(circle at top left, rgba(255,255,255,0.18), rgba(255,255,255,0.05));
  overflow-x: auto; /* 小屏还能滑动，大屏基本不需要 */
}

.kt-row {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.kt-main,
.kt-nav,
.kt-num {
  display: flex;
}

/* 主键盘与导航 / 数字区间距 */

.kt-nav {
  margin-left: 18px;
}

/* 数字区整体离方向键远一点，看起来是独立块 */

.kt-num {
  margin-left: 26px;
}

/* ===== 按键样式（整体紧凑） ===== */

.kt-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: top;
  margin-right: 3px;
  min-width: 36px;
  height: 36px;
  padding: 0 5px;
  text-align: center;
  border-radius: 6px;
  border: 1.5px solid rgba(0, 0, 0, 0.06);
  background: #fdfdfd;
  color: #222222;
  font-size: 12px;
  line-height: 1.1;
  user-select: none;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
  transition: background 0.12s ease, border-color 0.12s ease,
              box-shadow 0.12s ease, transform 0.06s ease;
}

.kt-key.small {
  min-width: 32px;
  height: 32px;
  font-size: 11px;
}

.kt-key.wide {
  min-width: 56px;
}

.kt-key.extra-wide {
  min-width: 88px;
}

/* 一般的“0 宽键” */

.kt-key.zero-wide {
  min-width: 76px;
}

/* 占位空白，用于行内对齐 */

.kt-spacer {
  display: inline-block;
  margin-right: 3px;
  min-width: 36px;
  height: 36px;
  visibility: hidden;
}

/* 空格键宽度减小一点，更紧凑 */

.kt-key[data-code="Space"] {
  min-width: 220px;
}

/* ===== 数字键盘细节调优：统一列宽，0 占两列 ===== */

.kt-num .kt-key,
.kt-num .kt-spacer {
  min-width: 34px;
  margin-right: 2px;
}

.kt-num .kt-key.zero-wide {
  min-width: calc(34px * 2 + 2px); /* 两键宽 + 间距 */
}

/* ===== 状态颜色 ===== */

.kt-key.tested {
  background: #e6ffe8;
  border-color: #3bbf52;
}

.kt-key.pressed {
  background: #5ec2ff;
  border-color: #ffffff;
  color: #ffffff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25) inset;
  transform: translateY(1px);
}

/* ===== 小屏适配 ===== */

@media (max-width: 700px) {
  #simple-keytest {
    padding: 16px 10px 18px;
  }

  .kb-title {
    font-size: 18px;
  }

  .kt-keyboard {
    padding: 12px 10px 14px;
  }

  .kt-key {
    min-width: 32px;
    height: 32px;
    font-size: 11px;
  }

  .kt-key.small {
    min-width: 30px;
    height: 30px;
    font-size: 10px;
  }

  .kt-key.wide {
    min-width: 50px;
  }

  .kt-key.extra-wide {
    min-width: 80px;
  }

  .kt-key.zero-wide {
    min-width: 70px;
  }

  .kt-key[data-code="Space"] {
    min-width: 190px;
  }

  .kt-num .kt-key,
  .kt-num .kt-spacer {
    min-width: 30px;
  }

  .kt-num .kt-key.zero-wide {
    min-width: calc(30px * 2 + 2px);
  }
}

/* CTA button below keyboard tester */
.kb-cta-wrap {
  margin-top: 16px;
  text-align: center;
}

.kb-cta-btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 999px;
  background: #ffb400;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  transition: background 0.12s ease, transform 0.08s ease, box-shadow 0.08s ease;
}

.kb-cta-btn:hover {
  background: #ff9a00;
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}
