:root {
  --ink: #1c1c1e;
  --muted: #6d6d72;
  --faint: #9a9aa1;
  --line: #e6e6ea;
  --track: #e7e7ec;
  --fill: #c5c5cc;
  --green: #06c755;
  --green-deep: #059142;
  --green-soft: #f2fbf5;
  --bg: #f6f6f8;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(20, 20, 20, 0.04);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #e9e9ed;
  color: var(--ink);
}

body {
  font-family: "PingFang TC", "Noto Sans CJK TC", "Noto Sans TC", "Microsoft JhengHei",
    "Heiti TC", "WenQuanYi Micro Hei", "Droid Sans Fallback", -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  padding: 0 16px calc(28px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -16px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(246, 246, 248, 0.94);
  backdrop-filter: saturate(1.2) blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(6, 199, 85, 0.16);
}

.close-btn {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.close-btn:active {
  background: #f3f3f5;
}

.close-btn:focus-visible,
.option:focus-visible,
.primary-btn:focus-visible,
.cal-btn:focus-visible,
.event-place:focus-visible {
  outline: 2px solid var(--green-deep);
  outline-offset: 2px;
}

.event-head {
  padding: 2px 0 14px;
}

.event-kicker,
.event-hero,
.event-match,
.event-fallback,
.event-place-line,
.event-address,
.option-label,
.person-name {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.event-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.event-hero {
  margin: 2px 0 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.event-match {
  margin: 6px 0 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.45;
}

.event-match.is-hero {
  margin-top: 2px;
  font-size: 26px;
}

.event-fallback {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
}

.event-fallback.is-kicker {
  margin-top: 0;
  color: var(--muted);
  font-size: 13px;
}

.event-fallback.is-main {
  margin-top: 2px;
  font-size: 22px;
  line-height: 1.35;
}

.event-place {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  margin-top: 8px;
  padding: 8px 0;
  color: var(--ink);
  text-decoration: none;
}

.event-place-line {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.event-place-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pin {
  flex: none;
  line-height: 1.4;
}

.event-address {
  padding-left: 24px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
}

.event-place:active {
  opacity: 0.7;
}

.event-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.calendar {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #efeff2;
  border-radius: 14px;
  background: var(--card);
}

.calendar-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.calendar-actions {
  display: flex;
  gap: 8px;
}

.cal-btn {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}

.cal-btn:active {
  border-color: var(--green);
  background: var(--green-soft);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: block;
  width: 100%;
  margin: 0;
  padding: 14px 14px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.12s ease;
}

.option:active {
  transform: scale(0.988);
}

.option.is-mine {
  border-color: var(--green);
  background: var(--green-soft);
}

.option:disabled {
  cursor: default;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.radio {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid #d0d0d4;
  border-radius: 50%;
  background: #fff;
}

.option.is-mine .radio {
  border-color: var(--green);
  background: var(--green);
}

.option-label {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
}

.emoji {
  font-size: 18px;
  line-height: 1;
}

.option-count {
  flex: none;
  min-width: 1.6em;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.bar {
  display: block;
  height: 6px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--track);
}

.bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--fill);
  transition: width 0.35s ease;
}

.option.is-mine .bar-fill {
  background: var(--green);
}

.hint {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.rosters {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.roster-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 2px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.roster-count {
  font-variant-numeric: tabular-nums;
  color: var(--faint);
}

.roster {
  overflow: hidden;
  border: 1px solid #efeff2;
  border-radius: 14px;
  background: var(--card);
}

.person {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 48px;
  padding: 10px 14px;
  border-top: 1px solid #f3f3f5;
}

.person:first-child {
  border-top: 0;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  margin-top: 1px;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.person-name {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
  font-size: 15px;
  line-height: 1.4;
}

.you {
  flex: none;
  align-self: flex-start;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 700;
}

.empty {
  margin: 0;
  padding: 14px;
  color: var(--faint);
  font-size: 14px;
}

.status {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - 88px);
  padding: 24px 12px 48px;
  text-align: center;
}

.status-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: #fff;
  font-size: 34px;
  box-shadow: var(--shadow);
}

.status-title {
  margin: 8px 0 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
}

.status-body {
  max-width: 280px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.primary-btn {
  min-height: 48px;
  margin-top: 18px;
  padding: 0 22px;
  border: 1.5px solid var(--green);
  border-radius: 12px;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn:active {
  background: var(--green-soft);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e5e5ea;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 6;
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(28, 28, 30, 0.92);
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  transform: translateX(-50%);
}

.noscript {
  max-width: 480px;
  margin: 12px auto;
  padding: 0 16px;
  color: var(--muted);
  text-align: center;
}

.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;
}

@media (min-width: 520px) {
  body {
    background: #e4e4e8;
  }

  .app {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  }
}

@media (prefers-reduced-motion: reduce) {
  .option,
  .bar-fill {
    transition: none;
  }

  .spinner {
    animation: none;
    border-top-color: var(--green);
  }
}

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