:root {
  --purple: #4b3fe8;
  --purple-deep: #3d32c4;
  --green: #22c55e;
  --green-soft: #dcfce7;
  --text: #1c1b22;
  --muted: #7a7788;
  --line: #eceaf3;
  --bg: #f3f4f8;
  --card: #ffffff;
  --radius: 22px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #d9dce6;
  color: var(--text);
}

.phone {
  min-height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.hero {
  background: linear-gradient(180deg, var(--purple) 0%, var(--purple-deep) 100%);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 22px;
}
.hero-top {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
}
.hero-spacer { width: 44px; }
.hero-titles { text-align: center; }
.hero-label {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.hero-date {
  margin: 6px 0 0;
  font-size: 13px;
  opacity: 0.85;
}
.icon-plus {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #fff;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  padding: 0;
}

.sheet {
  padding: 20px 18px 88px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 14px;
  color: var(--muted);
}
.search-wrap input {
  flex: 1;
  border: 0;
  background: transparent;
  height: 50px;
  font-size: 16px;
  outline: none;
  color: var(--text);
}

.hint {
  margin: 14px 4px 0;
  color: var(--muted);
  font-size: 14px;
}

.results {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.member-row {
  background: var(--card);
  border-radius: 16px;
  padding: 12px 12px 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 0 rgba(20, 16, 50, 0.03);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e8e6f2;
  color: #5b5770;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.member-meta { flex: 1; min-width: 0; }
.member-name {
  margin: 0;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-group {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.btn-present,
.btn-marked {
  border: 0;
  border-radius: 999px;
  padding: 9px 12px;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.btn-present {
  background: var(--purple);
  color: #fff;
}
.btn-marked {
  background: var(--green-soft);
  color: #15803d;
}

.optional { font-weight: 500; color: var(--muted); }

.install-bar {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(390px, calc(100% - 36px));
  max-width: 394px;
  border: 0;
  border-radius: 12px;
  background: #1c1b22;
  color: #fff;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
}
.hidden { display: none !important; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 16, 32, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}
.overlay.center { align-items: center; }
.popup-card {
  width: min(320px, calc(100% - 40px));
  margin: auto;
  background: #fff;
  border-radius: 20px;
  padding: 28px 22px 20px;
  text-align: center;
}
.popup-card p {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 800;
}
.popup-card .btn-primary { width: 100%; }
.modal {
  width: min(430px, 100%);
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(22px + var(--safe-bottom));
  max-height: 92dvh;
  overflow: auto;
}
.modal-handle {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: #ddd;
  margin: 6px auto 14px;
}
.modal h2 { margin: 0; font-size: 22px; }
.modal-sub { margin: 6px 0 16px; color: var(--muted); font-size: 14px; }
.modal label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #5b5770;
  margin-bottom: 12px;
}
.modal input,
.modal select {
  width: 100%;
  margin-top: 6px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  font-size: 16px;
  background: #fafafa;
}
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.brought-hits {
  list-style: none;
  margin: -4px 0 12px;
  padding: 0;
}
.brought-hits li button,
.brought-hits .brought-empty {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  font-size: 14px;
}
.brought-hits .brought-empty { color: var(--muted); }
.brought-picked {
  margin: -4px 0 12px;
  color: var(--purple);
  font-size: 13px;
  font-weight: 700;
}
.btn-primary, .btn-ghost, .btn-text {
  height: 48px;
  border-radius: 14px;
  border: 0;
  font-weight: 800;
  font-size: 15px;
}
.btn-primary { background: var(--purple); color: #fff; }
.btn-ghost { background: #efeefe; color: var(--purple); }
.btn-text { background: transparent; color: var(--muted); }

.gate {
  min-height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--purple), var(--purple-deep));
  display: flex;
  align-items: center;
  padding: 24px 18px;
  position: relative;
  z-index: 50;
}
.gate-card {
  width: 100%;
  background: #fff;
  border-radius: 22px;
  padding: 22px 20px;
}
.gate-kicker {
  margin: 0;
  color: var(--purple);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.gate h1 { margin: 8px 0 0; font-size: 24px; }
.gate-note { color: var(--muted); font-size: 14px; line-height: 1.4; }
.gate label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #5b5770;
  margin-bottom: 12px;
}
.gate input {
  width: 100%;
  height: 46px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  font-size: 16px;
}
.gate .btn-primary { width: 100%; margin-top: 4px; }
.gate-err { color: #b42318; font-size: 15px; font-weight: 700; min-height: 1.2em; }
.icon-out {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  padding: 0;
}

.toast {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  background: #1c1b22;
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 30;
  max-width: 90%;
}

