:root {
  color-scheme: light;
  --ink: #20242d;
  --muted: #66716c;
  --paper: #f3f8f5;
  --panel: #ffffff;
  --line: #dce6e1;
  --line-strong: #c9d8d1;
  --teal: #0b8a75;
  --teal-strong: #066654;
  --teal-soft: #e2f6ef;
  --coral: #f4514b;
  --coral-strong: #d63d38;
  --coral-soft: #fff0ef;
  --blue: #3167df;
  --blue-soft: #edf2ff;
  --yellow: #f5b91b;
  --yellow-soft: #fff7d9;
  --plum: #9146b7;
  --plum-soft: #f6edfb;
  --warn: #97580b;
  --danger: #b42318;
  --shadow: 0 14px 34px rgba(30, 52, 43, 0.08);
  --shadow-soft: 0 6px 18px rgba(30, 52, 43, 0.07);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--paper);
}

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

button,
input,
textarea,
select {
  font: inherit;
}

button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--teal);
  box-shadow: 0 3px 0 var(--teal-strong);
  color: white;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

button:hover {
  background: var(--teal-strong);
  transform: translateY(-1px);
}

button:active {
  box-shadow: 0 1px 0 var(--teal-strong);
  transform: translateY(2px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  stroke-width: 2.4;
  transition: transform 180ms ease;
}

button:hover svg {
  transform: rotate(-4deg) scale(1.08);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(49, 103, 223, 0.32);
  outline-offset: 2px;
}

input,
textarea,
select {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #aebfb7;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(49, 103, 223, 0.1);
}

textarea {
  resize: vertical;
}

label {
  display: block;
  margin-bottom: 7px;
  color: #4d5b55;
  font-size: 0.86rem;
  font-weight: 800;
}

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

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

h3 {
  margin-bottom: 10px;
  font-size: 1rem;
  line-height: 1.3;
}

.shell {
  display: grid;
  grid-template-columns: minmax(400px, 0.78fr) minmax(560px, 1.22fr);
  min-height: 100vh;
  max-width: 1540px;
  margin: 0 auto;
  background: var(--panel);
  box-shadow: 0 0 0 1px rgba(32, 36, 45, 0.04);
}

.brand-panel {
  position: sticky;
  top: 0;
  display: flex;
  min-height: 100vh;
  max-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 34px;
  background: #fbf8f4;
}

.brand-panel::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 1px solid rgba(32, 36, 45, 0.06);
  content: "";
  pointer-events: none;
}

.brand-art {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 63% center;
  animation: art-arrive 900ms cubic-bezier(0.2, 0.85, 0.28, 1) both;
}

.brand-copy,
.join-card {
  position: relative;
  z-index: 2;
}

.ambient-jellies {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-jelly {
  position: absolute;
  display: block;
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 8px 8px rgba(32, 36, 45, 0.16));
  animation: ambient-jelly-drift 5.8s ease-in-out infinite alternate;
}

.ambient-jelly:nth-child(1) {
  top: 8%;
  right: 10%;
  width: 48px;
  height: 48px;
  animation-delay: -1.2s;
}

.ambient-jelly:nth-child(2) {
  top: 38%;
  right: 4%;
  width: 66px;
  height: 66px;
  animation-delay: -3.8s;
  animation-duration: 7.2s;
}

.ambient-jelly:nth-child(3) {
  right: 27%;
  bottom: 19%;
  width: 42px;
  height: 42px;
  animation-delay: -2.4s;
  animation-duration: 6.4s;
}

.ambient-jelly:nth-child(4) {
  bottom: 10%;
  left: 9%;
  width: 52px;
  height: 52px;
  animation-delay: -4.7s;
  animation-duration: 7.6s;
}

.brand-copy {
  max-width: 410px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--teal-strong);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-spark {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(180, 126, 0, 0.3);
  border-radius: 8px;
  background: var(--yellow);
  box-shadow: 0 4px 0 #ca8f00;
  color: #4a3600;
  animation: sparkle-in 700ms 250ms cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}

.brand-spark svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.5;
}

.brand-copy h1 {
  margin-bottom: 12px;
  color: #20242d;
  font-size: 4.45rem;
  line-height: 0.92;
  letter-spacing: 0;
}

