:root {
  --bg: #0d0f17;
  --bg-glow: #14182b;
  --panel: #151a28;
  --panel-2: #1c2233;
  --ink: #eef1f8;
  --muted: #9aa3b5;
  --accent: #8b7bff;
  --accent-soft: #a99bff;
  --border: #262c3f;
  --error: #ff6b6b;
  --card-grad-a: #7c5cff;
  --card-grad-b: #b48cff;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -200px, var(--bg-glow) 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.site-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 28px 20px 0;
  max-width: 880px;
  margin: 0 auto;
}

.logo {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.logo-img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
}

.tagline { color: var(--muted); }

.wrap {
  max-width: 880px;
  margin: 24px auto 48px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.card-panel {
  grid-column: 1 / -1;
  max-width: 480px;
  justify-self: center;
}

h1, h2 {
  margin: 0 0 6px;
  font-size: 20px;
  letter-spacing: -0.3px;
}

.panel-intro {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
}

label em { color: var(--error); font-style: normal; }

.optional {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}

.field-group {
  margin-bottom: 14px;
}

.group-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 12px;
  font: inherit;
  font-weight: 400;
  color-scheme: dark;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* The hidden attribute is used all over for toggling (photo preview vs
   placeholder, the limit banner, form errors...). A global reset with
   !important beats any display rule on the same element — without it, the
   photo placeholder's `display: flex` would override the attribute. */
[hidden] { display: none !important; }

input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.75; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 123, 255, 0.22);
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.role {
  border: 0;
  padding: 0;
  margin: 0 0 16px;
}

.role legend {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--muted);
}

/* Segmented "I work / I study" picker. The radios stay in the DOM (and stay
   keyboard-focusable) but are hidden; the label is the visible pill. */
.role-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.role-opt {
  position: relative;
  display: block;
}

.role-opt input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.role-opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .1s ease;
}

.role-opt input:checked + span {
  border-color: var(--accent);
  background: rgba(139, 123, 255, 0.12);
  color: var(--accent-soft);
}

.role-opt input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.role-opt:active span { transform: scale(0.98); }

.role-icon { height: 18px; width: 18px; vertical-align: middle; border-radius: 3px; }

/* --- photo upload --- */
.photo-field { margin-bottom: 14px; }

.photo-drop {
  position: relative;
  width: 100%;
  height: 110px;
  margin-top: 8px;
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s ease, background .15s ease;
}

.photo-drop:hover { border-color: var(--accent); }

.photo-drop:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.photo-drop.dragging {
  border-color: var(--accent);
  background: rgba(139, 123, 255, 0.12);
}

.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
}

.photo-plus {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: border-color .15s ease, color .15s ease;
}

.photo-drop:hover .photo-plus {
  border-color: var(--accent);
  color: var(--accent-soft);
}

/* A picked photo keeps its real aspect ratio — no zoom-to-fill crop. The box
   grows to fit it (capped at 300px tall) so the whole image is visible. */
.photo-preview {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 300px;
}

.photo-drop.has-photo { border-style: solid; height: auto; }

.photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 15px;
  line-height: 1;
}

.photo-remove:hover:not(:disabled) { background: var(--error); }

textarea { resize: vertical; }

button {
  font: inherit;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

button:hover:not(:disabled) { background: #232b40; }

button:disabled { opacity: 0.55; cursor: default; }

button.primary {
  width: 100%;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  padding: 12px 16px;
}

button.primary:hover:not(:disabled) { background: var(--accent-soft); }

.error { color: var(--error); font-size: 14px; }

/* --- social media inputs --- */
.social-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.social-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.social-input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 123, 255, 0.22);
}

.social-input-row .platform-icon { flex-shrink: 0; }

.social-input-row input {
  flex: 1;
  min-width: 0;
  margin: 0;
  border: none;
  border-radius: 0 10px 10px 0;
  background: transparent;
  box-shadow: none;
  padding: 9px 12px 9px 4px;
}

