

:root {
  --background: #f4f7f1;
  --foreground: #373a36;
  --primary: #006937;
  --forest: #043d26;
  --forest-deep: #062f20;
  --lime: #76bc21;
  --lime-light: #cbe880;
  --soft: #f0f5ee;
  --secondary-text: #536358;
  --border: #dce6db;
  --card-shadow: 0 16px 45px rgba(6, 47, 32, .07);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--background);
}

body {
  margin: 0;
  color: var(--foreground);
  background: var(--background);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

button, input { font: inherit; }

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.app-shell, .join-shell { min-height: 100svh; }

.page-width, .topbar-inner {
  width: min(1200px, calc(100% - 60px));
  margin-inline: auto;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 19px;
}

.brand img { display: block; height: auto; }

.brand span {
  padding-left: 19px;
  border-left: 1px solid var(--border);
  color: var(--secondary-text);
  font-size: .875rem;
  font-weight: 650;
}

.header-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid #d5e4d7;
  border-radius: 11px;
  color: var(--primary);
  background: #f9fcf8;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 700;
  white-space: nowrap;
}

.header-link:hover { background: #eaf4e5; }

.setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.37fr) minmax(350px, 1fr);
  gap: 24px;
  padding-block: clamp(34px, 7vh, 76px);
}

.forum-hero {
  isolation: isolate;
  overflow: hidden;
  position: relative;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(31px, 4vw, 54px);
  border-radius: 26px;
  color: #fff;
  background: linear-gradient(112deg, var(--forest-deep), var(--primary));
  box-shadow: 0 20px 40px rgba(6, 47, 32, .14);
}

.forum-hero::before, .forum-hero::after {
  position: absolute;
  content: "";
  pointer-events: none;
  z-index: -1;
}

.forum-hero::before {
  inset: 0;
  background:
    linear-gradient(90deg, #063b25 0%, #063b25 27%, rgba(6, 59, 37, .91) 43%, rgba(6, 59, 37, .4) 72%, rgba(6, 59, 37, .13) 100%),
    linear-gradient(0deg, rgba(5, 39, 24, .8), rgba(5, 39, 24, .22) 60%),
    url('/ilim/pine.webp') center right / auto 115% no-repeat;
}

.forum-hero::after {
  width: 64%;
  height: 78%;
  right: -21%;
  top: -16%;
  opacity: .26;
  background: url('/ilim/constellation.webp') center / contain no-repeat;
  transform: rotate(12deg);
}

.hero-content, .hero-footer { position: relative; }

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 clamp(43px, 6vh, 63px);
  color: #e4efdc;
  font-size: .9rem;
  font-weight: 650;
}

.hero-kicker::before {
  content: "";
  width: 21px;
  height: 2px;
  background: var(--lime-light);
}

.forum-hero h1 {
  max-width: 10.8em;
  margin: 0;
  font-size: clamp(2.5rem, 4.22vw, 3.7rem);
  line-height: 1.04;
  letter-spacing: -.044em;
  font-weight: 760;
  text-wrap: balance;
}

.hero-slogan {
  display: inline-block;
  margin: 24px 0 0;
  padding: 0 0 8px;
  border-bottom: 2px solid rgba(203, 232, 128, .66);
  color: var(--lime-light);
  font-size: clamp(.94rem, 1.55vw, 1.22rem);
  font-weight: 780;
  letter-spacing: .022em;
  line-height: 1.35;
}

.hero-description {
  max-width: 35ch;
  margin: 25px 0 0;
  color: #f0f5ed;
  font-size: clamp(.99rem, 1.4vw, 1.13rem);
  line-height: 1.58;
}

.hero-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 33px;
  padding-top: 18px;
  border-top: 1px solid rgba(231, 247, 218, .34);
  color: #f3f8ef;
  font-size: .875rem;
  font-weight: 620;
}

.hero-footer span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero-footer svg { color: var(--lime-light); }

.setup-card, .qr-card, .live-card, .join-card {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
}

.setup-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: stretch;
  justify-content: center;
  padding: clamp(25px, 3.25vw, 42px);
  border-radius: 26px;
}

.card-icon {
  width: 51px;
  height: 51px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  background: #e7f2dd;
  border-radius: 14px;
  color: var(--primary);
}

.card-heading h2, .live-heading h2 {
  margin: 0;
  color: var(--forest-deep);
  font-size: 1.6rem;
  font-weight: 760;
  letter-spacing: -.034em;
  line-height: 1.16;
}

.card-heading p {
  margin: 7px 0 24px;
  color: var(--secondary-text);
  font-size: .98rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-block label, .code-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--forest-deep);
  font-size: .9rem;
  font-weight: 700;
}

.number-input { position: relative; }

