:root {
  --ink: #2b1a47;
  --soft: #5c4a72;
  --purple: #4a1a7a;
  --pink: #ff7eb3;
  --blush: #fff4f7;
  --cloud: #fbfaff;
  --card: rgba(255, 255, 255, 0.96);
  --line: #e7e0f8;
  --focus: #4a1a7a;
  --shadow: 0 18px 50px rgba(74, 26, 122, 0.12);
  --fire: #ff6b6b;
  --earth: #3f8f55;
  --air: #6b62c4;
  --water: #1d7eb8;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(255, 126, 179, 0.18), transparent 60%),
    radial-gradient(800px 380px at 110% 0%, rgba(91, 184, 245, 0.16), transparent 55%),
    var(--cloud);
  color: var(--ink);
  font-family: Quicksand, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--purple);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 5;
}

.skip:focus { top: 12px; }

.holo {
  height: 5px;
  background: linear-gradient(90deg, #ff7eb3, #8a4fd9, #5bb8f5, #7bc67e, #e0a648, #ff7eb3);
  background-size: 300% 100%;
  animation: holo 14s linear infinite;
}

@keyframes holo { to { background-position: 300% 0; } }

.site-header, main, .site-footer {
  width: min(760px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header { padding: 18px 0 4px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--purple);
  font-family: Fredoka, sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  text-decoration: none;
}

.brand img { display: block; }

.hero { padding: 12px 0 8px; }

h1, h2 {
  font-family: Fredoka, sans-serif;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

h1 { font-size: clamp(2rem, 7vw, 3.1rem); color: var(--purple); }

.lede {
  margin: 12px 0 20px;
  color: var(--soft);
  font-size: 1.125rem;
  max-width: 38rem;
}

.card {
  position: relative;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 28px;
  padding: 22px 18px 18px;
  box-shadow: var(--shadow);
}

.card::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 30px;
  background: linear-gradient(135deg, #ff7eb3, #8a4fd9, #5bb8f5, #e0a648);
  z-index: -1;
  opacity: 0.45;
  filter: blur(10px);
}

.field { margin-top: 16px; }
.field:first-child { margin-top: 0; }

.field-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

label, .field-head > label:first-child {
  display: block;
  font-family: Fredoka, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--soft);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.02em;
  text-transform: none;
  font-family: Quicksand, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #7a2452;
  cursor: pointer;
}

input[type="date"],
input[type="time"],
input[type="text"] {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 8px;
  border: 1.5px solid rgba(74, 26, 122, 0.18);
  border-radius: 14px;
  background: #fff;
  color: var(--purple);
  font: 600 1.05rem Quicksand, sans-serif;
  padding: 14px 16px;
  min-height: 52px;
}

input:focus {
  outline: 3px solid rgba(255, 126, 179, 0.45);
  border-color: var(--pink);
}

input:disabled {
  background: #f6f3fb;
  color: var(--soft);
}

.place-field { position: relative; }

.places {
  list-style: none;
  margin: 6px 0 0;
  padding: 6px;
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow: auto;
}

.places button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 12px;
  font: 600 1rem Quicksand, sans-serif;
  color: var(--ink);
  cursor: pointer;
  min-height: 44px;
}

.places button[aria-selected="true"],
.places button:hover,
.places button:focus-visible {
  background: #f5f0ff;
  outline: none;
}

.form-error {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: #8a2b12;
  font-weight: 650;
}

.primary, .secondary {
  font-family: Fredoka, sans-serif;
  font-weight: 650;
  border-radius: 999px;
  min-height: 52px;
  padding: 12px 22px;
  cursor: pointer;
  border: 0;
}

.primary {
  width: 100%;
  margin-top: 8px;
  background: var(--purple);
  color: #fff;
  font-size: 1.15rem;
}

.primary:hover { background: #39145f; }
.primary:disabled { opacity: 0.7; cursor: progress; }

.primary:focus-visible, .secondary:focus-visible, .check:focus-within {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
}

.results { padding: 28px 0 12px; }
.results h2 { color: var(--purple); font-size: 1.7rem; }

.where {
  margin: 6px 0 16px;
  color: var(--soft);
  overflow-wrap: break-word;
}

.result-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.result {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.result[data-element="Fire"] { border-top: 4px solid var(--fire); }
.result[data-element="Earth"] { border-top: 4px solid var(--earth); }
.result[data-element="Air"] { border-top: 4px solid var(--air); }
.result[data-element="Water"] { border-top: 4px solid var(--water); }
.result[data-element="none"] { border-top: 4px solid var(--line); }

.avatars { display: flex; gap: 4px; }
.avatars img { width: 84px; height: 84px; }
.avatars.pair img { width: 56px; height: 56px; }

.role {
  margin: 0;
  font-family: Fredoka, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
}

.sign {
  margin: 2px 0 0;
  font-family: Fredoka, sans-serif;
  font-size: 1.55rem;
  font-weight: 650;
  color: var(--purple);
  line-height: 1.2;
  overflow-wrap: break-word;
}

.actions { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.secondary {
  background: #fff;
  color: var(--purple);
  border: 1.5px solid var(--line);
  font-size: 1rem;
}

.share-status {
  margin: 0;
  color: var(--soft);
  font-weight: 650;
  overflow-wrap: anywhere;
  min-width: 0;
}

.site-footer {
  padding: 28px 0 40px;
  color: var(--soft);
  font-size: 0.95rem;
}

/* iOS Safari gives date and time inputs an intrinsic minimum width, and on
   current iOS it also forces content-box while appearance is auto. Padding is
   then added on top of width: 100%, so the controls run out to the viewport
   edge. appearance: none lets the border-box width above apply. The system
   picker still opens on tap. At 720px and up the native calendar and clock
   indicators stay. */
@media (max-width: 719px) {
  input[type="date"],
  input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
    overflow: hidden;
  }

  input[type="date"]::-webkit-date-and-time-value,
  input[type="time"]::-webkit-date-and-time-value {
    min-width: 0;
    margin: 0;
    text-align: left;
  }

  input::-webkit-datetime-edit,
  input::-webkit-datetime-edit-fields-wrapper {
    min-width: 0;
    padding: 0;
  }

  .primary, .secondary { max-width: 100%; }
}

@media (min-width: 720px) {
  .card { padding: 28px 28px 22px; }
  .result-grid { grid-template-columns: repeat(3, 1fr); }
  .result { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .primary { width: auto; min-width: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .holo { animation: none; }
  html { scroll-behavior: auto; }
}
