/* ============================
   RESET & ROOT
   ============================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0e0d0b;
  --surface: #181612;
  --surface-2: #201e1a;
  --border: rgba(210,190,155,0.1);
  --border-hover: rgba(210,190,155,0.22);
  --text: #e4dac8;
  --text-muted: rgba(228,218,200,0.38);
  --text-dim: rgba(228,218,200,0.6);
  --accent: #c9a96e;
  --accent-dim: rgba(201,169,110,0.15);
  --radius: 12px;
  --font-serif: 'Lora', Georgia, serif;
  --font-sans: 'Inter', system-ui, sans-serif;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  overflow-x: hidden;
}

/* ============================
   HEADER
   ============================ */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 40px;
  flex-shrink: 0;
}

.wordmark {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
  font-style: italic;
}

.dot {
  color: var(--accent);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.streak {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.streak.active {
  color: var(--accent);
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: color 0.2s, background 0.2s;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* ============================
   MAIN VIEW
   ============================ */
#main-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 40px 20px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  gap: 48px;
}

/* ============================
   QUESTION
   ============================ */
.question-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meta {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.question {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text);
  font-style: italic;
}

/* ============================
   ANSWER
   ============================ */
.answer-area {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.3s;
}

.answer-area:focus-within {
  border-color: var(--border-hover);
}

textarea {
  background: none;
  border: none;
  outline: none;
  resize: none;
  width: 100%;
  min-height: 200px;
  padding: 28px 32px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.8;
  color: var(--text);
  caret-color: var(--accent);
}

textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.answer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 32px 14px;
  border-top: 1px solid var(--border);
}

.word-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.save-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: opacity 0.3s;
}

.save-status.saved {
  color: var(--accent);
}

/* ============================
   DAY NAV
   ============================ */
.day-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 32px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  letter-spacing: 0.05em;
  padding: 8px 4px;
  transition: color 0.2s;
}

.nav-btn:hover {
  color: var(--text-dim);
}

.nav-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* ============================
   ARCHIVE VIEW
   ============================ */
#archive-view {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 50;
  overflow-y: auto;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  animation: slideIn 0.3s cubic-bezier(0.22,1,0.36,1);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.archive-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

.archive-header h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text);
}

.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--text);
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

.archive-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s;
}

.archive-item:hover {
  border-color: var(--border-hover);
}

.archive-item-header {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border);
}

.archive-item-date {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.archive-item-question {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text-dim);
  line-height: 1.4;
}

.archive-item-answer {
  padding: 16px 24px 20px;
  font-size: 0.9rem;
  line-height: 1.7;
  font-weight: 300;
  color: var(--text-dim);
  white-space: pre-wrap;
  max-height: 120px;
  overflow: hidden;
  position: relative;
}

.archive-item-answer::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--surface));
}

.archive-empty {
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.8;
  padding: 60px 0;
  max-width: 760px;
  margin: 0 auto;
}

/* ============================
   UTILITY
   ============================ */
.hidden {
  display: none !important;
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 600px) {
  header {
    padding: 20px 24px;
  }

  #main-view {
    padding: 24px 24px 16px;
    gap: 36px;
  }

  textarea {
    padding: 20px 20px;
    min-height: 160px;
  }

  .answer-footer {
    padding: 10px 20px 12px;
  }

  #archive-view {
    padding: 24px;
  }
}

/* ============================
   SCROLLBAR
   ============================ */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
