* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: linear-gradient(180deg, #f7f8fa 0%, #eceff4 100%);
  color: #111827;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font: inherit;
  border: 1px solid #c7ced9;
  border-radius: 10px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  padding: 10px 14px;
  transition: box-shadow 120ms ease, transform 120ms ease, border-color 120ms ease;
}

button:hover {
  border-color: #94a3b8;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

button:active {
  transform: translateY(1px);
}

.app {
  max-width: 1100px;
  padding: 0 20px;
  margin: 80px auto;
}

.app__github-link {
  position: absolute;
  top: 20px;
  right: 20px;
}

.header {
  margin-bottom: 28px;
}

.header__icon {
  font-size: 40px;
}

.header__title {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
}

.keyboard-panel {
  margin-bottom: 40px;
  padding: 24px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.1);
}

.keyboard-panel__intro {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  align-items: baseline;
}

.keyboard-panel__copy,
.keyboard-panel__status {
  margin: 0;
  line-height: 1.5;
}

.keyboard-panel__status {
  color: #475569;
  text-align: right;
}

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #dbe2ea 0%, #c9d0da 100%);
  border: 1px solid rgba(100, 116, 139, 0.35);
}

.keyboard__row {
  display: flex;
  gap: 10px;
}

.key {
  position: relative;
  min-height: 54px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(71, 85, 105, 0.25);
  background: linear-gradient(180deg, #ffffff 0%, #edf1f6 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 16px rgba(71, 85, 105, 0.12);
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.key:disabled {
  cursor: default;
  opacity: 0.7;
}

.key:hover {
  border-color: rgba(59, 130, 246, 0.45);
}

.key.is-selected {
  border-color: #2563eb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 2px rgba(37, 99, 235, 0.18), 0 12px 24px rgba(37, 99, 235, 0.18);
}

.key.is-remapped {
  border-color: #14b8a6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 18px rgba(20, 184, 166, 0.45), 0 12px 24px rgba(15, 118, 110, 0.16);
}

.key.is-selected.is-remapped {
  border-color: #0f766e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 2px rgba(20, 184, 166, 0.2), 0 0 18px rgba(20, 184, 166, 0.45), 0 12px 24px rgba(15, 118, 110, 0.16);
}

.key__label {
  font-size: 13px;
}

.key__subtext {
  font-size: 11px;
  color: #64748b;
}

.key__mapping {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-size: 11px;
  color: #0f766e;
}

.keyboard-panel__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.result__header {
  display: flex;
  width: 100%;
  margin-bottom: 10px;
}

.result__header__title {
  margin: 0;
  margin-right: auto;
  font-weight: 400;
}

.result__header button {
  margin-left: 5px;
}

.result__content {
  display: block;
  width: 100%;
  border: 1px solid #555;
  background-color: #eff4f8;
  padding: 10px;
  border-radius: 5px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

@media (max-width: 640px) {
  .app {
    margin: 64px auto 32px;
  }

  .app__github-link {
    position: static;
    display: inline-block;
    margin-bottom: 20px;
  }

  .keyboard-panel {
    padding: 16px;
  }

  .keyboard-panel__intro,
  .keyboard-panel__actions,
  .result__header {
    flex-direction: column;
  }

  .keyboard-panel__status {
    text-align: left;
  }

  .keyboard {
    overflow-x: auto;
    padding-bottom: 12px;
  }

  .keyboard__row {
    min-width: 820px;
  }

  .keyboard-panel__actions button,
  .result__header button {
    width: fit-content;
  }

  .result__header button {
    margin-left: 0;
  }
}
