/*
  Shared web-wrapper styles for the review shell, free-play server launcher,
  debug tools, and production-shaped room entry page.
*/
:root {
  color-scheme: dark;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #151515;
  color: #f4efe6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #151515;
}

.paid-client-body {
  display: grid;
  min-height: 100vh;
  background: #0e0e0e;
}

.paid-client-shell {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
}

.paid-client-shell > .build-version {
  display: none;
}

.paid-game-frame {
  width: 100%;
  height: 100vh;
  border: 0;
  background: #0e0e0e;
}

.paid-game-frame[hidden] {
  display: none;
}

.paid-client-message {
  align-self: center;
  justify-self: center;
  display: grid;
  gap: 16px;
  width: min(420px, calc(100% - 32px));
  padding: 32px;
  border: 1px solid #4a4a4a;
  color: #f4f4f4;
  background: #171717;
  text-align: center;
}

.paid-client-message[hidden] {
  display: none;
}

.paid-client-message h1 {
  margin: 0;
  font-size: 1.5rem;
}

.paid-client-message p {
  margin: 0;
  color: #c7c7c7;
}

.paid-client-message .paid-client-hint {
  min-height: 1.45em;
  color: #f3c66d;
  font-size: 0.82rem;
}

.paid-client-button,
.paid-client-secondary-action {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid #f4f4f4;
  border-radius: 0;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.paid-client-button {
  color: #171717;
  background: #f4f4f4;
  cursor: pointer;
}

.paid-client-button[hidden] {
  display: none;
}

.paid-client-secondary-action {
  color: #f4f4f4;
  background: transparent;
}

.free-client-body {
  display: grid;
  min-height: 100vh;
  background: #0e0e0e;
}

.free-client-shell {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
}

.free-client-shell > .build-version {
  display: none;
}

.free-game-frame {
  width: 100%;
  height: 100vh;
  border: 0;
  background: #0e0e0e;
}

.free-game-frame[hidden] {
  display: none;
}

a {
  color: inherit;
}

.wrapper-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  min-height: 100vh;
  padding: 16px;
}

.top-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding-block: 4px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #f3c66d;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-block-start: 0;
}

h1 {
  margin-block-end: 0;
  font-size: 1.7rem;
  line-height: 1.1;
}

.build-version {
  margin-block-start: 6px;
  color: rgba(244, 239, 230, 0.58);
  font-size: 0.78rem;
}

h2 {
  margin-block-end: 8px;
  font-size: 1rem;
}

p {
  margin-block-end: 0;
  color: #d7cfc1;
  line-height: 1.45;
}

.review-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.review-links a {
  min-width: 72px;
  padding: 8px 12px;
  border: 1px solid rgba(244, 239, 230, 0.22);
  border-radius: 6px;
  background: rgba(21, 21, 21, 0.62);
  text-align: center;
  text-decoration: none;
}

.game-frame-section {
  position: relative;
  aspect-ratio: 16 / 9;
  align-self: start;
  min-height: 0;
  border: 1px solid rgba(244, 239, 230, 0.16);
  background: #0e0e0e;
  overflow: hidden;
}

.game-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0e0e0e;
  visibility: hidden;
}

.game-frame.is-available {
  visibility: visible;
}

.offline-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 44%, rgba(56, 117, 186, 0.22), transparent 32%),
    #101010;
  text-align: center;
}

.offline-placeholder[hidden] {
  display: none;
}

.board-mark {
  width: 172px;
  aspect-ratio: 1;
  background: conic-gradient(
    from 30deg,
    #4a90e2 0 60deg,
    #6bbf59 60deg 120deg,
    #f2c94c 120deg 180deg,
    #f2994a 180deg 240deg,
    #e85d5a 240deg 300deg,
    #c77dff 300deg 360deg
  );
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

code {
  color: #f4efe6;
  font-size: 0.9em;
}

.review-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.review-panel > div {
  padding: 14px;
  border: 1px solid rgba(244, 239, 230, 0.16);
  border-radius: 6px;
  background: rgba(21, 21, 21, 0.78);
}

dl {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

dt {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding-inline: 6px;
  border: 1px solid rgba(244, 239, 230, 0.22);
  border-radius: 4px;
  color: #f3c66d;
  font-size: 0.9rem;
  font-weight: 800;
}

dd {
  margin: 0;
  color: #d7cfc1;
  line-height: 1.35;
}

.config-list {
  grid-template-columns: 76px minmax(0, 1fr);
}

.config-list dd {
  overflow-wrap: anywhere;
}

.panel-actions {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 12px;
}

.room-size-control {
  display: grid;
  gap: 4px;
  min-width: 86px;
  color: #d7cfc1;
  font-size: 0.78rem;
  font-weight: 700;
}

.seed-control {
  flex: 1 1 152px;
}

.room-size-control select,
.room-size-control input {
  min-height: 34px;
  padding: 7px 28px 7px 10px;
  border: 1px solid rgba(244, 239, 230, 0.22);
  border-radius: 6px;
  background: rgba(21, 21, 21, 0.72);
  color: #f4efe6;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
}

.shell-button {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(244, 239, 230, 0.22);
  border-radius: 6px;
  background: rgba(243, 198, 109, 0.18);
  color: #f4efe6;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.shell-button:hover {
  background: rgba(243, 198, 109, 0.28);
}

.shell-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.room-entry-shell {
  display: grid;
  align-content: start;
  gap: 32px;
  width: min(1120px, 100%);
  min-height: 100vh;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 64px);
  color: #171717;
}

body:has(.room-entry-shell) {
  color-scheme: light;
  background: #f7f7f5;
}

.entry-hero {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  max-width: 680px;
}

.entry-hero h1 {
  margin-block-end: 8px;
  color: #171717;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 650;
  letter-spacing: -0.035em;
}

.entry-brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px dashed #8a8a86;
  color: #6c6c68;
  background: #eeeeeb;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.room-entry-shell .eyebrow {
  margin-block-end: 8px;
  color: #5f5f5b;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.entry-placeholder-copy {
  color: #777773;
  font-style: italic;
}

