:root {
  /* Light Mode */
  --bg-color: #f0ede6;
  --text-primary: #121212;
  --accent: #ff3e00;
  --border-color: rgba(18, 18, 18, 0.15);
  --border-strong: #121212;
  --card-bg: rgba(255, 255, 255, 0.4);
  --noise-opacity: 0.04;
  --btn-hover-bg: rgba(18, 18, 18, 0.03);
  
  --font-display: 'Instrument Serif', serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-title: 'Noto Serif SC', serif;
  --font-body: 'Noto Sans SC', sans-serif;
  
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-smooth: cubic-bezier(0.25, 1, 0.5, 1);
}

[data-theme='dark'] {
  --bg-color: #111111;
  --text-primary: #e8e6e1;
  --accent: #ff5216;
  --border-color: rgba(232, 230, 225, 0.15);
  --border-strong: #e8e6e1;
  --card-bg: rgba(255, 255, 255, 0.03);
  --noise-opacity: 0.06;
  --btn-hover-bg: rgba(232, 230, 225, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s var(--ease-smooth), color 0.4s var(--ease-smooth);
}

/* Noise Texture - Shared */
.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Layout - Shared */
.site-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Masthead - Shared */
.masthead {
  margin-bottom: 2rem;
  padding-top: 1rem;
}

.masthead-top {
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  padding: 0.5rem 0;
  overflow: hidden;
  background: var(--text-primary);
  color: var(--bg-color);
  margin-bottom: 2rem;
}

.marquee-container {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.marquee-text {
  display: inline-block;
  animation: marquee 20s linear infinite;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.title {
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 0.9;
  margin: 0;
  position: relative;
}

.title-sub {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  color: var(--accent);
  margin-left: 0.5rem;
}

.subtitle {
  font-family: var(--font-mono);
  opacity: 0.7;
}

.stat-label {
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 0.2rem;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: var(--font-display);
  line-height: 1;
  color: var(--accent);
}

.meta-bottom {
  display: flex;
  gap: 2rem;
  justify-content: flex-end;
  align-items: flex-end;
}

.theme-toggle {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

#theme-btn:hover {
  color: var(--text-primary) !important;
}

.search-label {
  display: block;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  font-weight: 700;
}

.input-wrapper {
  display: flex;
  border: 1px solid var(--border-strong);
  background: var(--bg-color);
  transition: box-shadow 0.3s var(--ease-smooth), transform 0.3s var(--ease-smooth);
}

.search-form input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  color: var(--text-primary);
  outline: none;
  border-radius: 0;
  -webkit-appearance: none;
}

.search-form input::placeholder {
  color: var(--text-primary);
  opacity: 0.4;
}

.search-form button {
  background: var(--text-primary);
  color: var(--bg-color);
  border: none;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}

.search-form button:hover {
  background: var(--accent);
}

.hint {
  font-family: var(--font-mono);
  color: var(--text-primary);
  opacity: 0.6;
  border-left: 2px solid var(--accent);
}

.rotating-star {
  width: 40px;
  height: 40px;
  animation: rotate 10s linear infinite;
}

@keyframes rotate {
  100% { transform: rotate(360deg); }
}

.feed-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.feed-header h2 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.feed-line {
  height: 1px;
  background: var(--border-strong);
  flex: 1;
}

.moment-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.moment-card {
  animation: fadeUp 0.8s var(--ease-smooth) both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.contact-name {
  font-family: var(--font-display);
  color: var(--accent);
  line-height: 1;
}

.card-meta {
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.date-published {
  font-weight: 700;
}

.card-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.del-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s var(--ease-smooth);
}

.nav-btn {
  background: transparent;
  font-family: var(--font-display);
  cursor: pointer;
  transition: color 0.3s;
}

.page-indicator {
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
}


/* =========================================
   DESKTOP ADAPTATION (>= 900px)
   ========================================= */
@media (min-width: 900px) {
  .site-wrapper {
    padding: 0 3rem;
  }
  
  .masthead {
    border-bottom: 2px solid var(--border-strong);
    margin-bottom: 4rem;
  }
  
  .masthead-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 2rem;
  }
  
  .title {
    font-size: clamp(4rem, 10vw, 8rem);
  }
  
  .title-sub {
    font-size: 0.7em;
  }
  
  .masthead-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 350px;
  }
  
  .subtitle {
    font-size: 0.85rem;
  }
  
  .stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
  }
  
  .stat-label {
    font-size: 0.7rem;
  }
  
  .stat-value {
    font-size: 4rem;
  }
  
  .layout-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 5rem;
    flex: 1;
    padding-bottom: 6rem;
  }
  
  .sidebar {
    border-right: 1px solid var(--border-strong);
    padding-right: 3rem;
  }
  
  .sidebar-sticky {
    position: sticky;
    top: 3rem;
  }
  
  .search-form {
    margin-bottom: 4rem;
  }
  
  .search-label {
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
  }
  
  .input-wrapper:focus-within {
    box-shadow: 6px 6px 0 var(--accent);
    transform: translate(-3px, -3px);
  }
  
  .search-form input {
    padding: 1rem;
    font-size: 1rem;
  }
  
  .search-form button {
    padding: 0 1.5rem;
    font-size: 1.2rem;
  }
  
  .hint {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    padding-left: 1rem;
  }
  
  .decorative-element {
    display: flex;
    justify-content: center;
    opacity: 0.2;
  }
  
  .moment-list {
    gap: 3rem;
  }
  
  .moment-card {
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    padding: 2.5rem;
    transition: transform 0.4s var(--ease-spring), box-shadow 0.4s var(--ease-spring), background-color 0.4s var(--ease-smooth);
  }
  
  .moment-card:hover {
    transform: translate(-6px, -6px);
    box-shadow: 12px 12px 0 var(--border-strong);
  }
  
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
  }
  
  .contact-name {
    font-size: 2.5rem;
  }
  
  .card-meta {
    align-items: flex-end;
    font-size: 0.75rem;
  }
  
  .card-content {
    font-size: 1.15rem;
    max-width: 70ch;
  }
  
  .card-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
  }
  
  .del-btn {
    font-size: 0.75rem;
    padding: 0.5rem 1.2rem;
  }
  
  .del-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-color);
    transform: translateY(-2px);
    box-shadow: 4px 4px 0 var(--text-primary);
  }
  
  .pagination {
    margin-top: 5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid var(--border-strong);
    border-bottom: 2px solid var(--border-strong);
  }
  
  .nav-btn {
    border: none;
    font-size: 1.5rem;
    padding: 1.5rem 3rem;
  }
  
  .nav-btn:not(:disabled):hover {
    color: var(--accent);
    background: var(--btn-hover-bg);
  }
  
  .nav-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
  }
  
  .page-indicator {
    font-size: 0.9rem;
  }
}


