:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d0d5dd;
  --surface: #ffffff;
  --page: #f4f7fb;
  --accent: #171717;
  --accent-dark: #0a0a0a;
  --danger: #b42318;
  --side-nav-clearance: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  /* background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.12), transparent 38%),
    linear-gradient(300deg, rgba(37, 99, 235, 0.1), transparent 36%),
    var(--page); */
}

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

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

a {
  color: inherit;
  text-decoration: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.shell {
  width: min(1040px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr minmax(320px, 420px);
  gap: 56px;
  align-items: center;
  padding: 48px 0;
}

.brand h1 {
  margin: 0;
  font-size: clamp(3rem, 6vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.brand-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-dark);
  font-weight: 700;
  text-transform: uppercase;
}

.language-select {
  display: grid;
  gap: 6px;
  min-width: 150px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.language-select select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  color: var(--ink);
  background: #fff;
}

.lead {
  max-width: 560px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1.8;
}

.panel {
  width: 100%;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 80px rgba(23, 32, 42, 0.12);
}

.background-content {
  width: 100%;
}

.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(244, 247, 251, 0.54);
  backdrop-filter: blur(4px);
}

.auth-modal {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.back-button {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 34px;
  min-height: 34px;
  color: var(--muted);
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
}

.back-button:hover {
  color: var(--ink);
  background: #f2f4f7;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  min-height: 34px;
  color: var(--muted);
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--ink);
  background: #f2f4f7;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-right: 38px;
  margin-bottom: 22px;
}

.signup-head {
  justify-content: center;
  padding: 0 42px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.4rem;
}

.actions,
form {
  display: grid;
  gap: 18px;
}

.signup-contact-grid,
.signup-submit-grid {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 0.95rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}

input {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.primary,
.secondary {
  width: 100%;
}

.primary {
  color: #fff;
  background: var(--accent);
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  color: var(--accent-dark);
  border: 1px solid var(--line);
  background: #fff;
}

.secondary:hover {
  border-color: var(--accent);
}

.text-button {
  min-height: auto;
  padding: 0;
  color: var(--accent-dark);
  background: transparent;
}

.compact {
  width: auto;
  min-height: 38px;
  padding: 0 14px;
}

.message {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.message.error {
  color: var(--danger);
}

.home-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 0 max(16px, calc((100vw - 920px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.wordmark {
  color: var(--accent-dark);
  font-size: 1.2rem;
  font-weight: 800;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
}

.main-nav svg {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main-nav a.active {
  color: var(--accent-dark);
  background: rgba(15, 118, 110, 0.1);
}

.bottom-nav {
  display: none;
}

.mobile-topbar {
  display: none;
}

@media (min-width: 761px) and (min-aspect-ratio: 3 / 4) {
  .topbar {
    position: fixed;
    inset: 0 auto 0 0;
    width: calc(
      (100vw - min(max(784px, 50vw), calc(100vw - 32px))) / 2 -
        var(--side-nav-clearance)
    );
    height: 100vh;
    align-items: stretch;
    justify-content: flex-start;
    flex-direction: column;
    gap: 28px;
    min-height: 0;
    padding: 24px 18px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .wordmark {
    padding: 4px 10px;
  }

  .main-nav {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .main-nav a {
    min-height: 44px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 1.04rem;
  }
}

.account {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar .language-select {
  display: none;
}

.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #fff;
}

@media (min-width: 761px) and (min-aspect-ratio: 3 / 4) {
  .topbar-actions {
    margin-top: auto;
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .topbar .language-select {
    display: none;
  }

  .account {
    min-width: 0;
    padding: 10px;
    border-radius: 999px;
  }

  .account span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.avatar-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  border-color: transparent;
  background: var(--accent);
  font-size: 0.95rem;
  font-weight: 800;
}

.wide-layout {
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
  display: grid;
  gap: 18px;
}

.home-shell.is-app-view .page-stage {
  display: none;
}

.app-stage {
  display: none;
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 24px;
  min-height: calc(100vh - 64px);
}

.home-shell.is-app-view .app-stage {
  display: block;
}

.app-frame {
  display: none;
  width: 100%;
  height: calc(100vh - 72px);
  min-height: 480px;
  border: 0;
  background: var(--surface);
}

.app-frame.is-active {
  display: block;
}

@media (min-width: 761px) and (min-aspect-ratio: 3 / 4) {
  .wide-layout,
  .app-stage {
    width: min(max(784px, 50vw), calc(100vw - 32px));
  }

  .app-frame {
    height: calc(100vh - 24px);
  }
}

.profile-hero,
.home-panel,
.favorite-apps-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-hero .avatar {
  width: 64px;
  height: 64px;
  flex-basis: 64px;
  font-size: 1.4rem;
}

.profile-hero h1,
.home-panel h2,
.favorite-apps-panel h2 {
  margin: 0;
}

.profile-hero p,
.home-panel p,
.favorite-apps-panel > p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.favorite-app-grid {
  margin-top: 16px;
}

.composer,
.post {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.composer {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.timeline {
  display: grid;
  gap: 14px;
}

.post p {
  margin: 0;
  line-height: 1.7;
}

.post-meta {
  margin-bottom: 8px !important;
  color: var(--accent-dark);
  font-weight: 800;
}

.post-meta span {
  color: var(--muted);
  font-weight: 700;
}

.app-kicker {
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.app-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.favorite-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  color: #fff;
  background: rgba(23, 32, 42, 0.48);
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.18);
  backdrop-filter: blur(8px);
}

.favorite-button svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.favorite-button.active {
  color: #facc15;
  background: rgba(23, 32, 42, 0.72);
}

.favorite-button.active svg path {
  fill: currentColor;
}

.favorite-button:disabled {
  opacity: 0.7;
}

.app-visual {
  height: 112px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.88), rgba(37, 99, 235, 0.66)),
    #0f766e;
}

.app-card.map .app-visual {
  background:
    linear-gradient(135deg, rgba(22, 101, 52, 0.86), rgba(234, 179, 8, 0.58)),
    #166534;
}

.app-card.bingo .app-visual {
  background:
    linear-gradient(135deg, rgba(190, 24, 93, 0.8), rgba(14, 165, 233, 0.62)),
    #be185d;
}

.app-card.doredore .app-visual {
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.88), rgba(14, 165, 233, 0.64)),
    #0f172a;
}

.app-card.archive .app-visual {
  background:
    linear-gradient(135deg, rgba(30, 41, 59, 0.92), rgba(61, 139, 253, 0.58)),
    #1e293b;
}

.app-body {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  padding: 16px;
}

.app-card h2,
.app-card p {
  margin: 0;
}

.app-card h2 {
  font-size: 1.08rem;
}

.app-card p {
  color: var(--muted);
  line-height: 1.65;
}

.app-body > p:not(.app-kicker) {
  min-height: calc(1.65em * 3);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.app-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-self: end;
}

.app-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
}

.groups-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.groups-hero h1 {
  margin: 0;
  font-size: 1.8rem;
}

.groups-hero p {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.group-list {
  display: grid;
  gap: 12px;
}

.group-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.group-mark {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.9), rgba(59, 130, 246, 0.58)),
    var(--accent);
}

.group-card.local .group-mark {
  background:
    linear-gradient(135deg, rgba(22, 101, 52, 0.88), rgba(132, 204, 22, 0.56)),
    #166534;
}

.group-card.trip .group-mark {
  background:
    linear-gradient(135deg, rgba(124, 58, 237, 0.78), rgba(236, 72, 153, 0.58)),
    #7c3aed;
}

.group-card-body {
  min-width: 0;
}

.group-card h2,
.group-card p {
  margin: 0;
}

.group-card h2 {
  margin-top: 2px;
  font-size: 1.08rem;
}

.group-card-body > p:last-child {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
}

.group-badge {
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.chat-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.chat-hero h1 {
  margin: 0;
  font-size: 1.8rem;
}

.chat-hero p {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.chat-list {
  display: grid;
  gap: 12px;
}

.chat-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.chat-mark {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.9), rgba(37, 99, 235, 0.62)),
    var(--accent);
}

.chat-card.group .chat-mark {
  background:
    linear-gradient(135deg, rgba(22, 101, 52, 0.88), rgba(234, 179, 8, 0.58)),
    #166534;
}

.chat-card.live .chat-mark {
  background:
    linear-gradient(135deg, rgba(190, 24, 93, 0.82), rgba(124, 58, 237, 0.64)),
    #be185d;
}

.chat-card-body {
  min-width: 0;
}

.chat-card h2,
.chat-card p {
  margin: 0;
}

.chat-card h2 {
  font-size: 1.08rem;
}

.chat-card p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 42, 0.36);
}

.modal {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 24px 80px rgba(23, 32, 42, 0.28);
}

.modal h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
}

.modal p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.screen-name-status {
  min-height: 22px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.screen-name-status.success {
  color: var(--accent-dark);
}

.screen-name-status.error {
  color: var(--danger);
}

.screen-name-suggestions {
  display: grid;
  gap: 8px;
}

.screen-name-suggestions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion {
  min-height: 34px;
  padding: 0 10px;
  color: var(--accent-dark);
  border: 1px solid var(--line);
  background: #fff;
}

.suggestion:hover {
  border-color: var(--accent);
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
    gap: 28px;
    align-content: center;
  }

  .brand h1 {
    font-size: 3.2rem;
  }

  .lead {
    font-size: 1rem;
  }

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

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    padding: 0 16px;
    min-height: 56px;
    height: auto;
  }

  .mobile-topbar {
    width: 100%;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }

  .mobile-topbar-title {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--accent-dark);
    font-size: 1.05rem;
    font-weight: 800;
  }

  .mobile-notification {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border-radius: 50%;
    color: var(--ink);
    background: transparent;
  }

  .mobile-notification svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-topbar-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-topbar > .avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .wordmark {
    display: none;
  }

  .topbar-actions {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
    display: none;
  }

  .main-nav {
    width: 100%;
  }

  .account {
    width: 100%;
    justify-content: space-between;
  }

  .groups-hero,
  .chat-hero {
    flex-direction: column;
  }

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

  .app-visual {
    height: 84px;
  }

  .favorite-button {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    min-height: 32px;
  }

  .favorite-button svg {
    width: 23px;
    height: 23px;
  }

  .app-body {
    gap: 8px;
    padding: 12px;
  }

  .app-card h2 {
    font-size: 0.98rem;
  }

  .app-card p {
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .app-body > p:not(.app-kicker) {
    min-height: calc(1.55em * 3);
  }

  .app-card .compact {
    width: 100%;
    min-height: 36px;
    padding: 0 8px;
  }

  .group-card {
    grid-template-columns: 44px 1fr;
    align-items: flex-start;
  }

  .group-card .compact {
    grid-column: 1 / -1;
    width: 100%;
  }

  .group-mark {
    width: 44px;
    height: 44px;
  }

  .chat-card {
    grid-template-columns: 44px 1fr;
    align-items: flex-start;
  }

  .chat-card .compact {
    grid-column: 1 / -1;
    width: 100%;
  }

  .chat-mark {
    width: 44px;
    height: 44px;
  }

  .modal-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .modal-actions .compact {
    width: 100%;
  }
}

@media (max-width: 760px), (max-aspect-ratio: 3 / 4) {
  .home-shell {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: static;
  }

  .main-nav {
    display: none;
  }

  .wide-layout {
    padding-bottom: 24px;
  }

  .app-stage {
    width: calc(100% - 32px);
    min-height: calc(100vh - 56px - 78px - env(safe-area-inset-bottom));
  }

  .app-frame {
    height: calc(100vh - 56px - 78px - env(safe-area-inset-bottom));
    min-height: 360px;
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
  }

  .bottom-nav a {
    display: grid;
    place-items: center;
    min-height: 48px;
    border-radius: 8px;
    color: var(--muted);
  }

  .bottom-nav a.active {
    color: var(--accent-dark);
    background: rgba(15, 118, 110, 0.1);
  }

  .bottom-nav svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
}
