:root {
  color-scheme: light;
  --ink: #18202b;
  --muted: #647084;
  --line: #d6dde8;
  --paper: #ffffff;
  --bg: #eef3f8;
  --green: #12805c;
  --blue: #1f5eff;
  --red: #c2412f;
  --yellow: #f4c542;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.app {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  line-height: .95;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
}

.language,
input {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  padding: 0 12px;
}

.help-button {
  min-height: 44px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.mode-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.mode-link,
button {
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  min-height: 46px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
}

.mode-link {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.mode-link.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 16px 36px rgba(24, 32, 43, .08);
}

.setup,
.create-form,
.room-head,
.share {
  display: grid;
  gap: 16px;
}

.setup,
.room-head,
.share {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.create-form {
  grid-template-columns: 150px 160px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
}

.room {
  margin-top: 14px;
}

.progress {
  min-width: 96px;
  border-radius: 8px;
  background: #e9f4ef;
  color: var(--green);
  padding: 10px 14px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
}

.share {
  margin: 18px 0;
  grid-template-columns: 1fr 110px;
}

.share input {
  width: 100%;
}

.choice-form {
  display: grid;
  gap: 16px;
}

.choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.choice {
  min-height: 118px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 1.15rem;
}

.hand-image {
  display: inline-block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  vertical-align: middle;
}

.choice .hand-image {
  display: block;
  width: 76px;
  height: 76px;
  margin: 0 auto 8px;
}

.choice.selected {
  border-color: var(--green);
  background: #e9f4ef;
}

.result {
  margin-top: 20px;
  display: grid;
  gap: 12px;
}

.result-card {
  border-radius: 8px;
  padding: 16px;
  background: #f7f9fc;
  border: 1px solid var(--line);
}

.result-card h2,
.result-card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-card.win {
  background: #e9f4ef;
  border-color: #9ed9c3;
}

.result-card.lose {
  background: #fff0ed;
  border-color: #f0aca1;
}

.people-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pill {
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 6px 10px;
  font-weight: 700;
}

.submissions {
  margin-top: 18px;
  color: var(--muted);
}

.replay {
  justify-self: start;
  background: var(--green);
}

.help-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 32, 43, .52);
}

.help-dialog {
  width: min(680px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
}

.help-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.help-close {
  min-width: 44px;
  width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
}

.help-dialog p {
  color: var(--muted);
  line-height: 1.7;
}

.help-dialog ul {
  display: grid;
  gap: 10px;
  padding-left: 1.25rem;
}

.help-dialog li {
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .topbar,
  .top-actions,
  .setup,
  .create-form,
  .room-head,
  .share,
  .mode-links,
  .choices {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }
}
