:root {
  color-scheme: light;
  --paper: #f5f1e8;
  --paper-deep: #ece4d5;
  --ink: #2c2b28;
  --muted: #726f68;
  --soft: #aaa39a;
  --line: rgba(64, 58, 49, 0.12);
  --line-strong: rgba(64, 58, 49, 0.2);
  --green: #1cae77;
  --copper: #a36f4d;
  --shadow: rgba(66, 54, 35, 0.1);
  --content: min(980px, calc(100% - 32px));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgba(245, 241, 232, 0.72), rgba(245, 241, 232, 0.72)),
    url("./assets/wool-paper.png") center / 760px repeat;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.72), transparent 32%),
    radial-gradient(circle at 88% 80%, rgba(207, 184, 147, 0.18), transparent 30%);
  pointer-events: none;
}

button,
textarea {
  font: inherit;
}

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

.screen {
  width: var(--content);
  min-height: 100vh;
  margin: 0 auto;
  padding: 10vh 0;
}

.welcome-screen {
  display: grid;
  align-content: center;
  gap: 22px;
}

.paper-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.84), rgba(240, 234, 222, 0.72)),
    url("./assets/wool-paper.png") center / 680px repeat;
  box-shadow:
    0 28px 72px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.welcome-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 42px;
  align-items: center;
  min-height: 310px;
  padding: 58px 64px;
}

.ghost-word {
  position: absolute;
  left: 36px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(44, 43, 40, 0.045);
  font-size: clamp(5rem, 14vw, 10rem);
  font-weight: 850;
  letter-spacing: 0.02em;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.welcome-copy,
.clock-card,
.answer-card > * {
  position: relative;
  z-index: 1;
}

.time-label {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(3rem, 5.8vw, 4.85rem);
  line-height: 1.02;
  font-weight: 860;
  text-wrap: balance;
}

.welcome-body {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1.85;
}

.clock-card {
  display: grid;
  justify-items: end;
  gap: 12px;
  min-width: 150px;
  color: var(--muted);
}

#clockTime {
  color: var(--ink);
  font-size: 2rem;
  font-weight: 850;
  line-height: 1;
}

#clockDate {
  font-size: 0.96rem;
}

.status-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  width: max-content;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink);
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(66, 54, 35, 0.07);
}

.status-pill i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(28, 174, 119, 0.11);
}

.down-link {
  justify-self: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.answer-screen {
  display: grid;
  align-content: center;
}

.answer-card {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 18px 28px;
  padding: 48px;
}

.answer-heading {
  grid-row: span 3;
}

h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: clamp(2.2rem, 4vw, 4rem);
  font-weight: 500;
}

textarea {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink);
  line-height: 1.75;
  padding: 16px 18px;
}

textarea:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(163, 111, 77, 0.1);
}

textarea::placeholder {
  color: var(--soft);
}

.answer-actions {
  display: flex;
  gap: 10px;
}

.primary-button,
.quiet-button {
  min-height: 44px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button {
  min-width: 110px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 760;
}

.quiet-button {
  min-width: 82px;
  background: rgba(255, 255, 255, 0.48);
  color: var(--muted);
}

.primary-button:hover,
.quiet-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(66, 54, 35, 0.08);
}

.answer-output {
  min-height: 122px;
  padding: 22px 0 0 22px;
  border-left: 2px solid var(--copper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: 1.35rem;
  line-height: 1.78;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 760px) {
  :root {
    --content: min(100% - 28px, 980px);
  }

  .screen {
    padding: 7vh 0;
  }

  .welcome-card,
  .answer-card {
    grid-template-columns: 1fr;
    padding: 30px 24px;
  }

  .welcome-card {
    gap: 30px;
    min-height: 520px;
  }

  .clock-card {
    justify-items: start;
  }

  .answer-heading {
    grid-row: auto;
  }

  .ghost-word {
    left: 18px;
    top: 42%;
    font-size: 5.4rem;
  }

  .welcome-body {
    font-size: 1.06rem;
  }

  .answer-output {
    font-size: 1.18rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
  }
}
