:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101827;
  color: #f8fafc;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --app-max-width: 720px;
  --surface: rgb(15 23 42 / 88%);
  --surface-soft: rgb(30 41 59 / 72%);
  --border: rgb(255 255 255 / 11%);
  --muted: #a9b6c9;
  --accent: #93c5fd;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  background: linear-gradient(180deg, #17233a 0%, #101827 52%, #0c1422 100%);
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(100%, var(--app-max-width));
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) calc(112px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.app-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 4px 2px 24px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgb(147 197 253 / 42%);
  border-radius: 16px;
  background: linear-gradient(145deg, rgb(96 165 250 / 28%), rgb(15 23 42 / 80%));
  color: #dbeafe;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-copy {
  min-width: 0;
}

.eyebrow,
.section-kicker,
.card-label {
  margin: 0;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 3px 0 0;
  font-size: clamp(1.35rem, 6vw, 1.9rem);
  line-height: 1.05;
}

.preview-badge {
  align-self: start;
  padding: 7px 10px;
  border: 1px solid rgb(147 197 253 / 30%);
  border-radius: 999px;
  background: rgb(30 64 175 / 18%);
  color: #bfdbfe;
  font-size: 0.72rem;
  font-weight: 700;
}

.app-content {
  width: 100%;
}

.app-view {
  animation: view-enter 160ms ease-out;
}

.view-heading {
  padding: 26px 24px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgb(0 0 0 / 22%);
}

.view-heading h2 {
  margin: 7px 0 0;
  font-size: clamp(2rem, 11vw, 3.3rem);
  line-height: 0.98;
}

.view-heading p:last-child {
  max-width: 38rem;
  margin: 16px 0 0;
  color: #cbd5e1;
  line-height: 1.6;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.summary-card,
.content-card {
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.summary-card {
  min-height: 150px;
  padding: 20px;
  border-radius: 22px;
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.summary-card strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(1.9rem, 9vw, 2.8rem);
  line-height: 1;
}

.summary-card small {
  display: block;
  margin-top: 18px;
  color: #8794a8;
  line-height: 1.35;
}

.content-card {
  margin-top: 14px;
  padding: 24px;
  border-radius: 24px;
}

.content-card h3 {
  margin: 8px 0 0;
  font-size: 1.25rem;
  line-height: 1.25;
}

.content-card p:last-child {
  margin: 12px 0 0;
  color: #cbd5e1;
  line-height: 1.6;
}

.empty-state {
  display: grid;
  min-height: 240px;
  align-content: center;
  justify-items: start;
}

.empty-state-mark {
  display: grid;
  min-width: 58px;
  height: 58px;
  padding: 0 12px;
  place-items: center;
  border: 1px solid rgb(147 197 253 / 28%);
  border-radius: 18px;
  color: #bfdbfe;
  font-weight: 800;
}

.settings-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 7px rgb(74 222 128 / 12%);
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  left: max(12px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(calc(100% - 24px), calc(var(--app-max-width) - 24px));
  margin: 0 auto;
  padding: 8px;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 24px;
  background: rgb(8 15 27 / 92%);
  box-shadow: 0 18px 48px rgb(0 0 0 / 44%);
  backdrop-filter: blur(18px);
}

.nav-item {
  min-width: 0;
  min-height: 58px;
  padding: 8px 4px;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: #8f9caf;
  cursor: pointer;
  font-size: clamp(0.68rem, 2.8vw, 0.78rem);
  font-weight: 700;
}

.nav-item span {
  display: block;
}

.nav-index {
  margin-bottom: 4px;
  color: #64748b;
  font-size: 0.61rem;
  letter-spacing: 0.08em;
}

.nav-item.is-active {
  background: rgb(59 130 246 / 18%);
  color: #dbeafe;
}

.nav-item.is-active .nav-index {
  color: #93c5fd;
}

.nav-item:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 390px) {
  .app-shell {
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
  }

  .app-header {
    gap: 10px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 15px;
  }

  .preview-badge {
    padding: 6px 8px;
  }

  .view-heading,
  .content-card {
    padding: 21px;
  }

  .summary-card {
    min-height: 140px;
    padding: 17px;
  }
}

@media (min-width: 721px) {
  .bottom-nav {
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-view {
    animation: none;
  }
}

.today-status-card {
  min-height: 320px;
}

.card-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.refresh-button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid rgb(147 197 253 / 28%);
  border-radius: 14px;
  background: rgb(59 130 246 / 14%);
  color: #dbeafe;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.refresh-button:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.today-details {
  display: grid;
  gap: 0;
  margin: 22px 0 0;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 46px;
  border-top: 1px solid rgb(255 255 255 / 8%);
}

.detail-row dt {
  color: var(--muted);
  font-size: 0.88rem;
}

.detail-row dd {
  margin: 0;
  color: #f8fafc;
  font-weight: 750;
  text-align: right;
}

.content-card .data-meta {
  margin: 18px 0 0;
  color: #8794a8;
  font-size: 0.78rem;
  line-height: 1.45;
}

.summary-card[data-state="loading"] strong,
.today-status-card[data-state="loading"] h3,
.today-status-card[data-state="loading"] dd {
  color: #94a3b8;
}

.today-status-card[data-state="error"] {
  border-color: rgb(248 113 113 / 32%);
}

.today-status-card[data-state="error"] h3,
.today-status-card[data-state="error"] .data-meta {
  color: #fecaca;
}

@media (max-width: 390px) {
  .card-heading-row {
    gap: 12px;
  }

  .refresh-button {
    padding: 8px 10px;
  }

  .detail-row {
    gap: 14px;
  }
}

.today-status-card[data-state="stale"] {
  border-color: rgb(251 191 36 / 30%);
}

.today-status-card[data-state="stale"] .data-meta {
  color: #fde68a;
}


.profile-picker-card {
  min-height: 150px;
}

.field-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.profile-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.profile-select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 38px 9px 12px;
  border: 1px solid rgb(147 197 253 / 28%);
  border-radius: 14px;
  background: rgb(8 15 27 / 72%);
  color: #f8fafc;
  font: inherit;
  font-size: 1rem;
}

