.flygel-app {
  --flygel-available: #f8f3e7;
  --flygel-held: #e8b64c;
  --flygel-sold: #d83f31;
  --flygel-selected: #1d70b8;
  --flygel-ink: #1f2428;
  --flygel-line: #d6d1c5;
  color: var(--flygel-ink);
  max-width: 1120px;
  margin: 0 auto;
  font-family: inherit;
}

.flygel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.flygel-header h2 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: 0;
}

.flygel-progress {
  font-weight: 700;
  white-space: nowrap;
}

.flygel-stage {
  overflow-x: auto;
  padding: 18px 0 8px;
}

.flygel-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin: 0 0 18px;
  color: #4c5560;
  font-size: 0.9rem;
}

.flygel-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.flygel-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid var(--flygel-line);
  border-radius: 3px;
}

.flygel-swatch-available {
  background: var(--flygel-available);
}

.flygel-swatch-held {
  background: var(--flygel-held);
}

.flygel-swatch-sold {
  background: var(--flygel-sold);
}

.flygel-swatch-selected {
  background: var(--flygel-selected);
  border-color: var(--flygel-selected);
}

.flygel-keyboard {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 240px;
  padding: 0 10px;
  border-radius: 8px;
  background: linear-gradient(#3c2f2a 0 18px, #231f20 18px 42px, transparent 42px);
  box-sizing: border-box;
}

.flygel-loading {
  position: absolute;
  inset: 42px 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid var(--flygel-line);
  border-radius: 0 0 6px 6px;
  background: var(--flygel-available);
  color: #4c5560;
  font-weight: 700;
  text-align: center;
}

.flygel-loading-text {
  display: block;
}

.flygel-provider-credit {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #5c6670;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.flygel-provider-credit a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  line-height: 0;
  text-decoration: none;
}

.flygel-provider-credit img {
  display: block;
  width: auto;
  max-width: 150px;
  max-height: 28px;
  object-fit: contain;
}

.flygel-provider-credit strong {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.flygel-provider-credit .flygel-provider-name-visible {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

.flygel-provider-credit-loading {
  opacity: 0.92;
}

.flygel-provider-credit-footer {
  align-items: center;
  flex-direction: row;
  justify-content: flex-end;
  text-align: left;
  margin: -6px 0 16px;
  opacity: 0.82;
}

.flygel-provider-credit-footer a {
  transform: translateY(-5px);
}

.flygel-provider-credit-footer img {
  max-height: 20px;
}

.flygel-white-layer {
  display: grid;
  grid-template-columns: repeat(52, minmax(0, 1fr));
  position: absolute;
  left: 10px;
  right: 10px;
  top: 42px;
  bottom: 0;
}

.flygel-black-layer {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 42px;
  height: 150px;
  pointer-events: none;
}

  .flygel-key {
    border: 1px solid var(--flygel-line);
    cursor: pointer;
    font: inherit;
    -webkit-tap-highlight-color: rgba(255, 91, 36, 0.18);
    touch-action: manipulation;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  }

.flygel-key-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.flygel-key:focus-visible {
  outline: 3px solid #1d70b8;
  outline-offset: 2px;
  z-index: 3;
}

.flygel-key:not(:disabled):hover {
  border-color: #ff5b24;
  box-shadow: inset 0 0 0 2px rgba(255, 91, 36, 0.28);
  filter: brightness(0.97);
}

.flygel-key-white {
  position: relative;
  min-width: 0;
  background: var(--flygel-available);
  border-radius: 0 0 5px 5px;
  padding: 0 0 12px;
}

.flygel-key-white .flygel-key-label {
  position: absolute;
  left: 2px;
  bottom: 8px;
  display: block;
  width: auto;
  height: auto;
  clip: auto;
  overflow: visible;
  white-space: nowrap;
  color: rgba(31, 36, 40, 0.52);
  font-size: 10px;
  line-height: 1;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin: 0;
  pointer-events: none;
}

.flygel-key-black .flygel-key-label {
  position: absolute;
  left: 50%;
  bottom: 6px;
  display: block;
  width: auto;
  height: auto;
  clip: auto;
  overflow: visible;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.68);
  font-size: 9px;
  line-height: 1;
  writing-mode: vertical-rl;
  transform: translateX(-50%) rotate(180deg);
  margin: 0;
  pointer-events: none;
}

.flygel-key-black {
  position: absolute;
  width: 1.35%;
  height: 148px;
  pointer-events: auto;
  transform: translateX(-50%);
  z-index: 2;
  border-color: #111;
  border-radius: 0 0 4px 4px;
  background: #161616;
  color: #fff;
  padding: 0;
}

.flygel-key-black:not(:disabled):hover {
  transform: translateX(-50%);
  box-shadow: inset 0 0 0 2px rgba(255, 91, 36, 0.42), 0 3px 8px rgba(0, 0, 0, 0.24);
  filter: brightness(1.12);
}

.flygel-key.is-held,
.flygel-key.is-pending {
  background: var(--flygel-held);
  color: #261f10;
}

.flygel-key.is-paid {
  background: var(--flygel-sold);
  color: #fff;
}

.flygel-key.is-selected {
  background: var(--flygel-selected);
  border-color: #0d4f8b;
  color: #fff;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.45), 0 0 0 3px rgba(29, 112, 184, 0.28);
  z-index: 5;
}

.flygel-key.is-selected .flygel-key-label {
  color: rgba(255, 255, 255, 0.9);
}

.flygel-key-white.is-selected {
  z-index: 1;
}

.flygel-key-black.is-selected {
  z-index: 6;
}

.flygel-key:disabled {
  cursor: not-allowed;
  opacity: 1;
}

.flygel-key[aria-disabled="true"] {
  cursor: help;
}

.flygel-key[aria-disabled="true"]:hover {
  border-color: #7b8794;
  box-shadow: inset 0 0 0 2px rgba(123, 135, 148, 0.24);
  filter: none;
}

.flygel-form {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 680px;
  margin: 22px auto 0;
  padding: 22px;
  border: 1px solid var(--flygel-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 35px rgba(31, 36, 40, 0.12);
}

.flygel-form[hidden] {
  display: none;
}

.flygel-form h3,
.flygel-form-note,
.flygel-consent,
.flygel-submit,
.flygel-message {
  grid-column: 1 / -1;
}

.flygel-form h3 {
  margin: 0;
}

.flygel-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.flygel-form input {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  border: 1px solid var(--flygel-line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

.flygel-form .flygel-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 600;
  line-height: 1.4;
}

.flygel-form .flygel-consent input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.flygel-hp-field {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.flygel-form-note {
  margin: 0;
  color: #555;
}

.flygel-submit {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  background: #ff5b24;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.flygel-submit:disabled {
  opacity: 0.7;
  cursor: wait;
}

.flygel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--flygel-line);
  border-radius: 50%;
  background: #fff;
  color: var(--flygel-ink);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  text-align: center;
}

.flygel-message {
  min-height: 22px;
  margin: 6px 0 0;
  color: #b42318;
  font-weight: 700;
}

.flygel-return-message {
  max-width: 720px;
  margin: 0 auto 18px;
  padding: 16px 18px;
  border: 1px solid #b8dcc2;
  border-radius: 8px;
  background: #edf8f0;
  color: #174d26;
  box-shadow: 0 10px 24px rgba(31, 36, 40, 0.08);
}

.flygel-return-message[hidden] {
  display: none;
}

.flygel-return-message h3 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.flygel-return-message p {
  margin: 0;
  line-height: 1.45;
}

.flygel-return-message.is-pending {
  border-color: #d9bd73;
  background: #fff8e6;
  color: #5f4410;
}

.flygel-return-message.is-error {
  border-color: #e7aaa3;
  background: #fff0ee;
  color: #8a261d;
}

.flygel-notice[hidden] {
  display: none;
}

.flygel-notice {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 18px;
  box-sizing: border-box;
  background: rgba(31, 36, 40, 0.42);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.flygel-notice-box {
  width: min(92vw, 380px);
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 22px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(31, 36, 40, 0.22);
  text-align: center;
}

.flygel-notice-box h3 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.flygel-notice-box p {
  margin: 0 0 18px;
  line-height: 1.45;
}

.flygel-notice-ok {
  min-width: 110px;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: #1d70b8;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.flygel-admin-manual .flygel-stage {
  margin: 10px 0 22px;
  overflow-x: auto;
  padding-bottom: 14px;
}

.flygel-admin-manual-card {
  max-width: 1180px;
}

.flygel-admin-manual {
  max-width: none;
}

.flygel-admin-keyboard-desktop {
  min-width: 1040px;
  height: 280px;
}

.flygel-admin-keyboard-desktop .flygel-white-layer {
  top: 48px;
}

.flygel-admin-keyboard-desktop .flygel-black-layer {
  top: 48px;
  height: 176px;
}

.flygel-admin-keyboard-desktop .flygel-key-black {
  width: 1.55%;
  height: 172px;
}

.flygel-admin-keyboard-desktop .flygel-key-white .flygel-key-label {
  font-size: 11px;
  color: rgba(31, 36, 40, 0.68);
}

.flygel-admin-keyboard-desktop .flygel-key-black .flygel-key-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.82);
}

.flygel-admin-keyboard-mobile {
  display: none;
}

.flygel-admin-keyboard-mobile .flygel-vertical-key {
  height: 40px;
}

.flygel-admin-keyboard-mobile .flygel-keyboard.is-mobile .flygel-key-label,
.flygel-admin-keyboard-mobile .flygel-key-label {
  font-size: 14px;
  font-weight: 700;
}

@media (max-width: 720px) {
  .flygel-header {
    align-items: start;
    flex-direction: column;
  }

  .flygel-progress {
    white-space: normal;
  }

  .flygel-keyboard {
    min-width: 0;
    height: auto;
  }

  .flygel-keyboard.is-mobile {
    padding: 12px 44px 12px 0;
    border-radius: 8px;
    background: linear-gradient(270deg, #3c2f2a 0 16px, #231f20 16px 34px, transparent 34px);
  }

  .flygel-keyboard .flygel-loading {
    position: relative;
    inset: auto;
    min-height: 220px;
    border-radius: 6px 0 0 6px;
  }

  .flygel-provider-credit {
    gap: 6px;
    font-size: 0.78rem;
  }

  .flygel-provider-credit img {
    max-width: 130px;
    max-height: 24px;
  }

  .flygel-provider-credit-footer {
    justify-content: center;
    text-align: center;
    margin: -4px 0 16px;
  }

  .flygel-vertical-rail {
    position: relative;
    display: grid;
    gap: 0;
  }

  .flygel-vertical-key {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    width: 100%;
    height: 30px;
    transform: none;
    border-radius: 0 5px 5px 0;
    pointer-events: auto;
  }

  .flygel-keyboard.is-mobile .flygel-key-white {
    background: var(--flygel-available);
    border-color: var(--flygel-line);
  }

  .flygel-keyboard.is-mobile .flygel-key-label {
    position: static;
    display: block;
    width: auto;
    height: auto;
    clip: auto;
    overflow: visible;
    white-space: nowrap;
    writing-mode: horizontal-tb;
    transform: none;
    margin: 0 8px 0 0;
    color: rgba(31, 36, 40, 0.5);
    font-size: 11px;
  }

  .flygel-keyboard.is-mobile .flygel-key-black {
    justify-self: end;
    width: 62%;
    height: 28px;
    margin: -14px 0 -14px 0;
    z-index: 8;
    border-color: #111;
    background: #161616;
  }

  .flygel-keyboard.is-mobile .flygel-key-black::before {
    content: "";
    position: absolute;
    top: -3px;
    right: 0;
    bottom: -3px;
    left: 0;
    background: transparent;
  }

  .flygel-keyboard.is-mobile .flygel-key-black:not(:disabled):hover,
  .flygel-keyboard.is-mobile .flygel-key-black:not(:disabled):active {
    transform: none;
    filter: none;
    box-shadow: inset 0 0 0 2px rgba(255, 91, 36, 0.36);
  }

  .flygel-keyboard.is-mobile .flygel-key.is-selected {
    background: var(--flygel-selected);
    color: #fff;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.48), 0 0 0 3px rgba(29, 112, 184, 0.28);
  }

  .flygel-keyboard.is-mobile .flygel-key.is-held,
  .flygel-keyboard.is-mobile .flygel-key.is-pending {
    background: var(--flygel-held);
    color: #261f10;
  }

  .flygel-keyboard.is-mobile .flygel-key.is-paid {
    background: var(--flygel-sold);
    color: #fff;
  }

  .flygel-keyboard.is-mobile .flygel-key.is-selected,
  .flygel-keyboard.is-mobile .flygel-key.is-held.is-selected,
  .flygel-keyboard.is-mobile .flygel-key.is-pending.is-selected {
    background: var(--flygel-selected);
    color: #fff;
  }

  .flygel-keyboard.is-mobile .flygel-key-black.is-available {
    background: #161616;
    color: #fff;
  }

  .flygel-keyboard.is-mobile .flygel-key-black.is-selected {
    background: var(--flygel-selected);
    color: #fff;
  }

  .flygel-keyboard.is-mobile .flygel-key-black .flygel-key-label {
    color: rgba(255, 255, 255, 0.68);
  }

  .flygel-stage {
    overflow-x: visible;
  }

  .flygel-form {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .flygel-notice {
    align-items: start;
    padding: 14px;
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .flygel-notice-box {
    width: min(100%, 380px);
    max-height: calc(100vh - 28px);
    max-height: calc(100dvh - 28px);
    padding: 18px;
    margin: auto 0;
  }

  .flygel-admin-keyboard-desktop {
    display: none;
  }

  .flygel-admin-keyboard-mobile {
    display: block;
  }

  .flygel-admin-keyboard-mobile.flygel-keyboard.is-mobile {
    padding-right: 40px;
  }

  .flygel-admin-keyboard-mobile .flygel-key {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    height: 40px;
    transform: none;
    border-radius: 0 5px 5px 0;
  }

  .flygel-admin-keyboard-mobile.flygel-keyboard.is-mobile .flygel-key-black {
    width: 68%;
    height: 36px;
    margin: -18px 0 -18px 0;
  }

  .flygel-admin-keyboard-mobile.flygel-keyboard.is-mobile .flygel-key-label {
    position: static;
    display: block;
    width: auto;
    height: auto;
    clip: auto;
    overflow: visible;
    white-space: nowrap;
    writing-mode: horizontal-tb;
    transform: none;
    font-size: 14px;
    font-weight: 700;
    justify-self: center;
    margin: 0 auto;
    color: rgba(31, 36, 40, 0.72);
  }

  .flygel-admin-keyboard-mobile.flygel-keyboard.is-mobile .flygel-key-black .flygel-key-label {
    color: rgba(255, 255, 255, 0.88);
  }
}