.social-input-row input:focus { box-shadow: none; }

.platform-icon { height: 18px; width: 18px; border-radius: 4px; vertical-align: middle; }
.social-chip .platform-icon { height: 14px; width: 14px; }

/* --- "more about you" tiles --- */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tile {
  display: block;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tile:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 123, 255, 0.22);
}

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

.tile-label .optional {
  font-size: 11px;
  font-weight: 500;
}

.tile input {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: none;
  padding: 8px 10px;
}

.tile input:focus {
  border-color: var(--border);
  box-shadow: none;
}

/* Hide the native datalist dropdown arrow so every tile input looks identical */
.tile input::-webkit-calendar-picker-indicator {
  display: none;
}

/* --- the digital card --- */
.digital-card {
  background: linear-gradient(150deg, var(--card-grad-a) 0%, var(--card-grad-b) 100%);
  color: #fff;
  border-radius: 18px;
  padding: 28px 24px;
  min-height: 180px;
  box-shadow: 0 14px 34px rgba(124, 92, 255, 0.35);
  word-wrap: break-word;
}

.card-name {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.card-photo {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  margin: 0 auto 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Owner card — the site owner's card gets a gold name and a small badge */
.owner-name { color: #ffd166; }

.owner-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 209, 102, 0.55);
  background: rgba(255, 209, 102, 0.16);
  color: #ffd166;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.card-role {
  margin-top: 6px;
  font-size: 16px;
  opacity: 0.95;
}

.card-meta {
  margin-top: 14px;
  font-size: 14px;
  opacity: 0.9;
}

.card-section {
  margin-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  padding-top: 12px;
  font-size: 14px;
}

.card-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.8;
  margin-bottom: 4px;
}

.card-about {
  white-space: pre-wrap;
  opacity: 0.95;
}

.card-line { opacity: 0.95; }

.card-link {
  color: #fff;
  opacity: 0.95;
  word-break: break-all;
}

.card-link:hover { opacity: 1; }

.card-cta {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px 16px;
  text-align: center;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 10px;
  transition: background 0.15s ease;
}

.card-cta:hover { background: var(--accent-soft); }

.card-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.social-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  white-space: nowrap;
}

/* --- share links --- */
#result { margin-top: 24px; }

.link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.link-row a {
  flex: 1;
  font-size: 13px;
  color: var(--accent);
  word-break: break-all;
  text-decoration: none;
}

.link-row a:hover { text-decoration: underline; }

.hint {
  color: var(--muted);
  font-size: 13px;
}

.hint code {
  background: var(--panel-2);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
}

/* --- daily limit banner --- */
.limit-banner {
  max-width: 880px;
  margin: 20px auto 0;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.limit-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.limit-text strong { font-size: 16px; }

.limit-text span { color: var(--muted); font-size: 14px; }

.limit-links {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.limit-links a {
  background: rgba(139, 123, 255, 0.14);
  border: 1px solid rgba(139, 123, 255, 0.4);
  color: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  text-decoration: none;
}

.limit-links a:hover { background: rgba(139, 123, 255, 0.22); }

#limit-edit { margin-top: 12px; width: 100%; padding: 10px 16px; }

/* When today's limit is hit, the whole page recedes behind a darker veil. */
.limited .panel {
  opacity: 0.45;
  filter: grayscale(0.7);
  transition: opacity .2s ease, filter .2s ease;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 8px 0 40px;
}

.site-footer p { margin: 2px 0; }

.site-footer p:last-child {
  font-size: 13px;
  color: var(--accent-soft);
}

.credit-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  transition: color .15s ease;
}

.credit-link:hover { color: var(--ink); border-bottom-style: solid; }

/* --- responsive --- */
@media (max-width: 760px) {
  .wrap { grid-template-columns: 1fr; }

  .row { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 420px) {
  .site-header { padding-top: 20px; }

  .panel { padding: 18px; }

  .social-inputs { grid-template-columns: 1fr; }

  .tile-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
