/* YAPA - shares okcomer's "Greenmarket" design tokens. Light + dark via
   prefers-color-scheme. No external assets (CSP default-src 'self').
   Phone first: 360-390px wide, one-handed, 44px minimum touch targets. */

:root {
  --bg: #f6f4ec;
  --surface: #ffffff;
  --surface-2: #fbfbf7;
  --ink: #23302a;
  --ink-2: #4b5a51;
  --muted: #6b7b72;
  --faint: #93a199;
  --placeholder: #a6b0a8;
  --green: #3f8f5b;
  --green-deep: #2f6f46;
  --green-tint: #e6f0e6;
  --green-tint-2: #e3f1e6;
  --citrus: #e8873a;
  --citrus-deep: #b5651d;
  --citrus-tint: #fbe9d8;
  --line: #dcdccf;
  --line-card: #e8e8dc;
  --danger: #b04a2f;
  --danger-tint: #fbeeea;

  --radius-card: 20px;
  --radius-input: 12px;
  --radius-btn: 15px;
  --shadow-card: 0 6px 16px -12px rgba(35, 48, 42, 0.5);
  --shadow-btn: 0 10px 20px -10px rgba(63, 143, 91, 0.8);
  --touch: 44px;

  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system,
    "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14201a;
    --surface: #1e2c25;
    --surface-2: #24332b;
    --ink: #eef3ec;
    --ink-2: #c4d4c9;
    --muted: #9db0a4;
    --faint: #7e9186;
    --placeholder: #7e9186;
    --green: #6fd08a;
    --green-deep: #9fe0b1;
    --green-tint: #24382c;
    --green-tint-2: #24382c;
    --citrus: #eaa065;
    --citrus-deep: #f0b184;
    --citrus-tint: #3a2c1f;
    --line: #35473b;
    --line-card: #2c3d33;
    --danger: #e79079;
    --danger-tint: #3a241d;
    --shadow-card: 0 6px 16px -12px rgba(0, 0, 0, 0.6);
    --shadow-btn: 0 10px 20px -12px rgba(0, 0, 0, 0.7);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1 {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin: 0 0 0.5rem;
}

a {
  color: var(--green-deep);
}

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

:focus-visible {
  outline: 3px solid var(--citrus);
  outline-offset: 2px;
}

/* --- Shell ---------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.6rem 1rem;
  padding-top: calc(0.6rem + env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--line-card);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-height: var(--touch);
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 19px;
}

.brand-name {
  display: block;
  font-weight: 800;
  font-size: 16px;
  line-height: 1.05;
}

.brand-tagline {
  display: block;
  font-weight: 600;
  font-size: 11px;
  font-style: italic;
  color: var(--faint);
}

main {
  flex: 1;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

.app-footer {
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-card);
  background: var(--surface);
}

/* --- Cards and controls --------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.1rem;
  margin-bottom: 0.85rem;
}

.flash {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.flash li {
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.5rem;
  background: var(--green-tint-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  color: var(--green-deep);
  font-weight: 600;
  font-size: 14.5px;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0.7rem 1.1rem;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--green);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  touch-action: manipulation;
}

.button.secondary,
button.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.button.block,
button.block {
  display: flex;
  width: 100%;
}

button.chip {
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  box-shadow: none;
}

button.chip[aria-pressed="true"] {
  background: var(--green);
  border-color: transparent;
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  button,
  .button,
  button.chip[aria-pressed="true"],
  .brand-mark {
    color: #10221a;
  }

  .button.secondary,
  button.secondary {
    color: var(--ink);
  }
}

/* --- Language switcher ---------------------------------------------------- */

.lang-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
  margin: 0;
}

.lang-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.lang-options {
  display: inline-flex;
  gap: 0.4rem;
}

/* --- Pages ---------------------------------------------------------------- */

.error-code {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--citrus-deep);
}

/* --- Navigation ----------------------------------------------------------- */

/* A disclosure menu: works without any script and keeps the bar one row tall. */
.menu {
  margin-left: auto;
}

.menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu[open] summary {
  background: var(--green-tint);
}

.menu nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.6rem 1rem 0.9rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line-card);
  box-shadow: var(--shadow-card);
}

.menu nav a {
  display: flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.menu nav a[aria-current="page"] {
  background: var(--green);
  border-color: transparent;
  color: #fff;
}

.nav-form {
  margin: 0;
}

.nav-form button {
  width: 100%;
  border-radius: var(--radius-input);
}

/* --- Forms ---------------------------------------------------------------- */

label {
  display: block;
  margin: 0.8rem 0 0.3rem;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-2);
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--touch);
  padding: 0.65rem 0.8rem;
  /* 16px stops iOS zooming the page when a field is focused. */
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
}

