:root {
  --bg: #e8f0ff;
  --paper: #f8fbff;
  --paper-strong: #eef6ff;
  --ink: #1e2a46;
  --muted: #5f6b8a;
  --line: rgba(30, 42, 70, 0.14);
  --accent: #18a46b;
  --accent-soft: #d7f4e4;
  --accent-strong: #0f7b4e;
  --selection-soft: rgb(214, 238, 255);
  --selection-strong: #4769d6;
  --warm: #ff8f5a;
  --shadow: 0 28px 80px rgba(73, 87, 140, 0.18);
  --radius: 24px;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  touch-action: manipulation;
  background: var(--bg);
}

button,
input {
  font: inherit;
  touch-action: manipulation;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  padding: 32px 0 56px;
  display: flex;
  flex-direction: column;
}

.hero {
  min-height: 100vh;
}

.hero .shell {
  justify-content: center;
}

.card {
  background: var(--paper);
  border: 1px solid rgba(30, 42, 70, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.landing-card {
  width: min(560px, 100%);
  padding: 40px;
  display: grid;
  gap: 24px;
}

.eyebrow {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.74rem;
  color: var(--muted);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.title {
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: -0.03em;
}

.editable-title {
  margin-top: 10px;
  padding: 6px 0;
  outline: none;
  border-bottom: 1px solid transparent;
}

.editable-title:focus {
  border-bottom-color: rgba(34, 48, 45, 0.22);
}

.subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
  max-width: 42ch;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-button,
.secondary-button,
.day-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.primary-button {
  padding: 16px 24px;
  background: #3550c7;
  color: white;
  font-weight: 600;
}

.secondary-button {
  padding: 14px 20px;
  background: rgba(71, 105, 214, 0.1);
  color: var(--ink);
}

.primary-button:hover,
.secondary-button:hover,
.day-button:hover {
  transform: translateY(-1px);
}

.form-panel {
  display: none;
  gap: 16px;
  padding: 24px;
  border-radius: 22px;
  background: rgba(251, 253, 255, 0.94);
  border: 1px solid var(--line);
}

.form-panel.is-open {
  display: grid;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 0.92rem;
  color: var(--muted);
}

.field input {
  min-width: 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 251, 245, 0.96);
}

.status {
  display: none;
  font-size: 0.95rem;
  color: var(--accent-strong);
}

.status.has-content {
  display: block;
}

.calendar-layout {
  display: grid;
  gap: 24px;
}

.participant-strip {
  padding: 14px 20px;
}

.participant-strip.is-hidden {
  display: none;
}

.participant-list {
  line-height: 1.5;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  min-width: 0;
}

.participant-pill {
  white-space: nowrap;
}

.calendar-header {
  display: grid;
  gap: 16px;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: start;
}

.calendar-card,
.identity-card {
  padding: 24px;
}

.calendar-card,
.identity-card,
.month-card {
  position: relative;
  overflow: hidden;
}

.month-card,
.month-card * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.calendar-card::before,
.identity-card::before,
.month-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.38;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.95) 0.9px, transparent 1.15px),
    radial-gradient(circle at 78% 24%, rgba(71, 105, 214, 0.2) 0.9px, transparent 1.2px),
    radial-gradient(circle at 30% 74%, rgba(255, 255, 255, 0.7) 0.8px, transparent 1.1px),
    radial-gradient(circle at 68% 82%, rgba(255, 143, 90, 0.2) 0.8px, transparent 1.15px),
    radial-gradient(circle at 42% 48%, rgba(24, 164, 107, 0.14) 0.7px, transparent 1px);
  background-size: 11px 11px, 13px 13px, 17px 17px, 19px 19px, 23px 23px;
  mix-blend-mode: multiply;
}

.calendar-card > *,
.identity-card > *,
.month-card > * {
  position: relative;
  z-index: 1;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.pill {
  padding: 8px 12px;
  background: rgba(24, 164, 107, 0.12);
  color: var(--accent-strong);
  border-radius: 999px;
}

.share-link {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.share-link code {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(71, 105, 214, 0.08);
  font-size: 0.9rem;
  word-break: break-all;
}

.month-grid {
  display: grid;
  gap: 18px;
}

.month-card {
  padding: 18px;
  border-radius: 22px;
  background: var(--paper-strong);
  border: 1px solid rgba(71, 105, 214, 0.12);
}

.month-title {
  margin-bottom: 14px;
  font-size: 1.4rem;
}

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

.weekday {
  padding: 8px 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.day-spacer {
  min-height: 88px;
}

.day-button {
  min-height: 88px;
  padding: 10px 24px 10px 10px;
  text-align: left;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(71, 105, 214, 0.1);
  border-radius: 18px;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.day-button.is-selected {
  background: var(--selection-soft);
  border-color: rgba(71, 105, 214, 0.35);
}

.day-button .topline {
  display: block;
}

.day-content-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}

.day-number {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
  color: rgb(0, 136, 255);
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(248, 251, 255, 0.9);
}

.count {
  font-size: 0.8rem;
  color: var(--muted);
}

.checkline {
  position: absolute;
  inset: 8px;
  padding-top: 18px;
  padding-bottom: 4px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  align-content: flex-start;
}

.checkbadge {
  color: var(--selection-strong);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.18;
  display: block;
  max-width: 100%;
}

.checkbadge sup {
  display: block;
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.66rem;
  line-height: 1;
}

.emoji-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  line-height: 1.18;
  padding-top: 8px;
  margin-left: -.55em;
}

.emoji-chip {
  display: block;
  margin-right: -.6em;
  margin-bottom: -0.2em;
}

.emoji-chip:first-child {
  margin-right: -.6em;
}

.selected-mark {
  display: none;
  position: absolute;
  z-index: 2;
  pointer-events: none;
  top: 8px;
  right: 0px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--selection-strong);
  box-shadow: 0 1px 2px rgba(30, 42, 70, 0.18);
}

.selected-mark::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 2px;
  width: 4px;
  height: 7px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(45deg);
}

.identity-card {
  display: grid;
  gap: 14px;
}

.hint {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
}

.error-state {
  padding: 28px;
}

.app-footer {
  margin-top: auto;
  padding: 10px 4px 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.day-popup {
  position: fixed;
  inset: 0;
  z-index: 1000;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.day-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 44, 90, 0.34);
}

.day-popup__panel {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 24px));
  padding: 20px;
  display: grid;
  gap: 14px;
  background: var(--paper);
}

.day-popup__eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.day-popup__title {
  font-size: 1.25rem;
}

.day-popup__body {
  max-height: min(40vh, 280px);
  overflow: auto;
}

.day-popup__list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.day-popup__close {
  justify-self: start;
}

@media (max-width: 860px) {
  .calendar-header,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .landing-card {
    padding: 28px;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding-top: 20px;
  }

  .day-button,
  .day-spacer {
    min-height: 74px;
  }

  .day-button {
    padding: 16px 22px 8px 8px;
  }

  .checkline {
    inset: 6px;
    padding-top: 16px;
    padding-bottom: 3px;
  }

  .weekday-row,
  .days-grid {
    gap: 6px;
  }

  .day-number {
    font-size: 1.02rem;
  }

  .checkbadge {
    font-size: 0.92rem;
  }

  .selected-mark {
    top: 4px;
    right: -6px;
    width: 12px;
    height: 12px;
  }

  .selected-mark::before {
    left: 3px;
    top: 2px;
    width: 3px;
    height: 6px;
  }
}
