:root {
  --ink: #20201d;
  --muted: #68645b;
  --paper: #f7f2e6;
  --paper-deep: #ece0c7;
  --line: rgba(32, 32, 29, 0.16);
  --teal: #126a70;
  --teal-soft: #d5eeee;
  --coral: #d4543f;
  --coral-soft: #f5c8b7;
  --moss: #6d7f38;
  --blue: #4c6f9f;
  --shadow: 0 24px 70px rgba(45, 35, 18, 0.16);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(212, 84, 63, 0.14), transparent 28rem),
    radial-gradient(circle at 88% 4%, rgba(18, 106, 112, 0.13), transparent 24rem),
    linear-gradient(135deg, #f9f5ea 0%, #eef3eb 48%, #f2efe4 100%);
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fffdf5;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  padding: 0 18px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

button:hover:not(:disabled) {
  box-shadow: 0 10px 22px rgba(32, 32, 29, 0.22);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 245, 0.78);
  color: var(--ink);
  outline: none;
  padding: 13px 14px;
}

input:focus,
textarea:focus {
  border-color: rgba(18, 106, 112, 0.55);
  box-shadow: 0 0 0 4px rgba(18, 106, 112, 0.12);
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
}

.paper-grain {
  inset: 0;
  opacity: 0.38;
  pointer-events: none;
  position: fixed;
  background-image:
    linear-gradient(rgba(32, 32, 29, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 32, 29, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
}

.confetti-burst {
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  z-index: 50;
}

.confetti-burst span {
  animation: confetti-fall var(--duration) cubic-bezier(0.16, 0.8, 0.34, 1) var(--delay) forwards;
  background: var(--color);
  border-radius: 2px;
  box-shadow: 0 8px 18px rgba(32, 32, 29, 0.12);
  height: 16px;
  left: var(--left);
  opacity: 0;
  position: absolute;
  top: 16%;
  transform: translate3d(0, 0, 0) rotate(var(--rotation));
  width: 9px;
}

.confetti-burst span:nth-child(3n) {
  border-radius: 999px;
  height: 11px;
  width: 11px;
}

.confetti-burst span:nth-child(4n) {
  height: 9px;
  width: 18px;
}

@keyframes confetti-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -24px, 0) rotate(0deg) scale(0.7);
  }

  12% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate3d(calc((50vw - var(--left)) * 0.22), 52vh, 0)
      rotate(calc(var(--rotation) + 540deg)) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .confetti-burst {
    display: none;
  }
}

.shell {
  margin: 0 auto;
  max-width: 1240px;
  padding: 32px 20px 56px;
  position: relative;
}

.hero {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr minmax(230px, 0.34fr);
  min-height: 260px;
  padding: 22px 0 12px;
  position: relative;
}

.hero::before {
  border: 1px solid rgba(32, 32, 29, 0.14);
  border-radius: 50%;
  content: "";
  height: 170px;
  left: 42%;
  position: absolute;
  top: 26px;
  transform: rotate(-12deg);
  width: 170px;
}

.hero__copy {
  align-self: end;
  max-width: 780px;
  padding-top: 72px;
}

.hero h1 {
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(48px, 9vw, 112px);
  font-weight: 900;
  line-height: 0.93;
  margin: 0;
}

.hero p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
  margin: 16px 0 0;
  max-width: 660px;
}

.eyebrow {
  color: var(--coral);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.hero__stamp {
  border: 2px solid rgba(212, 84, 63, 0.72);
  border-radius: 50%;
  color: var(--coral);
  display: grid;
  font-size: 12px;
  font-weight: 900;
  height: 104px;
  letter-spacing: 0.12em;
  place-items: center;
  position: absolute;
  right: min(35%, 360px);
  text-align: center;
  text-transform: uppercase;
  top: 34px;
  transform: rotate(10deg);
  width: 104px;
}

.route-card,
.panel,
.status-strip {
  background:
    linear-gradient(135deg, rgba(255, 253, 245, 0.9), rgba(247, 242, 230, 0.72)),
    var(--paper);
  border: 1px solid rgba(32, 32, 29, 0.13);
  box-shadow: var(--shadow);
}

.route-card {
  align-self: center;
  border-radius: 7px;
  display: grid;
  gap: 14px;
  min-height: 188px;
  padding: 24px;
  position: relative;
}

.route-card::after {
  background: repeating-linear-gradient(
    -45deg,
    rgba(18, 106, 112, 0.2),
    rgba(18, 106, 112, 0.2) 6px,
    transparent 6px,
    transparent 12px
  );
  content: "";
  height: 11px;
  left: 18px;
  position: absolute;
  right: 18px;
  top: -6px;
}

.route-card strong {
  color: var(--teal);
  font-family: "Songti SC", "STSong", serif;
  font-size: 28px;
  line-height: 1.1;
}

.route-card__label,
#participant-count-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-strip {
  align-items: center;
  border-radius: 7px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 12px 0 18px;
  padding: 14px 18px;
}

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

