[hidden] {
  display: none !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: system-ui, sans-serif;
  background: #f4f7fb;
  margin: 0;
  padding: 24px;
  color: #222222;
}

.container {
  max-width: 880px;
  margin: 32px auto;
}

.container-narrow {
  max-width: 760px;
}

.card.container-narrow {
  margin: 40px auto;
}

.card,
.hero,
.header-card,
.event-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 26px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  margin-bottom: 18px;
}

.card-login {
  max-width: 420px;
  margin: 48px auto;
}

h1 {
  margin: 0 0 12px;
  font-size: 30px;
  line-height: 1.25;
}

h2 {
  margin: 0 0 12px;
  font-size: 22px;
}

h3 {
  margin: 0 0 10px;
}

label {
  display: block;
  margin-top: 16px;
  font-weight: 700;
}

input,
textarea,
select {
  max-width: 100%;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  padding: 13px 14px;
  border: 2px solid #dddddd;
  border-radius: 14px;
  font-size: max(16px, 1rem);
  line-height: 1.35;
  background: #ffffff;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-width: auto;
  max-width: none;
  margin-top: 0;
  padding: 0;
  border-radius: initial;
  accent-color: #58cc02;
}

select {
  appearance: auto;
  -webkit-appearance: menulist;
  color: #222222;
}

input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"] {
  display: block;
  appearance: none;
  -webkit-appearance: none;
  inline-size: 100%;
  max-inline-size: 100%;
  min-height: 52px;
  overflow: hidden;
  line-height: 1.2;
  white-space: nowrap;
  text-align: left;
}

