:root {
  --aqua: #65f4ff;
  --mint: #7cffc8;
  --rose: #ff6fd8;
  --amber: #ffd56b;
  --circus-red: #ff4c61;
  --circus-gold: #ffe38c;
  --ink: rgba(12, 17, 29, .86);
  --panel: rgba(23, 32, 52, .82);
  --panel-strong: rgba(35, 48, 76, .9);
  --line: rgba(143, 234, 255, .55);
  --text: #f4fcff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  overflow: hidden;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
}

body.preview {
  background-color: #d7d7d7;
  background-image:
    linear-gradient(45deg, #aaa 25%, transparent 25%),
    linear-gradient(-45deg, #aaa 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #aaa 75%),
    linear-gradient(-45deg, transparent 75%, #aaa 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.stage {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.booster {
  position: relative;
  width: min(338px, calc(100vw - 20px));
  padding: 13px;
  color: var(--text);
  background:
    repeating-linear-gradient(135deg, rgba(255, 76, 97, .14) 0 12px, rgba(255, 227, 140, .08) 12px 24px, transparent 24px 38px),
    linear-gradient(135deg, rgba(124, 255, 200, .16), transparent 31%),
    linear-gradient(315deg, rgba(255, 111, 216, .18), transparent 34%),
    linear-gradient(180deg, rgba(18, 25, 43, .88), rgba(10, 14, 24, .78));
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 8px;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, .28),
    0 0 22px rgba(101, 244, 255, .34),
    inset 0 0 0 1px rgba(101, 244, 255, .22);
  animation: arrive .45s cubic-bezier(.2, .9, .2, 1) both;
}

.booster::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(124, 255, 200, .28);
  border-radius: 6px;
  pointer-events: none;
}

.booster::after {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--aqua), var(--mint), transparent);
  pointer-events: none;
}

.top-strip {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 30px;
  align-items: center;
  gap: 8px;
  margin: 0 auto 8px;
  width: min(260px, 94%);
}

.top-ribbon {
  position: relative;
  height: 30px;
  padding: 0 14px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #071323;
  font-size: 14px;
  font-weight: 900;
  background: linear-gradient(90deg, var(--mint), var(--aqua));
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 999px;
  box-shadow: 0 0 16px rgba(101, 244, 255, .42);
  overflow: hidden;
}

.top-ribbon::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, rgba(255, 255, 255, .95) 0 2px, transparent 2.5px) 8px 4px / 18px 18px repeat-x,
    linear-gradient(90deg, rgba(255, 76, 97, .24), transparent 24%, transparent 76%, rgba(255, 76, 97, .24));
  pointer-events: none;
}

.top-ribbon span {
  position: relative;
}

.module-button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .76);
  border-radius: 50%;
  color: #261407;
  background: radial-gradient(circle at 35% 28%, #fff, var(--circus-gold) 45%, #ff9d55);
  box-shadow: 0 0 14px rgba(255, 213, 107, .45);
  font-size: 21px;
  line-height: 26px;
  font-weight: 1000;
  cursor: default;
}

.module-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .86);
  outline-offset: 2px;
}

.spark {
  color: #0c3b4a;
  font-size: 12px;
}

.status-panel {
  position: relative;
  z-index: 2;
  min-height: 64px;
  margin-bottom: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(circle at 12% 30%, rgba(101, 244, 255, .22), transparent 30%),
    linear-gradient(180deg, var(--panel-strong), rgba(18, 25, 43, .82));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: inset 0 0 22px rgba(101, 244, 255, .12);
  overflow: hidden;
}

.status-panel::before,
.status-panel::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  width: 7px;
  border-radius: 999px;
  background: repeating-linear-gradient(180deg, var(--circus-red) 0 8px, var(--circus-gold) 8px 16px);
  opacity: .85;
}

.status-panel::before {
  left: 10px;
}

.status-panel::after {
  right: 10px;
}

.corner {
  position: absolute;
  left: 12px;
  top: 8px;
  font-size: 8px;
  color: rgba(244, 252, 255, .62);
  letter-spacing: 1.2px;
}