.number-input input, .code-field input {
  width: 100%;
  height: 53px;
  padding: 0 11px;
  border: 1px solid #cfddd1;
  border-radius: 11px;
  color: var(--forest-deep);
  background: #fcfefb;
  font-size: 1.25rem;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.number-input input {
  padding-right: 41px;
  appearance: textfield;
}

.number-input input::-webkit-inner-spin-button,
.number-input input::-webkit-outer-spin-button { appearance: none; margin: 0; }

.number-input span {
  position: absolute;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  color: var(--secondary-text);
  font-size: .82rem;
  pointer-events: none;
}

.distribution-preview {
  margin: 18px 0 22px;
  padding: 13px 14px;
  border: 1px solid #e1ebde;
  border-radius: 13px;
  background: #f4f8f2;
}

.preview-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
  color: var(--secondary-text);
  font-size: .875rem;
  flex-wrap: wrap;
}

.preview-title strong {
  color: var(--forest-deep);
  font-weight: 700;
}

.team-dots {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.mini-team {
  flex: 0 0 47px;
  padding: 10px 0 2px;
  text-align: center;
}

.mini-team span, .team-number {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: white;
  font-weight: 750;
}

.mini-team span { margin-inline: auto; }

.mini-team small {
  display: block;
  margin-top: 4px;
  color: var(--secondary-text);
  font-size: .75rem;
}

.start-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 720;
  white-space: normal;
  cursor: pointer;
}

.start-button:hover:not(:disabled) { background: #005c30; }
.start-button:disabled { cursor: wait; opacity: .65; }

.privacy-note, .balance-note, .return-note {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  margin: 13px 0 0;
  color: #426553;
  font-size: .82rem;
  font-weight: 620;
}

.error-message {
  margin: 0 0 12px;
  color: #9e1930;
  font-size: .9rem;
  font-weight: 650;
}

.forum-caption {
  font-size: .86rem;
  line-height: 1.4;
}

.forum-caption p { margin: 0; }
.forum-caption p:first-child { color: var(--primary); font-weight: 800; letter-spacing: .035em; }
.forum-caption p:last-child { margin-top: 4px; font-size: .76rem; font-weight: 690; letter-spacing: .025em; }

.session-layout { padding-block: 34px 56px; }

.session-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 26px 32px;
  overflow: hidden;
  border-radius: 22px;
  background:
    linear-gradient(90deg, var(--forest-deep), rgba(4, 61, 38, .78)),
    url('/ilim/constellation.webp') center right / 28rem auto no-repeat,
    var(--forest);
  color: white;
}

.session-title .forum-caption p:first-child { color: #fff; }
.session-title .forum-caption p:last-child { color: var(--lime-light); }

.session-title h1 {
  margin: 14px 0 5px;
  font-size: clamp(2.05rem, 5vw, 3.5rem);
  line-height: 1.06;
  letter-spacing: -.045em;
  font-weight: 760;
}

.session-instruction { margin: 9px 0 0; color: #e4efdc; font-size: 1rem; }

.reset-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  gap: 8px;
  color: #fff;
  border-color: #a1bdac;
  border-style: solid;
  border-width: 1px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .07);
  font-size: .9rem;
  font-weight: 650;
  cursor: pointer;
}

