:root {
  --ink: #17312b;
  --ink-soft: #61736d;
  --green-950: #102c26;
  --green-800: #145c4b;
  --green-700: #1c735e;
  --green-100: #dcebe4;
  --cream: #f7f3e9;
  --paper: #fffefa;
  --lime: #dbea72;
  --line: #d9e2dd;
  --red: #c95e59;
  --yellow: #e8bd43;
  --purple: #8065b3;
  --incidental: #5d9252;
  --basket: #3c7b82;
  --shadow: 0 20px 60px rgba(16, 44, 38, .12);
  --radius: 18px;
  --hour-width: 72px;
  --timeline-width: 1224px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 86px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.035em; line-height: 1.08; }
h2 { margin-bottom: .55rem; font-size: clamp(2rem, 5vw, 3.5rem); }
h3 { margin-bottom: .45rem; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 1rem; top: -5rem; z-index: 100;
  background: white; border-radius: 8px; padding: .7rem 1rem;
}
.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky; top: 0; z-index: 30;
  min-height: 72px; padding: 0 max(1rem, calc((100vw - 1180px) / 2));
  display: flex; align-items: center; gap: 1.2rem;
  color: white; background: rgba(16, 44, 38, .96);
  border-bottom: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; font-size: .88rem; font-weight: 750; letter-spacing: .06em; white-space: nowrap; }
