:root {
  --ink: #25251f;
  --paper: #f0ecdf;
  --paper-light: #f8f5eb;
  --coral: #c85e47;
  --moss: #64705a;
  --line: rgba(37, 37, 31, 0.22);
  --muted: #777468;
  --display: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --body: "FangSong", "STFangsong", "Noto Serif CJK SC", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 18%, rgba(200, 94, 71, 0.09), transparent 24rem),
    var(--paper);
  font-family: var(--body);
  min-width: 320px;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 4vw;
  padding: 22px 0;
  border-bottom: 1px solid var(--ink);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.masthead p {
  margin: 0;
  color: var(--muted);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  width: 13px;
  height: 13px;
  background: var(--coral);
  border-radius: 50% 50% 3px 50%;
  transform: rotate(-20deg);
}

main {
  overflow: hidden;
}

.intro {
  position: relative;
  display: grid;
  grid-template-columns: minmax(70px, 0.3fr) minmax(380px, 1.25fr) minmax(240px, 0.8fr);
  align-items: center;
  gap: 4vw;
  min-height: 610px;
  padding: 72px 4vw 90px;
}

.issue-mark {
  align-self: end;
  padding-bottom: 6px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 30px;
  font-family: var(--display);
  font-size: clamp(64px, 8vw, 126px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.08em;
}

h1 em {
  position: relative;
  color: var(--coral);
  font-style: normal;
}

h1 em::after {
  content: "";
  position: absolute;
  right: -0.04em;
  bottom: 0.04em;
  left: 0.08em;
  height: 4px;
  background: var(--coral);
  transform: rotate(-1.5deg);
}

.deck {
  width: min(100%, 500px);
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.9;
}

.orbital {
  width: min(28vw, 360px);
  justify-self: center;
  animation: reveal 0.8s 0.2s both ease-out;
}

.orbital svg {
  width: 100%;
  overflow: visible;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
}

.orbital .orbit-dot {
  fill: var(--coral);
  stroke: none;
  transform-origin: 120px 120px;
  animation: orbit 12s linear infinite;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.78fr) minmax(480px, 1.22fr);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.composer-panel,
.messages-panel {
  padding: clamp(38px, 6vw, 86px);
}

.composer-panel {
  position: relative;
  background: var(--ink);
  color: var(--paper-light);
}

.messages-panel {
  background: var(--paper-light);
}

.section-number {
  position: absolute;
  top: 28px;
  right: 30px;
  color: rgba(248, 245, 235, 0.22);
  font-family: var(--display);
  font-size: 70px;
}

.section-heading h2,
.messages-header h2 {
  margin-bottom: 46px;
  font-family: var(--display);
  font-size: clamp(38px, 4vw, 62px);
  font-weight: 500;
  letter-spacing: -0.06em;
}

.field {
  display: block;
  margin-bottom: 32px;
}

.field > span,
.mood-field legend {
  display: block;
  margin-bottom: 11px;
  color: rgba(248, 245, 235, 0.62);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.field input,
.field textarea {
  width: 100%;
  color: var(--paper-light);
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(248, 245, 235, 0.34);
  border-radius: 0;
  outline: none;
  font-size: 17px;
  transition: border-color 180ms ease;
}

.field input {
  padding: 12px 0;
}

.field textarea {
  min-height: 138px;
  padding: 12px 0;
  resize: vertical;
  line-height: 1.7;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--coral);
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(248, 245, 235, 0.28);
}

.message-field {
  position: relative;
}

.message-field small {
  display: block;
  margin-top: 8px;
  color: rgba(248, 245, 235, 0.4);
  font-family: ui-monospace, monospace;
  text-align: right;
}

.mood-field {
  padding: 0;
  margin: 0 0 34px;
  border: 0;
}

.mood-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mood-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mood-options span {
  display: block;
  padding: 8px 15px;
  border: 1px solid rgba(248, 245, 235, 0.28);
  border-radius: 999px;
  color: rgba(248, 245, 235, 0.66);
  cursor: pointer;
  font-size: 13px;
  transition: 160ms ease;
}

.mood-options input:checked + span,
.mood-options input:focus-visible + span {
  color: var(--ink);
  background: var(--paper-light);
  border-color: var(--paper-light);
}

.form-status {
  min-height: 24px;
  margin: -10px 0 15px;
  color: #e5a18f;
  font-size: 13px;
}

.form-status.success {
  color: #b6c5a8;
}

.submit-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  color: var(--ink);
  background: var(--coral);
  border: 1px solid var(--coral);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.08em;
  transition: transform 160ms ease, background 160ms ease;
}

