:root {
  --page-bg: #f7f7f7;
  --ink: #111111;
  --muted: #7a7a7a;
  --line: #e5e5e5;
  --brand: #007aff;
  --f7-theme-color: #007aff;
  --f7-theme-color-rgb: 0, 122, 255;
  --f7-theme-color-shade: #0066d6;
  --f7-theme-color-tint: #298fff;
  --f7-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: auto;
  min-height: 100%;
  background: var(--page-bg);
  color: var(--ink);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.modal-open {
  overflow: hidden;
}

#app.framework7-root {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.app-page {
  min-height: 100vh;
  background: var(--page-bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.topbar strong {
  font-size: 18px;
}

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

.icon-btn {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px !important;
  min-width: 36px;
  max-width: 36px;
  height: 36px !important;
  min-height: 36px;
  max-height: 36px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  background: #ffffff;
  color: var(--ink);
  padding: 0;
}

.topbar-avatar {
  display: block;
  width: 100% !important;
  height: 100% !important;
  border-radius: 50%;
  object-fit: cover;
}

.intro-band {
  min-height: 224px;
  display: flex;
  align-items: flex-end;
  padding: 44px 20px 28px;
  color: #ffffff;
  background:
    linear-gradient(90deg, rgba(13, 23, 33, 0.82) 0%, rgba(13, 23, 33, 0.58) 42%, rgba(13, 23, 33, 0.18) 100%),
    linear-gradient(180deg, rgba(13, 23, 33, 0.08), rgba(13, 23, 33, 0.46)),
    url("https://images.unsplash.com/photo-1511988617509-a57c8a288659?auto=format&fit=crop&w=1600&q=82") center / cover;
}

.intro-copy {
  width: min(680px, 100%);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: 0;
}

.intro-copy p:last-child {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.55;
}

.shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 12px 12px 28px;
}

.controls {
  overflow: hidden;
  border-radius: 16px;
  background: #ffffff;
}

.view-tabs {
  margin: 0;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.filter-list {
  margin: 0;
  --f7-list-bg-color: #ffffff;
}

.filter-list ul::before,
.filter-list ul::after,
.form-panel .list ul::before,
.form-panel .list ul::after {
  display: none;
}

.quick-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 0 12px 12px;
}

.notice {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px dashed #d2d2d2;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  line-height: 1.5;
}

.stack {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.app-card {
  margin: 0;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.card-header,
.card-body {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 12px;
  color: inherit;
}

.card-header.static {
  cursor: default;
}

.card-title {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 3px;
}

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

.name {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count-pill {
  flex: 0 0 auto;
}

.card-body,
.detail-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.body-text {
  display: block;
  white-space: pre-wrap;
  color: #242424;
  font-size: 15px;
  line-height: 1.65;
}

.post-image-grid {
  display: grid;
  gap: 6px;
  width: 100%;
}

.post-image-grid.single {
  grid-template-columns: minmax(0, 1fr);
}

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

.post-image {
  width: 100%;
  height: 100%;
  max-height: 360px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}

.post-image-grid.single .post-image {
  height: auto;
  aspect-ratio: auto;
}

.post-image-grid.multi .post-image:nth-child(n + 5) {
  display: none;
}

.post-footer {
  color: var(--muted);
  font-size: 12px;
}

.snippets {
  display: grid;
  gap: 1px;
  padding: 0 12px 12px;
}

.snippet {
  overflow: hidden;
  width: 100%;
  border: 0;
  border-top: 1px solid #f0f0f0;
  background: transparent;
  color: var(--muted);
  padding: 8px 0 0;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

.empty {
  padding: 26px 16px;
  border: 1px dashed #d2d2d2;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
}

.compact-empty {
  padding: 16px;
}

.app-modal,
.app-alert {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.app-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
}

.app-sheet {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: 92vh;
  overflow: auto;
  border-radius: 20px 20px 0 0;
  background: var(--page-bg);
  padding-bottom: env(safe-area-inset-bottom);
}

.sheet-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 247, 247, 0.96);
  backdrop-filter: blur(8px);
}

.sheet-header h2 {
  margin: 0;
  font-size: 17px;
}

.sheet-close-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.auth-sheet {
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 122, 255, 0.14), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #fbfcfd 44%, var(--page-bg) 100%);
}

.auth-sheet-header {
  min-height: 86px;
  align-items: flex-start;
  padding: 18px 16px 12px;
  border-bottom: 0;
  background: transparent;
}

.auth-sheet-header h2 {
  margin-top: 2px;
  font-size: 26px;
  line-height: 1.12;
}

.auth-kicker {
  margin: 0;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.form-panel,
.comment-form,
.user-detail,
.post-detail {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.comment-form {
  padding-top: 0;
}

.auth-form {
  gap: 14px;
  padding: 0 16px 18px;
}

.auth-summary {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(0, 122, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.auth-summary.compact {
  margin-top: 2px;
}

.auth-summary h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.auth-summary p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: linear-gradient(135deg, #007aff, #20b486);
  color: #ffffff;
  font-weight: 800;
}

.auth-list {
  overflow: hidden;
  margin: 0;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  --f7-list-bg-color: #ffffff;
  --f7-list-item-min-height: 62px;
}

.auth-list .item-content {
  padding-left: 16px;
}

.auth-list input,
.auth-list select {
  width: 100%;
  min-height: 28px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.auth-list .item-input-wrap::after {
  display: none;
}

.username-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
}

.username-random-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 122, 255, 0.1);
  color: var(--brand);
}

.username-random-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.username-random-btn:disabled {
  opacity: 0.45;
}

.textarea-cell {
  align-items: flex-start;
}

.file-picker {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
}

.file-picker span {
  color: var(--ink);
  font-weight: 700;
}

.file-picker small {
  padding-right: 58px;
  line-height: 1.45;
}

.file-picker input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-picker::after {
  content: "选择";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 42px;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--brand);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.avatar-upload-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.avatar-upload-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, #eaf4ff, #eafaf3);
  color: #096b5a;
  font-size: 13px;
  font-weight: 800;
}

.avatar-file-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: 4px;
  align-items: center;
  min-width: 0;
  padding: 0;
  background: transparent;
  overflow: visible;
}

.avatar-file-picker span,
.avatar-file-picker small {
  grid-column: 1;
}

.avatar-file-picker small {
  padding-right: 0;
}

.avatar-file-picker::after {
  position: static;
  grid-column: 2;
  grid-row: 1 / span 2;
  transform: none;
  align-self: center;
  justify-self: end;
}

.auth-avatar-preview {
  width: 54px;
  height: 54px;
  border-radius: 18px;
}

.form-note {
  margin: 0;
  border-radius: 14px;
  background: rgba(255, 193, 7, 0.13);
  color: #6f5600;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.auth-primary {
  height: 48px;
  border-radius: 14px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(0, 122, 255, 0.22);
}

.image-preview {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 8px;
}

.image-preview-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.selected-image {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 10px;
  background: #eeeeee;
  padding: 0;
}

.selected-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.selected-image span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  min-width: 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #ffffff;
  padding: 2px 6px;
  font-size: 11px;
  text-align: center;
}

.avatar-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.account-sheet {
  background:
    radial-gradient(circle at 100% 0%, rgba(32, 180, 134, 0.12), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #f8f9fb 48%, var(--page-bg) 100%);
}

.account-sheet-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 12px;
  align-items: start;
  padding: 16px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.account-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 0;
  background: transparent;
}

.account-card .avatar {
  width: 58px;
  height: 58px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.account-tabs {
  margin: 0 16px 12px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.05);
}

.account-panel {
  padding: 0 16px;
}

.account-form {
  display: grid;
  gap: 12px;
}

.account-list {
  overflow: hidden;
  margin: 0;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.05);
  --f7-list-bg-color: #ffffff;
}