.status-title {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow-wrap: normal;
  text-align: center;
  font-size: 27px;
  line-height: 1.05;
  font-weight: 1000;
  color: #fff;
  text-shadow:
    0 2px 0 rgba(5, 83, 127, .78),
    0 0 12px rgba(101, 244, 255, .74);
}

.gift-board {
  position: relative;
  z-index: 2;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, .045) 1px, transparent 1px),
    rgba(6, 12, 24, .34);
  background-size: 26px 26px;
  border: 1px solid rgba(143, 234, 255, .36);
  border-radius: 8px;
}

.gift-button {
  position: relative;
  min-width: 0;
  height: 56px;
  border: 1px solid rgba(143, 234, 255, .38);
  border-radius: 7px;
  color: #f8fdff;
  background:
    linear-gradient(135deg, rgba(101, 244, 255, .18), transparent 44%),
    linear-gradient(180deg, rgba(36, 50, 79, .9), rgba(16, 24, 42, .88));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.045);
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  padding: 5px;
  cursor: pointer;
  overflow: hidden;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.gift-button::after {
  content: "";
  position: absolute;
  left: -30%;
  top: 0;
  width: 30%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  transform: skewX(-18deg);
}

.gift-button:hover,
.gift-button:focus-visible {
  outline: none;
  border-color: rgba(255, 255, 255, .82);
  transform: translateY(-1px);
  box-shadow: 0 0 14px rgba(101, 244, 255, .28), inset 0 0 18px rgba(101, 244, 255, .1);
}

.gift-button:hover::after,
.gift-button:focus-visible::after {
  animation: sweep .65s ease;
}

.gift-button.is-hit {
  animation: giftHit .42s ease both;
}

.gift-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .42)) drop-shadow(0 0 5px rgba(255, 255, 255, .36));
}

.gift-copy {
  min-width: 0;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
}

.gift-name {
  display: block;
  font-size: 16px;
  line-height: 1.08;
  font-weight: 1000;
  white-space: nowrap;
}

.gift-value {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  line-height: 1;
  font-weight: 1000;
  color: var(--amber);
  text-shadow: 0 0 8px rgba(255, 213, 107, .62);
}

.gift-value.is-minus {
  color: var(--rose);
  text-shadow: 0 0 8px rgba(255, 111, 216, .7);
}

.footer-bar {
  position: relative;
  z-index: 2;
  min-height: 34px;
  margin-top: 10px;
  padding: 5px 7px 5px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: center;
  gap: 7px;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  background: linear-gradient(90deg, rgba(124, 255, 200, .18), rgba(255, 111, 216, .15));
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 8px;
}

.footer-text {
  min-width: 0;
  padding: 2px 4px;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .75);
  border-radius: 5px;
  cursor: text;
}

.footer-text:focus {
  outline: 1px solid rgba(255, 255, 255, .72);
  background: rgba(0, 0, 0, .24);
  text-overflow: clip;
}

.footer-text.is-toast {
  color: #fff8c8;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, .9),
    0 0 10px rgba(255, 227, 140, .75);
}

.icon-button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.56);
  border-radius: 50%;
  color: #071323;
  background: linear-gradient(180deg, #fff, var(--aqua));
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  outline: none;
  filter: brightness(1.12);
}

.toast {
  position: absolute;
  z-index: 9;
  left: 50%;
  top: 62px;
  padding: 5px 10px;
  color: white;
  font-weight: 1000;
  font-size: 17px;
  background: rgba(12, 17, 29, .72);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
  transform: translate(-50%, 10px);
  opacity: 0;
  pointer-events: none;
  animation: toastUp .9s ease forwards;
}

.plugin-panel {
  position: absolute;
  z-index: 6;
  left: calc(100% + 8px);
  top: 56px;
  width: 258px;
  min-height: 246px;
  padding: 10px;
  color: #fff;
  background:
    repeating-linear-gradient(135deg, rgba(255, 76, 97, .1) 0 10px, transparent 10px 22px),
    linear-gradient(180deg, rgba(23, 32, 52, .96), rgba(10, 14, 24, .94));
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 8px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, .32), 0 0 18px rgba(255, 213, 107, .2);
}

.plugin-panel[hidden] {
  display: none;
}