.entry-mode-link {
  display: inline-block;
  margin-block-start: 12px;
  color: #4b4b48;
  font-size: 0.88rem;
  font-weight: 700;
}

.free-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.room-entry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.entry-panel {
  padding: clamp(18px, 2vw, 24px);
  border: 1px solid #b7b7b2;
  background: #ffffff;
}

.entry-step-label {
  margin-block-end: 6px;
  color: #656561;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.entry-help {
  margin-block-end: 16px;
  color: #666662;
  font-size: 0.9rem;
}

.entry-form {
  display: grid;
  gap: 12px;
}

.entry-form[hidden],
.invite-mode-panel[hidden],
.room-details-summary[hidden],
.invite-share-panel[hidden] {
  display: none;
}

.invite-mode-panel,
.room-details-summary {
  display: grid;
  gap: 12px;
}

.room-details-summary .config-list {
  grid-template-columns: 88px minmax(0, 1fr);
}

.ticket-option-row[hidden] {
  display: none;
}

.entry-field {
  display: grid;
  gap: 6px;
  color: #292927;
  font-size: 0.82rem;
  font-weight: 700;
}

.entry-field input,
.entry-field select {
  min-height: 46px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #90908b;
  border-radius: 0;
  background: #ffffff;
  color: #171717;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 4px;
}

.primary-entry-action {
  width: 100%;
  min-height: 48px;
  border-color: #171717;
  border-radius: 0;
  background: #171717;
  color: #ffffff;
}

.primary-entry-action:hover {
  background: #3d3d3a;
}

.secondary-entry-action {
  border-color: #8a8a86;
  border-radius: 0;
  background: #ffffff;
  color: #171717;
}

.room-entry-shell .shell-button:not(.primary-entry-action):not(.secondary-entry-action) {
  border-color: #8a8a86;
  border-radius: 0;
  background: #ffffff;
  color: #171717;
}

.room-entry-shell .shell-button:not(.primary-entry-action):not(.secondary-entry-action):hover {
  background: #eeeeeb;
}

.entry-status {
  min-height: 38px;
  margin-block-start: 12px;
  padding: 10px;
  border: 1px solid #d1d1cc;
  border-radius: 0;
  color: #4b4b48;
  background: #f7f7f5;
  overflow-wrap: anywhere;
}

.entry-status[data-tone="error"] {
  border-color: #171717;
  color: #171717;
  font-weight: 700;
}

.entry-status[data-tone="success"] {
  border-color: #5f5f5b;
  color: #171717;
  font-weight: 700;
}

.room-summary {
  display: grid;
  gap: 12px;
}

.room-summary[hidden] {
  display: none;
}

.room-summary .config-list {
  grid-template-columns: 112px minmax(0, 1fr);
}

.wallet-account {
  display: grid;
  place-items: center;
  min-height: 48px;
  margin: 4px 0 0;
  padding: 8px 12px;
  border: 1px solid #8a8a86;
  color: #171717;
  background: #f7f7f5;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.88rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.wallet-account[hidden] {
  display: none;
}

.payment-panel,
.paid-launch-panel {
  display: grid;
  gap: 12px;
  padding-block-start: 4px;
}

.payment-panel,
.paid-launch-panel,
.invite-share-panel {
  padding-block-start: 16px;
  border-block-start: 1px solid #d1d1cc;
}

.payment-panel[hidden],
.paid-launch-panel[hidden] {
  display: none;
}

.invite-copy-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.invite-link {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid #b7b7b2;
  border-radius: 0;
  color: #171717;
  background: #f7f7f5;
  font: inherit;
  text-overflow: ellipsis;
}

.empty-room-state {
  min-height: 160px;
  display: grid;
  place-content: center;
  padding: 18px;
  border: 1px dashed #aaa9a4;
  border-radius: 0;
  color: #777773;
  text-align: center;
}

.empty-room-state[hidden] {
  display: none;
}

.entry-advanced {
  margin-block-start: 10px;
  color: #5f5f5b;
  font-size: 0.82rem;
}

.entry-advanced summary {
  min-height: 38px;
  padding-block: 9px;
  cursor: pointer;
}

.entry-advanced[open] {
  display: grid;
  gap: 12px;
}

.technical-session-row {
  display: none;
}

.room-technical-details .config-list {
  margin-block-start: 8px;
}

.entry-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-inline: 4px;
}

.room-entry-shell .build-version {
  color: #777773;
}

.room-entry-shell dt {
  border-color: #b7b7b2;
  border-radius: 0;
  color: #4b4b48;
  background: #f7f7f5;
}

.room-entry-shell dd,
.room-entry-shell p {
  color: #4b4b48;
}

.room-entry-shell .entry-placeholder-copy {
  color: #777773;
}

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

  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .game-frame-section {
    aspect-ratio: 16 / 9;
  }

  .room-entry-grid {
    grid-template-columns: 1fr;
  }

  .free-entry-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .room-entry-shell {
    gap: 18px;
    padding: 16px;
  }

  .entry-brand-mark {
    width: 56px;
    height: 56px;
  }

  .entry-panel {
    padding: 18px;
  }

  .entry-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