/* =========================================
   MOBILE ADAPTATION (< 900px)
   ========================================= */
@media (max-width: 899px) {
  .masthead {
    margin-bottom: 1rem;
  }
  
  .masthead-top {
    margin-bottom: 1.5rem;
  }
  
  .masthead-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .title {
    font-size: clamp(3.5rem, 15vw, 5rem);
    line-height: 1;
  }
  
  .title-sub {
    display: block;
    font-size: 0.5em;
    margin-left: 0;
    margin-top: 0.5rem;
  }
  
  .masthead-meta {
    border-top: 2px solid var(--border-strong);
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: 100%;
    gap: 1rem;
  }
  
  .subtitle {
    font-size: 0.75rem;
    width: 100%;
    text-align: left;
  }
  
  .meta-bottom {
    width: 100%;
    justify-content: space-between;
  }
  
  .stats {
    text-align: right;
  }
  
  .stat-label {
    font-size: 0.65rem;
  }
  
  .stat-value {
    font-size: 2.5rem;
  }
  
  .layout-grid {
    display: flex;
    flex-direction: column;
  }
  
  /* Mobile Sticky Search Bar */
  .sidebar-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-color);
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-strong);
  }
  
  /* Mask gradient for smooth scroll underneath */
  .sidebar-sticky::before {
    content: '';
    position: absolute;
    top: -2rem;
    left: -1.5rem;
    right: -1.5rem;
    bottom: -1px;
    background: var(--bg-color);
    z-index: -1;
  }

  .search-form {
    position: relative;
    z-index: 2;
  }
  
  .search-label {
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
  }
  
  .input-wrapper:focus-within {
    border-color: var(--accent);
  }
  
  .search-form input {
    padding: 0.75rem;
    font-size: 0.9rem;
  }
  
  .search-form button {
    padding: 0 1rem;
    font-size: 1rem;
  }
  
  .hint {
    display: none; /* Hide hint on mobile to save sticky space */
  }
  
  .decorative-element {
    display: none;
  }
  
  .feed-header {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .moment-list {
    gap: 1.5rem;
  }
  
  .moment-card {
    border-top: 1px solid var(--border-strong);
    padding-top: 1.5rem;
    padding-bottom: 0.5rem;
  }
  
  .card-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
  
  .contact-name {
    font-size: 2rem;
  }
  
  .card-meta {
    font-size: 0.7rem;
    align-items: flex-start;
  }
  
  .card-content {
    font-size: 1rem;
    line-height: 1.7;
  }
  
  .card-actions {
    margin-top: 1.5rem;
  }
  
  .del-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.8rem;
    background: rgba(255, 62, 0, 0.05);
    border: 1px dashed var(--accent);
    color: var(--accent);
  }
  
  .del-btn:active {
    background: var(--accent);
    color: var(--bg-color);
  }
  
  .pagination {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem 0;
    border-top: 2px solid var(--border-strong);
  }
  
  .nav-btn {
    width: 100%;
    border: 1px solid var(--border-strong);
    padding: 1rem;
    font-size: 1.2rem;
  }
  
  .nav-btn:active:not(:disabled) {
    background: var(--text-primary);
    color: var(--bg-color);
  }
  
  .page-indicator {
    order: -1; /* Move indicator above buttons */
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
  }
  
  .empty-state {
    padding: 3rem 0;
    font-size: 1.2rem;
  }
}

