:root {
  --bg: #f7f2e9;
  --bg-soft: #fffaf3;
  --paper: #fffdf8;
  --paper-warm: #fff7e8;
  --paper-sage: #edf4eb;

  --ink: #342d29;
  --muted: #776f68;
  --line: #e5d9cc;
  --line-strong: #d6c4b4;

  --accent: #d9785d;
  --accent-dark: #b95d45;
  --accent-soft: #f9e2d8;

  --sage: #70957d;
  --sage-dark: #557661;
  --sage-soft: #e1eee4;

  --yellow: #e7bb63;
  --yellow-soft: #fff0c9;

  --lavender: #a797c7;
  --lavender-soft: #eee9f8;

  --danger: #c95f66;
  --danger-soft: #fae6e8;

  --shadow-sm: 0 5px 16px rgba(92, 69, 50, 0.08);
  --shadow: 0 12px 30px rgba(92, 69, 50, 0.1);

  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 30px;

  --content-width: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.78), transparent 31%),
    linear-gradient(180deg, #fbf7f0 0%, var(--bg) 62%, #f4ede3 100%);
  color: var(--ink);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(145, 113, 78, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(145, 113, 78, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  content: "";
  pointer-events: none;
}

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

img {
  display: block;
  max-width: 100%;
}

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

button {
  border: 0;
  cursor: pointer;
}

textarea {
  resize: vertical;
}

[hidden],
.hidden {
  display: none !important;
}

/* ---------- common layout ---------- */

.page,
.home,
.page-wrap {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  padding: 34px 0 68px;
}

.section {
  margin-top: 34px;
}

.panel,
.card,
.form-card,
.message-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow-sm);
}

.panel,
.form-card,
.message-card {
  padding: 24px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 92% 14%, rgba(255, 255, 255, 0.94), transparent 24%),
    linear-gradient(135deg, #fffaf2 0%, #f6ede0 100%);
  box-shadow: var(--shadow-sm);
}

.hero::after {
  position: absolute;
  top: -10px;
  right: 11%;
  width: 74px;
  height: 18px;
  border-radius: 4px;
  background: rgba(222, 195, 164, 0.66);
  box-shadow: 0 3px 8px rgba(92, 69, 50, 0.08);
  content: "";
  transform: rotate(6deg);
}

.small-hero {
  margin-bottom: 22px;
}

.hero h1,
.page h1,
.page h2,
.page h3 {
  color: var(--ink);
}

.hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.18;
}

.hero p {
  position: relative;
  z-index: 1;
}

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

.lead,
.hero p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.8;
}

.mini-info,
.note,
.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

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

.center {
  text-align: center;
}

/* ---------- header ---------- */

#siteHeader {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 10px 16px 0;
}

#siteHeader > * {
  border: 1px solid rgba(229, 217, 204, 0.96);
  border-bottom-color: rgba(214, 196, 180, 0.88);
  border-radius: 18px 18px 0 0;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(255, 248, 239, 0.9)),
    repeating-linear-gradient(
      0deg,
      rgba(125, 94, 66, 0.018) 0,
      rgba(125, 94, 66, 0.018) 1px,
      transparent 1px,
      transparent 5px
    );
  box-shadow: 0 7px 20px rgba(92, 69, 50, 0.08);
  backdrop-filter: blur(16px);
}

.site-header-inner,
.site-header,
.header-inner,
#siteHeader header {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(100%, 1280px);
  min-height: 64px;
  margin: 0 auto;
  padding: 10px 16px;
}

.site-logo,
.logo,
#siteHeader .logo {
  position: relative;
  flex-shrink: 0;
  padding: 7px 11px 7px 10px;
  border-radius: 10px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 950;
  letter-spacing: 0.06em;
  transition:
    transform 0.18s ease,
    color 0.18s ease;
}

.site-logo::before,
.logo::before,
#siteHeader .logo::before {
  margin-right: 3px;
  color: var(--accent);
  content: "✦";
}

.site-logo::after,
.logo::after,
#siteHeader .logo::after {
  position: absolute;
  top: -5px;
  right: -10px;
  width: 30px;
  height: 9px;
  border-radius: 2px;
  background: rgba(231, 187, 99, 0.56);
  box-shadow: 0 2px 4px rgba(92, 69, 50, 0.08);
  content: "";
  transform: rotate(8deg);
}

.site-logo:hover,
.logo:hover,
#siteHeader .logo:hover {
  color: var(--accent-dark);
  transform: translateY(-1px) rotate(-1deg);
}

.header-menu,
.main-nav,
#headerMenu {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.nav {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.header-menu a,
.main-nav a,
#headerMenu a {
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.header-menu .nav a:hover,
.main-nav a:hover,
#headerMenu .nav a:hover {
  border-color: rgba(217, 120, 93, 0.2);
  background: var(--accent-soft);
  color: var(--accent-dark);
  transform: translateY(-1px);
}

.header-actions,
.auth-box,
#siteHeader .auth-box {
  position: relative;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.header-account-link,
#userName {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.86);
  color: var(--sage-dark);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.header-account-link::before,
#userName::before {
  margin-right: 5px;
  color: var(--sage);
  content: "●";
  font-size: 9px;
}

.header-account-link:hover,
#userName:hover {
  border-color: #a7c3af;
  background: var(--sage-soft);
  transform: translateY(-1px);
}

.header-login-btn,
#loginBtn {
  min-height: 38px;
  padding: 8px 15px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 5px 12px rgba(185, 93, 69, 0.18);
  color: #fffdf9;
  font-size: 13px;
  font-weight: 900;
  transition:
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.header-login-btn:hover,
#loginBtn:hover {
  background: var(--accent-dark);
  box-shadow: 0 8px 16px rgba(185, 93, 69, 0.24);
  transform: translateY(-1px);
}

