:root {
  color-scheme: light;
  --bg: #fbfaf6;
  --panel: #ffffff;
  --text: #181816;
  --muted: #686761;
  --line: #dedbd1;
  --soft: #f1efe8;
  --accent: #181816;
  --danger: #8a2424;
  --shadow: 0 18px 42px rgba(24, 24, 22, 0.14);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button,
.button {
  min-height: 42px;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  padding: 0 16px;
  cursor: pointer;
  text-decoration: none;
}

button.secondary,
.button.secondary {
  background: transparent;
  color: var(--text);
}

button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text);
  padding-inline: 10px;
}

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

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 12px;
}

textarea {
  min-height: 128px;
  resize: vertical;
  line-height: 1.5;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
}

img {
  max-width: 100%;
}

.app-shell {
  width: min(100%, 640px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 18px 84px;
}

.view {
  padding: 24px 0 32px;
}

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

.screen-title,
.art-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: 0;
}

.screen-title {
  font-size: clamp(2rem, 12vw, 4rem);
  line-height: 0.95;
}

.art-title {
  font-size: 1.45rem;
  line-height: 1.15;
}

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

.small {
  font-size: 0.86rem;
}

.stack {
  display: grid;
  gap: 16px;
}

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

.row.wrap {
  flex-wrap: wrap;
}

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

.notice,
.empty,
.auth-card,
.compose-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
}

.notice {
  margin-bottom: 18px;
  background: var(--soft);
}

.empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.art-hero {
  display: grid;
  gap: 14px;
}

.art-hero img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: var(--soft);
  box-shadow: var(--shadow);
}

.caption {
  display: grid;
  gap: 4px;
}

.letter {
  margin: 8px 0 0;
  padding: 20px;
  border-left: 3px solid var(--text);
  background: var(--panel);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.searchbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

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

.art-card,
.journal-card,
.request-card,
.friend-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.art-card {
  padding: 0;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.art-card img,
.thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--soft);
}

.journal-card .thumb {
  width: 88px;
  flex: 0 0 88px;
}

.art-card .body,
.journal-card .body,
.request-card,
.friend-card {
  padding: 12px;
}

.card-title {
  margin: 0 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.2;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.compose-preview {
  display: grid;
  gap: 12px;
}

.compose-preview img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: var(--soft);
}

.counter {
  text-align: right;
  color: var(--muted);
  font-size: 0.82rem;
}

.targeting {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.targeting legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.88rem;
}

.targeting-tabs {
  width: 100%;
}

.location-picker {
  min-width: 0;
}

.map {
  z-index: 0;
  width: 100%;
  height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #e6e3da;
}

.map .leaflet-control-attribution {
  font-size: 9px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.tabs button {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

.tabs button.active {
  background: var(--text);
  color: var(--bg);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  width: min(100%, 640px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav a {
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
}

.bottom-nav a.active {
  background: var(--text);
  color: var(--bg);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 0.76rem;
}

.hide {
  display: none !important;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #151514;
    --panel: #1d1d1b;
    --text: #f5f2ea;
    --muted: #aaa59a;
    --line: #34322d;
    --soft: #24231f;
    --danger: #b14a4a;
    --shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  }
}

@media (min-width: 560px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
