*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-raised: #faf9f7;
  --border: #e5e0d8;
  --border-subtle: #ede9e3;
  --text: #1c1917;
  --text-secondary: #57534e;
  --muted: #78716c;
  --accent: #b07540;
  --accent-dark: #935f30;
  --accent-subtle: #fdf6ed;
  --danger: #dc2626;
  --danger-subtle: #fef2f2;
  --wanted-bg: #dbeafe;
  --wanted-fg: #1d4ed8;
  --wanted-border: #bfdbfe;
  --ordered-bg: #fef3c7;
  --ordered-fg: #b45309;
  --ordered-border: #fde68a;
  --bought-bg: #dcfce7;
  --bought-fg: #166534;
  --bought-border: #bbf7d0;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px rgb(0 0 0 / 0.08), 0 1px 2px rgb(0 0 0 / 0.06);
  --shadow-md: 0 4px 12px rgb(0 0 0 / 0.08), 0 2px 4px rgb(0 0 0 / 0.05);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 3.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

header > a {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

header form {
  flex-direction: row;
  align-items: center;
  max-width: none;
  gap: 0;
}

.log-out {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
  align-self: center;
}

.log-out:hover {
  color: var(--text);
  border-color: var(--text-secondary);
  background-color: var(--surface-raised);
}

main {
  max-width: 52rem;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}

h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
}

.filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: center;
}

.filters a {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
  white-space: nowrap;
}

.filters a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background-color: var(--accent-subtle);
}

.filters .filter-trash {
  margin-left: auto;
}

.filters .filter-trash:hover {
  color: var(--danger);
  border-color: var(--danger);
  background-color: var(--danger-subtle);
}

.btn-new {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 1.5rem;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
}

.btn-new:hover {
  background: var(--accent-dark);
  box-shadow: 0 3px 10px rgb(176 117 64 / 0.35);
  transform: translateY(-1px);
}

.btn-new:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.1);
}

#posts {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#posts li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
}

#posts li:hover {
  box-shadow: var(--shadow);
  border-color: #d8d2c8;
}

#posts li:has(.status-wanted)  { border-left: 3px solid var(--wanted-fg); }
#posts li:has(.status-ordered) { border-left: 3px solid var(--ordered-fg); }
#posts li:has(.status-bought)  { border-left: 3px solid var(--bought-fg); }

.post-images {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.post-images img {
  width: 7.5rem;
  height: 7.5rem;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  transition: transform 0.15s, box-shadow 0.15s;
}

.post-images img:hover {
  transform: scale(1.04);
  box-shadow: var(--shadow);
}

.post-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.post-header strong {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.status {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid transparent;
}

.status-wanted  { background: var(--wanted-bg);  color: var(--wanted-fg);  border-color: var(--wanted-border); }
.status-ordered { background: var(--ordered-bg); color: var(--ordered-fg); border-color: var(--ordered-border); }
.status-bought  { background: var(--bought-bg);  color: var(--bought-fg);  border-color: var(--bought-border); }
.status-deleted { background: #f4f4f5; color: #71717a; border-color: #e4e4e7; }

.description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.65rem;
  line-height: 1.55;
}

#posts a {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

#posts a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border-subtle);
}

.post-actions form {
  display: contents;
}

.post-actions a,
.post-actions button {
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.12s;
}

.post-actions a:hover {
  color: var(--accent);
}

.post-actions button:hover {
  color: var(--danger);
}

form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 30rem;
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9375rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(176 117 64 / 0.12);
}

input[type="file"] {
  padding: 0.45rem 0.7rem;
  font-size: 0.875rem;
  color: var(--muted);
  cursor: pointer;
}

textarea {
  min-height: 6.5rem;
  resize: vertical;
  line-height: 1.6;
}

button[type="submit"] {
  align-self: flex-start;
  padding: 0.55rem 1.4rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.1);
}

button[type="submit"]:hover {
  background: var(--accent-dark);
  box-shadow: 0 3px 10px rgb(176 117 64 / 0.3);
  transform: translateY(-1px);
}

button[type="submit"]:active {
  transform: translateY(0);
}

#login-area {
  max-width: 22rem;
  margin: 5rem auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-md);
}

#login-area p {
  font-size: 0.9rem;
  margin-bottom: 0.875rem;
  color: var(--text-secondary);
}

#login-area .error {
  color: var(--danger);
}

.error {
  color: var(--danger);
  font-size: 0.875rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}