.login-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 120;
  display: grid;
  gap: 12px;
  width: min(330px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.98), rgba(255, 247, 232, 0.96));
  box-shadow: var(--shadow);
}

.login-panel label {
  gap: 6px;
  font-size: 12px;
}

.login-panel input {
  min-height: 40px;
}

.google-login-btn,
.login-actions button {
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 11px;
  font-weight: 900;
}

.google-login-btn {
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
}

.google-login-btn:hover {
  background: var(--paper-warm);
}

.login-divider {
  position: relative;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.login-divider::before,
.login-divider::after {
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--line);
  content: "";
}

.login-divider::before {
  left: 0;
}

.login-divider::after {
  right: 0;
}

.login-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#emailLoginBtn {
  background: var(--accent);
  color: #fffdf9;
}

#emailRegisterBtn {
  background: var(--sage-soft);
  color: var(--sage-dark);
}

.login-message {
  min-height: 1.3em;
  margin: 0;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

#menuToggle,
.menu-toggle {
  display: none;
}

/* ---------- buttons ---------- */

.primary-btn,
.ghost-btn,
.danger-btn,
.small-btn,
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 10px 17px;
  border-radius: 999px;
  font-weight: 900;
  line-height: 1;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.primary-btn,
.primary-link {
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(185, 93, 69, 0.2);
  color: #fffdf9;
}

.primary-btn:hover,
.primary-link:hover {
  background: var(--accent-dark);
  box-shadow: 0 12px 22px rgba(185, 93, 69, 0.26);
  transform: translateY(-2px);
}

.ghost-btn {
  border: 1px solid var(--line-strong);
  background: rgba(255, 253, 248, 0.86);
  color: var(--ink);
}

.ghost-btn:hover {
  border-color: #dca48d;
  background: var(--paper-warm);
  transform: translateY(-2px);
}

.danger-btn {
  background: var(--danger-soft);
  color: var(--danger);
}

.small-btn {
  min-height: 34px;
  padding: 8px 12px;
  background: var(--sage-soft);
  color: var(--sage-dark);
  font-size: 13px;
}

.text-link {
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 900;
}

.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

button:disabled,
.primary-btn:disabled,
.ghost-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* ---------- forms ---------- */

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 254, 250, 0.98);
  color: var(--ink);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

input,
select {
  min-height: 44px;
  padding: 10px 12px;
}

textarea {
  min-height: 120px;
  padding: 12px;
  line-height: 1.7;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  background: #fffefa;
  box-shadow: 0 0 0 4px rgba(217, 120, 93, 0.14);
}

.check-label {
  display: flex;
  align-items: center;
  gap: 9px;
}

.check-label input {
  width: 18px;
  min-height: 18px;
}

.form-message {
  min-height: 1.5em;
  margin: 12px 0 0;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 800;
}

.error-text {
  color: var(--danger);
  font-weight: 800;
}

/* ---------- generic cards / lists ---------- */

.card {
  overflow: hidden;
}

.card-body {
  padding: 16px;
}

.card-title {
  margin: 0;
  font-size: 18px;
}

.card-text {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.empty-state {
  padding: 38px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.72);
  color: var(--muted);
  text-align: center;
}

.empty-state h2,
.empty-state h3 {
  margin: 0 0 8px;
  color: var(--ink);
}

.empty-state p {
  margin: 0;
  line-height: 1.8;
}

.tag,
.chip,
.filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--sage-dark);
  font-size: 12px;
  font-weight: 900;
}

.tag-list,
.chip-list,
.filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- footer ---------- */

#siteFooter {
  margin-top: 44px;
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.6);
}

#siteFooter > * {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  padding: 30px 0 36px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
  text-align: center;
}

#siteFooter a {
  color: var(--accent-dark);
  font-weight: 900;
}

/* ---------- mobile ---------- */

@media (max-width: 900px) {
  #siteHeader {
    padding: 8px 10px 0;
  }

  .site-header-inner,
  .site-header,
  .header-inner,
  #siteHeader header {
    min-height: 58px;
    padding: 8px 10px;
  }

  #menuToggle,
  .menu-toggle {
    display: inline-grid;
    width: 40px;
    height: 38px;
    margin-left: auto;
    padding: 9px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    background: var(--paper);
    place-content: center;
    gap: 4px;
  }

  .menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--ink);
    transition:
      transform 0.18s ease,
      opacity 0.18s ease;
  }

  .menu-toggle.is-open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .menu-toggle.is-open span:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle.is-open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .header-menu,
  .main-nav,
  #headerMenu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 10px;
    left: 10px;
    width: auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 253, 248, 0.98);
    box-shadow: var(--shadow);
  }

  .header-menu.is-open,
  .main-nav.is-open,
  #headerMenu.is-open {
    display: grid;
    gap: 10px;
  }

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

  .header-menu .nav a,
  .main-nav a,
  #headerMenu .nav a {
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 247, 232, 0.58);
    text-align: center;
  }

  .auth-box,
  #siteHeader .auth-box {
    margin-left: 0;
  }

  .header-menu .auth-box {
    justify-content: center;
  }

  .login-panel {
    position: static;
    width: 100%;
    margin-top: 2px;
  }
}

@media (max-width: 560px) {
  .site-logo,
  .logo,
  #siteHeader .logo {
    font-size: 19px;
  }

  .nav {
    grid-template-columns: 1fr;
  }

  .header-account-link,
  #userName,
  .header-login-btn,
  #loginBtn {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 12px;
  }
}