input[type="date"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value,
input[type="month"]::-webkit-date-and-time-value {
  display: block;
  max-width: 100%;
  min-height: 1.2em;
  text-align: left;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  margin: 0;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

button,
.button {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  background: #58cc02;
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button-secondary,
.logout {
  background: #eeeeee;
  color: #333333;
}

.button-danger {
  background: #ff4f5e;
  color: #ffffff;
}

.button:disabled,
button:disabled {
  background: #d9d9d9;
  color: #777777;
  cursor: not-allowed;
}

.button-full {
  width: 100%;
  margin-top: 24px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.row,
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.row > *,
.meta-grid > *,
.card,
.option-card {
  min-width: 0;
}

.form-row-safe {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.error,
.error-box {
  color: #a8071a;
}

.field-error {
  color: #a8071a;
  font-size: 13px;
  margin-top: 6px;
}

.field-invalid {
  border-color: #ff7875;
  background: #fffafa;
}

.error-box,
.success-box {
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
}

.error-box {
  background: #fff1f0;
  border: 2px solid #ffccc7;
}

.success-box {
  background: #f0fff0;
  border: 2px solid #b7eb8f;
}

.url-box {
  word-break: break-all;
  background: #f7f7f7;
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.hint,
.muted {
  color: #666666;
  font-size: 14px;
}

.hero-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.emoji {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: #ddf4cf;
  display: grid;
  place-items: center;
  font-size: 32px;
  flex: 0 0 auto;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 7px 11px;
  background: #eef7e8;
  font-size: 14px;
  font-weight: 800;
  color: #234018;
  text-decoration: none;
}

.poll-nav-badges .badge {
  cursor: pointer;
}

.poll-card {
  scroll-margin-top: 18px;
}

.summary-list {
  display: grid;
  gap: 10px;
}

.summary-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 2px solid #e5f4df;
  border-radius: 16px;
  color: #222222;
  text-decoration: none;
}

.summary-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.required-label,
.optional-label {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}

.required-label {
  background: #ffefef;
  color: #b42318;
}

.optional-label {
  background: #eef7e8;
  color: #477a1e;
}

.badge-active {
  background: #eef7e8;
  color: #477a1e;
}

.badge-ended {
  background: #eeeeee;
  color: #555555;
}

.meta {
  color: #555555;
  line-height: 1.8;
  margin: 0;
}

.mini-card,
.poll-option,
.empty {
  background: #f8faf7;
  border-radius: 16px;
  padding: 16px;
}

.location-card {
  border: 2px solid #eef7e8;
}

.danger-zone {
  border: 2px solid #ffd0d5;
  margin-bottom: 28px;
}

.mini-card strong {
  display: block;
  margin-bottom: 6px;
}

.description {
  white-space: pre-wrap;
  line-height: 1.8;
}

.participant {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eeeeee;
}

.participant-main {
  min-width: 0;
  flex: 1;
}

.participant-action {
  margin-left: auto;
  flex: 0 0 auto;
}

.participant:last-child {
  border-bottom: none;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ddf4cf;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  font-weight: bold;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar img,
.saved-user-avatar img,
.saved-user-chip-avatar img,
.voter-avatar img {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

.participant-name {
  font-weight: 800;
}

.poll-option {
  margin-top: 10px;
  border: 2px solid #eef7e8;
  position: relative;
}

.poll-option > .vote-counts {
  margin-top: 12px;
}

.option-card {
  background: #f8faf7;
  border: 2px solid #eef7e8;
  border-radius: 18px;
  padding: 16px;
  margin-top: 16px;
  overflow: hidden;
}

.option-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.option-card-title {
  font-weight: 800;
}

.button-small {
  padding: 8px 12px;
  font-size: 14px;
}

.choice-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.poll-choice-option {
  position: relative;
}

.choice-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 2px solid #d7efca;
  border-radius: 16px;
  padding: 12px;
  color: #222222;
  text-decoration: none;
}

.poll-choice-option .choice-item {
  padding-right: 72px;
}

.choice-item:hover,
.choice-item:focus-within {
  border-color: #58cc02;
  box-shadow: 0 4px 12px rgba(88, 204, 2, 0.16);
}

.choice-item input {
  width: auto;
  margin: 0;
}

.choice-item input:disabled {
  opacity: 1;
}

.choice-item label {
  margin: 0;
  font-weight: 800;
}

.choice-item span {
  min-width: 0;
}

.choice-item strong,
.choice-item small {
  display: block;
}

.choice-item small {
  color: #666666;
  font-size: 13px;
  font-weight: 600;
  margin-top: 3px;
}

.option-date {
  color: #666666;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  margin-top: 4px;
}

.dialog {
  width: min(520px, calc(100% - 28px));
  border: none;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
}

.dialog-wide {
  width: min(680px, calc(100% - 28px));
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dialog-header h2 {
  margin: 0;
}

.dialog::backdrop {
  background: rgba(20, 30, 20, 0.36);
}

.search-box {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.search-box label {
  flex: 1;
}

.user-search-results {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.user-search-result {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: #f8faf7;
  color: #222222;
  border: 2px solid #eef7e8;
  border-radius: 16px;
  padding: 12px;
}

.manual-fields {
  margin-top: 18px;
  border-top: 2px solid #eef7e8;
  padding-top: 18px;
}

.user-add-card {
  display: grid;
  gap: 10px;
}

.saved-user-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 2px solid #cdeec5;
  background: #f4fff1;
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 18px;
}

.saved-user-avatar,
.saved-user-chip-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #58cc02;
  color: #ffffff;
  font-weight: 900;
}

.saved-user-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 1.3rem;
}

.saved-user-avatar img,
.saved-user-chip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.saved-user-body {
  min-width: 0;
}

.saved-user-body strong,
.saved-user-body span {
  display: block;
}

.current-user-bar {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 2px solid #cdeec5;
  background: #f4fff1;
  border-radius: 18px;
  padding: 10px 12px;
}

.current-user-avatar {
  width: 44px;
  height: 44px;
  font-size: 1rem;
}

.poll-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.poll-card-header h3 {
  margin-right: auto;
}

.saved-user-chip {
  display: inline-grid;
  grid-template-columns: 28px minmax(0, 1fr) 22px;
  gap: 6px;
  align-items: center;
  max-width: min(220px, 52vw);
  border: 2px solid #cdeec5;
  background: #f4fff1;
  border-radius: 999px;
  padding: 4px;
  font-size: 0.85rem;
  justify-self: end;
}

.saved-user-chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.8rem;
}

.saved-user-chip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.chip-remove {
  display: grid;
  place-items: center;
  width: 22px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  line-height: 1;
  border: 0;
  border-radius: 50%;
  background: #e5f4df;
  color: #33502b;
  font-weight: 900;
  cursor: pointer;
  appearance: none;
}

.choice-item-graph {
  background:
    linear-gradient(90deg, rgba(88, 204, 2, 0.18) 0 var(--vote-percent), #ffffff var(--vote-percent) 100%);
}

.choice-item > span:first-of-type {
  min-width: 0;
  flex: 1;
}

.vote-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  z-index: 2;
}

.poll-choice-option > .vote-counts {
  margin-top: 0;
}

.vote-counts span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: #ff4f5e;
  border: 2px solid #ffffff;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(255, 79, 94, 0.24);
  padding: 4px 9px;
}

.inline-vote-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-left: auto;
  min-height: 26px;
  border-radius: 999px;
  background: #eef7e8;
  color: #33502b;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  padding: 4px 9px;
  white-space: nowrap;
}

.voter-stack {
  position: absolute;
  right: -5px;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  z-index: 3;
}

.voter-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: -10px;
  overflow: hidden;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #58cc02;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(49, 97, 34, 0.16);
}

.voter-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.voter-avatar-more {
  background: #e5f4df;
  color: #33502b;
  letter-spacing: 0;
}

.empty {
  color: #666666;
}

.text-center {
  text-align: center;
}

.event-card {
  position: relative;
}

.event-card-main {
  display: block;
  color: inherit;
  text-decoration: none;
}

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.filter-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 9px 12px;
  background: #eeeeee;
  color: #333333;
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
}

.filter-chip-active {
  background: #58cc02;
  color: #ffffff;
}

.fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  padding: 0;
  font-size: 34px;
  line-height: 1;
  box-shadow: 0 10px 28px rgba(88, 204, 2, 0.35);
}

.floating-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 14px max(24px, calc((100vw - 880px) / 2 + 24px));
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid #eeeeee;
  backdrop-filter: blur(10px);
}

.floating-footer > *,
.floating-footer form {
  min-width: 0;
  margin: 0;
}

.floating-footer > :only-child {
  grid-column: 1 / -1;
}

.floating-footer .button {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.has-floating-footer {
  padding-bottom: 132px;
}

@media (max-width: 680px) {
  body {
    padding: 14px;
  }

  .card,
  .hero,
  .header-card,
  .event-card {
    padding: 20px;
  }

  .row,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .form-row-safe {
    grid-template-columns: 1fr;
  }

  .hero-title {
    align-items: flex-start;
  }

  .search-box {
    display: grid;
    grid-template-columns: 1fr;
  }

  .saved-user-card {
    grid-template-columns: 44px 1fr;
  }

  .saved-user-card .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .current-user-bar {
    grid-template-columns: 38px 1fr auto;
    padding: 10px;
  }

  .current-user-avatar {
    width: 38px;
    height: 38px;
  }

  .poll-card-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
  }

  .poll-card-header h3 {
    min-width: 0;
  }

  .saved-user-chip {
    flex: 0 1 min(190px, 52vw);
    max-width: min(190px, 52vw);
  }

  .summary-item {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .floating-footer {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    margin: 0;
    padding: 12px 14px;
  }

  .has-floating-footer {
    padding-bottom: 124px;
  }
}
