/* Styling follows milanbridge.com/pybf: brand blue #063F8C, accent red #AC1500,
   Open Sans, pill buttons. */
:root {
  --brand: #063f8c;
  --brand-dark: #04306e;
  --brand-tint: #e8eefa;
  --accent: #ac1500;
  --accent-tint: #fdecea;
  --ink: #111111;
  --muted: #5b6675;
  --line: #d8dfea;
  --card: #ffffff;
  --ok: #1e874b;
  --radius: 12px;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: #f4f7fc;
}

body {
  margin: 0;
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: transparent;
  color: var(--ink);
  line-height: 1.45;
}

.wrap { max-width: 840px; margin: 0 auto; padding: 0 16px 80px; }

/* Hero banner mirrors the festival site header */
header.page {
  background: linear-gradient(rgb(6, 63, 140) 0%, rgba(5, 62, 140, 0.82) 100%);
  color: #fff;
  text-align: center;
  padding: 28px 20px;
  border-radius: 0 0 var(--radius) var(--radius);
  margin: 0 -16px 20px;
}
header.page h1 { font-size: 1.65rem; font-weight: 800; margin: 0 0 4px; letter-spacing: -0.01em; }
header.page p { margin: 0; color: rgba(255, 255, 255, 0.85); font-weight: 600; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  box-shadow: 0 1px 2px rgba(6, 63, 140, 0.05);
}
.card > h2 { font-size: 1.1rem; font-weight: 800; color: var(--brand); margin: 0 0 4px; }
.card > .hint { color: var(--muted); font-size: 0.87rem; margin: 0 0 14px; }

label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 4px; }
.req::after { content: " *"; color: var(--accent); }

input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=date], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}
textarea { min-height: 64px; resize: vertical; }

/* Keep hint placeholders (e.g. "leave empty for no preference") from clipping
   in the narrow three-column fields. */
::placeholder { font-size: 0.8em; color: var(--muted); opacity: 1; }

.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: 1fr 1fr 1fr; }
.field { margin-bottom: 12px; }
@media (max-width: 560px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }

.player, .pair, .team, .member {
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fbfcfe;
}
.player-head, .row-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.player-head strong { font-size: 0.95rem; font-weight: 800; color: var(--brand); }

.accom { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.9rem; }
.check input { width: auto; accent-color: var(--brand); }

.pair-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.member-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
@media (max-width: 560px) { .pair-row { grid-template-columns: 1fr; } }

button {
  font: inherit; cursor: pointer; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); padding: 8px 16px; font-weight: 600;
}
button.primary {
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700;
}
button.primary:hover { background: var(--brand-dark); }
button.add {
  border-style: dashed; color: var(--brand); border-color: var(--brand);
  background: #fff; width: 100%;
}
button.add:hover { background: var(--brand-tint); }
button.link { border: none; background: none; color: var(--muted); padding: 4px; font-weight: 600; }
button.link:hover { color: var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.event { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.event:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.event h3 { margin: 0 0 8px; font-size: 1rem; font-weight: 800; }
.badge {
  font-size: 0.72rem; font-weight: 700; padding: 2px 10px; border-radius: 999px;
  margin-left: 8px; text-transform: uppercase; letter-spacing: 0.03em;
}
.badge.pairs { background: var(--brand-tint); color: var(--brand); }
.badge.teams { background: var(--accent-tint); color: var(--accent); }

.actions {
  padding-top: 8px; margin-top: 24px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.actions button.primary { flex: 0 0 auto; padding: 12px 28px; }

.msg { padding: 12px 14px; border-radius: 8px; margin-top: 16px; font-size: 0.9rem; }
.msg.error { background: var(--accent-tint); color: var(--accent); border: 1px solid #f3c9c3; }
.msg.ok { background: #e9f7ef; color: var(--ok); border: 1px solid #bfe6cd; }
.msg.info { background: var(--brand-tint); color: var(--brand); border: 1px solid #c9d8f1; }

/* Flags: fixed display box, high-DPI sources via srcset, hairline edge so
   flags with white borders (PL, JP…) still read as a flag. */
.flag {
  display: inline-block;
  width: 21px; height: 14px;
  object-fit: cover;
  vertical-align: -2px;
  margin-right: 7px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.10);
}

/* Single nav row of buttons, directly under the hero */
.nav {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 16px 0 0;
}
.nav a {
  display: inline-block; padding: 8px 16px; border-radius: 999px;
  font-size: 0.88rem; font-weight: 700; text-decoration: none;
  background: #fff; color: var(--brand); border: 1px solid var(--line);
}
.nav a:hover { background: var(--brand-tint); border-color: var(--brand); }
.nav a.current { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (max-width: 560px) { .nav { justify-content: center; } }

/* Public listing */
.count { font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-left: 8px; }
.entry-list { list-style: none; margin: 6px 0 0; padding: 0; }
.entry-list li { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: #fbfcfe; }
.entry-list li .ext { color: var(--muted); font-style: italic; }
.team-block { border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; background: #fbfcfe; }
.team-block strong { color: var(--brand); }
.team-block ul { margin: 6px 0 0; padding-left: 18px; }
.team-block li { padding: 2px 0; }
.empty { color: var(--muted); padding: 8px 0; }

.page-footer {
  margin-top: 32px; padding: 20px 4px; text-align: center;
  font-size: 0.85rem; color: var(--muted);
  border-top: 1px solid var(--line);
}
.page-footer a { color: var(--brand); font-weight: 600; text-decoration: none; }
.page-footer a:hover { text-decoration: underline; }
.page-footer .sep { margin: 0 8px; opacity: 0.5; }
@media (max-width: 520px) {
  .page-footer .sep { display: none; }
  .page-footer > * { display: block; margin: 4px 0; }
}

.hidden { display: none !important; }
[x-cloak] { display: none !important; }

/* Embedded (iframe) mode: only the listing, no page chrome */
body.embed { background: transparent; }
body.embed .wrap { padding: 0 8px 16px; max-width: 100%; }
body.embed .page, body.embed .nav, body.embed .page-footer { display: none !important; }
body.embed .card { box-shadow: none; }
.center { text-align: center; }
.small { font-size: 0.85rem; color: var(--muted); }
