:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --panel: #fffaf2;
  --panel-strong: #ffffff;
  --ink: #121b1a;
  --muted: #69736f;
  --line: rgba(18, 27, 26, 0.13);
  --accent: #047a78;
  --accent-dark: #005b58;
  --danger: #bd493e;
  --shadow: 0 24px 70px rgba(19, 28, 26, 0.16);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(4, 122, 120, 0.11), transparent 34%),
    linear-gradient(315deg, rgba(189, 73, 62, 0.11), transparent 30%),
    var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(88px + env(safe-area-inset-bottom));
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 980px;
  margin: 0 auto 18px;
  padding: 12px 0;
  backdrop-filter: blur(18px);
}

.brand,
.header-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-weight: 900;
}

.brand strong {
  font-size: 17px;
}

.sync-state {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 250, 242, 0.78);
  font-size: 12px;
}

.icon-button,
.primary-button,
.secondary-button,
.danger-button,
.upload-button {
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 800;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  padding: 0;
  border-color: var(--line);
  color: var(--ink);
  background: var(--panel-strong);
}

.primary-button {
  padding: 0 18px;
  color: #fffaf2;
  background: var(--accent);
}

.secondary-button,
.upload-button {
  padding: 0 16px;
  color: var(--ink);
  border-color: var(--line);
  background: var(--panel-strong);
}

.danger-button {
  width: 100%;
  padding: 0 16px;
  color: #fffaf2;
  background: var(--danger);
}

.icon-button:hover,
.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.upload-button:hover {
  transform: translateY(-1px);
}

.auth-screen,
.workspace {
  max-width: 980px;
  margin: 0 auto;
}

.auth-screen {
  display: grid;
  min-height: calc(100svh - 160px);
  place-items: center;
}

.auth-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 242, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.auth-card {
  display: grid;
  gap: 18px;
  width: min(460px, 100%);
  padding: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 8vw, 54px);
  line-height: 1.04;
  letter-spacing: 0;
}

.workspace {
  display: grid;
  gap: 18px;
}

.panel {
  min-height: calc(100svh - 150px);
  padding: clamp(18px, 4vw, 30px);
}

.panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.field,
.auth-card label {
  display: grid;
  gap: 8px;
}

.field span,
.auth-card label span,
.photo-picker-head span,
.visibility legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select,
.auth-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  outline: 0;
  color: var(--ink);
  background: var(--panel-strong);
}

.field textarea {
  resize: vertical;
  min-height: 190px;
  line-height: 1.8;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.auth-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(4, 122, 120, 0.12);
}

.compose-panel form {
  display: grid;
  gap: 16px;
}

.photo-picker {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

.photo-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-button {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.photo-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: rgba(18, 27, 26, 0.08);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-item button {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  color: #fffaf2;
  background: rgba(5, 8, 8, 0.62);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.visibility {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.visibility legend {
  width: 100%;
  margin-bottom: 8px;
}

.visibility label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
}

.status-line {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.feed-list {
  display: grid;
  gap: 14px;
}

.feed-card,
.draft-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.feed-card {
  overflow: hidden;
}

.feed-body {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.feed-body time {
  color: var(--muted);
  font-size: 13px;
}

.feed-body h2 {
  margin: 0;
  font-size: 22px;
}

.feed-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.feed-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: rgba(18, 27, 26, 0.08);
}

.feed-photos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.draft-card {
  min-height: 180px;
  padding: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.settings-list {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
}

.settings-list div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.settings-list dt {
  color: var(--muted);
  font-weight: 700;
}

.settings-list dd {
  margin: 0;
  word-break: break-all;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(520px, calc(100% - 28px));
  transform: translateX(-50%);
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.9);
  box-shadow: 0 18px 48px rgba(19, 28, 26, 0.16);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.bottom-nav button.active {
  color: #fffaf2;
  background: var(--ink);
}

[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .app-shell {
    padding-inline: 14px;
  }

  .panel {
    min-height: calc(100svh - 142px);
  }

  .panel-head,
  .photo-picker-head {
    align-items: start;
  }

  .meta-grid,
  .action-row {
    grid-template-columns: 1fr;
  }

  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