.tagline {
  margin-bottom: 16px;
  color: #26332e;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.04;
}

.lede {
  max-width: 340px;
  color: #53615b;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.55;
}

.join-card {
  width: min(100%, 490px);
  border: 1px solid rgba(32, 36, 45, 0.12);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow:
    0 10px 28px rgba(32, 36, 45, 0.13),
    0 3px 0 rgba(32, 36, 45, 0.08);
  backdrop-filter: blur(14px);
}

.join-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 15px;
}

.host-auth-panel {
  max-width: 620px;
  margin: 0 auto;
}

.field-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.text-action {
  min-height: 36px;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: var(--teal-strong);
}

.text-action:hover {
  background: transparent;
  box-shadow: none;
  color: var(--blue);
}

.host-account-bar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 40px;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #f8fcfa;
}

.host-account-identity,
.credit-meter {
  display: flex;
  min-width: 0;
  gap: 10px;
  align-items: center;
}

.host-account-identity div,
.credit-meter div {
  display: grid;
  min-width: 0;
}

.host-account-identity strong,
.host-account-identity span,
.credit-meter span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.host-account-identity span,
.credit-meter div span {
  color: var(--muted);
  font-size: 0.76rem;
}

.host-avatar,
.credit-icon {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 900;
}

.host-avatar {
  background: var(--plum-soft);
  color: var(--plum);
}

.credit-icon {
  background: var(--yellow-soft);
  color: #7b5900;
}

.credit-icon svg {
  width: 19px;
}

.credit-meter strong {
  font-size: 1.12rem;
}

.icon-action {
  width: 40px;
  min-height: 40px;
  padding: 0;
}

.host-account-menu {
  position: absolute;
  z-index: 10;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  width: min(270px, calc(100vw - 48px));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
  box-shadow: var(--shadow);
}

.host-account-menu button {
  width: 100%;
}

.danger-text {
  color: var(--danger);
}

body.has-join-context .host-account-bar {
  display: none;
}

.join-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.join-kicker {
  margin: 0 0 2px;
  color: var(--coral-strong);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.join-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.join-code-input {
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.join-button {
  min-width: 112px;
  border-color: #a92825;
  background: var(--coral-strong);
  box-shadow:
    0 4px 0 #a92825,
    0 9px 18px rgba(214, 61, 56, 0.24);
}

.join-button:hover {
  background: #bd302c;
  box-shadow:
    0 4px 0 #92231f,
    0 11px 22px rgba(214, 61, 56, 0.3);
}

.join-button:active {
  box-shadow: 0 1px 0 #92231f;
}

.join-button-icon {
  display: inline-flex;
  width: 27px;
  height: 27px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--yellow);
  color: #493500;
}

.join-button-icon svg {
  width: 16px;
  height: 16px;
}

body.has-join-context .join-card,
body.has-join-context #back-to-games,
body.has-join-context .tabs {
  display: none;
}

body.has-join-context .workspace {
  background: #f7f9fb;
}

body.has-join-context .game-details-header {
  min-height: 68px;
  justify-content: flex-start;
  border-bottom-color: #d8e1dc;
  background: rgba(255, 255, 255, 0.96);
}

body.has-join-context .selected-game .icon-tile {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  box-shadow: none;
}

body.has-join-context .selected-game-kicker {
  color: var(--teal-strong);
}

body.has-join-context #participant-view {
  min-height: calc(100vh - 68px);
  padding: clamp(18px, 3vw, 36px);
  background: #f7f9fb;
}

body.has-join-context #participant-view > .stack {
  max-width: 780px;
  margin: 0 auto;
}

.workspace {
  min-width: 0;
  min-height: 100vh;
  border-left: 1px solid var(--line);
  background: #ffffff;
}

.game-picker {
  padding: 36px 32px;
}

.game-picker-header {
  max-width: 600px;
  margin-bottom: 28px;
}

.game-picker-header .eyebrow {
  margin-bottom: 16px;
}

.game-picker-header h2 {
  margin-bottom: 8px;
  font-size: 2.35rem;
}

