: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;
  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; }
.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%);
}
.app-list { display: grid; gap: 14px; }
.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; }
.ok-tag { border-color: rgba(52, 211, 153, .28); background: rgba(52, 211, 153, .13); color: #bbf7d0; }
.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-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; }
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;
}
.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; }
  .card-head, .list-head, .search-box { flex-direction: column; align-items: stretch; }
  .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; }
}
