:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #f0f5f1;
  --text: #17211d;
  --muted: #5a6962;
  --line: #d8e2dc;
  --brand: #0f6b5b;
  --brand-strong: #0a5145;
  --rose: #a93465;
  --amber: #8a6108;
  --danger: #b83232;
  --shadow: 0 16px 42px rgba(23, 33, 29, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(15, 107, 91, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(169, 52, 101, 0.05) 1px, transparent 1px),
    linear-gradient(160deg, #f7faf6 0%, #eef4f0 52%, #fff7f3 100%);
  background-size: 28px 28px, 28px 28px, auto;
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--brand);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--brand-strong);
}

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

button.ghost {
  background: #e8eee9;
  color: #294139;
}

button.danger {
  background: var(--danger);
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: white;
  color: var(--text);
}

input:focus {
  outline: none;
  border-color: rgba(15, 107, 91, 0.55);
  box-shadow: 0 0 0 4px rgba(15, 107, 91, 0.12);
}

.shell {
  width: min(1160px, calc(100% - 24px));
  margin: 14px auto 28px;
  display: grid;
  gap: 14px;
}

.topbar,
.auth-panel,
.composer,
.feed-toolbar,
.post,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 110px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
}

.brand-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--rose);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.4rem, 7vw, 5.2rem);
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  font-size: 1.2rem;
}

.session-panel,
.button-row,
.feed-toolbar,
.tabs,
.segmented,
.post-actions,
.post-footer,
.post-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.session-panel span {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  background: var(--surface-soft);
  font-weight: 700;
}

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

.auth-panel {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.auth-panel label,
.composer-controls {
  display: grid;
  gap: 6px;
}

.auth-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.app-view {
  display: grid;
  gap: 14px;
}

.composer {
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 14px;
}

.dropzone {
  min-height: 250px;
  border: 1px dashed rgba(169, 52, 101, 0.5);
  border-radius: 8px;
  background: #fff8fa;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--rose);
  font-weight: 800;
  cursor: pointer;
}

.dropzone input {
  display: none;
}

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

.composer-controls {
  align-content: center;
}

.segmented,
.tabs {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  width: fit-content;
}

.segmented button,
.tabs button {
  min-width: 96px;
  background: transparent;
  color: #294139;
  box-shadow: none;
}

.segmented button.is-active,
.tabs button.is-active {
  background: var(--brand);
  color: white;
}

.file-meta {
  min-height: 22px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.feed-toolbar {
  justify-content: space-between;
  padding: 10px;
}

.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.post {
  overflow: hidden;
  display: grid;
}

.post-head,
.post-footer {
  padding: 11px;
  justify-content: space-between;
}

.post-head div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.post-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-head small {
  color: var(--muted);
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge.public {
  background: #e3f4ed;
  color: var(--brand-strong);
}

.badge.private {
  background: #fff0c7;
  color: var(--amber);
}

.post-image {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: #e8eee9;
}

.aura-count {
  font-size: 19px;
  font-weight: 800;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 20px;
  color: var(--muted);
}

.toast-slot {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 10;
}

.toast {
  max-width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
  color: var(--text);
}

.toast.error {
  border-color: #e0b4b4;
  color: var(--danger);
}

@media (max-width: 760px) {
  .topbar,
  .auth-grid,
  .composer {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
  }

  .session-panel,
  .feed-toolbar,
  .post-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .session-panel > *,
  .feed-toolbar > *,
  .button-row > *,
  .post-actions > * {
    width: 100%;
  }

  .tabs,
  .segmented {
    width: 100%;
  }

  .tabs button,
  .segmented button {
    flex: 1 1 0;
    min-width: 0;
  }
}