:root {
  color-scheme: dark;
  --page-bg: radial-gradient(circle at top, #13161d 0%, #07090d 44%, #020304 100%);
  --panel-bg: rgba(11, 13, 17, 0.86);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #f3f1e8;
  --text-soft: #8c949b;
  --accent-hot: #f0bf75;
  --accent-cool: #75efd0;
  --accent-danger: #ff7a66;
  --board-open: rgba(19, 23, 29, 0.9);
  --board-locked: rgba(23, 25, 29, 0.94);
  --board-other: rgba(27, 32, 38, 0.96);
  --board-mine: rgba(16, 44, 38, 0.94);
  --board-winner: #f5b962;
  --board-selected: #9df0d4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text-main);
  font-family: "IBM Plex Sans", "Avenir Next", sans-serif;
}

html {
  min-height: 100%;
  background: #020304;
}

#main {
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  position: relative;
  max-width: 1480px;
  margin: 0 auto;
  padding: 10px 24px 56px;
}

.page-header {
  position: relative;
}

.page-header-wallet {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

.boot-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 32px 24px;
  text-align: center;
}

.boot-mark {
  color: var(--text-main);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.22em;
}

.boot-copy {
  color: var(--text-soft);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-bar {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  width: 100%;
  margin: 0 0 2px;
  padding-left: 12px;
  pointer-events: auto;
}

.brand-home-link {
  display: inline-flex;
  text-decoration: none;
}

.brand-home-link:focus-visible {
  outline: 2px solid rgba(93, 115, 255, 0.9);
  outline-offset: 6px;
  border-radius: 10px;
}

.brand-logo-image {
  display: block;
  width: min(130px, 15vw);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(17, 24, 39, 0.22));
}

.brand-home-link:hover .brand-logo-image {
  transform: translateY(-1px);
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 360px;
  gap: 14px;
  align-items: start;
  margin-top: -6px;
}

.board-column,
.social-column {
  display: grid;
  gap: 12px;
  align-content: start;
}

.board-column {
  justify-items: stretch;
  max-width: 812px;
  width: 100%;
  justify-self: center;
  overflow: visible;
}

.card,
.wallet-dock,
.board-stage,
.card {
  backdrop-filter: blur(18px);
}

.card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.wallet-name,
.reveal-countdown {
  margin: 0;
  font-weight: 600;
}

.wallet-address,
.wallet-error,
.reveal-subtitle {
  margin: 6px 0 0;
  color: var(--text-soft);
}

.wallet-dock {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
}

