/* KeyTestPro V2 - Keyboard Hardware Tester Responsive Stylesheet */

.keyboard-wrapper {
  overflow-x: auto;
  overflow-y: hidden; /* ❗ prevent vertical scroll */
  width: 100%;
}

/* ================= KEYBOARD CONTAINER ================= */
#keyboard_section {
  width: 100%;
}

#keyboard_container_main {
  width: 77%;
  margin: 0 auto;
}

.keyboard-container {
  background-color: var(--bg-surface, #ffffff);
  width: 100%;
  height: 25.5vw;
  margin: 0 auto;
  padding: 2vw 0.5vw;
  border-radius: 0.5vw;
  display: flex;
  gap: .3vw;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

/* ================= KEYBOARD BLOCKS ================= */

.keyboard-block {
  width: 64%;
  margin: 0 auto;
  padding: .1vw;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
}

/* MAIN KEYBOARD */
.main .row {
  display: flex;
  gap: 0.3vw;
  margin-bottom: 0.3vw;
}

/* NAV KEYS */
.nav {
  display: grid;
  grid-template-columns: repeat(3, 4vw);
  gap: .3vw 0vw;
  margin-top: 4vw;
  margin-block: 4vw;
}

/* ARROWS */
.middle {
  width: 16%;
}

.middle .key {
  width: 3.5vw;
  height: 3.5vw;
}

.arrows {
  display: grid;
  grid-template-columns: repeat(3, 4vw);
  gap: .3vw 0vw;
}

/* NUMPAD */
.numpad {
  width: 19%;
  margin-top: 4.2vw;
  display: grid;
  grid-template-columns: repeat(4, 3.5vw);
  grid-auto-rows: 3.7vw;
  gap: 0.1vw;
}

/* ================= KEY STYLE ================= */
.numpad .key {
  width: 3.5vw;
  height: 3.5vw;
}

.key {
  box-shadow: 0 6px 103px 0 rgba(255, 0, 140, 0.2), 0 6px 20px 0 rgba(0, 255, 251, 0.19);
  width: 3.5vw;
  height: 3.5vw;
  border-radius: 8px;
  text-align: center;
  line-height: 3.5vw;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-main, #020617);
  background: var(--bg-app, #f8fafc);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.key:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 10px aqua;
  border-color: var(--primary);
  cursor: pointer;
}

.numpad .key {
  width: 3.3vw;
  height: 3.3vw;
}

/* WIDTHS and RGB colour */
.arrows .w1 {
  box-shadow: 0 3px 1px 0 rgba(255, 0, 132, 0.652), 0 0px 20px 0 rgba(255, 0, 132, 0.39);
}

.numpad .w1 {
  box-shadow: 0 3px 1px 0 rgba(0, 255, 221, 0.652), 0 1px 20px 0 rgba(0, 250, 241, 0.39);
}

.w1 {
  width: 3.5vw;
  box-shadow: 0 3px 1px 0 rgba(0, 255, 221, 0.652), 0 1px 20px 0 rgba(0, 255, 0, 0.39);
}

.w2 {
  width: 7.2vw;
  box-shadow: 0 3px 1px 0 rgba(230, 167, 31, 0.541), 0 1px 20px 0 rgba(255, 174, 0, 0.39);
}

.w3 {
  width: 9.3vw;
  box-shadow: 0 3px 1px 0 rgba(255, 0, 93, 0.652), 0 1px 20px 0 rgba(255, 0, 128, 0.39);
}

.w6 {
  width: 22vw;
  box-shadow: 0 3px 1px 0 rgba(255, 255, 0, 0.652), 0 1px 20px 0 rgba(255, 251, 0, 0.39);
}

.h2 {
  height: 7.2vw;
  line-height: 7.2vw;
  box-shadow: 0 3px 1px 0 rgba(0, 255, 51, 0.652), 0 1px 20px 0 rgba(255, 255, 0, 0.252);
}

/* NUMPAD SPECIAL KEYS */
.numpad .zero {
  grid-column: span 2;
  width: 6.9vw;
  font-size: 0.85rem;
}

.numpad .enter {
  grid-row: span 2;
  height: 7vw;
}

.numpad .h2 {
  height: 7vw;
}

.numpad .dot {
  grid-column: 3;
}

/* PRESS EFFECT */
.key.active {
  background: #020617 !important;
  color: aqua !important;
  box-shadow: 0 0 14px aqua !important;
  transform: translateY(3px);
}

/* MENU KEY */
.key.menu {
  font-size: 1rem;
}

/* PERMANENT PRESSED KEY */
.key.pressed {
  background: #22c55e !important;
  color: white !important;
  box-shadow: 0 0 16px #22c55e !important;
  border-color: #22c55e !important;
}

/* ERROR KEY */
.key.error {
  background: #ef4444 !important;
  color: white !important;
  box-shadow: 0 0 18px red !important;
  border-color: #ef4444 !important;
}

/* ================= RESPONSIVE DESIGN ================= */

/* -------------------for Large mobile (426px)---------------------------- */
@media (max-width: 426px) {
  /* Wrapper handles scroll, not page */
  .keyboard-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 1vw 1vw;
    display: block;
  }

  #keyboard_container_main {
    width: fit-content;
    margin: auto;
  }

  .keyboard-container {
    margin: 0px auto;
    transform: none !important;
    background: var(--bg-surface, #ffffff);
    border-radius: 2vw;
    padding: 2vw;
    align-items: stretch;
    height: 64vw;
    transform-origin: center;
    width: fit-content;
    display: flex;
    gap: 2vw;
  }

  .keyboard-block {
    background: var(--bg-surface, #ffffff);
    padding: 2vw;
    border-radius: 0vw;
    display: flex;
    flex-direction: column;
    width: auto;
  }

  /* MAIN KEYBOARD */
  .main .row {
    display: flex;
    gap: 1.5vw;
    margin-bottom: 1vw;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(3, 8vw);
    margin-top: 9.6vw;
    margin-bottom: 1vw;
    column-gap: 1vw;
    row-gap: 1.5vw;
    width: 27vw;
  }

  .middle {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 32.5vw;
  }

  .arrows {
    display: grid;
    grid-template-columns: repeat(3, 8vw);
    margin-top: 8.2vw;
    margin-left: 0.6vw;
    width: 27vw;
    column-gap: 1vw;
    row-gap: 1.2vw;
  }

  /* NUMPAD */
  .numpad {
    width: 40vw;
    display: grid;
    grid-template-columns: repeat(4, 9vw);
    grid-auto-rows: 9.2vw;
    height: 100%;
    padding-top: 12vw;
    margin-top: 0vw;
    column-gap: 0vw;
    row-gap: 0vw;
  }

  /* ================= KEY STYLE ================= */

  .key {
    box-shadow: 0 6px 103px 0 rgba(255, 0, 140, 0.2), 0 6px 20px 0 rgba(0, 255, 251, 0.19);
    border-radius: 2vw;
    text-align: center;
    line-height: 8vw;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-main, #020617);
    transition: 0.08s;
    user-select: none;
    width: 8vw;
    height: 8vw;
  }

  .middle .key {
    width: 8vw;
    height: 8vw;
    border-radius: 2vw;
    text-align: center;
    line-height: 8vw;
    font-size: 0.65rem;
    font-weight: 600;
  }

  .numpad .key {
    width: 8vw;
    height: 8vw;
    border-radius: 8px;
    text-align: center;
    line-height: 8vw;
    font-size: 0.65rem;
    font-weight: 600;
  }

  /* WIDTH CLASSES and setting RGB colour */
  .w1 {
    width: 36px;
    box-shadow: 0 .3vw .1vw 0 rgba(0, 255, 221, 0.652), 0 1px 20px 0 rgba(0, 255, 0, 0.39);
  }

  .numpad .w1 {
    box-shadow: 0 .3vw .1vw 0 rgba(0, 255, 221, 0.652), 0 1px 20px 0 rgba(0, 250, 241, 0.39);
  }

  .arrows .w1 {
    box-shadow: 0 .3vw .1vw 0 rgba(255, 0, 132, 0.652), 0 0px 20px 0 rgba(255, 0, 132, 0.39);
  }

  .w2 {
    width: 76px;
    box-shadow: 0 .3vw .1vw 0 rgba(230, 167, 31, 0.541), 0 1px 20px 0 rgba(255, 174, 0, 0.39);
  }

  .w3 {
    width: 96px;
    box-shadow: 0 .3vw .1vw 0 rgba(255, 0, 93, 0.652), 0 1px 20px 0 rgba(255, 0, 128, 0.39);
  }

  .w6 {
    width: 220px;
    box-shadow: 0 .3vw .1vw 0 rgba(255, 255, 0, 0.652), 0 1px 20px 0 rgba(255, 251, 0, 0.39);
  }

  .h2 {
    height: 76px;
    line-height: 16vw;
    box-shadow: 0 .3vw .1vw 0 rgba(0, 255, 51, 0.652), 0 1px 20px 0 rgba(255, 255, 0, 0.252);
  }

  /* NUMPAD SPECIAL KEYS */
  .numpad .zero {
    width: 16.9vw;
    grid-column: span 2;
    font-size: 0.85rem;
  }

  .numpad .enter {
    grid-row: span 2;
  }

  .numpad .h2 {
    height: 17vw;
    line-height: 16vw;
  }

  .numpad .dot {
    grid-column: 3;
  }
}

/* Small Mobile final */
@media (max-width: 320px) {
  .keyboard-container {
    transform: scale(0.6);
  }

  .keyboard-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 8px 4px;
    display: block;
  }

  .keyboard-container {
    margin: 0px auto;
    transform: none !important;
    background: var(--bg-surface, #ffffff);
    border-radius: 6px;
    padding: 7px;
    align-items: stretch;
    height: 72vw;
    transform-origin: center;
    width: fit-content;
    display: flex;
    gap: 6px;
    gap: 8vw;
  }

  .keyboard-block {
    background: var(--bg-surface, #ffffff);
    padding: 2vw;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    width: auto;
  }

  /* MAIN KEYBOARD */
  .main .row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(3, 36px);
    margin-top: 10.4vw;
    margin-bottom: 30px;
    column-gap: 0vw;
    row-gap: 1.5vw;
  }

  .middle {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .arrows {
    display: grid;
    grid-template-columns: repeat(3, 36px);
    margin-top: 4vw;
    column-gap: 0vw;
    row-gap: 1.5vw;
  }

  /* NUMPAD */
  .numpad {
    display: grid;
    grid-template-columns: repeat(4, 35px);
    grid-auto-rows: 35px;
    padding-top: 12.6vw;
    height: 100%;
    margin-top: 0vw;
    column-gap: 0vw;
    row-gap: 0vw;
  }

  /* ================= KEY STYLE ================= */

  .key {
    box-shadow: 0 6px 103px 0 rgba(255, 0, 140, 0.2), 0 6px 20px 0 rgba(0, 255, 251, 0.19);
    border-radius: 2vw;
    text-align: center;
    line-height: 8vw;
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--text-main, #020617);
    transition: 0.08s;
    user-select: none;
    width: 4vw;
    height: 9vw;
  }

  .middle .key {
    border-radius: 8px;
    text-align: center;
    line-height: 8vw;
    font-size: 0.55rem;
    font-weight: 600;
    width: 9.5vw;
    height: 9.5vw;
  }

  .arrows .key {
    width: 9vw;
    height: 9vw;
  }

  .numpad .key {
    border-radius: 8px;
    text-align: center;
    line-height: 8vw;
    font-size: 0.55rem;
    font-weight: 600;
    width: 9.5vw;
    height: 9.5vw;
  }

  /* WIDTH CLASSES and setting RGB colour */
  .arrows .w1 {
    box-shadow: 0 1px 1px 0 rgba(255, 0, 132, 0.652), 0 0px 20px 0 rgba(255, 0, 132, 0.39);
  }

  .w1 {
    width: 9.5vw;
    height: 9vw;
    box-shadow: 0 1px 1px 0 rgba(0, 255, 221, 0.652), 0 1px 20px 0 rgba(0, 255, 0, 0.39);
  }

  .numpad .w1 {
    box-shadow: 0 1px 1px 0 rgba(0, 255, 221, 0.652), 0 1px 20px 0 rgba(0, 250, 241, 0.39);
  }

  .w2 {
    width: 21vw;
    box-shadow: 0 1px 1px 0 rgba(230, 167, 31, 0.541), 0 1px 20px 0 rgba(255, 174, 0, 0.39);
  }

  .w3 {
    width: 26.5vw;
    box-shadow: 0 1px 1px 0 rgba(255, 0, 93, 0.652), 0 1px 20px 0 rgba(255, 0, 128, 0.39);
  }

  .w6 {
    width: 75vw;
    box-shadow: 0 1px 1px 0 rgba(255, 255, 0, 0.652), 0 1px 20px 0 rgba(255, 251, 0, 0.39);
  }

  .h2 {
    height: 76px;
    line-height: 76px;
    box-shadow: 0 1px 1px 0 rgba(0, 255, 51, 0.652), 0 1px 20px 0 rgba(255, 255, 0, 0.252);
  }

  /* NUMPAD SPECIAL KEYS */
  .numpad .zero {
    width: 20.7vw;
    grid-column: span 2;
  }

  .numpad .enter {
    grid-row: span 2;
    height: 16.9vw;
  }

  .numpad .h2 {
    height: 20.7vw;
    line-height: 18vw;
  }

  .numpad .dot {
    grid-column: 3;
  }
}
