.site-root {
  position: relative;
  z-index: 1;
}

/* Signed-in host actions: small dark-gold boxes, not pills and not plain links. */
a.host-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
  box-sizing: border-box;
  min-height: 26px;
  padding: 0.15rem 0.5rem;
  border: 1px solid #5c4724;
  border-radius: 3px;
  background: #7a5f2e;
  color: #f0e2c0 !important;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-decoration: none !important;
  text-transform: none;
  white-space: nowrap;
}

a.host-nav-btn:hover,
a.host-nav-btn:visited,
a.host-nav-btn:focus {
  background: #8b6c34;
  border-color: #6a5429;
  color: #fff1d4 !important;
  text-decoration: none !important;
}

a.host-nav-btn .host-nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.9rem;
  padding: 0 0.2rem;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.28);
  color: #f0e2c0;
  font-size: 0.64rem;
  font-weight: 800;
}

.nav-actions-host .nav-who {
  color: var(--text);
  text-decoration: none;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(7, 8, 12, 0.72);
}

.app-modal-card {
  width: min(26rem, 100%);
  display: grid;
  gap: 1.1rem;
  padding: 1.35rem 1.25rem 1.2rem;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #10141c;
}

.app-modal-card p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.45;
}

.app-modal-card .btn {
  width: 100%;
}

.field textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0c0f16;
  color: var(--text);
}

.container.signup-page.profile-page {
  width: min(46rem, calc(100% - 2rem));
}

.profile-page .form-error {
  margin-top: 0.8rem;
}

.profile-id {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 1.15rem;
  padding: 0.8rem 0.95rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(8, 10, 16, 0.55);
}

.profile-id strong,
.profile-id span {
  display: block;
}

.profile-id strong {
  font-size: 1.05rem;
  line-height: 1.2;
}

.profile-id span {
  color: var(--muted);
  font-size: 0.92rem;
}

.profile-id .profile-points {
  margin-top: 0.15rem;
  color: var(--lime);
  font-weight: 700;
}

.profile-mark img,
.profile-editor .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-editor {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.75rem;
}

.profile-editor h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 0.9;
}

.profile-id-copy {
  min-width: 0;
  flex: 1;
}

.profile-side-links {
  margin-left: auto;
  flex: none;
  display: grid;
  justify-items: end;
  gap: 0.35rem;
  text-align: right;
}

.profile-side-links a {
  color: var(--lime);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.profile-id .profile-mark {
  width: 52px;
  height: 52px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--lime);
  color: var(--lime-ink);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
}

.pay-board {
  display: grid;
  gap: 1rem;
  margin-top: 1.35rem;
}

#add-card,
#add-payout {
  scroll-margin-top: 6.5rem;
}

.pay-panel {
  display: grid;
  gap: 0.9rem;
  padding: 1.15rem 1.1rem 1.25rem;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    radial-gradient(420px 160px at 0% 0%, rgba(196, 163, 90, 0.14), transparent 62%),
    #10141c;
}

.pay-panel-payout {
  background:
    radial-gradient(420px 160px at 100% 0%, rgba(255, 61, 138, 0.16), transparent 58%),
    #10141c;
}

.pay-heading {
  display: grid;
  gap: 0.2rem;
}

.pay-panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.7rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 0.9;
}

.pay-lead,
.pay-ready {
  margin: 0;
}

.pay-lead {
  color: var(--muted);
  font-size: 0.98rem;
}

.due-board {
  display: grid;
  gap: 0.45rem;
  margin-top: 1.75rem;
  padding: 1.35rem 1.2rem 1.45rem;
  border-radius: 22px;
  border: 1px solid rgba(196, 163, 90, 0.45);
  background: #10141c;
}

.due-board h2 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  line-height: 0.9;
}

.due-amount {
  margin: 0.35rem 0 0.15rem;
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 4.4rem);
  letter-spacing: 0.04em;
  line-height: 0.9;
  color: var(--lime);
}

.due-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.pay-ready {
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(196, 163, 90, 0.4);
  background: rgba(196, 163, 90, 0.08);
  color: var(--text);
}

.pay-return-ready {
  display: grid;
  gap: 0.7rem;
  justify-items: start;
}

.pay-return-ready p {
  margin: 0;
  line-height: 1.4;
}

.return-app-page {
  display: grid;
  gap: 1rem;
  max-width: 28rem;
  margin: 3rem auto 0;
  padding: 1.6rem 1.4rem 1.5rem;
  border-radius: 22px;
  border: 1px solid rgba(196, 163, 90, 0.35);
  background:
    linear-gradient(180deg, rgba(196, 163, 90, 0.12), transparent 48%),
    #10141c;
}

.return-app-page .btn {
  justify-self: start;
}

.return-app-page .display {
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  line-height: 0.95;
}

.return-app-page .section-intro {
  margin: 0;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1.45;
}