.plugin-panel-close {
  position: absolute;
  top: 8px;
  right: -36px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(93, 202, 255, .38);
  border-radius: 999px;
  background: rgba(6, 19, 36, .82);
  color: #d9fbff;
  font-size: 20px;
  line-height: 1;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(101, 244, 255, .18);
}

.plugin-panel-close:hover,
.plugin-panel-close:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 231, 122, .7);
  color: #fff3a0;
}

.plugin-panel::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 24px;
  width: 8px;
  height: 42px;
  background: linear-gradient(90deg, rgba(255, 227, 140, .74), rgba(255, 227, 140, .2));
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}

.panel-search-row {
  display: flex;
  margin-bottom: 8px;
}

.gift-search-input {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, .28);
  font-size: 14px;
  font-weight: 800;
}

.gift-search-input:focus {
  outline: 2px solid rgba(101, 244, 255, .58);
  outline-offset: 1px;
}

.gift-search-results {
  height: 146px;
  padding: 8px;
  overflow: auto;
  color: rgba(244, 252, 255, .8);
  background: rgba(0, 0, 0, .22);
  border: 1px solid rgba(143, 234, 255, .26);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
}

.gift-search-results.is-error {
  color: #ffe7e7;
  border-color: rgba(255, 104, 104, .72);
  background: rgba(126, 20, 20, .28);
}

.gift-result {
  width: 100%;
  height: 38px;
  margin-bottom: 6px;
  padding: 4px 8px;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  font-size: 13px;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.gift-result img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.gift-result.is-selected,
.gift-result:hover,
.gift-result:focus-visible {
  outline: none;
  border-color: rgba(255, 227, 140, .78);
  background: rgba(255, 213, 107, .18);
}

.rule-row {
  margin-top: 9px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 66px;
  gap: 7px;
}

.rule-select,
.rule-time-input,
.rule-save-button {
  min-width: 0;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 999px;
  color: #071323;
  background: linear-gradient(180deg, #fff, var(--circus-gold));
  font-size: 15px;
  font-weight: 1000;
  text-align: center;
}

.rule-time-input {
  padding: 0 12px;
}

.rule-save-button {
  padding: 0 10px;
  cursor: pointer;
}

.rule-save-button:hover,
.rule-save-button:focus-visible {
  outline: none;
  filter: brightness(1.08);
}

.time-edit-panel {
  min-height: 170px;
  padding: 16px 12px 12px;
}

.time-edit-label {
  display: block;
  margin: 2px 36px 10px 2px;
  color: #fff8ca;
  font-size: 15px;
  font-weight: 1000;
}

.time-edit-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 8px;
  color: #fff;
  background: rgba(0, 0, 0, .32);
  font-size: 20px;
  font-weight: 1000;
  text-align: center;
}

.time-edit-input:focus {
  outline: 2px solid rgba(101, 244, 255, .58);
  outline-offset: 1px;
}

.time-edit-hint {
  min-height: 34px;
  margin: 9px 2px 10px;
  color: rgba(244, 252, 255, .78);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.time-edit-hint.is-error {
  color: #ffd9d9;
}

.time-edit-save {
  width: 100%;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 999px;
  color: #071323;
  background: linear-gradient(180deg, #fff, var(--circus-gold));
  font-size: 15px;
  font-weight: 1000;
  cursor: pointer;
}

.time-edit-save:hover,
.time-edit-save:focus-visible {
  outline: none;
  filter: brightness(1.08);
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.96);
  }
}

@keyframes sweep {
  to {
    left: 110%;
  }
}

@keyframes giftHit {
  45% {
    transform: scale(1.04);
    filter: brightness(1.18);
  }
}

@keyframes toastUp {
  20%,
  72% {
    opacity: 1;
    transform: translate(-50%, -4px);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -26px);
  }
}

@media (max-width: 300px) {
  .stage {
    padding: 8px;
  }

  .booster {
    width: calc(100vw - 8px);
    padding: 10px;
  }

  .gift-name {
    font-size: 15px;
  }

  .gift-value {
    font-size: 14px;
  }

  .plugin-panel {
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    width: auto;
  }

  .plugin-panel::before {
    display: none;
  }
}