.status-strip__label {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.action-strip {
  align-items: center;
  background: rgba(255, 253, 245, 0.9);
  border: 1px solid rgba(32, 32, 29, 0.13);
  border-radius: 7px;
  box-shadow: 0 16px 42px rgba(45, 35, 18, 0.14);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 0 0 18px;
  padding: 12px 14px;
  position: sticky;
  top: 10px;
  z-index: 20;
}

.action-strip div {
  display: grid;
  gap: 3px;
}

.action-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.action-strip strong {
  color: var(--teal);
  font-size: 18px;
}

.action-strip .secondary-button {
  margin-top: 0;
  max-width: 260px;
}

.workspace {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(260px, 310px);
}

.panel {
  border-radius: 7px;
  padding: 18px;
}

.panel h2 {
  font-family: "Songti SC", "STSong", serif;
  font-size: 26px;
  line-height: 1.12;
  margin: 0;
}

.panel__heading {
  margin-bottom: 16px;
}

.stack {
  display: grid;
  gap: 12px;
}

.inline-form {
  display: grid;
  gap: 10px;
}

.secondary-button {
  background: var(--teal);
  margin-top: 14px;
  width: 100%;
}

.ghost-button {
  background: rgba(32, 32, 29, 0.08);
  color: var(--ink);
}

.roster-picker {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.roster-button {
  align-items: center;
  background: rgba(255, 253, 245, 0.62);
  border: 1px solid rgba(32, 32, 29, 0.12);
  border-radius: 7px;
  color: var(--ink);
  display: grid;
  gap: 6px;
  grid-template-columns: 32px minmax(0, 1fr);
  justify-items: start;
  min-height: 66px;
  padding: 9px;
  text-align: left;
}

.roster-button strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.roster-button em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  grid-column: 2;
}

.roster-button.is-filled {
  background: rgba(245, 200, 183, 0.28);
}

.roster-button.is-active {
  background: var(--teal-soft);
  border-color: rgba(18, 106, 112, 0.5);
}

.manual-name,
.range-tools {
  border-top: 1px solid rgba(32, 32, 29, 0.12);
  margin-top: 16px;
  padding-top: 16px;
}

.manual-name summary,
.range-tools summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  list-style: none;
}

.manual-name summary::-webkit-details-marker,
.range-tools summary::-webkit-details-marker {
  display: none;
}

.range-tools summary {
  display: grid;
  gap: 3px;
}

.range-tools summary strong {
  color: var(--ink);
  font-family: "Songti SC", "STSong", serif;
  font-size: 21px;
}

.range-tools summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.manual-name .stack,
.range-tools .date-fields {
  margin-top: 12px;
}

.range-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.range-actions .secondary-button {
  margin-top: 0;
}

.calendar-panel {
  min-width: 0;
}