.wallet-dock-button.button {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(17, 19, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
}

.wallet-dock-button.wallet-dock-button--primary.button {
  background: linear-gradient(180deg, #5a6cff 0%, #4153de 100%);
  color: #fff;
}

.button {
  padding: 8px 18px;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.button:focus-visible {
  box-shadow: 0 0 0 2px var(--focused-border-color);
}

.button[data-style="primary"] {
  background-color: var(--secondary-color-2);
  color: var(--primary-color);
}

.button[data-style="primary"]:hover {
  background-color: var(--secondary-color-1);
}

.button[data-style="secondary"] {
  background-color: var(--primary-color-5);
  color: var(--secondary-color-1);
}

.button[data-style="secondary"]:hover {
  background-color: var(--primary-color-4);
}

.button[data-style="ghost"] {
  background-color: transparent;
  color: var(--secondary-color-4);
}

.button[data-style="ghost"]:hover {
  background-color: var(--primary-color-5);
  color: var(--secondary-color-1);
}

.button[data-style="outline"] {
  border: 1px solid var(--primary-color-6);
  background-color: var(--light, var(--primary-color)) var(--dark, var(--primary-color-3));
  color: var(--secondary-color-4);
}

.button[data-style="outline"]:hover {
  background-color: var(--primary-color-4);
}

.button[data-style="destructive"] {
  background-color: var(--primary-error-color);
  color: var(--contrast-error-color);
}

.button[data-style="destructive"]:hover {
  background-color: var(--secondary-error-color);
}

.card-header {
  display: grid;
  align-items: start;
  padding: 0 1.5rem;
  gap: 0.5rem;
  grid-auto-rows: min-content;
  grid-template-rows: auto auto;
}

.card-header:has([data-slot="card-action"]) {
  grid-template-columns: 1fr auto;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
}

.card-description {
  color: var(--secondary-color-5);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.card-action {
  grid-column-start: 2;
  grid-row: 1 / span 2;
  place-self: start end;
}

.card-content {
  padding: 0 1.5rem;
}

.card-footer {
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}

.dialog-backdrop {
  position: fixed;
  z-index: 1000;
  background: rgb(0 0 0 / 30%);
  inset: 0;
  opacity: 0;
  will-change: transform, opacity;
}

.dialog-backdrop[data-state="closed"] {
  animation: dialog-backdrop-animate-out 150ms ease-in forwards;
  pointer-events: none;
}

@keyframes dialog-backdrop-animate-out {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }

  100% {
    opacity: 0;
    transform: scale(0.95) translateY(-2px);
  }
}

.dialog-backdrop[data-state="open"] {
  animation: dialog-content-animate-in 150ms ease-out forwards;
}

@keyframes dialog-content-animate-in {
  0% {
    opacity: 0;
    transform: scale(0.95) translateY(-2px);
  }

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

.dialog {
  position: fixed;
  z-index: 1001;
  top: 50%;
  left: 50%;
  display: flex;
  width: 100%;
  max-width: calc(100% - 2rem);
  box-sizing: border-box;
  flex-direction: column;
  padding: 32px 24px 24px;
  border: 1px solid var(--primary-color-6);
  border-radius: 8px;
  margin: 0;
  background: var(--primary-color-2);
  box-shadow: 0 2px 10px rgb(0 0 0 / 18%);
  color: var(--secondary-color-4);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  gap: 16px;
  text-align: center;
  transform: translate(-50%, -50%);
}

.dialog-title {
  margin: 0;
  color: var(--secondary-color-4);
  font-size: 1.25rem;
  font-weight: 700;
}

.dialog-description {
  margin: 0;
  color: var(--secondary-color-5);
  font-size: 1rem;
}

@media (width >= 40rem) {
  .dialog {
    max-width: 32rem;
    text-align: left;
  }
}

.dialog-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  align-self: flex-start;
  padding: 0;
  border: none;
  margin: 0;
  background: none;
  color: var(--secondary-color-3);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.dialog-close:hover {
  color: var(--secondary-color-1);
}

.progress {
  position: relative;
  overflow: hidden;
  width: 200px;
  height: 0.5rem;
  box-sizing: border-box;
  border-radius: 9999px;
  background: var(--primary-color-5);
}

.progress[data-state="indeterminate"] .progress-indicator {
  width: 50%;
  animation: indeterminate 1s infinite linear;
}

.progress-indicator {
  width: var(--progress-value, 0%);
  height: 100%;
  background-color: var(--secondary-color-1);
  transition: width 250ms ease;
}

@keyframes indeterminate {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(200%);
  }
}

.board-stage {
  position: relative;
  padding: 0;
  border-radius: 0;
  background: transparent;
  margin-top: 14px;
  margin-left: 0;
}

.board-stage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.board-stage-layout--with-sidebar {
  grid-template-columns: 248px minmax(0, 1fr);
}

.board-stage-sidebar {
  display: grid;
  align-content: start;
  gap: 12px;
  margin-top: 14px;
}

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

.board-stat-card,
.board-deploy-panel {
  display: grid;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(17, 19, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.board-stat-card {
  min-height: 72px;
  align-content: stretch;
  gap: 4px;
  justify-items: start;
  text-align: left;
}

.board-stat-card--motherlode {
  border-color: rgba(245, 200, 108, 0.34);
  background: linear-gradient(180deg, rgba(35, 25, 12, 0.92), rgba(17, 19, 24, 0.92));
}

.board-stat-label,
.board-stat-value,
.board-deploy-label,
.board-deploy-value {
  margin: 0;
}

.board-stat-label,
.board-deploy-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.board-stat-value {
  color: #f6f7fb;
  font-size: 1.16rem;
  font-weight: 700;
  line-height: 1.2;
}

.board-stat-card .board-stat-value {
  order: 1;
  align-self: start;
}

.board-stat-card .board-stat-label {
  order: 2;
  align-self: start;
  margin-top: auto;
}

.board-stat-value--with-icon,
.board-deploy-value--with-icon {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.board-stat-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.board-stat-icon--token {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
}

.board-deploy-panel {
  gap: 12px;
  padding-top: 13px;
  padding-bottom: 13px;
}

.board-deploy-summary {
  display: grid;
  gap: 10px;
}

.board-deploy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.board-deploy-value {
  color: #dce3ff;
  font-size: 0.94rem;
  font-weight: 700;
}

.board-stage-main {
  display: grid;
  gap: 12px;
  padding-left: 0;
}

.reveal-ribbon {
  display: grid;
  gap: 10px;
  width: min(520px, 100%);
  margin: 0 auto 18px;
  transform: translate(72px, 10px);
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(9, 10, 14, 0.72);
}

.reveal-progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.reveal-progress-indicator {
  width: var(--progress-value);
  height: 100%;
  background: linear-gradient(90deg, var(--accent-danger), var(--accent-hot), var(--accent-cool));
  transition: width 90ms linear;
}

.board-grid-shell {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: min(500px, 100%);
  margin: 0 auto;
  transform: translate(72px, 10px);
  padding: 8px 0 0;
}

.board-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 0;
  border-radius: 16px;
  border: 1px solid rgba(108, 144, 255, 0.22);
  color: var(--text-main);
  background: rgba(4, 6, 12, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 12px 18px rgba(0, 0, 0, 0.14);
  transition: transform 180ms ease, opacity 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
  display: block;
  text-align: left;
  padding: 12px 12px 12px 14px;
}

.board-cell:hover {
  transform: translateY(-1px);
  border-color: rgba(132, 164, 255, 0.4);
}

.board-cell-number {
  position: absolute;
  top: 12px;
  left: 14px;
  font-size: clamp(0.82rem, 1vw, 0.98rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
}

.board-cell-owner {
  position: absolute;
  right: 12px;
  bottom: 12px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.12em;
  color: rgba(226, 232, 255, 0.74);
  text-transform: uppercase;
}

.board-cell--mine {
  background: linear-gradient(180deg, rgba(7, 10, 18, 0.98), rgba(8, 18, 22, 0.98));
  border-color: rgba(82, 214, 187, 0.4);
}

.board-cell--other,
.board-cell--locked {
  background: linear-gradient(180deg, rgba(5, 7, 12, 0.98), rgba(6, 9, 15, 0.98));
  border-color: rgba(116, 137, 192, 0.28);
}

.board-cell--selected {
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.88), 0 0 16px rgba(255, 255, 255, 0.12);
}

.board-cell--active-elimination {
  transform: scale(0.92);
  border-color: var(--accent-danger);
  box-shadow: 0 0 0 1px rgba(255, 122, 102, 0.42), 0 0 22px rgba(255, 122, 102, 0.18);
}

.board-cell--eliminated {
  opacity: 0.14;
  transform: scale(0.92);
  background: rgba(4, 6, 10, 0.5);
  border-color: rgba(255, 255, 255, 0.03);
  box-shadow: none;
}

.board-cell--winner,
.board-cell--winning {
  background: linear-gradient(180deg, rgba(10, 8, 5, 0.98), rgba(19, 13, 6, 0.98));
  color: #fff7e4;
  border-color: rgba(245, 200, 108, 0.95);
  box-shadow: 0 0 0 1px rgba(245, 200, 108, 0.92), 0 0 22px rgba(245, 200, 108, 0.2);
}

.board-action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.board-action-bar--sidebar {
  margin-top: 0;
  align-items: flex-start;
  justify-content: flex-start;
}

.board-action-note {
  margin-top: 0;
  font-size: 0.82rem;
  line-height: 1.35;
}

.board-action-button.button {
  min-height: 58px;
  width: 100%;
  padding: 0 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, #5a6cff 0%, #4153de 100%);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.board-action-button.button:disabled {
  background: rgba(31, 35, 44, 0.96);
  color: rgba(255, 255, 255, 0.52);
  box-shadow: none;
  cursor: not-allowed;
}

.chat-card .card-header,
.chat-card .card-content {
  padding-left: 1.2rem;
  padding-right: 1.2rem;
}

.chat-thread {
  display: grid;
  gap: 12px;
  min-height: 280px;
  max-height: 440px;
  overflow: auto;
}

.chat-message {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(17, 19, 24, 0.84);
}

.chat-message--system {
  background: rgba(20, 25, 31, 0.88);
}

.chat-sender,
.chat-body {
  margin: 0;
}

.chat-sender {
  color: var(--text-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.chat-body {
  margin-top: 8px;
  line-height: 1.45;
}

.chat-compose {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.chat-input {
  width: 100%;
  min-height: 96px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(14, 16, 21, 0.92);
  color: var(--text-soft);
  resize: none;
}

.chat-send-button.button {
  justify-self: end;
  border-radius: 999px;
}

.profile-modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(4, 8, 12, 0.72);
}

.profile-modal {
  width: min(560px, calc(100vw - 32px));
}

@media (max-width: 1100px) {
  .board-stage {
    margin-top: 0;
    margin-left: 0;
  }

  .board-stage-main {
    padding-left: 0;
  }

  .reveal-ribbon,
  .board-grid-shell {
    transform: none;
  }

  .page-header-wallet {
    position: static;
    transform: none;
    margin: 8px 0 0;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .wallet-dock {
    justify-content: flex-start;
  }

  .board-stage-layout--with-sidebar {
    grid-template-columns: 1fr;
  }

  .board-stage-sidebar {
    order: 2;
    margin-top: 0;
  }

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

  .board-column {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px 14px 32px;
  }

  .brand-bar {
    padding-left: 6px;
    margin-bottom: 0;
  }

  .main-layout {
    margin-top: -4px;
  }

  .board-grid-shell {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .board-stat-card,
  .board-deploy-panel {
    padding: 12px;
    border-radius: 18px;
  }

  .board-stat-value {
    font-size: 1.18rem;
  }

  .board-stat-card {
    min-height: 78px;
  }

  .board-cell {
    aspect-ratio: 1 / 1;
    min-height: 0;
    border-radius: 14px;
  }

  .board-cell-number {
    top: 12px;
    left: 12px;
    font-size: 0.82rem;
  }

  .board-cell-owner {
    right: 10px;
    bottom: 10px;
    font-size: 10px;
  }

  .board-action-button.button,
  .wallet-dock-button.button {
    width: 100%;
  }

  .brand-logo-image {
    width: min(164px, 42vw);
  }
}