/* 원격 폰트로 한글 본문과 고정폭 라벨을 구분하고, CSS 변수로 공통 색상을 관리합니다. */
@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Noto+Sans+KR:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --paper: #f5f4ed;
  --ink: #20231e;
  --muted: #77796f;
  --line: #d9d9cf;
  --green: #285e49;
  --lime: #d7e9a6;
  --coral: #c65c42;
  font-family: "Noto Sans KR", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

/* 미세한 점 무늬는 배경에만 적용해 질감을 주면서도 본문 대비를 유지합니다. */
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(#b9b9a9 0.55px, transparent 0.55px);
  background-size: 8px 8px;
}

.page-shell { width: min(100% - 48px, 1120px); min-height: 100vh; margin: 0 auto; display: flex; flex-direction: column; }
/* 상단 내비게이션은 전체 폭, 본문은 읽기 편한 폭으로 제한합니다. */
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.wordmark { color: var(--ink); text-decoration: none; font-size: 19px; font-weight: 800; letter-spacing: 0; }
.wordmark span { color: var(--green); }
.service-status { color: var(--muted); font-size: 12px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin: 0 7px 1px 0; border-radius: 50%; background: #6a9a64; }
.workspace { width: min(100%, 700px); margin: 0 auto; padding: 72px 0 84px; animation: arrive 500ms ease-out both; }
/* 순번과 보조 영문 라벨은 고정폭 글꼴로 표시해 행 간 정렬을 분명히 합니다. */
.eyebrow, .mail-number, .sequence-heading > span, footer { font-family: "DM Mono", monospace; letter-spacing: 0; }
.eyebrow { margin: 0 0 22px; color: var(--green); font-size: 11px; font-weight: 500; }
.eyebrow > span:first-child { padding: 0 5px; color: var(--coral); }
h1 { margin: 0; font-size: clamp(42px, 7vw, 68px); line-height: 1.22; font-weight: 700; letter-spacing: 0; }
h1 em { color: var(--green); font-style: normal; }
.description { max-width: 465px; margin: 20px 0 0; color: #666960; font-size: 15px; line-height: 1.9; }
/* 입력과 전송 버튼을 같은 행에 놓고, 포커스 링으로 키보드 포커스를 드러냅니다. */
.send-form { margin-top: 47px; }
.send-form label { display: block; margin-bottom: 10px; font-size: 13px; font-weight: 700; }
.input-row { display: flex; gap: 10px; }
.input-row input { width: 100%; min-width: 0; height: 56px; padding: 0 17px; border: 1px solid #c8c9bd; border-radius: 3px; outline: none; color: var(--ink); background: rgba(255,255,255,.64); font: inherit; font-size: 15px; transition: border-color 160ms, box-shadow 160ms; }
.input-row input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(40,94,73,.12); }
.input-row input::placeholder { color: #a0a196; }
.input-row button { flex: 0 0 132px; display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 17px; border: 0; border-radius: 3px; color: #fff; background: var(--green); font: inherit; font-weight: 600; cursor: pointer; transition: background 160ms, transform 160ms; }
.input-row button:hover { background: #204b3a; }
.input-row button:active { transform: translateY(1px); }
.input-row button:disabled { cursor: wait; opacity: .68; }
.button-arrow { font-size: 19px; }
.form-message { min-height: 22px; margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.form-message[data-state="error"] { color: var(--coral); }
.form-message[data-state="success"] { color: var(--green); }
/* 서버에서 받은 긴 제목도 줄바꿈되도록 번호와 제목 두 열을 사용합니다. */
.sequence { margin-top: 39px; border-top: 1px solid var(--line); }
.sequence-heading { display: flex; justify-content: space-between; align-items: center; padding: 17px 0 10px; }
.sequence-heading h2 { margin: 0; font-size: 13px; }
.sequence-heading > span { color: var(--muted); font-size: 10px; }
.mail-list { margin: 0; padding: 0; list-style: none; }
.mail-list li { min-height: 49px; display: grid; grid-template-columns: 50px minmax(0, 1fr); align-items: start; gap: 0 12px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.65; animation: arrive 420ms ease-out both; }
.mail-list li:nth-child(2) { animation-delay: 35ms; }
.mail-list li:nth-child(3) { animation-delay: 70ms; }
.mail-list li:nth-child(4) { animation-delay: 105ms; }
.mail-list li:nth-child(5) { animation-delay: 140ms; }
.mail-number { color: var(--coral); font-size: 11px; }
.mail-subject { min-width: 0; overflow-wrap: anywhere; }
.mail-list-message { grid-template-columns: 1fr !important; color: var(--muted); }
footer { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: auto; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
footer span:first-child { color: var(--green); }

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

/* 좁은 화면에서는 폼을 세로로 쌓고 여백과 열 너비를 조정해 가로 넘침을 막습니다. */
@media (max-width: 560px) {
  .page-shell { width: min(100% - 36px, 1120px); }
  .topbar { height: 68px; }
  .workspace { padding: 56px 0 65px; }
  .description { font-size: 14px; }
  .send-form { margin-top: 36px; }
  .input-row { flex-direction: column; }
  .input-row button { flex-basis: 52px; width: 100%; height: 52px; }
  .mail-list li { grid-template-columns: 42px minmax(0, 1fr); gap: 0 8px; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 5px; padding: 12px 0; }
}

/* 사용자가 동작 감소를 설정한 환경에서는 장식 애니메이션을 최소화합니다. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}