:root {
  --bg: #0f1115;
  --card: #181b22;
  --card-2: #1f232c;
  --line: #2a2f3a;
  --text: #f3f5f8;
  --muted: #9aa3b2;
  --accent: #6c8cff;
  --accent-press: #5a78e6;
  --good: #38c172;
  --danger: #ff6b6b;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 18px 40px;
  flex: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 18px;
  margin-bottom: 22px;
}
.brand .dot {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #9d7cff);
  display: grid; place-items: center; font-size: 15px;
}

h1 { font-size: 26px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 0 0 24px; line-height: 1.5; }

ol.steps {
  margin: 0 0 24px;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 15px;
}
ol.steps li { margin-bottom: 4px; }
ol.steps b { color: var(--text); font-weight: 600; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 6px;
  font-weight: 600;
}

input[type="text"], input[type="email"] {
  width: 100%;
  font-size: 17px; /* >=16px avoids iOS zoom-on-focus */
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  margin-bottom: 14px;
  transition: border-color .15s ease;
}
input:focus { outline: none; border-color: var(--accent); }

button {
  width: 100%;
  font-size: 17px;
  font-weight: 700;
  padding: 15px 16px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: background .15s ease, transform .05s ease;
}
button:hover { background: var(--accent-press); }
button:active { transform: scale(0.99); }
button:disabled { opacity: .5; cursor: not-allowed; }

button.secondary {
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--line);
}
button.secondary:hover { background: #262b35; }

.error { color: var(--danger); font-size: 14px; margin: 6px 0 0; min-height: 18px; }
.hidden { display: none !important; }

/* QR + share block */
.qr-wrap { text-align: center; }
.qr-wrap img {
  width: 100%;
  max-width: 280px;
  background: #fff;
  border-radius: 14px;
  padding: 12px;
}
.linkrow {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.linkrow input { margin-bottom: 0; font-size: 14px; }
.linkrow button { width: auto; padding: 0 16px; white-space: nowrap; }

/* Attendee list */
.count-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 5px 11px; border-radius: 999px; margin-bottom: 14px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(56,193,114,.6); animation: pulse 1.8s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(56,193,114,.5); }
  70% { box-shadow: 0 0 0 7px rgba(56,193,114,0); }
  100% { box-shadow: 0 0 0 0 rgba(56,193,114,0); }
}
.live-dot.off { background: var(--muted); animation: none; }

ul.people { list-style: none; padding: 0; margin: 0; }
ul.people li {
  display: flex; flex-direction: column; gap: 2px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
ul.people li:last-child { border-bottom: none; }
.people .nm { font-weight: 600; }
.people .em { color: var(--muted); font-size: 14px; text-decoration: none; }
.people .em:hover { color: var(--accent); }
.people .me { color: var(--accent); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: #fff; color: #111; font-weight: 600; font-size: 14px;
  padding: 11px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; z-index: 10;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* "Your events" (localStorage) */
#myEvents { margin-top: 28px; }
ul.events { list-style: none; padding: 0; margin: 0; }
ul.events li { display: flex; gap: 8px; margin-bottom: 8px; }
.evt-open {
  flex: 1; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 3px;
}
.evt-open:hover { background: var(--card-2); }
.evt-open .evt-name { font-weight: 600; font-size: 16px; }
.evt-open .evt-meta { color: var(--muted); font-size: 12px; }
.evt-forget {
  width: 46px; flex: 0 0 auto; background: var(--card); border: 1px solid var(--line);
  color: var(--muted); border-radius: 12px; font-size: 15px;
}
.evt-forget:hover { background: var(--card-2); color: var(--danger); }

.ev-name-small { font-weight: 600; text-align: center; margin: 14px 0 0; }
.btn-row { display: flex; gap: 8px; margin-top: 10px; }
.btn-row button { width: 100%; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 16px 0; line-height: 1.5; }
#shareBtn { margin-top: 16px; }
#copyImg { margin-top: 10px; }
#newEvent { margin-top: 18px; }

footer {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 18px; opacity: .8; line-height: 1.6;
}
a.plain { color: var(--accent); text-decoration: none; }
a.plain:hover { text-decoration: underline; }

/* ---- Print-only sheet ---------------------------------------------------- */
.print-only { display: none; }

@media print {
  body { background: #fff; color: #000; }
  body > main, body > footer, .toast { display: none !important; }
  .print-only {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    min-height: 100vh;
    text-align: center;
    padding: 40px;
  }
  #printSheet .ps-name { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; max-width: 90%; }
  #printSheet .ps-qr { width: 62%; max-width: 380px; }
  #printSheet .ps-qr svg, #printSheet .ps-qr img { width: 100%; height: auto; display: block; }
  #printSheet .ps-cta { font-size: 26px; font-weight: 700; }
  #printSheet .ps-url { font-size: 16px; color: #333; word-break: break-all; }
}