.reset-button:hover { color: #fff; background: #246445; }
.reset-button:focus-visible { outline-color: #fff; }

.session-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  align-items: start;
  gap: 20px;
}

.qr-card, .live-card { border-radius: 22px; padding: 22px 25px; }

.qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qr-wrap {
  width: min(100%, 306px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--primary);
}

.qr-wrap svg { display: block; max-width: 100%; height: auto; }

.session-code {
  display: grid;
  gap: 4px;
  color: var(--secondary-text);
  font-size: .85rem;
}

.session-code strong {
  display: block;
  padding-left: .17em;
  color: var(--forest-deep);
  font-size: clamp(1.75rem, 5.5vw, 2.25rem);
  font-weight: 770;
  letter-spacing: .17em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.join-url {
  max-width: 100%;
  margin: 12px 0 0;
  color: var(--secondary-text);
  font-size: .81rem;
  overflow-wrap: anywhere;
  user-select: text;
}

.link-copy, .join-back {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 0 13px;
  border: 1px solid #d6e6d4;
  border-radius: 10px;
  color: var(--primary);
  background: #f1f7ef;
  font-size: .875rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.link-copy:hover, .join-back:hover { background: #e9f3e5; }

.copy-status { margin: 5px 0 0; color: var(--primary); font-size: .8rem; }
.copy-status:empty { display: none; }

.live-heading {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 15px;
}

.live-heading p { margin: 0; color: var(--secondary-text); font-size: .9rem; }
.live-heading strong { color: var(--primary); font-size: 1.2rem; }

.progress-track {
  width: 100%;
  height: 8px;
  display: block;
  overflow: hidden;
  margin: 16px 0 19px;
  border: 0;
  border-radius: 99px;
  background: #e4ede2;
  accent-color: var(--primary);
  appearance: none;
}

.progress-track::-webkit-progress-bar { background: #e4ede2; }
.progress-track::-webkit-progress-value { background: var(--primary); border-radius: 99px; }
.progress-track::-moz-progress-bar { background: var(--primary); border-radius: 99px; }

.team-list { display: grid; gap: 8px; max-height: 370px; overflow-y: auto; }

.team-row {
  min-height: 51px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 7px 11px;
  border: 1px solid #e4ede2;
  border-radius: 10px;
  background: #f8fbf7;
}

.team-name { font-weight: 670; }
.team-count { color: var(--forest-deep); font-variant-numeric: tabular-nums; font-weight: 750; }
.team-count small { color: var(--secondary-text); font-size: .82rem; font-weight: 630; }
.balance-note { justify-content: flex-start; }

.join-shell { background: radial-gradient(ellipse at 50% 35%, #e3f0da, var(--background) 36rem); }
.join-frame { width: min(450px, calc(100% - 30px)); margin-inline: auto; padding-block: 24px 42px; text-align: center; }
.join-frame > .forum-caption { margin-bottom: 19px; }

.join-card {
  padding: clamp(20px, 5.5vw, 31px);
  border-radius: 23px;
}

.join-card h1 {
  margin: 0;
  color: var(--forest-deep);
  font-size: clamp(1.45rem, 6vw, 1.86rem);
  font-weight: 760;
  letter-spacing: -.035em;
  line-height: 1.13;
}

.join-card > p:not(.error-message) {
  margin: 10px 0 0;
  color: var(--secondary-text);
  font-size: .98rem;
  line-height: 1.5;
}

.forum-mark { display: block; margin: 0 auto 20px; object-fit: contain; }

.code-field { margin: 22px 0 17px; text-align: start; }

.code-field input { text-transform: uppercase; text-align: center; font-size: 1.6rem; letter-spacing: .15em; }
.code-field input[aria-invalid="true"], .number-input input[aria-invalid="true"] { border-color: #a42634; }

.join-error .start-button { margin-top: 21px; }

.number-machine {
  width: 110px;
  height: 110px;
  display: grid;
  place-items: center;
  margin: 10px auto 23px;
  border-radius: 24px;
  color: #fff;
  font-size: 3.75rem;
  font-weight: 790;
  font-variant-numeric: tabular-nums;
}

.result-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 9px;
  min-height: 237px;
  margin-bottom: 23px;
  padding: 18px 12px;
  border-radius: 17px;
  color: #fff;
  animation: result-arrive .36s ease-out both;
}

.result-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: url('/ilim/constellation.webp') right -86px top -15px / 270px auto no-repeat;
  opacity: .32;
}

.result-card p { margin: 0; font-size: 1.05rem; font-weight: 690; }

.result-card strong {
  padding-right: .04em;
  font-weight: 800;
  font-size: clamp(5.75rem, 29vw, 7.4rem);
  line-height: .91;
  letter-spacing: -.055em;
  font-variant-numeric: tabular-nums;
}

.result-check {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-top: 4px;
  color: var(--forest-deep);
  background: var(--lime-light);
  border-radius: 50%;
}

.join-card > .return-note:not(.error-message) {
  color: var(--primary);
  font-size: .85rem;
  font-weight: 690;
}

@keyframes result-arrive { from { opacity: .6; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 860px) {
  .setup-layout { grid-template-columns: minmax(0, 1fr); max-width: 620px; gap: 17px; }
  .forum-hero { min-height: 0; }
  .forum-hero h1 { font-size: clamp(2.4rem, 7.4vw, 3.5rem); }
  .hero-kicker { margin-bottom: 28px; }
  .session-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 530px) {
  .page-width, .topbar-inner { width: calc(100% - 28px); }
  .topbar-inner { min-height: 63px; gap: 8px; }
  .brand { gap: 8px; }
  .brand img { width: 75px; }
  .brand span { padding-left: 8px; font-size: .72rem; }
  .header-link { gap: 5px; padding-inline: 8px; font-size: .79rem; }
  .header-link svg { width: 14px; }
  .setup-layout { padding-block: 14px 29px; }
  .forum-hero, .setup-card { border-radius: 19px; padding: 22px; }
  .forum-hero h1 { font-size: clamp(1.78rem, 8.4vw, 2.75rem); }
  .hero-kicker { margin-bottom: 22px; font-size: .84rem; }
  .hero-slogan { margin-top: 16px; }
  .hero-description { margin-top: 17px; }
  .hero-footer { margin-top: 21px; font-size: .82rem; gap: 8px 16px; }
  .hero-footer svg { width: 15px; }
  .session-layout { padding-block: 14px 26px; }
  .session-title { flex-direction: column; align-items: flex-start; padding: 21px 18px; gap: 13px; }
  .qr-card, .live-card { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .result-card { animation: none; }
}
