.xh-player-button {
  position: fixed;
  z-index: 1200;
  top: max(12px, env(safe-area-inset-top));
  right: max(76px, calc(env(safe-area-inset-right) + 76px));
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid rgba(228, 185, 89, 0.5);
  border-radius: 4px;
  background: rgba(12, 14, 19, 0.94);
  color: #e7c16e;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.26);
  font: 700 12px/1.2 "Noto Sans SC", sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.xh-player-button[data-home] {
  top: auto;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
}

.top.xh-player-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  flex-shrink: 0;
}
.xh-player-header > .top-text {
  grid-column: 1;
  grid-row: 1;
}
.xh-player-header > .close {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}
.xh-player-header > .xh-player-button {
  position: static;
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
  max-width: 100%;
  min-width: 0;
  min-height: 38px;
  border-radius: 20px;
  z-index: auto;
}
.xh-player-header .xh-player-button-name {
  max-width: none;
  min-width: 0;
}
.xh-player-header > .ranking-trigger {
  position: static;
  grid-column: 2;
  grid-row: 2;
  align-self: center;
  margin: 0;
  min-height: 38px;
}

.xh-player-button:hover,
.xh-player-button:focus-visible {
  border-color: #f0ce7c;
  background: #1b1b1d;
  color: #ffe5a0;
}

.xh-player-button:focus-visible,
.xh-player-submit:focus-visible,
.xh-player-cancel:focus-visible,
.xh-player-suggestion:focus-visible,
.xh-player-notice-retry:focus-visible {
  outline: 2px solid #f0ce7c;
  outline-offset: 3px;
}

.xh-player-button-icon {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
}

.xh-player-button-icon svg {
  display: block;
  width: 17px;
  height: 17px;
}

.xh-player-button-name {
  max-width: min(24vw, 105px);
  overflow: hidden;
  color: #f4e5bf;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xh-player-button-name[hidden],
.xh-player-button-label[hidden] {
  display: none;
}

.xh-player-shade[hidden],
.xh-player-notice[hidden] {
  display: none;
}

.xh-player-shade {
  position: fixed;
  z-index: 5000;
  inset: 0;
  display: grid;
  overflow-y: auto;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  background: rgba(4, 5, 8, 0.78);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.xh-player-dialog {
  position: relative;
  width: min(100%, 430px);
  padding: 25px 25px 19px;
  border: 1px solid rgba(226, 186, 99, 0.58);
  background:
    linear-gradient(135deg, rgba(229, 190, 102, 0.055), transparent 35%),
    #111319;
  color: #eee8d8;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.58);
}

.xh-player-dialog::before,
.xh-player-dialog::after {
  position: absolute;
  width: 13px;
  height: 13px;
  border-color: #e7c16e;
  content: "";
  pointer-events: none;
}

.xh-player-dialog::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.xh-player-dialog::after {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid;
  border-bottom: 2px solid;
}

.xh-player-kicker,
.xh-player-overline,
.xh-player-label span,
.xh-player-count,
.xh-player-footnote,
.xh-player-suggestion-label {
  font-family: "JetBrains Mono", "Noto Sans SC", monospace;
}

.xh-player-kicker {
  color: #d8b968;
  font-size: 9px;
  letter-spacing: 0.17em;
}

.xh-player-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}

.xh-player-overline {
  margin: 0 0 6px;
  color: #9f9887;
  font-size: 10px;
  letter-spacing: 0.06em;
}

.xh-player-heading h2 {
  margin: 0;
  color: #f5e9c9;
  font: 900 24px/1.25 "Noto Sans SC", sans-serif;
  letter-spacing: 0.01em;
}

.xh-player-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-content: center;
  border: 1px solid rgba(231, 193, 110, 0.6);
  color: #e7c16e;
  font: 700 9px/1.35 "JetBrains Mono", monospace;
  letter-spacing: 0.08em;
  text-align: center;
}

.xh-player-copy {
  margin: 13px 0 20px;
  color: #aaa697;
  font: 400 12px/1.75 "Noto Sans SC", sans-serif;
}

.xh-player-form {
  display: grid;
  gap: 9px;
}

