:root {
  font:
    14px/1.45 system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
  color: #d4be98;
  background: #282828;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 24px;
  color: #e78a4e;
  background: #32302f;
  border-bottom: 1px solid #45403d;
}
.appbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 1372px;
  margin: 0 auto;
}
h1 {
  display: flex;
  align-items: baseline;
  justify-self: center;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0;
  font-weight: 600;
  font-variant-ligatures: none;
  font-feature-settings:
    "liga" 0,
    "calt" 0;
  margin: 0;
}
.brand-part {
  display: inline-flex;
  gap: 0.18em;
}
.brand-editor {
  margin-left: 0.7em;
}
.app-menus {
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 2px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.file-menu-wrap,
.view-menu-wrap {
  position: relative;
}
.file-menu-button,
.view-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  color: #d4be98;
  background: transparent;
  border-color: transparent;
  font-size: 12px;
  line-height: 1.2;
}
.menu-bracket {
  color: #7c6f64;
}
.file-menu-button:hover,
.file-menu-button[aria-expanded="true"],
.view-menu-button:hover,
.view-menu-button[aria-expanded="true"] {
  background: #45403d;
  border-color: #5a524c;
}
.file-menu,
.view-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1100;
  padding: 5px;
  color: #d4be98;
  background: #32302f;
  border: 1px solid #5a524c;
  border-radius: 8px;
  box-shadow: 0 12px 34px #1d2021cc;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.file-menu {
  width: 250px;
}
.view-menu {
  width: 190px;
}
.file-menu[hidden],
.view-menu[hidden] {
  display: none;
}
.file-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 7px 9px;
  text-align: left;
  background: transparent;
  border-color: transparent;
}
.file-menu button:hover:not(:disabled),
.file-menu button:focus-visible {
  background: #45403d;
}
.file-menu kbd {
  color: #a89984;
  font:
    11px/1 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
}
.file-menu-separator {
  height: 1px;
  margin: 5px 7px;
  background: #5a524c;
}
.view-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  color: #d4be98;
  border-radius: 6px;
  cursor: pointer;
}
.view-option:hover,
.view-option:focus-within {
  background: #45403d;
}
.view-option input {
  width: auto;
  margin: 0;
  padding: 0;
  accent-color: #a9b665;
}
.active-filename {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  justify-self: end;
  color: #a89984;
  font:
    12px/1.2 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.active-file-label {
  color: #7c6f64;
}
.active-file-value {
  min-width: 0;
  overflow: hidden;
  color: #d4be98;
  text-overflow: ellipsis;
}
.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  max-width: 1420px;
  margin: 22px auto;
  padding: 0 20px;
}
.shell.sidebar-hidden {
  grid-template-columns: minmax(0, 1fr);
}
.shell.main-hidden {
  grid-template-columns: 260px;
  justify-content: center;
}
.panel {
  background: #32302f;
  border: 1px solid #45403d;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 2px 10px #1d202155;
}
.side {
  align-self: start;
  display: grid;
  gap: 18px;
}
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.title-row h2,
h2 {
  font-size: 16px;
  margin: 0 0 13px;
}
.title-row h2 {
  margin: 0;
}
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid #5a524c;
  border-radius: 7px;
  background: #3c3836;
  color: #d4be98;
  padding: 7px 11px;
}
button:hover {
  background: #45403d;
}
button.primary {
  background: #a9b665;
  border-color: #a9b665;
  color: #282828;
}
button.primary:hover {
  background: #b8c577;
}
button.success-outline {
  color: #a9b665;
  background: transparent;
  border-color: #a9b665;
}
button.success-outline:hover {
  color: #282828;
  background: #a9b665;
  border-color: #a9b665;
}
button.danger {
  color: #ea6962;
}
button.danger-outline {
  color: #ea6962;
  background: transparent;
  border-color: #ea6962;
}
button.danger-outline:hover {
  color: #fbf1c7;
  background: #5b302f;
  border-color: #ea6962;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
input,
select,
textarea {
  font: inherit;
  width: 100%;
  border: 1px solid #5a524c;
  border-radius: 7px;
  padding: 9px;
  color: #d4be98;
  background: #282828;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #89b482;
  outline-offset: 1px;
}
.prefix,
.environment,
#editTitle,
#editSubtitle,
#environmentInput,
#prefixInput,
#action,
textarea,
code,
.key .letter {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-variant-ligatures: none;
  font-feature-settings:
    "liga" 0,
    "calt" 0;
}
.prefix-list,
.environment-list {
  margin-top: 8px;
  padding: 4px 8px 4px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: auto;
  border: 1px solid #45403d;
  border-radius: 8px;
  background: #28282866;
  scrollbar-color: #5a524c #282828;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}
.prefix-list,
.environment-list {
  max-height: min(260px, calc(100vh - 310px));
}
.sidebar-controls {
  display: flex;
  gap: 6px;
  margin: 0 0 8px;
  flex-wrap: wrap;
}
.sidebar-controls button {
  padding: 5px 7px;
  font-size: 12px;
}
.sidebar-controls .success-outline {
  margin-left: auto;
}
.prefix,
.environment {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  min-height: 27px;
  padding: 3px 7px;
  border-color: transparent;
}
.prefix.active,
.environment.active {
  background: #45403d;
  color: #d8a657;
  border-color: #d8a657;
}
.count {
  background: #3c3836;
  color: #a89984;
  padding: 0 6px;
  border-radius: 20px;
  font-size: 11px;
}
.prefix.active .count,
.environment.active .count {
  background: #5a524c;
  color: #ddc7a1;
}
.prefix-identity {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  line-height: 1.25;
}
.prefix-name,
.prefix-nickname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prefix-nickname {
  color: #a89984;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
  font-size: 11px;
}
.prefix.active .prefix-nickname {
  color: #d4be98;
}
.muted {
  color: #a89984;
}
.small {
  font-size: 12px;
}
.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.topline h2 {
  margin: 0;
}
.keyboard-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.current-prefix-context {
  --prefix-accent: #e78a4e;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 25px;
  min-width: 0;
}
.current-prefix-context.color-green {
  --prefix-accent: #a9b665;
}
.current-prefix-context.color-blue {
  --prefix-accent: #7daea3;
}
.current-prefix-context.color-aqua {
  --prefix-accent: #89b482;
}
.current-prefix-context.color-purple {
  --prefix-accent: #d3869b;
}
.current-prefix-context.color-red {
  --prefix-accent: #ea6962;
}
.current-prefix-nickname {
  max-width: 260px;
  overflow: hidden;
  padding: 2px 8px;
  color: #282828;
  background: var(--prefix-accent);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.current-prefix-divider {
  color: #7c6f64;
}
.current-prefix-value {
  overflow: hidden;
  padding: 1px 7px;
  color: var(--prefix-accent);
  background: #282828;
  border: 1px solid var(--prefix-accent);
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-variant-ligatures: none;
  font-feature-settings:
    "liga" 0,
    "calt" 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #a89984;
  cursor: pointer;
  white-space: nowrap;
}
.toggle input {
  width: auto;
  margin: 0;
  accent-color: #a9b665;
}
.toolbar-separator {
  align-self: stretch;
  width: 1px;
  min-height: 24px;
  margin: 0 4px;
  background: #5a524c;
}
.color-picker {
  width: auto;
  padding: 4px 26px 4px 7px;
  font-size: 12px;
}
.keyboard {
  width: 100%;
  height: auto;
  display: block;
  margin: 8px auto 0;
  max-width: 1200px;
}
.key {
  cursor: pointer;
  outline: none;
}
.key.disabled {
  cursor: default;
}
.key rect {
  fill: #3c3836;
  stroke: #7c6f64;
  stroke-width: 1.5;
}
.key.mapped rect {
  fill: #49392f;
  stroke: #e78a4e;
  stroke-width: 2;
}
.key.mapped.color-green rect {
  fill: #3d4536;
  stroke: #a9b665;
}
.key.mapped.color-blue rect {
  fill: #344849;
  stroke: #7daea3;
}
.key.mapped.color-aqua rect {
  fill: #354543;
  stroke: #89b482;
}
.key.mapped.color-purple rect {
  fill: #453b3e;
  stroke: #d3869b;
}
.key.mapped.color-red rect {
  fill: #4a3432;
  stroke: #ea6962;
}
.key:hover rect,
.key:focus rect {
  stroke: #d8a657;
  stroke-width: 2.5;
}
.key.disabled:hover rect {
  fill: #3c3836;
  stroke: #7c6f64;
  stroke-width: 1.5;
}
.key .letter {
  font-size: 9.5px;
  fill: #a89984;
  font-weight: 700;
  pointer-events: none;
}
.key .action {
  font-size: 10px;
  fill: #ddc7a1;
  font-weight: 600;
  pointer-events: none;
}
.key .empty {
  font-size: 10px;
  fill: #7c6f64;
  pointer-events: none;
}
.legend {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid #7c6f64;
  vertical-align: -1px;
  margin-right: 5px;
}
.dot.mapped {
  border-color: #e78a4e;
  background: #49392f;
}
.jsonbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.jsonbar h2 {
  margin: 0;
}
.jsonbar .toolbar {
  flex-wrap: nowrap;
  justify-content: flex-start;
}
textarea {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  min-height: 230px;
  resize: vertical;
  tab-size: 2;
  scrollbar-color: #5a524c #282828;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}
.status {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  max-width: min(440px, calc(100vw - 32px));
  margin: 0;
  padding: 9px 12px;
  font-size: 12px;
  color: #a9b665;
  background: #32302f;
  border: 1px solid #5a524c;
  border-left: 3px solid #a9b665;
  border-radius: 8px;
  box-shadow: 0 8px 28px #1d2021aa;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}
.status.visible {
  opacity: 1;
  transform: translateY(0);
}
.status.error {
  color: #ea6962;
  border-left-color: #ea6962;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.dialog {
  color: #d4be98;
  background: #32302f;
  border: 1px solid #5a524c;
  border-radius: 12px;
  padding: 22px;
  width: min(440px, calc(100vw - 30px));
  box-shadow: 0 20px 65px #1d2021cc;
}
.dialog::backdrop {
  background: #1d2021b3;
}
.dialog h2 {
  margin: 0 0 6px;
}
.dialog label {
  display: block;
  font-weight: 600;
  margin: 16px 0 6px;
}
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
.hint {
  background: #282828;
  padding: 10px;
  border-radius: 8px;
  margin-top: 12px;
  color: #a89984;
  font-size: 12px;
}
.empty-state {
  padding: 35px 10px;
  text-align: center;
  color: #928374;
}
code {
  color: #e78a4e;
  background: #282828;
  padding: 2px 5px;
  border-radius: 4px;
}
@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 0 12px;
    margin: 12px auto;
  }
  .shell.sidebar-hidden,
  .shell.main-hidden {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 13px;
  }
  .side {
    order: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }
  .side.single-section > .panel:not([hidden]) {
    grid-column: 1 / -1;
  }
  .side.single-section .prefix-list,
  .side.single-section .environment-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
  }
  .prefix-list,
  .environment-list {
    max-height: 190px;
  }
  .stack {
    order: 1;
  }
  header {
    min-height: 35px;
    padding: 5px 15px;
  }
  .keyboard {
    min-width: 570px;
  }
  .keyboard-wrap {
    overflow-x: auto;
  }
}
@media (max-width: 520px) {
  .brand-editor,
  .active-filename {
    display: none;
  }
}