/* =========================================
   FOOTER STYLES
   ========================================= */
.site-footer {
  margin-top: 4rem;
  border-top: 2px solid var(--border-strong);
  background-color: var(--text-primary);
  color: var(--bg-color);
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  position: relative;
  overflow: hidden;
}

.footer-top {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

[data-theme='dark'] .footer-top {
}

.footer-brand {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-en {
  font-family: var(--font-display);
  font-size: clamp(2rem, 10vw, 6rem);
  text-transform: uppercase;
  color: var(--accent);
}

.brand-cn {
  font-family: var(--font-title);
  font-size: clamp(1.5rem, 5vw, 3rem);
  font-weight: 700;
  margin-top: -0.2em;
}

.footer-quote {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-style: italic;
  max-width: 400px;
  line-height: 1.8;
  opacity: 0.9;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  opacity: 0.7;
}

.col-title {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
  opacity: 1;
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding-top: 2rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  opacity: 0.6;
}

[data-theme='dark'] .footer-bottom {
}

.footer-decor {
  color: var(--accent);
  animation: pulse 4s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.5); opacity: 1; }
}

@media (min-width: 900px) {
  .site-footer {
    padding: 6rem 3rem;
    gap: 4rem;
  }
  
  .footer-top {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
  }
  
  .footer-quote {
    text-align: right;
    font-size: 1.5rem;
  }
  
  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* =========================================
   GENDER INQUIRY OVERLAY
   ========================================= */
.gender-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-color);
  color: var(--text-primary);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.8s var(--ease-spring), opacity 0.8s var(--ease-smooth);
}

.gender-overlay.hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.gender-overlay-inner {
  text-align: center;
  width: 100%;
  max-width: 1200px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

.gender-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.gender-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 1;
  text-transform: uppercase;
  margin: 0;
  letter-spacing: 0.02em;
}

.gender-title-cn {
  font-family: var(--font-title);
  font-size: clamp(1.2rem, 3vw, 2rem);
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.gender-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.gender-btn {
  background: transparent;
  border: 2px solid var(--border-strong);
  color: var(--text-primary);
  padding: 4rem 2rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  transition: all 0.4s var(--ease-spring);
  position: relative;
  overflow: hidden;
}

.gender-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--text-primary);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.4s var(--ease-spring);
  z-index: -1;
}

.gender-btn:hover {
  color: var(--bg-color);
  transform: translateY(-10px);
  box-shadow: 0 20px 0 var(--border-strong);
}

.gender-btn:hover::before {
  transform: scaleY(1);
}

.gender-en {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.gender-cn {
  font-family: var(--font-title);
  font-size: clamp(4rem, 10vw, 8rem);
  line-height: 1;
}

@media (max-width: 899px) {
  .gender-overlay-inner {
    padding: 1.5rem;
    gap: 2.5rem;
  }

  .gender-title {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .gender-options {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .gender-btn {
    padding: 1.5rem 1rem;
    flex-direction: row;
    justify-content: center;
    gap: 1.5rem;
  }

  .gender-cn {
    font-size: 3rem;
  }

  .gender-en {
    font-size: 1.2rem;
  }
  
  .gender-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 0 var(--border-strong);
  }
}

