@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --cream: #f5efe6;
  --paper: #fbf7f0;
  --ink: #3f3a34;
  --muted: #7d746a;
  --border: rgba(63, 58, 52, 0.12);
  --teal: #2e888a;
  --accent: #b26a45;
  --shadow-card: 0 12px 26px rgba(43, 37, 31, 0.12);
}

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

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  min-height: 100vh;
}

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

header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(245, 239, 230, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(63, 58, 52, 0.08);
}

.brand {
  font-family: 'Fraunces', serif;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header-nav {
  display: none;
  align-items: center;
  gap: 18px;
}

.header-nav-link {
  font-size: 14px;
  color: var(--muted);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-nav-link:hover {
  color: var(--ink);
}

.header-nav-link.active {
  color: var(--ink);
  font-weight: 500;
  border-bottom-color: rgba(63, 58, 52, 0.35);
}

.header-actions { display: flex; align-items: center; gap: 12px; }

.auth-link {
  font-size: 14px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
}

.auth-link:hover { color: var(--ink); }

.avatar-menu { position: relative; display: none; }

.avatar-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: rgba(63, 58, 52, 0.1);
}

.avatar-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-dropdown {
  position: absolute;
  right: 0;
  top: 44px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 26px rgba(43, 37, 31, 0.18);
  padding: 8px;
  min-width: 140px;
  display: none;
  z-index: 30;
}

.avatar-menu.open .avatar-dropdown { display: block; }

.avatar-dropdown button {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}

.avatar-dropdown button:hover {
  background: rgba(63, 58, 52, 0.08);
  border-radius: 8px;
}

.app-main {
  width: min(900px, 100% - 32px);
  margin: 24px auto 100px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 20px;
}

.section-title {
  font-family: 'Fraunces', serif;
  font-size: 34px;
  font-weight: 500;
  margin-bottom: 12px;
}

.section-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 14px;
}

.section-divider {
  border-top: 1px solid var(--border);
  margin: 8px 0 0;
}

.saved-palette-list {
  display: grid;
  gap: 12px;
}

.saved-palette-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.saved-palette-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.saved-palette-name { font-weight: 500; }
.saved-palette-meta { color: var(--muted); font-size: 13px; }
.saved-swatches { display: flex; gap: 6px; }

.saved-swatch {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.saved-empty {
  color: var(--muted);
  font-size: 14px;
}

.bottom-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: rgba(251, 247, 240, 0.98);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  gap: 10px;
}

.bottom-tab {
  height: 42px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background: transparent;
}

.bottom-tab.active {
  border-color: var(--border);
  color: var(--ink);
  background: #fff;
}

@media (min-width: 768px) {
  .header-nav {
    display: inline-flex;
  }

  .bottom-tabs {
    display: none;
  }

  .app-main {
    margin-bottom: 28px;
  }
}

@media (min-width: 960px) {
  .brand { font-size: 38px; }
  header { padding: 22px 32px; }
  .app-main { width: min(960px, 100% - 80px); }
}