.brand strong { color: var(--lime); }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(219,234,114,.55); border-radius: 50%; color: var(--lime); font-family: Georgia, serif; font-size: 1.15rem; }
.site-header nav { margin-left: auto; display: flex; align-items: center; gap: .1rem; overflow-x: auto; scrollbar-width: none; }
.site-header nav a, .nav-login { padding: .48rem .72rem; color: #e8efec; background: transparent; border: 0; border-radius: 999px; text-decoration: none; white-space: nowrap; cursor: pointer; font-size: .88rem; }
.site-header nav a:hover, .site-header nav a:focus-visible, .nav-login:hover, .nav-login:focus-visible { color: white; background: rgba(255,255,255,.11); outline: none; }
.nav-login { margin-left: .35rem; color: var(--green-950); background: var(--lime); font-weight: 750; }
.nav-login:hover, .nav-login:focus-visible { color: var(--green-950); background: #ebf59d; }

.hero {
  min-height: 620px; padding: clamp(5rem, 10vw, 9rem) max(1rem, calc((100vw - 1180px) / 2));
  display: grid; grid-template-columns: 1.4fr .6fr; gap: 3rem; align-items: end;
  color: white; background:
    radial-gradient(circle at 83% 18%, rgba(219,234,114,.18) 0 1px, transparent 2px) 0 0 / 22px 22px,
    linear-gradient(135deg, #102c26 0%, #123f34 64%, #145c4b 100%);
  overflow: hidden;
}
.hero-copy { max-width: 850px; position: relative; }
.hero-copy::after { content: ""; position: absolute; right: -90px; top: -90px; width: 235px; height: 235px; border: 1px solid rgba(219,234,114,.33); border-radius: 50%; pointer-events: none; }
.eyebrow { margin-bottom: .65rem; color: var(--lime); font-size: .76rem; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow.dark { color: var(--green-700); }
.eyebrow.light { color: var(--lime); }
.hero h1 { margin-bottom: 1.25rem; max-width: 900px; font-size: clamp(3rem, 8vw, 6.8rem); }
.hero-lead { max-width: 690px; color: #d5e1dd; font-size: clamp(1.05rem, 2vw, 1.3rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.8rem; }
.hero-status { display: flex; align-items: flex-start; gap: .8rem; padding: 1.15rem; border: 1px solid rgba(255,255,255,.16); border-radius: var(--radius); background: rgba(255,255,255,.07); backdrop-filter: blur(10px); }
.hero-status strong, .hero-status span { display: block; }
.hero-status span { margin-top: .2rem; color: #cedbd6; font-size: .9rem; }
.status-dot { margin-top: .4rem; width: 10px; height: 10px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgba(219,234,114,.12); }

.button { min-height: 44px; padding: .72rem 1rem; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 999px; text-decoration: none; font-weight: 750; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: var(--green-950); background: var(--lime); }
.button-primary:hover { background: #e8f28f; }
.button-ghost { color: white; border-color: rgba(255,255,255,.3); background: transparent; }
.button-light { color: var(--green-950); background: white; }
.button-outline { color: var(--green-800); background: white; border-color: var(--line); }
.button-danger { color: #8f2f2b; background: #fff0ef; border-color: #f0c4c1; }
.button.full { width: 100%; }
.text-button, .icon-button { border: 0; color: var(--green-800); background: transparent; cursor: pointer; font-weight: 750; }
.text-button:hover { text-decoration: underline; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: white; font-size: 1.1rem; }
.icon-button:hover { background: var(--green-100); }

.section { padding: clamp(4.5rem, 9vw, 8rem) max(1rem, calc((100vw - 1180px) / 2)); }
.section-heading { max-width: 780px; margin-bottom: 2rem; }
.section-heading p:not(.eyebrow) { color: var(--ink-soft); }
.split-heading, .schedule-heading-row { max-width: none; display: flex; justify-content: space-between; align-items: end; gap: 2rem; }
.schedule-heading-row > div:first-child, .split-heading > div:first-child { max-width: 760px; }
.schedule-section { background: var(--paper); }
.week-controls { display: flex; align-items: center; gap: .3rem; }

.schedule-legend { margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: .65rem 1.1rem; color: var(--ink-soft); font-size: .82rem; }
.schedule-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.legend-dot.priority-1, .booking-block.priority-1 { background: var(--red); }
.legend-dot.priority-2, .booking-block.priority-2 { background: var(--yellow); }
.legend-dot.priority-3, .booking-block.priority-3 { background: var(--purple); }
.legend-dot.incidental, .booking-block.incidental { background: var(--incidental); }
.legend-dot.basket, .booking-block.basket { background: var(--basket); }

.schedule-shell { position: relative; min-height: 460px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); overflow: hidden; }
.schedule-loading, .schedule-error { min-height: 460px; display: grid; place-items: center; padding: 2rem; color: var(--ink-soft); }
.schedule-error { color: #8c302c; }
.schedule-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-color: var(--green-700) #e8eeeb; }
.schedule-canvas { width: calc(112px + var(--timeline-width)); min-height: 460px; background: white; }
.schedule-header, .schedule-row { display: grid; grid-template-columns: 112px var(--timeline-width); }
.schedule-header { position: sticky; top: 0; z-index: 4; height: 52px; border-bottom: 1px solid var(--line); background: #f7faf8; }
.schedule-corner, .row-label { position: sticky; left: 0; z-index: 5; background: #f7faf8; border-right: 1px solid var(--line); }
.schedule-corner { display: grid; place-items: center; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.time-axis { position: relative; height: 52px; background: repeating-linear-gradient(to right, transparent 0 calc(var(--hour-width) - 1px), #bdcbc4 calc(var(--hour-width) - 1px) var(--hour-width)); }
.time-label { position: absolute; top: 15px; transform: translateX(-50%); color: var(--ink-soft); font-size: .75rem; font-weight: 700; }
.time-label:first-child { transform: translateX(4px); }
.schedule-row { min-height: 57px; border-bottom: 1px solid #e9eeeb; }
.schedule-row:last-child { border-bottom: 0; }
.row-label { padding: .55rem .65rem; display: grid; grid-template-columns: 1fr 24px; align-items: center; gap: .3rem; }
.row-label strong { display: block; font-size: .78rem; }
.row-label span { color: var(--ink-soft); font-size: .68rem; }
.row-label b { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green-800); font-size: .72rem; }
.timeline-row { position: relative; min-height: 57px; background:
  repeating-linear-gradient(to right, transparent 0 17px, #eef2ef 17px 18px),
  repeating-linear-gradient(to right, transparent 0 71px, #cbd7d1 71px 72px);
}
.booking-block { position: absolute; top: 7px; height: 43px; min-width: 11px; padding: .25rem .38rem; overflow: hidden; border: 0; border-radius: 7px; color: white; text-align: left; cursor: pointer; box-shadow: 0 4px 10px rgba(16,44,38,.12); }
.booking-block.priority-2 { color: #493b0a; }
.booking-block strong, .booking-block span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.booking-block strong { font-size: .69rem; }
.booking-block span { opacity: .85; font-size: .6rem; }
.booking-block:hover, .booking-block:focus-visible { outline: 3px solid white; box-shadow: 0 0 0 5px var(--green-800); z-index: 2; }
.scroll-hint { margin: .75rem 0 0; color: var(--ink-soft); font-size: .82rem; }

.players-section { background: var(--cream); }
.search-box { width: min(320px, 100%); display: block; }
.search-box input, form input, form select, form textarea {
  width: 100%; min-height: 46px; padding: .72rem .82rem; color: var(--ink); background: white;
  border: 1px solid #cdd9d3; border-radius: 10px; outline: none;
}
.search-box input:focus, form input:focus, form select:focus, form textarea:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(28,115,94,.12); }
.search-box.compact { width: 100%; margin-bottom: 1rem; }
.player-summary { margin-bottom: 1rem; color: var(--ink-soft); }
.player-summary strong { color: var(--green-800); font-size: 1.5rem; }
.player-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .65rem; }
.player-chip { min-height: 50px; padding: .75rem .85rem; display: flex; align-items: center; gap: .65rem; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.player-initial { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--green-950); background: var(--green-100); font-size: .74rem; font-weight: 850; }
.player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; font-weight: 680; }
.empty-state { grid-column: 1 / -1; padding: 2rem; text-align: center; color: var(--ink-soft); }
.show-more { margin-top: 1rem; }

.rules-section { color: white; background: var(--green-950); }
.rules-section .section-heading p:not(.eyebrow) { color: #c8d7d1; }
.rule-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 2rem; }
.rule-cards article { min-height: 220px; padding: 1.25rem; border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); background: rgba(255,255,255,.06); }
.rule-cards article > span { display: inline-block; margin-bottom: 2.6rem; color: var(--lime); font-size: .72rem; font-weight: 850; letter-spacing: .12em; }
.rule-cards p { margin-bottom: 0; color: #cad8d3; font-size: .9rem; }

.admin-section { background: #eef3f0; }
.pending-card { padding: 1.3rem; border: 1px solid #e8cf86; border-radius: var(--radius); background: #fff7db; }
.admin-tabs { display: flex; gap: .35rem; margin-bottom: 1rem; overflow-x: auto; }
.admin-tab { padding: .65rem .9rem; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 999px; background: white; cursor: pointer; white-space: nowrap; font-weight: 750; }
.admin-tab.active { color: white; border-color: var(--green-800); background: var(--green-800); }
.admin-grid { display: grid; grid-template-columns: minmax(300px,.75fr) minmax(420px,1.25fr); gap: 1rem; align-items: start; }
.admin-card { padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 10px 35px rgba(16,44,38,.06); }
.card-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin-bottom: 1rem; }
.card-heading h3 { margin-bottom: 0; font-size: 1.35rem; }
.admin-card label, .modal label { display: block; margin-bottom: .8rem; color: var(--ink-soft); font-size: .8rem; font-weight: 700; }
.admin-card label input, .admin-card label select, .admin-card label textarea, .modal label input { display: block; margin-top: .3rem; color: var(--ink); font-weight: 450; }
.form-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .7rem; }
.form-message { min-height: 1.2rem; margin: 0 0 .65rem; color: var(--green-700); font-size: .82rem; }
.form-message.error { color: #9b342f; }
.admin-list { display: grid; gap: .6rem; max-height: 610px; overflow-y: auto; }
.admin-list-item { padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfb; }
.admin-list-main { display: flex; justify-content: space-between; gap: .8rem; align-items: start; }
.admin-list-main strong { display: block; }
.admin-list-main p { margin: .15rem 0 0; color: var(--ink-soft); font-size: .78rem; }
.admin-list-actions { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.mini-button { padding: .35rem .55rem; border: 1px solid var(--line); border-radius: 8px; color: var(--green-800); background: white; cursor: pointer; font-size: .74rem; font-weight: 750; }
.mini-button.danger { color: #91312c; }
.role-select { min-height: 36px; padding: .35rem; border: 1px solid var(--line); border-radius: 8px; background: white; }
.badge { display: inline-block; padding: .16rem .42rem; border-radius: 999px; color: var(--green-800); background: var(--green-100); font-size: .68rem; font-weight: 800; }
.badge.cancelled { color: #93332e; background: #fbe3e1; }
.badge.pending { color: #795e0a; background: #fff0b9; }

footer { padding: 2.2rem max(1rem, calc((100vw - 1180px) / 2)); display: flex; justify-content: space-between; gap: 2rem; color: #d2dfda; background: #0b211c; }
footer strong, footer span { display: block; }
footer span { margin-top: .2rem; color: #95aaa2; font-size: .85rem; }
footer a { color: var(--lime); font-size: .85rem; font-weight: 750; }

.modal { width: min(510px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 0; border-radius: 20px; color: var(--ink); background: white; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(7,23,19,.72); backdrop-filter: blur(5px); }
.modal-content { padding: 1.8rem; }
.modal-content > p:not(.eyebrow) { color: var(--ink-soft); }
.modal-close-form { position: absolute; right: .7rem; top: .7rem; z-index: 2; }
.modal-close-form button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--ink); background: #eff3f1; cursor: pointer; font-size: 1.25rem; }
.modal details { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.modal summary { color: var(--green-800); cursor: pointer; font-weight: 750; }
.modal details form { margin-top: 1rem; }
.booking-modal { width: min(570px, calc(100% - 2rem)); }
.booking-detail-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: .7rem; margin-top: 1rem; }
.booking-detail-item { padding: .75rem; border-radius: 10px; background: #f1f5f3; }
.booking-detail-item span, .booking-detail-item strong { display: block; }
.booking-detail-item span { color: var(--ink-soft); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.booking-detail-item strong { margin-top: .15rem; }
.toast { position: fixed; left: 50%; bottom: 1.2rem; z-index: 80; transform: translate(-50%, 120px); max-width: calc(100% - 2rem); padding: .7rem 1rem; border-radius: 999px; color: white; background: var(--green-950); box-shadow: var(--shadow); opacity: 0; transition: .25s ease; font-size: .86rem; }
.toast.show { transform: translate(-50%,0); opacity: 1; }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; align-items: center; }
  .hero-status { max-width: 360px; }
  .player-grid, .rule-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .site-header { min-height: 66px; display: block; padding: .65rem 1rem .45rem; }
  .brand { margin-bottom: .4rem; }
  .site-header nav { margin: 0; }
  .site-header nav a:first-child { padding-left: 0; }
  .site-header nav a, .nav-login { font-size: .8rem; }
  .hero { min-height: 590px; padding-top: 4.5rem; }
  .hero-copy::after { display: none; }
  .hero h1 { font-size: clamp(2.8rem, 15vw, 4.8rem); }
  .split-heading, .schedule-heading-row { display: block; }
  .week-controls, .search-box { margin-top: 1rem; }
  .player-grid, .rule-cards { grid-template-columns: 1fr; }
  .rule-cards article { min-height: 165px; }
  .rule-cards article > span { margin-bottom: 1.5rem; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  footer { display: block; }
  footer a { display: inline-block; margin-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
