:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --border: #e2e0da;
  --accent: #d6336c;
  --accent-text: #ffffff;
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416;
    --surface: #1f1f23;
    --text: #f2f2f4;
    --muted: #a0a0a8;
    --border: #34343a;
    --accent: #f06595;
  }
}

* {
  box-sizing: border-box;
}

/* Hidden until i18n.js has translated the page (fallback: shown after 2 s anyway). */
html:not([data-i18n-ready]) body {
  opacity: 0;
  animation: reveal 0s linear 2s forwards;
}

@keyframes reveal {
  to {
    opacity: 1;
  }
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

header .brand {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}

header .brand span {
  color: var(--accent);
}

main {
  flex: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

h1,
h2,
h3 {
  line-height: 1.2;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

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

.error {
  color: #e03131;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

button.secondary,
.button.secondary {
  background: transparent;
  color: var(--accent);
}

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

label {
  display: block;
  font-weight: 600;
  margin: 0.75rem 0 0.25rem;
}

input,
select,
textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

textarea {
  min-height: 6rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.demo-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
}

.demo-card img.qr {
  width: 140px;
  height: 140px;
  background: #fff;
  border-radius: 8px;
}

.share-link {
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
  word-break: break-all;
}

.big-count {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.counters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.counter {
  text-align: center;
  padding: 0.75rem 0.5rem;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.counter-label {
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.counter-total {
  text-align: center;
  margin-top: 0.6rem;
}

.chip {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  margin: 0 0.25rem 0.25rem 0;
}

.category {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.status {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
}

.status-ACTIVE {
  background: #e03131;
  border-color: #e03131;
  color: #fff;
}

.status-FINISHED {
  color: var(--muted);
}

.status-blocked {
  background: #343a40;
  border-color: #343a40;
  color: #fff;
}

.badges {
  margin-bottom: 0.25rem;
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

@media (max-width: 560px) {
  .two-cols {
    grid-template-columns: 1fr;
  }
}

.notice {
  border-left: 4px solid var(--accent);
}

.address a {
  color: inherit;
}

.mode-choice {
  border: none;
  padding: 0;
  margin: 0;
}

.mode-choice legend {
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.mode-option {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  font-weight: normal;
  margin: 0 0 0.5rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.mode-option input {
  width: auto;
}

.mode-option:has(input:checked) {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
}

.reaction-buttons button {
  font-size: 1.6rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg);
  border-color: var(--border);
}

.slogan-buttons button {
  text-align: left;
}

.events {
  list-style: none;
  padding: 0;
  margin: 0;
}

.events li {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.events .who {
  font-weight: 600;
}

.events .when {
  margin-left: auto;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* The live feed sits right under the cover image and is the eye-catcher of the page. */
.feed-card {
  border: 2px solid var(--accent);
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.08);
}

.feed-card h2 {
  margin-top: 0;
  color: var(--accent);
}

.feed-card .events {
  max-height: 22rem;
  overflow-y: auto;
}

.feed-card .events li {
  font-size: 1.1rem;
  padding: 0.55rem 0;
}

.feed-card .events .slogan {
  font-weight: 700;
}

.feed-card .events .reaction {
  font-size: 1.5rem;
  line-height: 1;
}

.roster {
  display: flex;
  flex-wrap: wrap;
}

@media (max-width: 560px) {
  .demo-card {
    grid-template-columns: 1fr;
  }
}

.invite {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  align-items: center;
}

.invite img.qr {
  width: 180px;
  height: 180px;
  background: #fff;
  border-radius: 8px;
}

.invite h2 {
  margin-top: 0;
}

@media (max-width: 560px) {
  .invite {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

.slogan-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.slogan-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.icon-button {
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 50%;
}

.remove-slogan {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.remove-slogan:not(:disabled):hover {
  color: #e03131;
  border-color: #e03131;
}

#add-slogan {
  margin-top: 0.5rem;
}

.map-card h2 {
  margin-top: 0;
}

.map-frame {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}

.map-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.map-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
}

.warning {
  color: #b35c00;
}

/* --- cover image ---------------------------------------------------------- */

.hero-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--border);
  margin-bottom: 1rem;
}

.demo-card .hero-image {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.image-preview {
  max-width: 100%;
  max-height: 220px;
  border-radius: 8px;
  margin-top: 0.5rem;
}

/* --- optional profile & statistics ---------------------------------------- */

.profile-details {
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
}

.profile-details summary,
.stats summary {
  cursor: pointer;
  font-weight: 600;
}

.consent {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-weight: normal;
}

.consent input {
  width: auto;
  margin-top: 0.3rem;
}

.stats {
  margin: 0.75rem 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.5rem 1rem;
}

.stat-group h4 {
  margin: 0.75rem 0 0.25rem;
}

.stat-group ul {
  margin: 0;
  padding-left: 1.1rem;
}

.small {
  font-size: 0.85rem;
}

/* --- main menu ---------------------------------------------------------------- */

header {
  flex-wrap: wrap;
}

.main-menu {
  display: flex;
  align-items: center;
  gap: 0.25rem 1.1rem;
  flex-wrap: wrap;
}

.main-menu a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}

.main-menu a:hover,
.main-menu a[aria-current='page'] {
  border-bottom-color: var(--accent);
}

.language-select {
  width: auto;
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
}

.menu-user {
  font-size: 0.85rem;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-toggle {
  display: none;
  padding: 0.35rem 0.8rem;
  font-size: 1.1rem;
}

@media (max-width: 720px) {
  .menu-toggle {
    display: inline-flex;
  }

  .main-menu {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 0.5rem;
  }

  header.menu-open .main-menu {
    display: flex;
  }
}

/* --- demonstrations list ---------------------------------------------------- */

main.wide {
  max-width: 1100px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filters select {
  width: auto;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.demo-tile {
  display: block;
  color: inherit;
  text-decoration: none;
  margin: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}

.demo-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.08);
}

.demo-tile h3 {
  margin: 0.4rem 0;
}

.tile-counts {
  margin-bottom: 0;
}

/* --- account ------------------------------------------------------------------ */

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  margin: 0;
}

.facts dt {
  font-weight: 600;
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* --- home: features ------------------------------------------------------------ */

#welcome > h2 {
  margin-top: 2.5rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.feature {
  margin: 0;
}

.feature-icon {
  font-size: 2rem;
  line-height: 1;
}

.feature h3 {
  margin: 0.6rem 0 0.4rem;
}

.feature p {
  margin: 0;
  color: var(--muted);
}

/* --- administration ------------------------------------------------------------ */

.admin-item h3 {
  margin: 0.4rem 0;
}

.admin-item p {
  margin: 0.25rem 0;
}

.admin-item .row {
  margin-top: 0.75rem;
}

.filters input[type='search'] {
  width: auto;
  flex: 1 1 220px;
}

.filters .consent {
  margin: 0;
  align-items: center;
}

.filters .consent input {
  margin-top: 0;
}

/* --- leave ---------------------------------------------------------------- */

.my-participation {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
}

.my-participation h2 {
  margin: 0 0 0.25rem;
}

.my-participation > div {
  flex: 1 1 260px;
}

button.danger {
  background: #e03131;
  border-color: #e03131;
  color: #fff;
}

button.danger-outline {
  background: transparent;
  border-color: #e03131;
  color: #e03131;
}

/* --- dialog ------------------------------------------------------------------- */

.dialog {
  width: min(92vw, 440px);
  border: none;
  border-radius: 16px;
  padding: 1.5rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.3);
  text-align: center;
}

.dialog[open] {
  animation: dialog-in 0.18s ease-out;
}

.dialog::backdrop {
  background: rgb(20 20 25 / 0.55);
  backdrop-filter: blur(2px);
}

.dialog h2 {
  margin: 0.25rem 0 0.5rem;
  font-size: 1.25rem;
}

.dialog-confirm-text {
  font-weight: normal;
  text-align: left;
  margin-top: 1rem;
}

.dialog-confirm-text input {
  margin-top: 0.35rem;
}

.danger-zone {
  border-color: #e03131;
}

.danger-zone h2 {
  color: #e03131;
}

.dialog-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.dialog-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}

/* --- chant & reaction animations ---------------------------------------------- */

.chant-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 50;
  animation: chant-fade 1.6s ease-out forwards;
}

.chant-text {
  max-width: 90vw;
  padding: 0.6em 1em;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  font-size: clamp(1.6rem, 6vw, 3.2rem);
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.25);
  animation: chant-shout 1.6s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}

@keyframes chant-shout {
  0% {
    transform: scale(0.3) rotate(-4deg);
  }
  20% {
    transform: scale(1.08) rotate(1deg);
  }
  30% {
    transform: scale(1) rotate(0);
  }
  70% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1.12) translateY(-40px);
  }
}

@keyframes chant-fade {
  0%,
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.reaction-particle {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  font-size: 1.8rem;
  translate: -50% -50%;
  opacity: 0;
  animation: float-up 1.1s ease-out var(--delay) forwards;
}

@keyframes float-up {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(0.6);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), -160px) scale(1.3);
  }
}

.pulse {
  animation: pulse 0.35s ease-out;
}

@keyframes pulse {
  50% {
    transform: scale(0.92);
  }
}

/* --- footer & legal pages -------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
  margin-bottom: 0.5rem;
}

.site-footer a {
  color: var(--text);
}

.site-footer a.support-link {
  font-weight: 600;
  color: var(--accent);
}

.site-footer .version {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
}

.site-footer p {
  margin: 0;
}

.legal h2 {
  font-size: 1.15rem;
  margin-top: 1.75rem;
}

.template-note {
  background: #fff3bf;
  color: #5c4400;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
}

mark {
  background: #fff3bf;
  color: #5c4400;
  padding: 0 0.2rem;
  border-radius: 3px;
}
