@layer tokens, base, layout, components, responsive;
@layer tokens {
  :root {
    color-scheme: light;
    --white: #ffffff; --ink: #263b42; --gray: #566b72;
    --line: #d4e0e3; --soft: #e8eff1;
    --green: #286247; --green-soft: #e7f2eb; --green-line: #cbded2;
    --red: #a12b35; --red-soft: #fbeef0; --red-line: #e8bfc5;
    --canvas: #f1f6f7; --surface: var(--white); --text: var(--ink);
    --muted: var(--gray); --border: var(--line); --border-strong: #aabec4;
    --accent: #236673; --accent-hover: #174d58; --accent-soft: #e2eff2;
    --chart: #527e88;
    --ticket-date: #f4eccd; --ticket-date-ink: #5d5128;
    --avatar-lilac: #e9e3f2; --avatar-sky: #dcecf2;
    --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
    --space-6: 24px; --space-8: 32px; --space-12: 48px; --space-16: 64px;
    --radius-input: 10px; --radius-card: 20px; --radius-pill: 999px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --display: ui-rounded, 'Arial Rounded MT Bold', var(--font);
    --shadow: 0 1px 2px #263b4205, 0 8px 24px #263b4208;
    --shadow-ticket: 0 2px 4px #263b4208, 0 20px 48px #263b4212;
    --fast: 160ms; --ease: cubic-bezier(.2,.7,.3,1);
    --z-toast: 10;
  }
}
@layer base {
  * { box-sizing: border-box; }
  body { margin: 0; background: var(--canvas); color: var(--text); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
  button, input, textarea, select { font: inherit; }
  button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
  button, a { touch-action: manipulation; }
  button { cursor: pointer; }
  button:disabled { cursor: wait; opacity: .6; }
  a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 4px; }
  h1, h2, h3, p { margin: 0; }
  h1, h2, h3 { line-height: 1.12; letter-spacing: -.04em; }
  h1 { font-family: var(--display); font-size: clamp(40px, 5vw, 64px); font-weight: 750; }
  h2 { font-size: 26px; font-weight: 700; }
  h3 { font-size: 19px; font-weight: 650; }
  p { text-wrap: pretty; }
  h1, h2 { text-wrap: balance; }
  :focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
  input, textarea, select { color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-input); padding: 12px 14px; width: 100%; min-height: 48px; }
  input::placeholder, textarea::placeholder { color: var(--muted); }
  input:focus, textarea:focus, select:focus { border-color: var(--accent); }
  textarea { resize: vertical; min-height: 90px; }
  label, legend { font-weight: 600; }
  label > input, label > textarea, label > select { display: block; margin-top: var(--space-2); font-weight: 400; }
  fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
  legend { padding: 0; }
  small, .small { font-size: 13px; }
  [hidden] { display: none !important; }
  ::selection { background: var(--accent-soft); }
}
@layer layout {
  .wrap { width: min(1120px, calc(100% - 80px)); margin-inline: auto; }
  .site-header { height: 106px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); border-bottom: 1px solid var(--border); }
  nav { display: flex; align-items: center; gap: var(--space-8); }
  main { min-height: calc(100svh - 106px); padding-bottom: var(--space-16); }
  .hero { display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 88px; padding: 72px 0 64px; }
  .hero h1 { font-size: clamp(46px, 5.4vw, 70px); line-height: 1.06; }
  .hero-copy > p { max-width: 385px; margin-top: var(--space-6); font-size: 18px; color: var(--muted); }
  .hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); margin-top: var(--space-8); }
  .section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); margin-bottom: var(--space-6); }
  .home-plans { padding-top: var(--space-8); border-top: 1px solid var(--border); }
  .plan-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
  .page-heading { padding: var(--space-12) 0 var(--space-8); }
  .page-heading h1 { margin: var(--space-4) 0; }
  .page-heading > p { color: var(--muted); max-width: 580px; }
  .create-layout, .create-heading { max-width: 720px; margin-inline: auto; }
  .create-heading h1 { font-size: clamp(36px, 4vw, 48px); margin-bottom: 0; }
  .hangout-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); align-items: start; gap: var(--space-8); }
  .hangout-heading { display: flex; justify-content: space-between; gap: var(--space-8); align-items: center; }
  .hangout-heading > div { flex: 1; min-width: 0; }
  .hangout-heading h1 { max-width: 760px; font-size: clamp(34px, 4vw, 48px); overflow-wrap: anywhere; }
  .hangout-heading .note { margin-top: var(--space-4); max-width: 620px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
  .stack { display: grid; gap: var(--space-6); }
  .row { display: flex; align-items: center; gap: var(--space-3); }
  .between { justify-content: space-between; }
}
@layer components {
  .wordmark { font-family: var(--display); font-size: 28px; font-weight: 850; letter-spacing: -.065em; text-decoration: none; white-space: nowrap; }
  .wordmark span { color: var(--accent); }
  .nav-link { font-size: 14px; text-decoration: none; }
  .nav-link:hover { text-decoration: underline; }
  .button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-3); padding: 14px 24px; min-height: 50px; border: 1px solid transparent; border-radius: var(--radius-pill); background: var(--accent); color: white; font-size: 15px; font-weight: 650; line-height: 1.35; text-decoration: none; transition: background var(--fast), transform var(--fast) var(--ease); }
  .button:hover { background: var(--accent-hover); }
  .button:active { transform: translateY(0); }
  .button-small { min-height: 44px; padding: 11px 18px; font-size: 13px; }
  .button-dark { background: var(--ink); }
  .button-secondary { background: transparent; color: var(--ink); border-color: var(--border-strong); }
  .button-secondary:hover { background: var(--soft); }
  .text-button { min-height: 44px; padding: 8px 0; border: 0; background: none; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
  .muted { color: var(--muted); }
  .accent-text { color: var(--accent); }
  .status-label { font-size: 13px; font-weight: 600; margin-bottom: var(--space-4); color: var(--muted); }
  .ticket { transform: rotate(2deg); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-ticket); overflow: hidden; }
  .ticket-head { padding: var(--space-4) var(--space-8); border-bottom: 1px dashed var(--border-strong); font-size: 12px; }
  .ticket-body { padding: var(--space-8); }
  .ticket-body h2 { font-size: 30px; }
  .ticket-date { display: flex; align-items: center; gap: var(--space-6); margin: var(--space-6) 0; }
  .date-block { display: grid; place-items: center; width: 76px; height: 85px; border: 1px solid transparent; border-radius: 12px; background: var(--ticket-date); color: var(--ticket-date-ink); font-size: 11px; letter-spacing: .06em; }
  .date-block strong { font-size: 34px; line-height: 1; letter-spacing: -.04em; }
  .ticket-footer { padding: 18px var(--space-8); background: var(--green-soft); color: var(--green); display: flex; align-items: center; gap: var(--space-3); font-size: 13px; }
  .avatars { display: flex; padding-left: 4px; }
  .avatar { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 2px solid var(--surface); border-radius: 50%; background: var(--soft); font-size: 11px; font-weight: 650; color: var(--ink); flex-shrink: 0; }
  .avatars .avatar { margin-left: -4px; background: var(--avatar-sky); }
  .avatars .avatar:nth-child(2n) { background: var(--avatar-lilac); }
  .avatars .avatar:nth-child(3n) { background: var(--ticket-date); }
  .avatars .avatar:nth-child(4n) { background: var(--green-soft); }
  .empty-plans { padding: var(--space-8); border: 1px dashed var(--border-strong); border-radius: var(--radius-card); display: flex; justify-content: space-between; align-items: center; gap: var(--space-6); }
  .ideas { display: flex; flex-wrap: wrap; gap: var(--space-2); }
  .idea { border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 10px 16px; font-size: 13px; text-decoration: none; background: var(--surface); min-height: 44px; }
  .idea:hover { border-color: var(--accent); }
  .plan-card { display: block; padding: var(--space-6); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); text-decoration: none; }
  .plan-card:hover { border-color: var(--border-strong); }
  .plan-card h3 { margin: 18px 0 var(--space-2); overflow-wrap: anywhere; }
  .plan-card .row { flex-wrap: wrap; }
  .badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--radius-pill); background: var(--soft); font-size: 11px; font-weight: 650; line-height: 1.4; }
  .badge-success { background: var(--green-soft); color: var(--green); }
  .badge-accent { background: var(--accent-soft); color: var(--accent); }
  .back-link { color: var(--muted); font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; min-height: 32px; }
  .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--space-8); box-shadow: var(--shadow); }
  .form-section + .form-section { padding-top: var(--space-8); margin-top: var(--space-8); border-top: 1px solid var(--border); }
  .form-section > h2 { font-size: 23px; margin-bottom: var(--space-6); }
  .form-section > .muted { font-size: 14px; margin-top: -16px; margin-bottom: var(--space-6); }
  .field-stack { display: grid; gap: 20px; }
  .field-stack label { font-size: 14px; }
  .optional { font-weight: 400; color: var(--muted); }
  .option-row { display: grid; grid-template-columns: 1fr 44px; align-items: end; gap: var(--space-2); }
  .remove-button { width: 44px; height: 48px; padding: 0; font-size: 22px; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-input); color: var(--muted); }
  .remove-button:hover { color: var(--red); border-color: var(--red); }
  .date-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .75fr) 44px; align-items: end; gap: var(--space-2); }
  .date-fields input { min-width: 0; }
  .timezone { margin: var(--space-4) 0 var(--space-6); font-size: 12px; color: var(--muted); }
  .form-bottom { padding-top: var(--space-8); display: grid; gap: var(--space-4); }
  .form-bottom .button { justify-self: start; }
  .error { padding: 12px 16px; background: var(--red-soft); border: 1px solid var(--red-line); color: var(--red); border-radius: var(--radius-input); font-size: 14px; }
  .share-panel { margin-bottom: var(--space-8); background: var(--accent-soft); padding: var(--space-6); border-radius: var(--radius-card); display: flex; gap: var(--space-6); align-items: center; justify-content: space-between; }
  .share-panel h3 { margin-bottom: var(--space-1); }
  .share-panel p { font-size: 13px; }
  .share-input { max-width: 400px; margin-top: var(--space-3); font-size: 13px; }
  .vote-intro { margin-bottom: var(--space-6); }
  .vote-group { margin-top: var(--space-8); }
  .vote-group > legend { font-size: 20px; letter-spacing: -.025em; }
  .vote-group > p { margin: var(--space-2) 0 var(--space-4); color: var(--muted); font-size: 13px; }
  .activity-choices { display: grid; gap: var(--space-3); }
  .activity-choice { padding: 14px 16px; display: flex; gap: var(--space-3); align-items: center; border: 1px solid var(--border); border-radius: var(--radius-input); font-size: 14px; font-weight: 500; cursor: pointer; overflow-wrap: anywhere; }
  .activity-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
  .activity-choice input { margin: 0; padding: 0; width: 19px; height: 19px; min-height: 0; accent-color: var(--accent); flex-shrink: 0; }
  .availability-row { padding: var(--space-4) 0; border-bottom: 1px solid var(--border); }
  .availability-row legend { float: left; width: 100%; margin-bottom: var(--space-3); font-size: 14px; }
  .availability-row legend span { font-weight: 400; color: var(--muted); }
  .radio-group { clear: both; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
  .radio-choice { position: relative; }
  .radio-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
  .radio-choice span { display: block; padding: 11px 8px; min-height: 44px; text-align: center; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }
  .radio-choice input:checked + span { border-color: var(--accent); background: var(--accent); color: var(--white); }
  .radio-choice input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 3px; }
  .result-panel h2 { font-size: 23px; }
  .result-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-6); }
  .recommendation { padding: var(--space-6); border-radius: 14px; background: var(--accent-soft); }
  .recommendation h3 { font-size: 22px; margin-bottom: var(--space-2); overflow-wrap: anywhere; }
  .recommendation p { font-size: 13px; }
  .recommendation .explanation { padding-top: var(--space-4); margin-top: var(--space-4); border-top: 1px solid var(--border); color: var(--muted); }
  .result-section { margin-top: var(--space-8); }
  .result-section > h3 { font-size: 15px; margin-bottom: var(--space-4); letter-spacing: -.01em; }
  .result-row + .result-row { margin-top: var(--space-4); }
  .result-row .row { align-items: baseline; font-size: 13px; gap: var(--space-4); }
  .result-row .row > span:first-child { overflow-wrap: anywhere; min-width: 0; }
  .result-row .row > span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
  progress { appearance: none; width: 100%; height: 5px; border: 0; border-radius: 5px; overflow: hidden; background: var(--soft); color: var(--chart); }
  progress::-webkit-progress-bar { background: var(--soft); }
  progress::-webkit-progress-value { background: var(--chart); border-radius: 5px; }
  progress::-moz-progress-bar { background: var(--chart); }
  .result-note { font-size: 12px; color: var(--muted); margin-top: var(--space-4); }
  .no-responses { padding: var(--space-8) 0; text-align: center; }
  .no-responses h3 { margin-bottom: var(--space-2); }
  .no-responses p { color: var(--muted); font-size: 13px; }
  .saved-response { padding: var(--space-8); text-align: center; }
  .checkmark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--green-soft); color: var(--green); margin: 0 auto var(--space-4); font-size: 22px; }
  .saved-response h2 { margin-bottom: var(--space-3); }
  .saved-response p { color: var(--muted); font-size: 14px; }
  .saved-response .button { margin-top: var(--space-6); }
  .participant-list { margin-top: var(--space-6); }
  summary { cursor: pointer; min-height: 44px; padding-block: 10px; font-size: 14px; font-weight: 600; }
  .person { display: flex; align-items: start; gap: var(--space-3); padding-block: var(--space-4); border-top: 1px solid var(--border); font-size: 13px; }
  .person strong { overflow-wrap: anywhere; }
  .person p { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
  .person .availability-list { margin-top: var(--space-2); }
  .host-panel { margin-top: var(--space-6); padding: var(--space-6); border: 1px solid var(--border); border-radius: 14px; }
  .host-panel h3 { margin-bottom: var(--space-2); }
  .host-panel p { color: var(--muted); font-size: 13px; }
  .host-panel form { margin-top: var(--space-4); }
  .host-panel .button { width: 100%; margin-top: var(--space-4); }
  .confirmed-banner { background: var(--green-soft); border: 1px solid var(--green-line); padding: var(--space-8); border-radius: var(--radius-card); margin-bottom: var(--space-8); }
  .confirmed-banner .status-label { color: var(--green); }
  .confirmed-banner h2 { font-size: 32px; margin-bottom: var(--space-3); overflow-wrap: anywhere; }
  .confirmed-banner p { color: var(--green); }
  .loading { color: var(--muted); padding: 80px 0; }
  .error-page { padding: 80px 0; max-width: 540px; }
  .error-page h1 { margin-bottom: var(--space-6); }
  .error-page p { margin-bottom: var(--space-6); color: var(--muted); }
  .toast { position: fixed; left: 50%; bottom: var(--space-6); transform: translateX(-50%); background: var(--ink); color: white; border-radius: 12px; padding: 14px 22px; max-width: calc(100% - 32px); width: max-content; box-shadow: var(--shadow); z-index: var(--z-toast); font-size: 14px; }
  .skip-link { position: fixed; top: -100px; left: 10px; background: var(--surface); padding: 12px; z-index: var(--z-toast); }
  .skip-link:focus { top: 10px; }
  .connection-note { padding-top: var(--space-3); font-size: 12px; color: var(--red); }
}
@layer responsive {
  @media (hover: hover) and (pointer: fine) {
    .button:hover { transform: translateY(-1px); }
    .button:active { transform: translateY(0); }
  }
  @media (max-width: 900px) {
    .wrap { width: calc(100% - 48px); }
    .hero { gap: var(--space-8); padding-block: var(--space-12); }
    .hero h1 { font-size: 48px; }
    .ticket-head, .ticket-body { padding: var(--space-6); }
    .hangout-layout { grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr); gap: var(--space-6); }
    .panel { padding: var(--space-6); }
    .empty-plans { align-items: start; flex-direction: column; }
  }
  @media (max-width: 680px) {
    .wrap { width: calc(100% - 36px); }
    .site-header { height: 84px; gap: var(--space-4); }
    .wordmark { font-size: 25px; }
    .site-header .button-small { padding-inline: 14px; white-space: nowrap; }
    nav { gap: var(--space-3); }
    .nav-link { display: none; }
    .hero { grid-template-columns: 1fr; gap: var(--space-12); padding-block: var(--space-12); }
    .hero h1 { font-size: clamp(44px, 11.5vw, 64px); }
    .hero-copy > p { font-size: 16px; max-width: 330px; margin-top: var(--space-4); }
    .hero-actions { margin-top: var(--space-6); }
    .ticket { transform: rotate(1deg); margin-inline: 5px; }
    .ticket-body { padding: var(--space-6); }
    .ticket-head { padding: 18px var(--space-6); }
    .ticket-date { margin-block: 20px; }
    .ticket-footer { padding-inline: var(--space-6); }
    .plan-list, .hangout-layout { grid-template-columns: minmax(0, 1fr); }
    .page-heading { padding-top: var(--space-8); }
    .page-heading h1 { font-size: 38px; }
    .hangout-heading { display: block; }
    .hangout-heading > .button { margin-top: var(--space-6); }
    .share-panel { flex-direction: column; align-items: stretch; gap: var(--space-4); }
    .share-panel .button { align-self: start; }
    .panel { padding: 22px 18px; border-radius: 16px; }
    .form-bottom .button { width: 100%; }
    .date-fields { grid-template-columns: minmax(0, 1fr) minmax(0, .85fr) 40px; gap: 6px; }
    .date-fields input { padding-inline: 8px; font-size: 14px; }
    .date-fields .remove-button { width: 40px; }
    .recommendation { padding: 20px; }
    .section-heading { align-items: start; }
    .section-heading h2 { font-size: 24px; }
    .empty-plans { padding: var(--space-6); }
    .confirmed-banner { padding: var(--space-6); }
    .form-section > h2 { font-size: 22px; }
  }
  @media (max-width: 380px) {
    .site-header { gap: 10px; }
    .wordmark { font-size: 23px; }
    .site-header .button-small { padding-inline: 12px; font-size: 12px; gap: 8px; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  }
}

.date-fields .repeat-choice { grid-column: 1 / -1; }
