@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap');

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  color-scheme: light dark;
}

body {
  font-family: 'Manrope', sans-serif;
  color: var(--text-main);
  background: var(--bg-main);
  min-height: 100vh;
}

html.embedded-profile-view body {
  min-height: auto;
}

html.is-standalone body {
  min-height: 100dvh;
}

html.embedded-profile-view .top-bar,
html.embedded-profile-view .bottom-nav {
  display: none;
}

html.embedded-profile-view .page-shell {
  max-width: 100%;
  margin: 0;
  padding: var(--space-2) var(--space-2) var(--space-5);
}

html.embedded-profile-view .card,
html.embedded-profile-view .profile-card {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

html.embedded-profile-view .card + .card,
html.embedded-profile-view .profile-card + .card,
html.embedded-profile-view .profile-card + .profile-card {
  margin-top: var(--space-4);
}

html.embedded-profile-view .friend-item,
html.embedded-profile-view .habit-item,
html.embedded-profile-view .record-item {
  border: 1px solid var(--surface-border);
  background: var(--bg-soft);
}

html.embedded-profile-view .comments-box {
  border-top: 1px solid var(--surface-border-strong);
}

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

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

.page-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) calc(var(--space-10) + 60px);
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-main);
  border-bottom: 1px solid var(--primary);
}

html.is-standalone .top-bar {
  padding-top: env(safe-area-inset-top);
}

.top-bar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--brand-solid);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.top-settings-link {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid rgb(95 66 231 / 0.58);
  background: transparent;
  color: var(--text-main);
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.top-settings-link:hover {
  background: var(--surface-hover);
  border-color: rgb(95 66 231 / 0.88);
}

.top-settings-icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.card-title {
  margin: 0 0 var(--space-4);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
}

.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  color: var(--brand-on);
  background: var(--brand-solid);
}

.btn-primary:hover {
  background: rgb(111 85 235);
  transform: translateY(-1px);
}

.btn-soft {
  color: var(--text-main);
  background: var(--bg-soft);
  border: 1px solid var(--primary);
}

.btn-danger {
  color: #fff;
  background: var(--error);
}

.field {
  display: grid;
  gap: var(--space-2);
}

.field-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-soft);
}

.field-input,
.field-textarea,
.field-select {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--primary);
  background: var(--bg-surface);
  color: var(--text-main);
  padding: 11px 12px;
}

.field-textarea {
  min-height: 100px;
  resize: vertical;
}

.grid {
  display: grid;
  gap: var(--space-4);
}

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

.helper-text {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.message {
  margin: var(--space-4) 0 0;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.92rem;
}

.message-ok {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.message-error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  min-height: 76px;
  padding: var(--space-2) var(--space-3) calc(var(--space-4) + env(safe-area-inset-bottom));
  background: var(--bg-main);
  border-top: none;
}

.bottom-nav::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--primary);
  box-shadow: 0 -1px 4px rgb(95 66 231 / 0.25);
  pointer-events: none;
}

html.is-standalone .bottom-nav {
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
}

.bottom-nav-inner {
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
  margin-bottom: 6px;
  background: var(--bg-main);
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 6px;
  border-radius: var(--radius-md);
  color: var(--text-soft);
  border: 1px solid transparent;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.nav-link:hover {
  color: var(--text-main);
  background: var(--surface-hover);
}

.nav-link-icon {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateY(-2px);
}

.nav-link-icon-solid {
  display: none;
  stroke: none;
  fill: currentColor;
}

.nav-link.active .nav-link-icon-outline {
  display: none;
}

.nav-link.active .nav-link-icon-solid {
  display: block;
}

.nav-profile-avatar,
.nav-profile-fallback {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  transform: translateY(-2px);
}

.nav-profile-avatar {
  object-fit: cover;
  border: 1.5px solid var(--primary);
}

.nav-profile-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  background: transparent;
  border: 1.5px solid var(--primary);
}

.nav-link.active {
  color: #fff;
  background: transparent;
  border-color: transparent;
}

.nav-link.active .nav-profile-avatar {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgb(95 66 231 / 0.35) inset;
}

.nav-link.active .nav-profile-fallback {
  color: #111;
  background: #fff;
  border-color: var(--primary);
}

.mt-4 {
  margin-top: 16px;
}

@media (max-width: 760px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .page-shell {
    padding-top: var(--space-4);
  }
}
