:root {
  color-scheme: dark;
  --bg: #070a13;
  --bg-soft: #0d1324;
  --card: rgba(15, 23, 42, .74);
  --card-strong: rgba(15, 23, 42, .92);
  --text: #eef4ff;
  --muted: #9fb0cc;
  --line: rgba(148, 163, 184, .2);
  --primary: #6d7cff;
  --primary-strong: #8b5cf6;
  --cyan: #22d3ee;
  --danger: #fb7185;
  --ok: #34d399;
  --warning: #fbbf24;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100%;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 6%, rgba(109, 124, 255, .36), transparent 28rem),
    radial-gradient(circle at 92% 10%, rgba(34, 211, 238, .22), transparent 30rem),
    radial-gradient(circle at 50% 100%, rgba(139, 92, 246, .2), transparent 34rem),
    linear-gradient(135deg, #050816 0%, #0b1020 45%, #111827 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.7), transparent 78%);
}
a { color: #b8c4ff; text-decoration: none; }
a:hover { color: #ffffff; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.wrap { position: relative; width: min(1180px, calc(100% - 36px)); margin: 28px auto 48px; }
.topbar {
  position: sticky;
  top: 16px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 28px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(8, 13, 27, .72);
  box-shadow: 0 20px 70px rgba(0, 0, 0, .32);
  backdrop-filter: blur(18px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: .3px;
}
.brand::before {
  content: "iOS";
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 36px;
  border-radius: 14px;
  color: #07111f;
  font-size: 13px;
  font-weight: 950;
  background: linear-gradient(135deg, var(--cyan), #a78bfa 55%, #f0abfc);
  box-shadow: 0 12px 30px rgba(34, 211, 238, .22);
}
.nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nav a {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
}
.nav a:hover { border-color: var(--line); background: rgba(255,255,255,.06); color: #fff; }
.card {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.035)), var(--card);
  box-shadow: 0 24px 90px rgba(0, 0, 0, .34);
  backdrop-filter: blur(16px);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.48), transparent);
}
.card h1 { margin: 0 0 14px; font-size: clamp(30px, 5vw, 58px); line-height: 1.02; letter-spacing: -1.8px; }
.card h2 { margin: 0 0 16px; font-size: 22px; letter-spacing: -.4px; }
.card p { line-height: 1.72; }
.card-head,
.list-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
}
.card-head h1,
.list-head h2 { margin-bottom: 8px; }
.mode-switch {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(2, 6, 23, .38);
}
.mode-tab {
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  padding: 9px 14px;
  color: var(--muted);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  background: transparent;
}
.mode-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 12px 28px rgba(109, 124, 255, .22);
}
.create-panel { display: none; }
.create-panel.active { display: block; }
.search-box {
  display: flex;
  width: min(520px, 100%);
  gap: 10px;
  align-items: center;
}
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.form-help { margin: 0; line-height: 1.6; }
label { color: #dbe7ff; font-weight: 800; font-size: 14px; }
input, select, textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 15px;
  padding: 13px 14px;
  color: var(--text);
  font: inherit;
  background: rgba(2, 6, 23, .48);
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input:focus, select:focus, textarea:focus { border-color: rgba(109,124,255,.8); box-shadow: 0 0 0 4px rgba(109,124,255,.16); background: rgba(2, 6, 23, .68); }
textarea { min-height: 88px; resize: vertical; }
.btn {
  display: inline-flex;
  min-height: 42px;
  border: 0;
  border-radius: 15px;
  padding: 11px 18px;
  color: white;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 16px 36px rgba(109, 124, 255, .28);
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn.secondary { background: rgba(255,255,255,.09); color: #e5ecff; box-shadow: none; border: 1px solid var(--line); }
.btn.danger { background: linear-gradient(135deg, #f43f5e, #be123c); box-shadow: 0 14px 30px rgba(244, 63, 94, .22); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.compact { min-height: 40px; padding: 9px 13px; border-radius: 13px; }
.muted { color: var(--muted); }
.ok { color: var(--ok); font-weight: 800; }
.error { color: var(--danger); font-weight: 800; }
.notice {
  padding: 13px 15px;
  border-radius: 16px;
  margin-bottom: 18px;
  background: rgba(251, 191, 36, .12);
  border: 1px solid rgba(251, 191, 36, .34);
  color: #fde68a;
}
.success { background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .36); color: #bbf7d0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 14px 10px; vertical-align: top; }
th { color: #c3d0e8; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
td { color: #e6edf8; }
tbody tr:hover { background: rgba(255,255,255,.035); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 220px;
}
.inline-form input { min-width: 120px; padding: 9px 10px; border-radius: 12px; }
.checks { display: grid; gap: 9px; }
.check { display: flex; gap: 9px; align-items: center; font-weight: 600; color: #dbe7ff; }
.check input { width: auto; accent-color: var(--primary); }
.hero { min-height: 74vh; display: grid; place-items: center; }
.hero .card { width: min(680px, 100%); padding: clamp(26px, 5vw, 44px); }
.hero .card::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(34,211,238,.3), transparent 64%);
}
.udid-hero {
  align-items: start;
  padding-top: 10px;
}
.udid-hero .card { width: min(760px, 100%); }
.udid-card .card-head { margin-bottom: 18px; }
.udid-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.udid-step {
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 118px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 18px;
  background: rgba(2, 6, 23, .32);
}
.udid-step-head {
  display: flex;
  gap: 10px;
  align-items: center;
}
.udid-step-head span {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: #07111f;
  font-weight: 950;
  background: linear-gradient(135deg, var(--cyan), #a78bfa);
}
.udid-step strong { color: #eef4ff; line-height: 1.25; }
.udid-step p { margin: 0; font-size: 14px; line-height: 1.55; }
.udid-result {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}
.udid-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.udid-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.udid-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.udid-download-panel {
  width: min(520px, 100%);
}
.udid-settings-path {
  margin: 10px 0 0;
  padding: 14px 16px;
  border: 1px solid rgba(125, 211, 252, .22);
  border-radius: 16px;
  color: #eef4ff;
  font-weight: 900;
  line-height: 1.55;
  background: rgba(14, 165, 233, .1);
}
.app-list { display: grid; gap: 14px; }
.redeem-results {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.redeem-results-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.redeem-results-head h2 { margin-bottom: 6px; }
.game-group-list {
  display: grid;
  width: 100%;
  gap: 12px;
}
.app-group {
  display: block;
  width: 100%;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025)), rgba(2, 6, 23, .36);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.app-group.is-allowed {
  border-color: rgba(125, 211, 252, .24);
  box-shadow: inset 3px 0 0 rgba(52, 211, 153, .8), inset 0 1px 0 rgba(255,255,255,.07);
}
.app-group.is-locked { opacity: .78; }
.app-group-main {
  appearance: none;
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border: 0;
  padding: 16px 18px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  background: transparent;
}
.app-group-main:hover { background: rgba(255,255,255,.045); }
.app-group .app-title { min-width: 0; }
.app-group .app-title strong {
  display: block;
  color: var(--text);
  font-size: 17px;
  line-height: 1.25;
}
.app-group-status {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 0 auto;
}
.version-summary {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.version-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 999px;
  padding: 4px 10px;
  color: #dbe7ff;
  font-size: 13px;
  font-weight: 900;
  background: rgba(255,255,255,.06);
}
.version-list {
  display: grid;
  border-top: 1px solid var(--line);
  background: rgba(2, 6, 23, .28);
}
.version-list[hidden] { display: none; }
.version-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid rgba(148, 163, 184, .12);
}
.version-item:first-child { border-top: 0; }
.version-item.is-locked { color: var(--muted); }
.version-item p { margin: 4px 0 0; }
.version-meta { min-width: 0; }
.version-meta strong { color: #eef4ff; }
.version-action { flex: 0 0 auto; }
.version-overview {
  display: grid;
  gap: 18px;
}
.version-card {
  position: relative;
  display: grid;
  gap: 16px;
  border: 1px solid rgba(125, 211, 252, .18);
  border-radius: 20px;
  padding: 18px 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.028)), rgba(2, 6, 23, .48);
  box-shadow: inset 4px 0 0 rgba(34, 211, 238, .42), 0 16px 44px rgba(0,0,0,.16);
}
.version-card + .version-card {
  margin-top: 2px;
}
.version-card-main {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}
.version-card-title {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.version-card-title strong { font-size: 19px; }
.version-card p { margin: 5px 0 0; }
.version-game-title { min-width: 0; }
.version-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, .14);
}
.release-note {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 16px;
  background: rgba(2, 6, 23, .3);
}
.release-note-label {
  color: #dbe7ff;
  font-size: 13px;
  font-weight: 900;
}
.release-note p {
  margin: 0;
  white-space: pre-wrap;
}
.app-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 18px;
  padding: 16px;
  background: rgba(2, 6, 23, .38);
}
.app-item strong { font-size: 18px; }
.app-title { display: flex; gap: 12px; align-items: center; }
.app-icon { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; border: 1px solid var(--line); background: rgba(255,255,255,.08); }
.app-icon.small { width: 38px; height: 38px; border-radius: 10px; }
.tag-list { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; border: 1px solid rgba(125, 211, 252, .22); border-radius: 999px; padding: 5px 10px; color: #dbeafe; background: rgba(14, 165, 233, .12); font-size: 13px; font-weight: 800; }
.version-tag { border-color: rgba(109, 124, 255, .34); background: rgba(109, 124, 255, .18); color: #e0e7ff; }
.ok-tag { border-color: rgba(52, 211, 153, .28); background: rgba(52, 211, 153, .13); color: #bbf7d0; }
.locked-tag { border-color: rgba(148, 163, 184, .2); background: rgba(148, 163, 184, .1); color: var(--muted); }
.modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 22px; background: rgba(3,7,18,.78); backdrop-filter: blur(12px); }
.modal.active { display: flex; }
.modal-panel { width: min(820px, 100%); max-height: min(86vh, 820px); overflow: auto; border: 1px solid var(--line); border-radius: 26px; padding: 24px; background: var(--card-strong); box-shadow: 0 28px 90px rgba(0,0,0,.48); }
.modal-panel.app-manage-modal { width: min(980px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; }
.modal-close { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--text); background: rgba(255,255,255,.08); cursor: pointer; }
.announcement-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(3, 7, 18, .78);
  backdrop-filter: blur(14px);
}
.announcement-overlay.active { display: grid; }
.announcement-panel {
  width: min(520px, 100%);
  border: 1px solid rgba(125, 211, 252, .24);
  border-radius: 26px;
  padding: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.04)), var(--card-strong);
  box-shadow: 0 28px 90px rgba(0,0,0,.46);
}
.announcement-head {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}
.announcement-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.18;
}
.announcement-time {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.announcement-content {
  margin: 0 0 22px;
  color: #dbe7ff;
  white-space: pre-wrap;
}
.announcement-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.modal-section {
  display: grid;
  gap: 14px;
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}
.modal-section:first-of-type {
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}
.modal-section h3 {
  margin: 0;
  color: #eaf1ff;
  font-size: 17px;
}
.version-manage-list {
  display: grid;
  gap: 12px;
}
.version-manage-item {
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 18px;
  padding: 16px;
  background: rgba(2, 6, 23, .34);
}
.version-manage-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.version-manage-head p {
  margin: 8px 0 0;
  line-height: 1.55;
}
.version-mod-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.version-mod-form .btn { min-width: 72px; }
code { display: inline-block; max-width: 360px; overflow-wrap: anywhere; background: rgba(2, 6, 23, .55); color: #bae6fd; padding: 3px 7px; border: 1px solid rgba(125, 211, 252, .18); border-radius: 8px; }
.signing-overlay {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(3, 7, 18, .78);
  backdrop-filter: blur(14px);
}
.signing-overlay.active { display: grid; }
.signing-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 32px;
  text-align: center;
  background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.04)), var(--card-strong);
  box-shadow: 0 28px 90px rgba(0,0,0,.45);
}
.signing-panel.inline {
  width: min(520px, 100%);
  margin: 0 auto;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.signed-title {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.signed-title h1 {
  margin: 0;
}
.countdown-tag {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid rgba(52, 211, 153, .3);
  border-radius: 999px;
  padding: 7px 12px;
  color: #bbf7d0;
  font-size: 14px;
  font-weight: 900;
  background: rgba(52, 211, 153, .12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.countdown-tag.expired {
  border-color: rgba(125, 211, 252, .26);
  color: #c8f3ff;
  background: rgba(34, 211, 238, .1);
}
.spinner {
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  border-radius: 999px;
  border: 4px solid rgba(255,255,255,.14);
  border-top-color: var(--cyan);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .wrap { width: min(100% - 22px, 1180px); margin: 14px auto 34px; }
  .topbar, .app-item { align-items: flex-start; flex-direction: column; }
  .topbar {
    position: static;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: 20px;
  }
  .brand {
    font-size: 20px;
  }
  .brand::before {
    width: 40px;
    height: 34px;
    border-radius: 13px;
  }
  .nav {
    gap: 4px;
  }
  .nav a {
    padding: 8px 9px;
    font-size: 14px;
  }
  .card-head, .list-head, .search-box, .redeem-results-head { flex-direction: column; align-items: stretch; }
  .app-group-main, .version-item, .version-card-main, .version-manage-head { align-items: flex-start; flex-direction: column; }
  .app-group-status { justify-content: flex-start; }
  .version-action, .version-action .sign-form, .version-action .btn { width: 100%; }
  .version-manage-head .btn, .version-mod-form .inline-form, .version-mod-form .inline-form .btn { width: 100%; }
  .announcement-actions, .announcement-actions .btn { width: 100%; }
  .udid-hero {
    min-height: auto;
    padding-top: 0;
  }
  .udid-hero .card {
    padding: 22px 26px;
  }
  .udid-card .card-head {
    margin-bottom: 12px;
  }
  .udid-card .card-head h1 {
    margin-bottom: 10px;
    font-size: 30px;
    line-height: 1.06;
    letter-spacing: 0;
  }
  .udid-card .card-head p {
    margin: 0;
    line-height: 1.55;
  }
  .udid-card .tag {
    padding: 4px 9px;
    font-size: 12px;
  }
  .udid-steps {
    grid-template-columns: 1fr;
    gap: 9px;
    margin: 16px 0 12px;
  }
  .udid-step {
    min-height: auto;
    gap: 8px;
    padding: 13px 16px;
    border-radius: 16px;
  }
  .udid-step-head {
    gap: 10px;
  }
  .udid-step-head span {
    width: 28px;
    height: 28px;
  }
  .udid-step p {
    padding-left: 38px;
    font-size: 13px;
    line-height: 1.42;
  }
  .udid-copy-row { grid-template-columns: 1fr; }
  .udid-actions {
    gap: 8px;
    margin-top: 12px;
  }
  .udid-actions, .udid-actions .btn { width: 100%; }
  .udid-actions .btn {
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 14px;
  }
  .udid-download-panel {
    padding: 20px;
    border-radius: 20px;
  }
  .udid-settings-path {
    padding: 12px 14px;
    font-size: 14px;
  }
  .mode-switch { width: 100%; }
  .mode-tab { flex: 1; }
  .grid { grid-template-columns: 1fr; }
  .card { padding: 20px; border-radius: 22px; }
  table { display: block; overflow-x: auto; }
}
