/* Only the Mini App shell is scoped to .tg-mode; existing Community artwork stays unchanged. */
.tg-mode {
  --tg-bottom: 0px;
  --tg-top: 0px;
  --tg-height: 100dvh;
  background: #000;
  color-scheme: dark;
}
.tg-mode body {
  height: var(--tg-height);
  min-height: 0;
  overflow: hidden;
}
.tg-mode .ritual-nav,
.tg-mode .bottom-nav,
.tg-mode .ritual-nav-shell,
.tg-mode #ritualDock,
.tg-mode #preloader,
.tg-mode .burn-counter {
  display: none !important;
}
.tg-mode #community-view {
  height: var(--tg-height);
  padding-top: max(var(--tg-top), env(safe-area-inset-top, 0px));
  padding-bottom: calc(
    98px + max(var(--tg-bottom), env(safe-area-inset-bottom, 0px))
  );
  overscroll-behavior-y: contain;
}
.tg-mode .rf-discovery-header > [aria-label="Back to Ritual"] {
  visibility: hidden;
  pointer-events: none;
}
.tg-mode [data-tg-section="spaces"] #memberCommunitySection,
.tg-mode [data-tg-section="account"] #memberCommunitySection {
  display: none !important;
}
.tg-nav {
  position: fixed;
  z-index: 170;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px
    calc(10px + max(var(--tg-bottom), env(safe-area-inset-bottom, 0px)));
  background: #10110ff2;
  border-top: 1px solid #ffffff0e;
  backdrop-filter: blur(18px);
}
.tg-nav-item {
  display: flex;
  flex: 1;
  max-width: 160px;
  align-items: center;
  flex-direction: column;
  gap: 5px;
  border: 0;
  background: transparent;
  color: #8c897e;
  padding: 8px;
  border-radius: 12px;
  font:
    10px Inter,
    sans-serif;
  cursor: pointer;
  min-height: 48px;
  transition:
    color 0.2s,
    background 0.2s;
}
.tg-nav-item svg {
  width: 21px;
  height: 21px;
}
.tg-nav-item.selected {
  color: #e5cfaa;
  background: #bfa47b0a;
}
.tg-nav-item:focus-visible,
.tg-row:focus-visible {
  outline: 1px solid #cdb58f;
  outline-offset: 3px;
}
.tg-panel {
  max-width: 620px;
  margin: auto;
  padding: 36px 24px 30px;
  animation: tg-enter 0.3s ease both;
}
.tg-panel[hidden] {
  display: none;
}
.tg-kicker {
  font:
    10px Inter,
    sans-serif;
  letter-spacing: 0.36em;
  color: #a49c8b;
}
.tg-title {
  font:
    300 clamp(28px, 7vw, 38px) Inter,
    sans-serif;
  margin: 16px 0 12px;
  color: #f2eee4;
  letter-spacing: -0.04em;
}
.tg-note {
  font:
    13px/1.7 Inter,
    sans-serif;
  color: #a49c8c;
  overflow-wrap: anywhere;
  margin: 12px 0 20px;
}
.tg-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 20px 0;
  border: 0;
  border-bottom: 1px solid #ffffff12;
  background: transparent;
  color: #d6cfc1;
  font:
    13px Inter,
    sans-serif;
  cursor: pointer;
  transition: color 0.2s;
}
.tg-row:hover {
  color: #f0dcc0;
}
.tg-row:disabled {
  opacity: 0.5;
  cursor: wait;
}
.tg-balance {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  color: #cec6b7;
  background: linear-gradient(120deg, #d7b7790b, transparent);
  border: 1px solid #b79b6e24;
  border-radius: 20px;
  padding: 26px;
  margin: 24px 0 12px;
  text-align: left;
  font:
    12px Inter,
    sans-serif;
  cursor: pointer;
}
.tg-balance strong {
  color: #f1debc;
  font:
    300 58px/1 Inter,
    sans-serif;
  letter-spacing: -0.07em;
}
.tg-spaces {
  display: grid;
  gap: 4px;
  margin-top: 28px;
}
.tg-space {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 16px;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #ffffff12;
  color: #dcd1bc;
  padding: 17px 0;
  cursor: pointer;
}
.tg-space img {
  width: 64px;
  height: 86px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
  pointer-events: none;
}
.tg-space div {
  flex: 1;
}
.tg-space h2 {
  font:
    400 18px Inter,
    sans-serif;
  margin: 0 0 7px;
}
.tg-space p {
  font:
    11px/1.6 Inter,
    sans-serif;
  color: #979181;
  margin: 0;
}
.tg-new,
.tg-expired {
  display: inline-block;
  font:
    10px Inter,
    sans-serif;
  color: #cfb98c;
  margin-top: 9px;
}
.tg-expired {
  color: #8c887d;
}
.tg-preview {
  font:
    10px/1.5 Inter,
    sans-serif;
  color: #aaa18e;
  text-align: center;
  background: #151610;
  padding: 9px 16px;
}
.tg-sheet {
  color: #ddd5c7 !important;
  max-height: calc(100dvh - max(20px, var(--tg-top, 0px)));
  padding-bottom: calc(
    28px + max(var(--tg-bottom, 0px), env(safe-area-inset-bottom, 0px))
  ) !important;
}
.tg-sheet h2 {
  font-weight: 400;
}
.tg-field {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 18px 0;
  color: #a9a18f;
  font:
    11px/1.6 Inter,
    sans-serif;
}
.tg-field input,
.tg-field textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #a38e662e;
  border-radius: 10px;
  background: #ffffff04;
  color: #eee5d4;
  font:
    14px/1.6 Inter,
    sans-serif;
  padding: 12px;
  outline: none;
}
.tg-field input:focus,
.tg-field textarea:focus {
  border-color: #af966e;
}
.tg-field:has([type="checkbox"]) {
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}
.tg-field input[type="checkbox"] {
  accent-color: #c9ae7b;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.tg-field textarea {
  min-height: 130px;
  resize: vertical;
}
.tg-details {
  margin: 18px 0;
  border-top: 1px solid #a18d6226;
  padding-top: 18px;
}
.tg-details summary {
  font:
    12px Inter,
    sans-serif;
  color: #d1c5ae;
  cursor: pointer;
  padding: 6px 0 10px;
}
.tg-package {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid #a18d6226;
  border-radius: 14px;
}
.tg-package h3 {
  font:
    13px Inter,
    sans-serif;
}
.tg-code {
  display: block;
  font:
    16px/1.9 ui-monospace,
    monospace;
  letter-spacing: 0.1em;
  overflow-wrap: anywhere;
  background: #a68c5812;
  border: 1px solid #a18d6226;
  padding: 18px;
  border-radius: 12px;
  margin: 18px 0;
  user-select: all;
}
.tg-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 25px;
  font:
    11px Inter,
    sans-serif;
}
.tg-legal a {
  color: #a99e87;
  text-decoration: none;
}
.tg-review {
  padding: 15px 0;
  border-bottom: 1px solid #ffffff14;
  font:
    12px Inter,
    sans-serif;
}
.tg-review p,
.tg-review small {
  color: #9a9384;
}
.tg-review small {
  overflow-wrap: anywhere;
  display: block;
}
.tg-review strong {
  font-weight: 400;
}
.tg-fatal {
  position: fixed;
  inset: 0;
  z-index: 2147483640;
  background: #10110f;
  padding: 25vh 28px 40px;
}
.tg-mode .direct-dock {
  bottom: calc(87px + max(var(--tg-bottom), env(safe-area-inset-bottom, 0px)));
}
@keyframes tg-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .tg-panel {
    animation: none;
  }
  .tg-row,
  .tg-nav-item {
    transition: none;
  }
}
.tg-mode .tab-content:not(#community-view) {
  display: none !important;
}
.tg-mode #community-view {
  display: block !important;
}
.tg-panel .member-primary,
.tg-sheet .member-primary {
  appearance: none;
  display: block;
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #cfb78355;
  border-radius: 999px;
  padding: 17px 22px;
  margin: 18px 0;
  background: linear-gradient(110deg, #edd7ac, #cba064);
  color: #211d15;
  text-align: center;
  text-decoration: none;
  font:
    500 12px/1.4 Inter,
    sans-serif;
  letter-spacing: 0.06em;
  cursor: pointer;
  min-height: 48px;
}
.tg-panel .member-primary:disabled,
.tg-sheet .member-primary:disabled {
  opacity: 0.5;
  cursor: wait;
}
