:root {
  color-scheme: light;
  --ink: #172a35;
  --muted: #667983;
  --line: #dce3df;
  --paper: #ffffff;
  --canvas: #f3f5f3;
  --navy: #17324d;
  --navy-soft: #c6d9e2;
  --accent: #c84c38;
  --shadow: 0 8px 24px rgba(25, 48, 59, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 34px max(24px, calc((100vw - 1120px) / 2)) 28px;
  color: #fff;
  background: var(--navy);
}

.hero::after {
  position: absolute;
  right: -90px;
  bottom: -160px;
  width: 420px;
  height: 420px;
  border: 2px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  content: "";
}

.hero-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow,
.modal-kicker {
  color: #a9c8d6;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.hero h1 {
  margin: 6px 0 4px;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.18;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hero p {
  margin: 0;
  color: #c5d8e1;
  font-size: 14px;
}

.admin-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.button {
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-weight: 650;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button-light {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.button-light:hover {
  background: rgba(255, 255, 255, 0.16);
}

.button-accent {
  background: var(--accent);
  color: #fff;
}

.button-primary {
  background: var(--navy);
  color: #fff;
}

.button-danger {
  border-color: #e7c7cb;
  background: #fff7f7;
  color: #a93443;
}

.button-full {
  width: 100%;
}

.hero-meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  max-width: 720px;
  margin-top: 26px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(7, 20, 31, 0.24);
}

.metric {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding-right: 20px;
}

.metric + .metric {
  padding-left: 20px;
}

.metric strong {
  font-size: 24px;
}

.metric span {
  color: var(--navy-soft);
  font-size: 12px;
}

.metric-divider {
  width: 1px;
  height: 25px;
  background: rgba(255, 255, 255, 0.2);
}

.sync-state {
  margin-left: auto;
  color: #a9c8d6;
  font-size: 12px;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 18px max(24px, calc((100vw - 1120px) / 2)) 14px;
  border-bottom: 1px solid rgba(220, 227, 223, 0.7);
  background: rgba(243, 245, 243, 0.96);
  backdrop-filter: blur(12px);
}

.search-box {
  display: flex;
  align-items: center;
  max-width: 580px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.search-box span {
  width: 24px;
  color: #72848e;
  font-size: 24px;
}

.search-box input {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.project-chips {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.project-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #526772;
  font-size: 13px;
}

.chip.is-active {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.schedule-list {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 24px 48px;
}

.date-group + .date-group {
  margin-top: 26px;
}

.date-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}

.date-main {
  display: flex;
  align-items: center;
  gap: 9px;
}

.date-main strong {
  font-size: 18px;
}

.date-main span {
  color: var(--muted);
  font-size: 13px;
}

.today-tag {
  padding: 2px 7px;
  border-radius: 4px;
  background: #dcece6;
  color: #2e705b !important;
  font-weight: 700;
}

.date-count {
  color: #8b999f;
  font-size: 12px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.schedule-card {
  position: relative;
  min-width: 0;
  padding: 17px 17px 17px 20px;
  border: 1px solid #e1e6e3;
  border-left: 5px solid #6b7780;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.schedule-card.is-other {
  background: #fbfaf6;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 24px;
}

.sport-tag {
  padding: 3px 8px;
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.card-time {
  color: #41555f;
  font-size: 13px;
  font-weight: 650;
}

.edit-button {
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid #d9e0dd;
  border-radius: 5px;
  background: #f8faf9;
  color: #536a75;
  font-size: 12px;
}

.card-title {
  margin: 11px 0 0;
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.35;
}

.card-stage {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.date-hint {
  display: inline-block;
  margin-top: 7px;
  padding: 3px 7px;
  border-radius: 4px;
  background: #fff3dd;
  color: #855a15;
  font-size: 12px;
}

.location-line {
  display: flex;
  gap: 8px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid #edf0ee;
  color: #3c505a;
  font-size: 13px;
}

.location-line span:first-child {
  flex: none;
  color: #8b999f;
}

.card-note {
  margin-top: 9px;
  padding: 8px 10px;
  border-radius: 5px;
  background: #f4f6f4;
  color: #647780;
  font-size: 12px;
  line-height: 1.5;
}

.state-panel {
  display: flex;
  min-height: 300px;
  margin: 30px auto;
  padding: 30px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  max-width: 620px;
  text-align: center;
}

.state-panel h2 {
  margin: 0 0 6px;
  font-size: 21px;
}

.state-panel p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  border: 3px solid #dbe5e1;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px calc(24px + env(safe-area-inset-bottom));
  color: #93a0a6;
  font-size: 12px;
}

.footer-orgs {
  color: #61727a;
  font-weight: 650;
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(12, 26, 36, 0.58);
}

.modal {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 25px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(5, 18, 27, 0.28);
}

.login-modal {
  max-width: 440px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #77888f;
  font-size: 26px;
}

.modal-kicker {
  color: #9a6b3e;
}

.modal h2 {
  margin: 5px 30px 5px 0;
  font-size: 25px;
}

.modal-copy {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 13px;
}

.field > span {
  color: #526772;
  font-size: 13px;
  font-weight: 650;
}

.field b {
  color: var(--accent);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  color: var(--ink);
  background: #fafbfa;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #5a7d90;
  box-shadow: 0 0 0 3px rgba(23, 50, 77, 0.08);
}

.form-error {
  min-height: 20px;
  margin: 2px 0 8px;
  color: #b23a48;
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.modal-actions .button-primary {
  min-width: 150px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: min(90vw, 480px);
  padding: 10px 16px;
  border-radius: 7px;
  background: #1c3442;
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 720px) {
  .hero {
    padding: 26px 18px 22px;
  }

  .hero h1 {
    font-size: clamp(24px, 6.6vw, 28px);
    line-height: 1.2;
    word-break: normal;
  }

  .hero h1 span {
    display: block;
  }

  .hero-top {
    display: block;
  }

  .admin-controls {
    justify-content: flex-start;
    margin-top: 18px;
  }

  .hero-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 0;
    margin-top: 20px;
    padding: 12px 14px;
  }

  .metric {
    justify-content: center;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 0 8px !important;
  }

  .metric strong {
    font-size: 22px;
  }

  .metric-divider {
    display: none;
  }

  .sync-state {
    grid-column: 1 / -1;
    margin: 0;
    text-align: center;
  }

  .toolbar {
    padding: 14px 18px 12px;
  }

  .schedule-list {
    padding: 14px 18px 34px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .modal {
    max-height: calc(100vh - 24px);
    padding: 22px 18px;
  }

  .footer {
    padding: 0 18px calc(18px + env(safe-area-inset-bottom));
    flex-direction: column;
    gap: 4px;
  }

  .footer-orgs {
    order: -1;
    margin-bottom: 3px;
  }
}