.return-app-hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.pay-form {
  display: grid;
  gap: 0.85rem;
}

.pay-form .btn {
  width: 100%;
}

/* Spinner inside controls that start a full page load. */
.btn.is-loading,
a.host-nav-btn.is-loading,
a.host-game-row.is-loading,
a.host-row-card.is-loading,
a.host-play.is-loading,
.host-link.is-loading {
  display: inline-flex !important;
  align-items: center;
  gap: 0.45rem;
  cursor: progress;
  pointer-events: none;
}

.btn.is-loading::before,
a.host-nav-btn.is-loading::before,
a.host-game-row.is-loading::before,
a.host-row-card.is-loading::before,
a.host-play.is-loading::before,
.host-link.is-loading::before {
  content: "";
  flex: none;
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: hh-spin 0.7s linear infinite;
}

a.host-nav-btn.is-loading::before {
  width: 0.7rem;
  height: 0.7rem;
  border-width: 2px;
  border-color: #fff1d4;
  border-right-color: transparent;
}

@keyframes hh-spin {
  to { transform: rotate(360deg); }
}

@keyframes pay-spin {
  to { transform: rotate(360deg); }
}

.field-label {
  font-weight: 600;
  font-size: 0.92rem;
}

.select-wrap {
  position: relative;
  display: block;
}

.select-wrap select {
  width: 100%;
  min-height: 52px;
  padding: 0 2.6rem 0 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0c0f16;
  color: var(--text);
  font: inherit;
  color-scheme: dark;
  appearance: none;
}

.select-wrap select:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 1px var(--lime);
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 1.05rem;
  top: 50%;
  width: 0.48rem;
  height: 0.48rem;
  border-right: 2px solid var(--lime);
  border-bottom: 2px solid var(--lime);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.pay-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pay-steps li {
  margin: 0;
  padding: 0.45rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 10, 16, 0.55);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}

.pay-steps li:last-child {
  color: var(--text);
}

.saved-card {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  min-height: 108px;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  border: 1px solid rgba(196, 163, 90, 0.35);
  background:
    radial-gradient(220px 90px at 100% 0%, rgba(196, 163, 90, 0.35), transparent 70%),
    linear-gradient(145deg, #1c2610, #0c0f16 58%);
}

.saved-card-brand {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.06em;
  line-height: 0.9;
}

.saved-card-num {
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  font-size: 0.95rem;
}

#card-element {
  min-height: 4.5rem;
  padding: 0.35rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #0c0f16;
}

.entity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.entity-grid legend {
  grid-column: 1 / -1;
  margin-bottom: 0.1rem;
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
}

.entity-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.7rem;
  row-gap: 0.12rem;
  align-items: center;
  min-height: 4.7rem;
  padding: 0.8rem 0.85rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #0c0f16;
  cursor: pointer;
}

.entity-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.entity-dot {
  grid-row: 1 / span 2;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 2px solid rgba(245, 247, 251, 0.28);
}

.entity-card strong {
  font-size: 0.98rem;
  line-height: 1.2;
}

.entity-detail {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.3;
}

.entity-card:hover {
  border-color: rgba(196, 163, 90, 0.45);
}

.entity-card:focus-within {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.entity-card:has(input:checked) {
  border-color: #c4a35a;
  background:
    linear-gradient(180deg, rgba(196, 163, 90, 0.14), transparent 72%),
    #12151c;
  box-shadow: inset 0 0 0 1px #c4a35a;
}

.entity-card:has(input:checked) .entity-dot {
  border-color: #c4a35a;
  background: radial-gradient(circle, #12160a 0 3px, #c4a35a 3.5px 100%);
}

.payout-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.payout-fact {
  margin: 0;
  padding: 0.85rem 0.9rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #0c0f16;
}

.payout-fact small {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (min-width: 720px) {
  .container.signup-page.profile-page {
    width: min(46rem, calc(100% - 3rem));
  }
}

@media (max-width: 640px) {
  .entity-grid,
  .payout-summary {
    grid-template-columns: 1fr;
  }

  .pay-steps li {
    letter-spacing: 0.02em;
    font-size: 0.62rem;
  }
}

/* Obsidian Vault & Gem upgrades for auth, account, legal, and admin surfaces */
.auth-card,
.signup-card,
.legal-card,
.payout-fact,
.account-card,
.admin-card {
  background: linear-gradient(180deg, rgba(18, 23, 35, 0.94) 0%, rgba(10, 13, 21, 0.98) 100%);
  border: 1px solid rgba(229, 200, 120, 0.24);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.auth-card input,
.signup-card input,
.account-card input {
  background: rgba(8, 10, 17, 0.92);
  border: 1px solid rgba(229, 200, 120, 0.24);
}

.auth-card input:focus,
.signup-card input:focus,
.account-card input:focus {
  outline: none;
  border-color: #e5c878;
  box-shadow: 0 0 0 3px rgba(229, 200, 120, 0.18);
}

