#game {
  width: 100vw;
  height: calc(100vh - 45px);
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: #fff;
  font-family: Segoe UI, Tahoma, Geneva, Verdana, sans-serif;
  padding: 20px;
  padding-top: 65px;
  box-sizing: border-box;
  overflow-y: auto;
  position: relative;

  & .header {
    text-align: center;
    margin-bottom: 30px;
    background: #ffffff1a;
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px #0000001a;

    & h1 {
      margin: 0 0 20px;
      font-size: 2.5em;
      font-weight: 700;
      text-shadow: 2px 2px 4px #0000004d;
    }
  }

  & .status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
  }

  & .progress-section, & .status-section {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
  }

  & .progress-label, & .status-label {
    font-weight: 600;
    color: #e0e6ed;
  }

  & .progress-stats {
    background: #fff3;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1.1em;
  }

  & .separator {
    color: #b0c4de;
    margin: 0 4px;
  }

  & .progress-percent {
    color: #90ee90;
    font-weight: 700;
  }

  & .status-value {
    background: #90ee9033;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    border: 2px solid #90ee904d;

    &.complete {
      background: #32cd324d;
      border-color: #32cd3280;
      color: #32cd32;
      animation: .6s ease-in-out celebration;
    }
  }

  & .instructions {
    background: #ffffff1a;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    backdrop-filter: blur(5px);

    & h3 {
      margin: 0 0 15px;
      font-size: 1.4em;
      color: #f0f8ff;
    }

    & ul {
      margin: 0;
      padding: 0;
      list-style: none;
    }

    & li {
      margin: 8px 0;
      padding: 8px 0;
      font-size: 1.1em;
      display: flex;
      align-items: center;
      gap: 8px;

      &:before {
        content: "•";
        color: #90ee90;
        font-weight: bold;
        font-size: 1.2em;
      }
    }
  }

  & .color-demo {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: .9em;

    &.tested {
      background: #32cd32;
      color: #fff;
    }

    &.untested {
      background: #666;
      color: #fff;
    }
  }

  & kbd {
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
    border: 1px solid #555;
    box-shadow: 0 2px 4px #0003;
  }

  & .keyboard-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 30px;
  }

  & .keyboard-section {
    background: #ffffff0d;
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(5px);

    & h4 {
      margin: 0 0 15px;
      font-size: 1.3em;
      color: #e0e6ed;
      text-align: center;
    }
  }

  & .key {
    background: linear-gradient(145deg, #4a4a4a, #363636);
    border: 2px solid #555;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    min-width: 40px;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 3px 6px #0003;
    user-select: none;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 5px 12px #0000004d;
    }

    &.tested {
      background: linear-gradient(145deg, #32cd32, #228b22);
      border-color: #90ee90;
      color: #fff;
      font-weight: 700;
      box-shadow: 0 0 15px #32cd3266;
    }

    &.active {
      background: linear-gradient(145deg, #ff6b6b, #ee5a5a);
      border-color: #f99;
      transform: scale(.95);
      box-shadow: 0 0 20px #ff6b6b99;
    }

    &.wide {
      min-width: 80px;
    }

    &.extra-wide {
      min-width: 100px;
    }

    &.spacebar {
      min-width: 200px;
    }

    &.tall {
      grid-row: span 2;
      min-height: 85px;
    }

    &.wide-numpad {
      grid-column: span 2;
      min-width: 85px;
    }

    &.arrow {
      font-size: 16px;
      font-weight: bold;
    }
  }

  & .key-row {
    display: flex;
    gap: 5px;
    margin: 5px 0;
    justify-content: center;
    flex-wrap: wrap;

    &.bottom-row {
      margin-top: 10px;
    }
  }

  & .spacer {
    width: 20px;
  }

  & .spacer-numpad {
    width: 40px;
    height: 40px;
  }

  & .function-keys .key-row {
    justify-content: center;
    align-items: center;
  }

  & .nav-group {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 15px;
  }

  & .nav-cluster {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  & .arrow-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
  }

  & .arrow-row {
    display: flex;
    gap: 5px;
  }

  & .numpad-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    max-width: 200px;
    margin: 0 auto;
  }

  & .test-log {
    background: #ffffff1a;
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(5px);
    max-height: 300px;
    overflow-y: auto;

    & h4 {
      margin: 0 0 15px;
      font-size: 1.3em;
      color: #e0e6ed;
      text-align: center;
    }
  }

  & .log-display {
    background: #0003;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    max-height: 200px;
    overflow-y: auto;
    font-family: Courier New, monospace;
  }

  & .log-item {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 6px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;

    &.new {
      background: #90ee9033;
      border: 1px solid #90ee904d;
    }

    &.repeat {
      background: #ffa50033;
      border: 1px solid #ffa5004d;
    }

    &.placeholder {
      color: #999;
      font-style: italic;
      justify-content: center;
    }
  }

  & .log-key {
    font-weight: bold;
    color: #90ee90;
  }

  & .log-code {
    color: #b0c4de;
    font-size: 12px;
  }

  & .log-timestamp {
    color: #999;
    font-size: 11px;
  }

  & .action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
  }

  & .reset-test-btn {
    background: linear-gradient(145deg, #32cd32, #228b22);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-size: 14px;
    box-shadow: 0 3px 8px #32cd324d;

    &:hover {
      background: linear-gradient(145deg, #28a745, #1e7e34);
      transform: translateY(-2px);
      box-shadow: 0 5px 15px #32cd3266;
    }
  }

  & .clear-log-btn {
    background: linear-gradient(145deg, #ff6b6b, #ee5a5a);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-size: 14px;
    box-shadow: 0 3px 8px #ff6b6b4d;

    &:hover {
      background: linear-gradient(145deg, #ff5252, #e53e3e);
      transform: translateY(-2px);
      box-shadow: 0 5px 15px #ff6b6b66;
    }
  }

  & .progress-stats.complete {
    animation: .6s ease-in-out celebration;
  }

  @media (width <= 1200px) {
    & .keyboard-layout {
      gap: 20px;
    }

    & .key {
      min-height: 35px;
      min-width: 35px;
      font-size: 11px;

      &.wide {
        min-width: 70px;
      }

      &.extra-wide {
        min-width: 85px;
      }

      &.spacebar {
        min-width: 160px;
      }
    }
  }

  @media (width <= 800px) {
    padding: 10px;
    padding-top: 50px;
    height: calc(100vh - 40px);

    & .header h1 {
      font-size: 2em;
    }

    & .status-bar {
      flex-direction: column;
      gap: 20px;
    }

    & .keyboard-layout {
      gap: 15px;
    }

    & .keyboard-section {
      padding: 15px;
    }

    & .key {
      min-height: 30px;
      min-width: 30px;
      font-size: 10px;

      &.wide {
        min-width: 60px;
      }

      &.extra-wide {
        min-width: 70px;
      }

      &.spacebar {
        min-width: 120px;
      }
    }

    & .key-row {
      gap: 3px;
    }

    & .numpad-grid {
      gap: 3px;
    }
  }
}

@keyframes celebration {
  0%, 100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}