/* --- Lists ---------------------------------------------------------------- */

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

.rows li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line-card);
}

.rows li:first-child {
  border-top: 0;
}

.row-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.row-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.row-meta {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.2rem;
}

.tag {
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--green-tint);
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 700;
}

.tag.pending {
  background: var(--citrus-tint);
  color: var(--citrus-deep);
}

@media (prefers-color-scheme: dark) {
  .menu nav a[aria-current="page"] {
    color: #10221a;
  }
}

.stack {
  margin: 0 0 0.6rem;
}

/* --- Choice groups -------------------------------------------------------- */

fieldset {
  margin: 0.8rem 0 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
  margin-bottom: 0.3rem;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-2);
}

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

.choices.column {
  flex-direction: column;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-height: var(--touch);
  margin: 0;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: var(--surface);
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}

.choice input {
  width: 22px;
  min-height: 22px;
  height: 22px;
  flex: none;
  accent-color: var(--green);
}

.choice span span {
  display: block;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Keeps the primary action within thumb reach on long forms. */
.sticky-action {
  position: sticky;
  bottom: 0;
  padding: 0.6rem 0;
  padding-bottom: calc(0.6rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

/* --- Availability grid ---------------------------------------------------- */

/* The grid card runs edge to edge so that seven day columns are each at least
   44px wide on a 360px screen: 52px of time labels plus 7 x 44px. */
.card.bleed {
  margin-left: -1rem;
  margin-right: -1rem;
  padding-left: 0;
  padding-right: 0;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}

.card.bleed > h1,
.card.bleed > p {
  padding: 0 1rem;
}

.grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.grid thead td {
  width: 52px;
}

.grid thead th {
  position: sticky;
  top: 0;
  padding: 0.3rem 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-2);
  background: var(--surface);
}

.grid thead th {
  overflow: hidden;
}

.grid abbr {
  text-decoration: none;
}

.grid tbody th {
  padding-right: 0.3rem;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  color: var(--muted);
  white-space: nowrap;
}

.grid td {
  padding: 0;
}

.cell {
  display: block;
  position: relative;
  height: var(--touch);
  margin: 0;
  cursor: pointer;
}

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

/* The whole 44px cell is the target; the visible tile sits 1px inside it. */
.cell span {
  position: absolute;
  inset: 1px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.cell input:checked + span {
  background: var(--green);
  border-color: var(--green);
}

.cell input:focus-visible + span {
  outline: 3px solid var(--citrus);
  outline-offset: 1px;
}

/* --- Matches -------------------------------------------------------------- */

main > h2 {
  margin: 1.2rem 0 0.5rem;
}

.match-when {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.match-where {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.6rem;
  margin: 0.2rem 0 0.5rem;
  font-weight: 700;
}

.teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0.6rem 0;
}

.team {
  padding: 0.6rem;
  border: 1px solid var(--line-card);
  border-radius: var(--radius-input);
  background: var(--surface-2);
}

.team-label {
  margin: 0 0 0.3rem;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}

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

.players li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  padding: 0.25rem 0;
  font-size: 13px;
}

.player-name {
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.button.danger,
button.danger {
  background: var(--danger-tint);
  color: var(--danger);
  box-shadow: none;
}

/* --- Consent dialog and notices ------------------------------------------- */

.promise {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: var(--green-tint);
  color: var(--ink);
  font-weight: 700;
}

/* The default answer gets the larger tap target. */
button.big {
  min-height: 76px;
  font-size: 18px;
}

/* The other choice stays visibly smaller, even when its label wraps. */
.card[role="dialog"] button.secondary {
  font-size: 14px;
}

.notice {
  border-color: var(--citrus);
  background: var(--citrus-tint);
}

/* --- Facts, prose and footer links ---------------------------------------- */

.facts {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0;
}

.facts dt {
  margin-top: 0.6rem;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

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

.facts dd.secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  letter-spacing: 0.04em;
  user-select: all;
}

.prose h2 {
  margin-top: 1.2rem;
  font-size: 17px;
}

.prose ul {
  padding-left: 1.1rem;
}

.prose li {
  margin-bottom: 0.4rem;
}

.footer-links {
  margin: 0 0 0.6rem;
  text-align: center;
  font-size: 13px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 0.6rem;
}