.account-list .item-content {
  padding-left: 16px;
}

.account-list input,
.account-list select {
  border: 0;
  outline: 0;
  background: transparent;
}

.profile-readonly-value {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
}

.account-list small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.profile-avatar-picker,
.account-form .button {
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.05);
}

.account-logout {
  width: calc(100% - 32px);
  margin: 12px 16px 18px;
  color: #d93025;
  background: transparent;
}

.comments {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.comments h3 {
  margin: 0;
  font-size: 16px;
}

.comment-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: #ffffff;
}

.comment-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.comment-head strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-item p {
  margin: 4px 0 0;
  line-height: 1.55;
}

.app-alert .dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 81;
  transform: translate(-50%, -50%);
}

.app-alert .dialog-text {
  white-space: pre-wrap;
  text-align: left;
}

.credentials-success {
  z-index: 82;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #f6f8fb;
}

.success-panel {
  display: grid;
  gap: 12px;
  width: min(420px, 100%);
  border-radius: 24px;
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 122, 255, 0.14), transparent 38%),
    #ffffff;
  padding: 26px 18px 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.1);
}

.success-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, #007aff, #20b486);
  color: #ffffff;
  font-size: 28px;
  font-weight: 800;
}

.success-panel h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
}

.success-note,
.success-notice {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.credential-card {
  display: grid;
  gap: 10px;
  border-radius: 18px;
  background: #f7faff;
  padding: 12px;
}

.credential-card div {
  display: grid;
  gap: 4px;
  border-radius: 14px;
  background: #ffffff;
  padding: 12px;
}

.credential-card span {
  color: var(--muted);
  font-size: 12px;
}

.credential-card strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 20px;
  letter-spacing: 0;
}

.success-close {
  height: 48px;
  border-radius: 14px;
  font-weight: 800;
}

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.92);
  touch-action: pan-y;
}

.photo-viewer img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
}

.photo-viewer-close,
.photo-viewer-nav {
  position: absolute;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  backdrop-filter: blur(8px);
}

.photo-viewer-close {
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  width: 42px;
  height: 42px;
  font-size: 28px;
  line-height: 1;
}

.photo-viewer-nav {
  top: 50%;
  width: 42px;
  height: 42px;
  transform: translateY(-50%);
  font-size: 34px;
}

.photo-viewer-prev {
  left: 12px;
}

.photo-viewer-next {
  right: 12px;
}

.photo-viewer-count {
  position: absolute;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #ffffff;
  padding: 5px 12px;
  font-size: 13px;
}

.date-picker-input {
  cursor: pointer;
}

.comment-form textarea,
.form-panel textarea {
  width: 100%;
  min-height: 96px;
  border: 0;
  background: transparent;
  resize: vertical;
  color: var(--ink);
}

@media (min-width: 680px) {
  .intro-band {
    min-height: 280px;
    padding-left: 34px;
  }

  h1 {
    font-size: 42px;
  }

  .app-sheet {
    right: 50%;
    left: auto;
    width: min(560px, calc(100vw - 32px));
    transform: translateX(50%);
    border-radius: 16px;
    bottom: 24px;
    max-height: calc(100vh - 48px);
  }

  .auth-sheet {
    width: min(460px, calc(100vw - 32px));
  }
}