.calendar-header {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.legend {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 800;
  gap: 10px;
  justify-content: flex-end;
}

.legend span {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.legend-dot {
  border-radius: 50%;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.legend-dot--mine {
  background: var(--teal);
}

.legend-dot--best {
  background: var(--coral);
}

.legend-dot--all {
  background: var(--moss);
}

.weekday-row,
.calendar-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 8px;
  text-align: center;
}

.day-cell,
.calendar-spacer {
  aspect-ratio: 1 / 0.92;
  min-height: 72px;
}

.day-cell {
  border: 1px solid rgba(32, 32, 29, 0.14);
  border-radius: 7px;
  background: rgba(255, 253, 245, 0.62);
  color: var(--ink);
  display: grid;
  gap: 4px;
  grid-template-rows: auto 1fr auto;
  padding: 9px;
  position: relative;
  text-align: left;
}

.day-cell:hover {
  border-color: rgba(18, 106, 112, 0.48);
}

.day-cell.is-mine {
  background: rgba(213, 238, 238, 0.9);
  border-color: rgba(18, 106, 112, 0.62);
}

.day-cell.is-best {
  box-shadow: none;
}

.day-cell.is-all {
  background: linear-gradient(135deg, rgba(109, 127, 56, 0.24), rgba(213, 238, 238, 0.92));
  border-color: rgba(109, 127, 56, 0.58);
}

.day-cell__date {
  font-size: 18px;
  font-weight: 900;
}

.day-cell__month {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.day-cell__count {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.day-cell__names {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-rail {
  display: grid;
  gap: 18px;
}

.result-list,
.participant-list {
  display: grid;
  gap: 10px;
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
}

.result-pill {
  border: 1px solid rgba(32, 32, 29, 0.13);
  border-radius: 7px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.result-pill strong {
  color: var(--teal);
  font-size: 18px;
}

.result-pill span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.participant-item {
  align-items: center;
  border-bottom: 1px solid rgba(32, 32, 29, 0.1);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 9px 0;
}

.participant-item strong {
  font-size: 15px;
}

.participant-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.participant-avatar {
  background: var(--coral-soft);
  border: 1px solid rgba(212, 84, 63, 0.28);
  border-radius: 50%;
  display: inline-grid;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
  height: 30px;
  place-items: center;
  width: 30px;
}

details summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  list-style: none;
}

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

details summary::after {
  color: var(--coral);
  content: "+";
  font-size: 24px;
  font-weight: 800;
}

details[open] summary::after {
  content: "-";
}

.settings-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.date-fields {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 1040px) {
  .workspace {
    grid-template-columns: minmax(220px, 0.38fr) minmax(0, 1fr);
  }

  .side-rail {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 18px 12px 128px;
  }

  .hero,
  .workspace,
  .side-rail {
    grid-template-columns: 1fr;
  }

  .hero {
    gap: 10px;
    min-height: auto;
    padding: 4px 0 8px;
  }

  .hero::before {
    height: 118px;
    left: auto;
    right: 36px;
    top: 22px;
    width: 118px;
  }

  .hero__copy {
    padding-top: 26px;
  }

  .hero h1 {
    font-size: 44px;
    line-height: 1;
  }

  .hero p {
    font-size: 15px;
    line-height: 1.55;
    margin-top: 10px;
  }

  .hero__stamp {
    font-size: 9px;
    height: 76px;
    right: 8px;
    top: 12px;
    width: 76px;
  }

  .route-card {
    gap: 8px;
    min-height: 104px;
    padding: 18px;
  }

  .route-card strong {
    font-size: 28px;
  }

  .status-strip {
    margin: 8px 0 12px;
    padding: 12px 14px;
  }

  .status-strip,
  .calendar-header {
    align-items: start;
    flex-direction: column;
  }

  .action-strip {
    background: linear-gradient(180deg, #fffdf5 0%, #f7f2e6 100%);
    border-radius: 18px 18px 0 0;
    bottom: 0;
    left: 0;
    margin: 0;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    top: auto;
  }

  .action-strip .secondary-button {
    flex: 1;
    max-width: none;
    min-width: 166px;
  }

  .action-strip strong {
    font-size: 15px;
  }

  .legend {
    justify-content: flex-start;
  }

  .calendar-panel {
    order: -1;
    padding-left: 12px;
    padding-right: 12px;
  }

  .weekday-row,
  .calendar-grid {
    gap: 5px;
  }

  .day-cell,
  .calendar-spacer {
    aspect-ratio: auto;
    min-height: 68px;
  }

  .day-cell {
    padding: 7px 6px;
  }

  .day-cell__date {
    font-size: 16px;
  }

  .day-cell__names {
    display: none;
  }

  .date-fields {
    grid-template-columns: 1fr;
  }
}