.game-picker-header > .muted {
  font-size: 1.02rem;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.game-card {
  display: grid;
  min-width: 0;
  min-height: 410px;
  overflow: hidden;
  align-content: start;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0;
  background: white;
  box-shadow:
    0 5px 0 #d9e2de,
    var(--shadow-soft);
  color: var(--ink);
  text-align: left;
}

.game-card:hover {
  border-color: var(--teal);
  background: white;
  box-shadow:
    0 7px 0 #bed8ce,
    var(--shadow);
  color: var(--ink);
  transform: translateY(-2px);
}

.game-card:active {
  box-shadow: 0 2px 0 #bed8ce;
}

.game-card-visual {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #fbf8f4;
}

.game-card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% center;
  transition: transform 280ms ease;
}

.game-card:hover .game-card-visual img {
  transform: scale(1.035);
}

.game-card[data-game-type="vote-best-phrase"] .game-card-visual img {
  object-position: 92% center;
}

.game-card-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(32, 36, 45, 0.1);
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 3px 0 rgba(32, 36, 45, 0.12);
  color: var(--teal-strong);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.game-card[data-game-type="vote-best-phrase"] .game-card-badge {
  color: var(--plum);
}

.game-card-badge svg {
  width: 15px;
  height: 15px;
}

.game-card-body {
  display: grid;
  min-width: 0;
  gap: 9px;
  padding: 18px;
}

.game-card-title {
  font-size: 1.28rem;
  font-weight: 900;
}

.game-card-summary {
  display: block;
  min-height: 48px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.45;
}

.game-card-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--teal-strong);
  font-weight: 900;
}

.game-card[data-game-type="vote-best-phrase"] .game-card-action {
  color: var(--plum);
}

.game-card-action svg {
  width: 17px;
  height: 17px;
}

.game-details-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 12px 24px;
  background: var(--paper);
}

