:root {
  --bg-deep: #0b1a3a;
  --bg-card: rgba(18, 40, 78, 0.92);
  --pink: #f7a8c4;
  --pink-deep: #e879a8;
  --cyan: #9fd6e8;
  --text: #f5f7ff;
  --muted: rgba(245, 247, 255, 0.72);
  --line: rgba(159, 214, 232, 0.35);
  --danger: #ff8a9b;
  --ok: #8fe0b8;
  --shadow: 0 10px 30px rgba(4, 12, 32, 0.35);
  --radius: 16px;
  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-deep);
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* Home */
.home-page {
  min-height: 100vh;
  background: #071226;
}

.invite-image {
  width: 100%;
  height: auto;
  vertical-align: top;
}

.float-cta {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 20;
  min-width: min(86vw, 340px);
  padding: 14px 22px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  color: #1a1030;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, rgba(247, 168, 196, 0.92), rgba(159, 214, 232, 0.92));
  box-shadow: var(--shadow), 0 0 0 1px rgba(247, 168, 196, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  animation: floatPulse 2.8s ease-in-out infinite;
}

.float-cta:active {
  transform: translateX(-50%) scale(0.98);
}

@keyframes floatPulse {
  0%,
  100% {
    box-shadow: var(--shadow), 0 0 0 0 rgba(247, 168, 196, 0.35);
  }
  50% {
    box-shadow: var(--shadow), 0 0 0 10px rgba(247, 168, 196, 0);
  }
}

.home-spacer {
  height: 88px;
}

/* Shared page shell */
.page {
  min-height: 100vh;
  padding: 24px 18px 40px;
  background:
    radial-gradient(circle at 20% 0%, rgba(247, 168, 196, 0.22), transparent 42%),
    radial-gradient(circle at 90% 10%, rgba(159, 214, 232, 0.18), transparent 36%),
    linear-gradient(180deg, #0a1733 0%, #12284e 55%, #0b1a3a 100%);
}

.page-card {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 22px 18px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.page-card--wide {
  width: min(1080px, 100%);
}

.page-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
}

.page-sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.back-link {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--cyan);
  font-size: 14px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
}

.required::after {
  content: " *";
  color: var(--pink);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(8, 18, 40, 0.55);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--pink);
}

.form-textarea {
  min-height: 96px;
  resize: vertical;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice {
  position: relative;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(8, 18, 40, 0.4);
  cursor: pointer;
  user-select: none;
}

.choice input:checked + span {
  color: #1a1030;
  border-color: transparent;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  font-weight: 650;
}

.hidden {
  display: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  color: #1a1030;
  font-weight: 700;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}

.form-error {
  min-height: 20px;
  margin: 4px 0 12px;
  color: var(--danger);
  font-size: 13px;
}

.success-box {
  text-align: center;
  padding: 28px 8px 12px;
}

.success-box h2 {
  margin: 0 0 10px;
  color: var(--ok);
}

.success-box p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.6;
}

/* Admin */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 18, 40, 0.4);
}

.stat-item .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.stat-item .value {
  font-size: 20px;
  font-weight: 700;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar .btn {
  width: auto;
  flex: 1;
  min-height: 42px;
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 560px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(159, 214, 232, 0.15);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--cyan);
  font-weight: 600;
  background: rgba(8, 18, 40, 0.55);
}

td {
  color: var(--muted);
}

.empty-tip {
  text-align: center;
  color: var(--muted);
  padding: 24px 8px;
}

@media (min-width: 768px) {
  .page {
    padding-top: 40px;
  }

  .float-cta {
    font-size: 17px;
  }

  .stats-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
