:root {
  color-scheme: light;
  --bg: #edf6fb;
  --ink: #1a1d23;
  --muted: #64748b;
  --line: #c8dff0;
  --panel: #ffffff;
  --accent: #3a9fd6;
  --accent-dark: #1a7cb5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
}

.home {
  display: grid;
  min-height: 100dvh;
  padding: 24px 0;
  place-items: center;
}

.panel,
.vote-area,
.side-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.panel {
  min-width: 0;
  width: min(720px, 100%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2rem, 4rem, 4rem);
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.hero-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  margin-bottom: 4px;
}

.join-form {
  display: grid;
  gap: 8px;
  margin-top: 32px;
}

.inline-form {
  display: flex;
  gap: 8px;
  min-width: 0;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
}

textarea {
  resize: vertical;
}

button,
.link-button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
  padding: 12px 16px;
  text-decoration: none;
}

button:hover,
.link-button:hover {
  background: var(--accent-dark);
}

button.secondary {
  background: #4b5563;
}

.room-page {
  padding: 32px 0;
}

.room-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

#topic {
  min-width: 0;
}

.topic-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  max-width: 560px;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  min-width: 0;
}

.share-box {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  position: relative;
  width: min(520px, 100%);
}

.share-box input {
  min-width: 0;
  background: #f0f8fd;
}

.share-box .copy-status {
  bottom: -22px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
  position: absolute;
  right: 0;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.side-panel {
  order: -1;
}

.vote-area {
  margin: 0 auto;
  width: min(100%, 1040px);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 12px;
}

@media (min-width: 1280px) {
  .cards {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }
}

.card-button {
  width: 100%;
  min-height: 112px;
  border: 2px solid var(--accent);
  background: #e6f4fb;
  color: var(--accent-dark);
  font-size: 1.7rem;
}

.card-button:hover {
  color: white;
}

.card-button.is-selected {
  background: var(--accent);
  color: white;
}

.owner-only {
  display: none;
}

body.is-owner .owner-only {
  display: grid;
}

.controls {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}

.comment-panel {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 24px;
}

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

.finalize-panel {
  display: grid;
  gap: 14px;
}

.finalized-note,
.owner-hint {
  color: var(--muted);
  margin: 0;
}

.final-estimate-cards {
  margin-bottom: 10px;
}

.estimate-option {
  cursor: pointer;
}

.estimate-option input {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.estimate-option span {
  align-items: center;
  background: #e6f4fb;
  border: 2px solid var(--accent);
  border-radius: 6px;
  color: var(--accent-dark);
  display: flex;
  font-size: 1.7rem;
  font-weight: 700;
  justify-content: center;
  min-height: 112px;
}

.estimate-option input:checked + span {
  background: var(--accent);
  color: #fff;
}

.participants {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 24px;
  padding: 0;
}

.participant {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  flex: 0 0 220px;
  gap: 8px;
  list-style: none;
  min-height: 42px;
  padding: 12px;
}

.participant-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.participant-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.participant-status strong {
  background: #e6f4fb;
  border: 1px solid #9ecde8;
  border-radius: 999px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  padding: 3px 8px;
}

.muted {
  color: var(--muted);
}

.comments {
  display: grid;
  gap: 6px;
}

.comments p {
  padding-left: 1em;
  position: relative;
}

.comments p::before {
  content: "•";
  left: 0;
  position: absolute;
}

.comments p,
.no-comment {
  color: var(--muted);
  margin: 0;
  overflow-wrap: anywhere;
}

.modal-backdrop {
  align-items: center;
  background: rgba(32, 33, 36, 0.45);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 10;
}

.modal {
  background: var(--panel);
  border-radius: 8px;
  max-height: min(720px, 90vh);
  overflow: auto;
  padding: 24px;
  width: min(720px, 100%);
}

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

.final-estimate {
  background: #e6f4fb;
  border: 1px solid #9ecde8;
  border-radius: 6px;
  margin: 0 0 18px;
  padding: 12px 14px;
}

.modal-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 18px;
}

.modal-footer .copy-status {
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
  min-height: 1em;
}

.final-result-list {
  display: grid;
  gap: 12px;
}

.final-result-item {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
}

@media (max-width: 760px) {
  .inline-form,
  .header-actions,
  .modal-footer,
  .room-header,
  .share-box,
  .topic-form,
  .workspace {
    display: grid;
  }

  .share-box {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .header-actions {
    justify-content: stretch;
  }

  .link-button,
  button {
    width: 100%;
  }

  h1 {
    font-size: 2rem;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1440px);
  }

  .panel,
  .vote-area,
  .side-panel,
  .modal {
    padding: 16px;
  }

  .inline-form,
  .topic-form {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.6rem;
  }
}