.selected-game {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.selected-game strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-game-kicker {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tabs {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 66px;
  border-bottom: 1px solid var(--line);
  padding: 10px 20px 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.tab {
  position: relative;
  flex: 1;
  border: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}

.tab::after {
  position: absolute;
  right: 20px;
  bottom: -1px;
  left: 20px;
  height: 4px;
  border-radius: 4px 4px 0 0;
  background: transparent;
  content: "";
}

.tab:hover {
  background: var(--paper);
  color: var(--ink);
  transform: none;
}

.tab:active {
  box-shadow: none;
  transform: none;
}

.tab.is-active {
  color: var(--ink);
}

.tab.is-active::after {
  background: var(--coral);
}

.tab[data-view="participant"].is-active::after {
  background: var(--blue);
}

.view {
  display: none;
  min-width: 0;
  padding: 24px;
}

.view.is-active {
  display: block;
  animation: view-in 320ms ease-out both;
}

.stack {
  display: grid;
  gap: 18px;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

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

.session-launch {
  grid-template-columns: minmax(0, 1.45fr) minmax(190px, 0.55fr);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: white;
  box-shadow: var(--shadow-soft);
}

.launch-panel {
  border-top: 4px solid var(--coral);
}

.room-console {
  border-top: 4px solid var(--teal);
}

.participant-console {
  border-top: 4px solid var(--blue);
}

.participant-join {
  position: relative;
  display: grid;
  gap: 26px;
  overflow: hidden;
  border: 1px solid #d7dfeb;
  border-top: 4px solid var(--blue);
  border-radius: 8px;
  padding: clamp(24px, 4vw, 38px);
  background: white;
  box-shadow: 0 18px 42px rgba(35, 52, 80, 0.09);
}

.participant-join-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 16px;
  align-items: center;
}

.participant-join-intro h2,
.participant-join-intro p {
  grid-column: 1 / -1;
}

.participant-join-intro h2 {
  max-width: 620px;
  margin: 4px 0 0;
  color: var(--ink);
  font-size: clamp(1.8rem, 4vw, 2.35rem);
  line-height: 1.08;
}

.participant-join-intro p {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.participant-join-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.participant-join-kicker .icon-tile {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border-color: #c7d5f7;
  box-shadow: none;
}

.participant-join-kicker .icon-tile svg {
  width: 18px;
  height: 18px;
}

.participant-join-form {
  display: grid;
  gap: 20px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.participant-join-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.participant-join-form input {
  min-height: 52px;
  border-color: #bcc9d8;
  background: #fbfcfe;
}

.participant-join-button {
  min-width: 190px;
  width: fit-content;
  justify-self: start;
  padding: 0 13px 0 20px;
}

.participant-game-overview,
.participant-input-panel,
.participant-section {
  border: 1px solid #dce3e9;
  border-radius: 8px;
  background: white;
}

.participant-game-overview {
  border-top: 4px solid var(--blue);
  padding: 22px;
  box-shadow: 0 12px 30px rgba(35, 52, 80, 0.07);
}

.participant-input-panel {
  border-color: #cbd8f5;
  padding: 14px;
  background: var(--blue-soft);
}

.participant-input-panel .phrase-form input {
  min-height: 52px;
  border-color: #aebfea;
}

.participant-input-panel .phrase-form button {
  min-width: 124px;
  box-shadow: 0 7px 16px rgba(49, 103, 223, 0.24);
}

.participant-section {
  padding: 18px;
}

.participant-section-recent {
  border-top: 3px solid var(--coral);
}

.participant-section-leaderboard {
  border-top: 3px solid var(--yellow);
}

.participant-section-vote {
  border-top: 3px solid var(--plum);
}

.participant-section .icon-tile {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  box-shadow: none;
}

.participant-section .icon-tile svg {
  width: 18px;
  height: 18px;
}

.participant-console .score-grid {
  gap: 8px;
  overflow: visible;
  border: 0;
  background: transparent;
}

.participant-console .score-stat {
  border: 1px solid #ccd8f2;
  border-radius: 8px;
  background: var(--blue-soft);
}

.participant-console .score-stat:nth-child(2) {
  border-color: #ead795;
  background: var(--yellow-soft);
}

.section-heading {
  display: flex;
  gap: 12px;
  align-items: center;
}

.section-heading h2,
.section-heading h3,
.section-heading p {
  margin-bottom: 0;
}

.section-heading-copy {
  min-width: 0;
}

.section-heading-copy .muted {
  margin: 4px 0 0;
}

.panel:not(.stack) > .section-heading {
  margin-bottom: 16px;
}

.icon-tile {
  display: inline-flex;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(32, 36, 45, 0.13);
  border-radius: 8px;
  background: var(--teal-soft);
  box-shadow: 0 4px 0 rgba(32, 36, 45, 0.14);
  color: var(--teal-strong);
}

.icon-tile svg {
  width: 21px;
  height: 21px;
  stroke-width: 2.35;
}

.icon-tile-coral {
  background: var(--coral-soft);
  color: var(--coral-strong);
}

.icon-tile-blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.icon-tile-yellow {
  background: var(--yellow-soft);
  color: #7b5700;
}

.icon-tile-plum {
  background: var(--plum-soft);
  color: var(--plum);
}

.field {
  min-width: 0;
}

.primary-action {
  width: 100%;
  background: var(--coral-strong);
  box-shadow: 0 4px 0 #a92825;
}

.primary-action:hover {
  background: #bd302c;
}

.participant-join-form .participant-join-button {
  box-shadow: 0 8px 20px rgba(214, 61, 56, 0.22);
}

.participant-join-form .participant-join-button:hover {
  box-shadow: 0 10px 24px rgba(214, 61, 56, 0.28);
}

.participant-join-form .participant-join-button:active {
  box-shadow: 0 4px 10px rgba(214, 61, 56, 0.2);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.toolbar + .muted {
  margin-top: 14px;
}

.toolbar-heading {
  justify-content: space-between;
}

.toolbar-heading h2 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--teal-soft);
  color: var(--teal-strong);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-pill::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-live::before {
  animation: status-pop 650ms ease-out 3;
}

.status-ended,
.status-archived {
  background: #eff1f0;
  color: #5e6964;
}

.status-paused {
  background: var(--yellow-soft);
  color: var(--warn);
}

.game-timer {
  display: inline-flex;
  width: fit-content;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  margin: 0;
  border: 1px solid #9fd9c4;
  border-radius: 8px;
  padding: 7px 11px;
  background: var(--teal-soft);
  color: var(--teal-strong);
  font-weight: 900;
}

.game-timer svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
}

.game-timer-player {
  border-color: #b8cafa;
  background: var(--blue-soft);
  color: var(--blue);
}

.timer-value {
  min-width: 8.5ch;
  font-variant-numeric: tabular-nums;
}

.game-timer.is-paused {
  border-color: #efd18b;
  background: var(--yellow-soft);
  color: var(--warn);
}

.game-timer.is-urgent {
  border-color: #ffb5b0;
  background: var(--coral-soft);
  color: var(--coral-strong);
  animation: timer-urgent 650ms ease-out 3;
}

.celebration-layer {
  position: fixed;
  z-index: 1000;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.jelly-floater {
  position: absolute;
  bottom: -90px;
  left: var(--jelly-left);
  display: block;
  width: var(--jelly-size);
  height: var(--jelly-size);
  animation: jelly-rise var(--jelly-duration) var(--jelly-delay) cubic-bezier(0.2, 0.72, 0.28, 1)
    forwards;
  will-change: transform, opacity;
}

.jelly-piece {
  --jelly-main: var(--coral);
  --jelly-light: #ff9692;
  --jelly-dark: var(--coral-strong);
  --jelly-glow: rgba(244, 81, 75, 0.3);
  position: relative;
  display: block;
  width: 100%;
  height: 86%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 46% 46% 38% 38% / 36% 36% 58% 58%;
  background:
    radial-gradient(circle at 28% 21%, rgba(255, 255, 255, 0.95) 0 7%, transparent 8%),
    linear-gradient(145deg, var(--jelly-light) 0 18%, var(--jelly-main) 48%, var(--jelly-dark) 100%);
  box-shadow:
    inset 5px 4px 8px rgba(255, 255, 255, 0.36),
    inset -5px -7px 8px rgba(65, 26, 33, 0.15),
    0 9px 14px var(--jelly-glow);
  transform-origin: center bottom;
  animation: jelly-wobble 720ms ease-in-out infinite alternate;
}

.jelly-piece::after {
  position: absolute;
  inset: 13% 18% 9%;
  border-right: 2px solid rgba(255, 255, 255, 0.23);
  border-left: 2px solid rgba(255, 255, 255, 0.26);
  border-radius: inherit;
  content: "";
}

.jelly-yellow {
  --jelly-main: var(--yellow);
  --jelly-light: #ffd95f;
  --jelly-dark: #d89300;
  --jelly-glow: rgba(245, 185, 27, 0.3);
}

.jelly-blue {
  --jelly-main: var(--blue);
  --jelly-light: #75a0ff;
  --jelly-dark: #214cb3;
  --jelly-glow: rgba(49, 103, 223, 0.28);
}

.jelly-plum {
  --jelly-main: var(--plum);
  --jelly-light: #c381e3;
  --jelly-dark: #6f2e91;
  --jelly-glow: rgba(145, 70, 183, 0.28);
}

.jelly-teal {
  --jelly-main: var(--teal);
  --jelly-light: #59c9b4;
  --jelly-dark: var(--teal-strong);
  --jelly-glow: rgba(11, 138, 117, 0.28);
}

.jelly-milestone {
  position: absolute;
  top: clamp(92px, 17vh, 170px);
  left: 50%;
  display: flex;
  min-width: min(330px, calc(100vw - 32px));
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 2px solid var(--yellow);
  border-radius: 8px;
  padding: 16px 22px;
  background: white;
  box-shadow:
    0 7px 0 var(--blue),
    0 18px 44px rgba(32, 36, 45, 0.22);
  color: var(--ink);
  animation: milestone-pop 520ms cubic-bezier(0.2, 0.9, 0.3, 1.22) both;
}

.jelly-milestone strong,
.jelly-milestone small {
  display: block;
  letter-spacing: 0;
}

.jelly-milestone strong {
  font-size: 1.45rem;
  line-height: 1.05;
}

.jelly-milestone small {
  margin-top: 3px;
  color: var(--coral-strong);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.milestone-jellies {
  position: relative;
  display: block;
  width: 76px;
  height: 54px;
  flex: 0 0 76px;
}

.milestone-jellies .jelly-piece {
  position: absolute;
  width: 38px;
  height: 38px;
}

.milestone-jellies .jelly-piece:nth-child(1) {
  z-index: 2;
  bottom: 0;
  left: 0;
  transform: rotate(-10deg);
}

.milestone-jellies .jelly-piece:nth-child(2) {
  z-index: 1;
  top: 0;
  left: 20px;
}

.milestone-jellies .jelly-piece:nth-child(3) {
  z-index: 3;
  right: 0;
  bottom: 2px;
  transform: rotate(9deg);
}

.display-timer {
  margin: 16px 0;
  font-size: 1.12rem;
}

.room-label {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.code {
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  border: 2px dashed var(--teal);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--teal-soft);
  color: var(--teal-strong);
  font-size: 1.85rem;
  font-weight: 900;
}

.qr {
  display: block;
  width: min(100%, 220px);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: white;
  box-shadow: 0 5px 0 #dbe8e2;
}

.qr-wrap {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 10px;
}

.qr-wrap p {
  margin: 0;
}

.join-link {
  min-width: 0;
  font-size: 0.82rem;
}

.room-display {
  display: none;
}

.room-display.is-open {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 24px;
  overflow: auto;
  padding: 28px;
  background: #fbf8f4;
}

.display-art {
  position: fixed;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.72;
}

.display-toolbar {
  display: flex;
  position: relative;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.display-content {
  display: grid;
  position: relative;
  grid-template-columns: minmax(260px, 1fr) minmax(360px, 0.9fr);
  gap: 48px;
  align-items: center;
  width: min(1120px, 100%);
  margin: 0 auto;
}

.display-content h1 {
  max-width: 720px;
  margin-bottom: 20px;
  font-size: 3.5rem;
  line-height: 1;
}

.display-copy {
  border-left: 8px solid var(--coral);
  padding: 20px 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.display-url {
  max-width: 720px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 1.05rem;
}

.display-join {
  display: grid;
  justify-items: center;
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  text-align: center;
}

.display-qr {
  display: block;
  width: min(100%, 360px);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.display-code {
  display: inline-block;
  color: var(--teal-strong);
  font-size: 3rem;
  font-weight: 900;
}

body.is-presenting {
  overflow: hidden;
}

body.is-presenting .view.is-active {
  animation: none;
  transform: none;
}

body.is-presenting .brand-panel,
body.is-presenting .workspace > .tabs,
body.is-presenting .view > .stack {
  visibility: hidden;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.metric-card {
  display: grid;
  min-width: 0;
  gap: 4px;
  justify-items: start;
  padding: 14px;
  background: white;
}

.metric-card strong {
  color: var(--ink);
  font-size: 1.55rem;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.score-stat {
  padding: 14px;
  background: white;
}

.score-stat strong {
  display: block;
  margin-bottom: 2px;
  color: var(--blue);
  font-size: 1.8rem;
}

.score-stat p {
  margin: 0;
}

.metric-row,
.leaderboard-row,
.activity-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.leaderboard-row {
  padding: 6px 0;
}

.leaderboard-rank {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--yellow-soft);
  color: #6d4e00;
}

.leaderboard-row:first-child .leaderboard-rank {
  background: var(--yellow);
  box-shadow: 0 3px 0 #ce9300;
}

.leaderboard-score {
  color: var(--teal-strong);
  font-weight: 900;
}

.leaderboard-row:last-child,
.activity-row:last-child {
  border-bottom: 0;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.history-row:last-child {
  border-bottom: 0;
}

.history-row p {
  margin: 3px 0 0;
}

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

.notice,
.error,
.success {
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 8px;
  padding: 12px;
}

.notice {
  border: 1px solid #efd18b;
  background: #fff9e7;
  color: var(--warn);
}

.error {
  border: 1px solid #ffc9c4;
  background: #fff3f1;
  color: var(--danger);
}

.success {
  border: 1px solid #9fd9c4;
  background: var(--teal-soft);
  color: var(--teal-strong);
  font-weight: 900;
  animation: success-pop 520ms cubic-bezier(0.2, 0.85, 0.3, 1.2) both;
}

.notice svg,
.error svg,
.success svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.ghost {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  background: white;
  box-shadow: 0 3px 0 #d9e2de;
  color: var(--ink);
  font-weight: 800;
}

.ghost:hover {
  background: var(--paper);
  color: var(--ink);
}

.danger {
  background: var(--danger);
  box-shadow: 0 3px 0 #7f1811;
}

.danger:hover {
  background: #8e1b12;
}

.phrase-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.phrase-form button {
  background: var(--blue);
  box-shadow: 0 3px 0 #1f47a6;
}

.phrase-form button:hover {
  background: #2453be;
}

.entry-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  animation: item-in 260ms ease-out both;
}

.entry-actions {
  display: flex;
  gap: 6px;
}

.entry-action-button {
  position: relative;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  flex: 0 0 36px;
  border: 1px solid #c8d4ee;
  border-radius: 8px;
  padding: 0;
  background: var(--blue-soft);
  box-shadow: none;
  color: #2453be;
}

.entry-action-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.entry-action-button:hover {
  background: #dfe8ff;
  box-shadow: none;
  color: #183f99;
  transform: translateY(-1px);
}

.entry-action-button:hover svg {
  transform: none;
}

.entry-action-delete {
  border-color: #f2c5c2;
  background: var(--coral-soft);
  color: var(--danger);
}

.entry-action-delete:hover {
  background: #ffe1df;
  color: #8e1b12;
}

.entry-action-button::after {
  position: absolute;
  z-index: 30;
  right: 0;
  bottom: calc(100% + 7px);
  width: max-content;
  max-width: 120px;
  border-radius: 6px;
  padding: 5px 7px;
  background: var(--ink);
  color: white;
  content: attr(data-tooltip);
  font-size: 0.72rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.entry-action-button:hover::after,
.entry-action-button:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.entry-row.is-rejected {
  border-color: #ffc9c4;
  background: #fff3f1;
  color: var(--danger);
}

.status-note {
  display: inline-flex;
  margin-left: 6px;
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.empty-state .icon-tile {
  width: 58px;
  height: 58px;
}

.empty-state .icon-tile svg {
  width: 28px;
  height: 28px;
}

.empty-state h2,
.empty-state p {
  max-width: 420px;
  margin-bottom: 0;
}

@keyframes art-arrive {
  from {
    opacity: 0;
    transform: scale(1.035) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes sparkle-in {
  from {
    opacity: 0;
    transform: rotate(-12deg) scale(0.6);
  }

  to {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes item-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes success-pop {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }

  70% {
    transform: translateY(0) scale(1.01);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes status-pop {
  50% {
    opacity: 0.45;
    transform: scale(0.75);
  }
}

@keyframes timer-urgent {
  50% {
    transform: scale(1.035);
  }
}

@keyframes ambient-jelly-drift {
  from {
    transform: translate3d(-6px, -10px, 0) rotate(-7deg);
  }

  to {
    transform: translate3d(10px, 15px, 0) rotate(9deg);
  }
}

@keyframes jelly-rise {
  0% {
    opacity: 0;
    transform: translate3d(-50%, 0, 0) rotate(0);
  }

  12% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate3d(calc(-50% + var(--jelly-drift)), -115vh, 0)
      rotate(var(--jelly-spin));
  }
}

@keyframes jelly-wobble {
  from {
    transform: scaleX(1.03) scaleY(0.97) rotate(-3deg);
  }

  to {
    transform: scaleX(0.96) scaleY(1.05) rotate(3deg);
  }
}

@keyframes milestone-pop {
  from {
    opacity: 0;
    transform: translate(-50%, 18px) scale(0.86);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@media (max-width: 1060px) {
  .shell {
    grid-template-columns: minmax(340px, 0.7fr) minmax(500px, 1.3fr);
  }

  .brand-copy h1 {
    font-size: 3.55rem;
  }

  .tagline {
    font-size: 1.7rem;
  }

  .brand-panel {
    padding: 26px;
  }

  .grid-three {
    grid-template-columns: 1fr;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    position: relative;
    min-height: 500px;
    max-height: none;
  }

  .brand-art {
    object-position: 68% center;
  }

  .brand-copy {
    max-width: 52%;
  }

  .brand-copy h1 {
    font-size: 3.25rem;
  }

  .tagline {
    font-size: 1.55rem;
  }

  .lede {
    font-size: 0.96rem;
  }

  .join-card {
    width: min(100%, 520px);
  }

  .workspace {
    min-height: 680px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

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

  body.has-join-context .brand-panel {
    min-height: 160px;
    max-height: 160px;
    justify-content: flex-start;
    padding: 18px 20px;
  }

  body.has-join-context .brand-art {
    object-position: 70% 54%;
  }

  body.has-join-context .brand-copy {
    max-width: 68%;
  }

  body.has-join-context .brand-copy .eyebrow {
    margin-bottom: 12px;
  }

  body.has-join-context .brand-copy h1 {
    margin-bottom: 0;
    font-size: 2.65rem;
  }

  body.has-join-context .tagline,
  body.has-join-context .lede {
    display: none;
  }
}

@media (max-width: 640px) {
  .host-account-bar {
    grid-template-columns: minmax(0, 1fr) 40px;
  }

  .credit-meter {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .host-account-identity {
    grid-column: 1;
    grid-row: 1;
  }

  .host-account-identity strong {
    white-space: normal;
  }

  .host-account-identity span {
    display: none;
  }

  .host-account-bar > .icon-action {
    grid-column: 2;
    grid-row: 1;
  }

  .brand-panel {
    min-height: 490px;
    padding: 22px 18px;
  }

  .brand-art {
    object-position: 71% center;
    opacity: 0.58;
  }

  .brand-copy {
    max-width: 76%;
  }

  .brand-copy h1 {
    font-size: 3rem;
  }

  .tagline {
    font-size: 1.45rem;
  }

  .lede {
    display: none;
  }

  .join-card {
    padding: 14px;
  }

  .ambient-jelly:nth-child(2),
  .ambient-jelly:nth-child(4) {
    display: none;
  }

  .join-heading {
    margin-bottom: 12px;
  }

  .tabs {
    min-height: 62px;
    padding: 8px 10px 0;
  }

  .game-picker {
    padding: 26px 16px 34px;
  }

  .game-picker-header {
    margin-bottom: 22px;
  }

  .game-picker-header h2 {
    font-size: 2rem;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .game-card {
    min-height: 370px;
  }

  .game-card-visual {
    height: 196px;
  }

  .game-details-header {
    min-height: 70px;
    padding: 10px 12px;
  }

  .selected-game .icon-tile {
    display: none;
  }

  .view {
    padding: 16px 12px 28px;
  }

  .grid-two,
  .session-launch,
  .phrase-form,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    gap: 0;
  }

  .metric-card {
    border-bottom: 1px solid var(--line);
  }

  .metric-card:last-child {
    border-bottom: 0;
  }

  .panel {
    padding: 15px;
  }

  .entry-row,
  .history-row,
  .activity-row {
    grid-template-columns: 1fr;
  }

  .activity-row {
    gap: 6px;
    padding: 10px 0;
  }

  .activity-row > .toolbar {
    justify-content: space-between;
  }

  .entry-actions {
    width: 100%;
  }

  .entry-actions button {
    flex: 1;
  }

  .entry-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .entry-actions {
    width: auto;
    justify-content: flex-end;
  }

  .entry-actions .entry-action-button {
    flex: 0 0 36px;
  }

  .participant-join-fields {
    grid-template-columns: 1fr;
  }

  .participant-join {
    gap: 22px;
    padding: 22px 18px;
  }

  .participant-join-button {
    width: 100%;
  }

  body.has-join-context .brand-panel {
    min-height: 150px;
    max-height: 150px;
  }

  body.has-join-context .game-details-header {
    min-height: 62px;
  }

  body.has-join-context #participant-view {
    min-height: calc(100vh - 62px);
    padding: 16px 12px 30px;
  }

  .room-display.is-open {
    padding: 18px;
  }

  .display-content {
    grid-template-columns: 1fr;
    gap: 24px;
    align-content: start;
  }

  .display-content h1 {
    font-size: 2.25rem;
  }

  .display-qr {
    width: min(100%, 280px);
  }

  .display-code {
    font-size: 2.25rem;
  }
}

@media (max-width: 390px) {
  .brand-copy {
    max-width: 88%;
  }

  .brand-copy h1 {
    font-size: 2.65rem;
  }

  .join-heading {
    display: none;
  }

  .toolbar > button {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .brand-art,
  .brand-spark,
  .ambient-jelly,
  .jelly-floater,
  .jelly-piece,
  .jelly-milestone,
  .view.is-active,
  .entry-row,
  .success,
  .status-live::before {
    animation-name: none;
  }

  .game-timer.is-urgent {
    animation-name: none;
  }

  button:hover,
  button:active,
  button:hover svg {
    transform: none;
  }
}