.xh-player-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #e8dcc0;
  font: 700 12px/1.5 "Noto Sans SC", sans-serif;
}

.xh-player-label span {
  color: #837d70;
  font-size: 9px;
  font-weight: 500;
}

.xh-player-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #49463c;
  border-radius: 2px;
  background: #0b0d11;
  color: #f4e8c9;
  font: 600 16px/1.4 "Noto Sans SC", sans-serif;
  caret-color: #e7c16e;
}

.xh-player-input:hover {
  border-color: #81704a;
}

.xh-player-input:focus {
  border-color: #e7c16e;
  outline: 2px solid rgba(231, 193, 110, 0.2);
  outline-offset: 1px;
}

.xh-player-input[aria-invalid="true"] {
  border-color: #cf8170;
}

.xh-player-input:disabled {
  opacity: 0.65;
}

.xh-player-meta {
  display: flex;
  min-height: 19px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.xh-player-feedback {
  min-height: 16px;
  margin: 0;
  color: #d4a06e;
  font: 500 11px/1.5 "Noto Sans SC", sans-serif;
}

.xh-player-count {
  flex: 0 0 auto;
  color: #777366;
  font-size: 9px;
}

.xh-player-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 2px 0 4px;
}

.xh-player-suggestions[hidden] {
  display: none;
}

.xh-player-suggestion-label {
  width: 100%;
  color: #777366;
  font-size: 9px;
}

.xh-player-suggestion {
  max-width: 100%;
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid #4b4535;
  border-radius: 2px;
  background: #191a1d;
  color: #d9c797;
  font: 500 11px/1.3 "Noto Sans SC", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.xh-player-suggestion:hover {
  border-color: #c3a052;
  color: #f4dfa4;
}

.xh-player-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 6px;
}

.xh-player-actions button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 2px;
  font: 700 12px/1 "Noto Sans SC", sans-serif;
  cursor: pointer;
}

.xh-player-cancel {
  border: 1px solid #46443c;
  background: transparent;
  color: #aaa697;
}

.xh-player-cancel:hover:not(:disabled) {
  border-color: #77705f;
  color: #eee8d8;
}

.xh-player-submit {
  min-width: 120px;
  border: 1px solid #e3bd68;
  background: #d4ad56;
  color: #211b10;
}

.xh-player-submit:hover:not(:disabled) {
  background: #f0ce7c;
}

.xh-player-submit:disabled,
.xh-player-cancel:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.xh-player-footnote {
  margin: 17px 0 0;
  color: #777366;
  font-size: 9px;
  line-height: 1.6;
}

.xh-player-notice {
  position: fixed;
  z-index: 5100;
  top: max(60px, calc(env(safe-area-inset-top) + 54px));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  width: min(390px, calc(100vw - 24px));
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(215, 153, 117, 0.55);
  background: #171719;
  color: #e7c7b0;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.4);
  font: 500 12px/1.6 "Noto Sans SC", sans-serif;
}

.xh-player-notice[data-kind="success"] {
  border-color: rgba(218, 184, 105, 0.52);
  color: #ead59d;
}

.xh-player-notice-retry {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid #8e7540;
  border-radius: 2px;
  background: transparent;
  color: #f0ce7c;
  font: 700 11px/1.2 "Noto Sans SC", sans-serif;
  cursor: pointer;
}

@media (max-width: 520px) {
  .xh-player-button {
    top: max(8px, env(safe-area-inset-top));
    right: max(58px, calc(env(safe-area-inset-right) + 58px));
    min-height: 34px;
    gap: 5px;
    padding: 0 8px;
    font-size: 11px;
  }

  .xh-player-button-icon,
  .xh-player-button-icon svg {
    width: 15px;
    height: 15px;
  }

  .xh-player-dialog {
    padding: 21px 18px 16px;
  }

  .xh-player-heading h2 {
    font-size: 21px;
  }

  .xh-player-copy {
    margin-bottom: 17px;
  }

  .xh-player-actions button {
    min-height: 44px;
  }

  .xh-player-notice {
    top: max(52px, calc(env(safe-area-inset-top) + 48px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .xh-player-button,
  .xh-player-suggestion,
  .xh-player-submit {
    scroll-behavior: auto;
    transition: none;
  }
}