.profile-select:disabled {
  color: #8794a8;
  opacity: 0.72;
}

.profile-select:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.profile-picker-card[data-state="error"] {
  border-color: rgb(248 113 113 / 32%);
}

.profile-picker-card[data-state="error"] .data-meta {
  color: #fecaca;
}

.profile-picker-card[data-state="stale"] {
  border-color: rgb(251 191 36 / 30%);
}

.profile-picker-card[data-state="stale"] .data-meta {
  color: #fde68a;
}

.profile-card {
  min-height: 390px;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgb(147 197 253 / 34%);
  border-radius: 19px;
  background: linear-gradient(145deg, rgb(96 165 250 / 25%), rgb(15 23 42 / 82%));
  color: #dbeafe;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.profile-identity-copy {
  min-width: 0;
}

.profile-identity-copy h3 {
  overflow-wrap: anywhere;
}

.profile-tag {
  margin: 5px 0 0;
  color: #8794a8;
  font-size: 0.82rem;
  font-weight: 650;
}

.profile-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.profile-stat {
  min-height: 110px;
  padding: 16px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 18px;
  background: rgb(8 15 27 / 34%);
}

.profile-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
}

.profile-stat strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(1.55rem, 7vw, 2.15rem);
  line-height: 1;
}

.profile-details {
  display: grid;
  gap: 0;
  margin: 22px 0 0;
}

.profile-empty-state {
  min-height: 210px;
}

@media (max-width: 390px) {
  .profile-picker-row {
    grid-template-columns: 1fr;
  }

  .profile-picker-row .refresh-button {
    width: 100%;
  }

  .profile-stat {
    padding: 14px;
  }
}

.clan-overview-card {
  min-height: 300px;
}

.clan-overview-details {
  display: grid;
  gap: 0;
  margin: 22px 0 0;
}

.clan-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.count-badge {
  display: grid;
  min-width: 42px;
  min-height: 34px;
  padding: 6px 10px;
  place-items: center;
  border: 1px solid rgb(147 197 253 / 28%);
  border-radius: 999px;
  background: rgb(59 130 246 / 12%);
  color: #dbeafe;
  font-size: 0.82rem;
  font-weight: 800;
}

.member-list {
  display: grid;
  gap: 0;
  margin-top: 18px;
}

.member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 64px;
  padding: 12px 0;
  border-top: 1px solid rgb(255 255 255 / 8%);
}

.member-row-identity,
.member-row-activity {
  min-width: 0;
}

.member-row-identity strong,
.member-row-identity span,
.member-row-activity strong,
.member-row-activity span {
  display: block;
}

.member-row-identity strong {
  overflow-wrap: anywhere;
  font-size: 0.94rem;
}

.member-row-identity span,
.member-row-activity span {
  margin-top: 4px;
  color: #8794a8;
  font-size: 0.76rem;
  line-height: 1.35;
}

.member-row-activity {
  text-align: right;
}

.member-row-activity strong {
  color: #f8fafc;
  font-size: 1rem;
}

.list-placeholder {
  margin: 0;
  padding: 18px 0 2px;
  color: #8794a8;
  line-height: 1.55;
}

.clan-overview-card[data-state="loading"] h3,
.clan-overview-card[data-state="loading"] dd,
.clan-list-card[data-state="loading"] .count-badge {
  color: #94a3b8;
}

.clan-overview-card[data-state="error"],
.clan-list-card[data-state="error"] {
  border-color: rgb(248 113 113 / 32%);
}

.clan-overview-card[data-state="error"] h3,
.clan-overview-card[data-state="error"] .data-meta {
  color: #fecaca;
}

.clan-overview-card[data-state="stale"],
.clan-list-card[data-state="stale"] {
  border-color: rgb(251 191 36 / 30%);
}

.clan-overview-card[data-state="stale"] .data-meta {
  color: #fde68a;
}

@media (max-width: 390px) {
  .member-row {
    gap: 10px;
  }

  .member-row-identity span {
    font-size: 0.72rem;
  }
}
