:root {
  --bg: #f3f9ff;
  --card: #ffffff;
  --text: #13233b;
  --muted: #66758d;
  --line: #dce9f8;
  --blue: #2277ff;
  --green: #18b86b;
  --red: #e6495f;
  --orange: #f59e0b;
  --soft-blue: #eaf3ff;
  --soft-green: #e9fbf2;
  --shadow: 0 18px 50px rgba(37, 88, 140, .11);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(34,119,255,.14), transparent 34%),
    linear-gradient(180deg, #f7fbff, var(--bg));
  font-family: Arial, Helvetica, sans-serif;
  font-size: 17px;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 26px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.back {
  display: inline-flex;
  margin-bottom: 13px;
  color: var(--blue);
  font-weight: 900;
}

.pill,
.badge {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--soft-blue);
  font-size: 13px;
  font-weight: 900;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin: 12px 0 12px;
  font-size: clamp(40px, 6vw, 72px);
  line-height: .96;
  letter-spacing: -2px;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.lookup,
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.lookup {
  display: grid;
  gap: 12px;
  padding: 20px;
}

label {
  display: grid;
  gap: 8px;
  color: #263d5d;
  font-weight: 900;
}

label span { font-size: 15px; }

input,
select {
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  color: var(--text);
  background: #f9fcff;
  border: 1px solid #cce0f2;
  border-radius: 16px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(34,119,255,.12);
}

button {
  min-height: 56px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #25b4ff);
  font-weight: 900;
  cursor: pointer;
}

button:disabled { opacity: .65; cursor: wait; }

.grid,
.leader-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.card {
  padding: 22px;
  margin-bottom: 18px;
}

.card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.card-title h2 {
  margin-bottom: 4px;
  font-size: 30px;
}

.card-title span,
.soft {
  color: var(--muted);
  font-weight: 800;
}

.status-card {
  display: grid;
  gap: 12px;
  align-content: center;
}

.status-card strong {
  font-size: 28px;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.badge.ok { color: #0d6940; background: var(--soft-green); }
.badge.bad { color: #b32138; background: #fff0f2; }
.badge.warn { color: #935000; background: #fff4e6; }

.overlay-box {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: #f7fbff;
  border: 1px solid var(--line);
  color: var(--muted);
  word-break: break-all;
  font-weight: 800;
}

.overlay-box a {
  color: var(--blue);
  font-weight: 900;
}

.preset-list,
.event-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.effect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

.effect-card {
  position: relative;
  display: grid;
  gap: 10px;
  min-height: 220px;
  padding: 18px;
  border: 1px solid #d6e7f8;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(34,119,255,.10), transparent 42%),
    #ffffff;
  box-shadow: 0 14px 32px rgba(37, 88, 140, .08);
}

.effect-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(37, 88, 140, .13);
}

.effect-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.effect-icon {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border-radius: 24px;
  background: linear-gradient(180deg, #f8fbff, #eaf4ff);
  border: 1px solid #d8e9fa;
  font-size: 43px;
  box-shadow: inset 0 -8px 18px rgba(34,119,255,.08);
}

.effect-img,
.preset-preview-img {
  max-width: 78px;
  max-height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(30, 68, 120, .16));
}

.effect-repeat {
  display: grid;
  place-items: center;
  min-width: 46px;
  height: 38px;
  padding: 0 10px;
  border-radius: 14px;
  color: #13233b;
  background: #eef6ff;
  font-weight: 1000;
  font-size: 18px;
}

.effect-card h3 {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.1;
}

.effect-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.effect-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.effect-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 999px;
  color: #35506f;
  background: #f2f8ff;
  border: 1px solid #dce9f8;
  font-size: 12px;
  font-weight: 900;
}

.gift-meta img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.leader-list {
  display: grid;
  gap: 10px;
}

.leader-row {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfdff;
}

.leader-rank {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
}

.leader-score {
  color: var(--green);
  font-weight: 900;
}

.preset-row,
.event-row {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfdff;
}

.preset-row b,
.event-row b {
  color: var(--text);
}

.preset-row small,
.event-row small {
  color: var(--muted);
  font-weight: 800;
}

.event-row.gift .badge { color: #7b2cbf; background: #f3e9ff; }
.event-row.chat .badge { color: #0f7490; background: #e9fbff; }
.event-row.follow .badge,
.event-row.member .badge { color: #0d6940; background: var(--soft-green); }
.event-row.share .badge { color: #935000; background: #fff4e6; }

.empty {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  background: #fbfdff;
  font-weight: 900;
  text-align: center;
}

.preset-editor {
  display: grid;
  gap: 14px;
}

.editor-help {
  padding: 14px 16px;
  border-radius: 18px;
  color: #205d43;
  background: var(--soft-green);
  border: 1px solid #c8f3dc;
  font-weight: 800;
}

.preset-editor-rows {
  display: grid;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.preset-edit-row {
  display: grid;
  grid-template-columns: 96px repeat(7, minmax(150px, 1fr)) repeat(4, minmax(92px, .55fr)) auto auto auto;
  gap: 10px;
  align-items: end;
  min-width: 1880px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fbfdff;
}

.preset-edit-row {
  grid-template-columns: 96px minmax(150px, 220px);
  min-width: 0;
  max-width: 390px;
}

.preset-edit-row label:not(:has([data-field="repeatCount"])),
.preset-edit-row .gift-picker,
.preset-edit-row .danger-light,
.editor-actions [data-add-preset-row] {
  display: none;
}

.preset-editor-rows {
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  align-items: start;
  overflow-x: visible;
}

.gift-picker {
  grid-column: 1 / -1;
  padding-top: 8px;
}

.gift-picker-title {
  margin: 2px 2px 8px;
  color: #35506f;
  font-size: 12px;
  font-weight: 1000;
}

.gift-picker.hidden,
.gift-only.hidden {
  display: none;
}

.gift-picker-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding: 8px 8px 10px;
  border: 1px solid #dce9f8;
  border-radius: 18px;
  background: #f7fbff;
}

.gift-pick {
  min-width: 0;
  min-height: 118px;
  padding: 10px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  border: 1px solid #d7e8fb;
  border-radius: 18px;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 10px 24px rgba(37, 88, 140, .08);
}

.gift-pick.selected {
  border-color: #2277ff;
  background: #edf6ff;
  box-shadow: 0 12px 28px rgba(34, 119, 255, .18);
}

.gift-pick img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.gift-pick b {
  font-size: 12px;
  text-align: center;
}

.gift-pick small,
.gift-picker-empty {
  color: var(--muted);
  font-weight: 900;
  font-size: 11px;
}

.gift-picker-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #fbfdff;
}

.preset-edit-preview {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 92px;
  padding: 10px;
  border: 1px solid #d8e9fa;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #eef7ff);
}

.preset-edit-preview span {
  font-size: 38px;
  line-height: 1;
}

.preset-edit-preview img {
  max-width: 72px;
  max-height: 58px;
  object-fit: contain;
}

.preset-edit-preview b {
  color: #13233b;
  font-size: 17px;
}

.preset-edit-row label span {
  font-size: 12px;
}

.preset-edit-row input,
.preset-edit-row select {
  min-height: 46px;
  border-radius: 14px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 10px;
  border-radius: 14px;
  background: #f5faff;
  border: 1px solid var(--line);
  color: var(--text);
}

.check-line input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.editor-actions button {
  min-width: 180px;
}

.danger-light {
  min-height: 46px;
  padding: 0 16px;
  color: #b32138;
  background: #fff0f2;
  border: 1px solid #ffd1d9;
}

.reset-light {
  min-height: 46px;
  padding: 0 16px;
  color: #935000;
  background: #fff4e6;
  border: 1px solid #ffdca8;
}

.import-light {
  min-height: 46px;
  padding: 0 16px;
  color: #075985;
  background: #e8f7ff;
  border: 1px solid #bcecff;
}

@media (max-width: 880px) {
  .hero,
  .grid,
  .leader-grid,
  .preset-row,
  .event-row,
  .preset-edit-row {
    grid-template-columns: 1fr;
  }

  .effect-grid {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  }
}