.submit-button:hover {
  background: #d16b53;
  transform: translateY(-2px);
}

.submit-button:active {
  transform: translateY(1px);
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.56;
  transform: none;
}

.submit-button svg,
.refresh-button svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.messages-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.refresh-button:hover {
  color: var(--coral);
}

.refresh-button.loading svg {
  animation: spin 0.8s linear infinite;
}

.messages {
  display: grid;
  gap: 0;
}

.message-card {
  position: relative;
  padding: 30px 0 34px;
  border-top: 1px solid var(--line);
  animation: reveal 0.5s both ease-out;
}

.message-card:first-child {
  border-top-color: var(--ink);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-meta time {
  margin-left: auto;
}

.mood-dot {
  width: 8px;
  height: 8px;
  background: var(--mood-color, var(--moss));
  border-radius: 50%;
}

.message-card blockquote {
  margin: 24px 0 20px;
  font-family: var(--display);
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.55;
}

.message-author {
  margin: 0;
  color: var(--coral);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.message-author::before {
  content: "— ";
}

.empty-state,
.error-state {
  padding: 72px 20px;
  border-top: 1px solid var(--ink);
  text-align: center;
}

.empty-state strong,
.error-state strong {
  display: block;
  margin-bottom: 12px;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 500;
}

.empty-state p,
.error-state p {
  color: var(--muted);
  line-height: 1.7;
}

.error-state button {
  padding: 10px 16px;
  color: var(--paper-light);
  background: var(--ink);
  border: 0;
  cursor: pointer;
}

.skeleton-card {
  display: grid;
  gap: 14px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
}

.skeleton-card i {
  display: block;
  height: 12px;
  background: linear-gradient(90deg, #e5e0d3, #f3efe4, #e5e0d3);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}

.skeleton-card i:nth-child(1) { width: 25%; }
.skeleton-card i:nth-child(2) { width: 83%; height: 28px; }
.skeleton-card i:nth-child(3) { width: 38%; }

footer {
  display: flex;
  justify-content: space-between;
  padding: 32px 4vw;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

footer p {
  margin: 0;
}

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

@keyframes orbit {
  to { transform: rotate(360deg); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

@media (max-width: 900px) {
  .intro {
    grid-template-columns: 36px 1fr;
    min-height: auto;
    padding-top: 80px;
  }

  .orbital {
    position: absolute;
    top: 46px;
    right: -70px;
    width: 220px;
    opacity: 0.32;
  }

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

  .messages-panel {
    min-height: 600px;
  }
}

@media (max-width: 600px) {
  .masthead {
    margin: 0 20px;
  }

  .masthead p,
  .issue-mark {
    display: none;
  }

  .intro {
    display: block;
    padding: 74px 20px 72px;
  }

  h1 {
    font-size: clamp(58px, 19vw, 86px);
  }

  .deck {
    font-size: 15px;
  }

  .composer-panel,
  .messages-panel {
    padding: 48px 20px;
  }

  .section-number {
    font-size: 48px;
  }

  .section-heading h2,
  .messages-header h2 {
    margin-bottom: 34px;
  }

  .message-card blockquote {
    font-size: 23px;
  }

  footer {
    gap: 15px;
    padding: 28px 20px;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

