:root {
  color-scheme: light;
  --ink: #1c211d;
  --muted: #5d675e;
  --soft: #eef0e7;
  --paper: #fffdf6;
  --paper-deep: #f5f0e2;
  --line: #d8d1bd;
  --red: #b62534;
  --red-deep: #841d28;
  --green: #315f57;
  --gold: #b9872f;
  --shadow: 0 24px 70px rgba(42, 36, 24, 0.15);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(247, 248, 241, 0.84), #eef0e7 58%),
    #eef0e7;
  font-family:
    "Noto Serif SC", "Songti SC", "SimSun", "STSong", Georgia, serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.visual-band {
  position: fixed;
  inset: 0 0 auto 0;
  height: 48vh;
  min-height: 360px;
  background:
    linear-gradient(180deg, rgba(255, 253, 246, 0.18), rgba(238, 240, 231, 0.92)),
    url("./assets/ink-landscape.png") center top / cover no-repeat;
  pointer-events: none;
}

.visual-band::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(49, 95, 87, 0.16), transparent 38%, rgba(182, 37, 52, 0.12)),
    radial-gradient(circle at 83% 18%, rgba(185, 135, 47, 0.22), transparent 18rem);
}

.app-shell {
  position: relative;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 1.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  margin-bottom: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex: 0 0 3rem;
  width: 3rem;
  height: 3rem;
  margin-right: 0.85rem;
  place-items: center;
  color: #fffdf6;
  background: var(--red);
  border: 1px solid rgba(132, 29, 40, 0.38);
  border-radius: 6px;
  box-shadow: 0 14px 30px rgba(132, 29, 40, 0.22);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
}

.brand-kicker,
.brand-title {
  display: block;
  white-space: nowrap;
}

.brand-kicker {
  color: var(--red-deep);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
}

.brand-title {
  margin-top: 0.2rem;
  color: #161915;
  font-size: 1.42rem;
  font-weight: 900;
  line-height: 1.1;
}

.date-chip,
.mode-chip,
.volume-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  color: var(--green);
  background: rgba(255, 253, 246, 0.82);
  border: 1px solid rgba(49, 95, 87, 0.18);
  border-radius: 999px;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
  white-space: nowrap;
}

.date-chip {
  padding: 0 0.95rem;
  box-shadow: 0 10px 28px rgba(42, 36, 24, 0.1);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 21.5rem;
  gap: 1rem;
  align-items: stretch;
}

.quote-reader,
.side-panel {
  border: 1px solid rgba(63, 55, 37, 0.12);
  border-radius: 8px;
  background: rgba(255, 253, 246, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.quote-reader {
  display: flex;
  flex-direction: column;
  min-height: 34rem;
  padding: 2rem;
  overflow: hidden;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mode-chip {
  padding: 0 0.9rem;
  color: var(--paper);
  background: var(--green);
  border-color: rgba(49, 95, 87, 0.25);
}

.volume-chip {
  padding: 0 0.85rem;
}

.quote-block {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 17rem;
  margin: 2.25rem 0 1.5rem;
  padding: 0 0 0 3.5rem;
}

.quote-mark {
  position: absolute;
  left: 0;
  top: -0.85rem;
  color: rgba(182, 37, 52, 0.18);
  font-size: 8rem;
  font-weight: 900;
  line-height: 1;
}

.quote-block p {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 3rem;
  font-weight: 900;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.has-prose-quote .quote-block p {
  font-size: 1.72rem;
  font-weight: 850;
  line-height: 1.78;
}

.has-long-quote .quote-block p {
  font-size: 1.55rem;
}

.source-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.96rem;
  font-weight: 700;
}

.dot {
  width: 0.32rem;
  height: 0.32rem;
  border-radius: 50%;
  background: var(--gold);
}

.reflection {
  margin: 1.4rem 0 0;
  padding-left: 1rem;
  color: #343b35;
  border-left: 3px solid var(--red);
  font-size: 1.15rem;
  line-height: 1.75;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  margin-top: auto;
  padding-top: 2rem;
}

.primary-action,
.ghost-action,
.icon-action,
.text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.1rem;
  border-radius: 7px;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 900;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.primary-action,
.ghost-action {
  gap: 0.5rem;
  padding: 0 1rem;
}

.primary-action {
  color: #fffdf6;
  background: var(--red);
  border: 1px solid var(--red-deep);
  box-shadow: 0 16px 34px rgba(182, 37, 52, 0.25);
}

.ghost-action,
.icon-action,
.text-action {
  color: var(--green);
  background: rgba(255, 253, 246, 0.72);
  border: 1px solid rgba(49, 95, 87, 0.2);
}

.icon-action {
  width: 3.1rem;
  padding: 0;
}

.text-action {
  min-height: 2.35rem;
  padding: 0 0.7rem;
  color: var(--red-deep);
  font-size: 0.88rem;
}

.primary-action:hover,
.ghost-action:hover,
.icon-action:hover,
.text-action:hover {
  transform: translateY(-1px);
}

.primary-action:hover {
  box-shadow: 0 18px 38px rgba(182, 37, 52, 0.3);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.76;
  transform: none;
}

.primary-action:focus-visible,
.ghost-action:focus-visible,
.icon-action:focus-visible,
.text-action:focus-visible {
  outline: 3px solid rgba(185, 135, 47, 0.38);
  outline-offset: 3px;
}

.quote-reader.is-drawing .quote-block p {
  animation: pulseText 260ms ease;
}

@keyframes pulseText {
  0% {
    opacity: 0.55;
    transform: translateY(0.25rem);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.side-panel {
  display: flex;
  flex-direction: column;
  min-height: 34rem;
  padding: 1.3rem;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(63, 55, 37, 0.12);
}

.side-head h2 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.25;
}

.history-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-item {
  border-bottom: 1px solid rgba(63, 55, 37, 0.1);
}

.history-button {
  display: grid;
  width: 100%;
  min-height: 4.25rem;
  padding: 0.85rem 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
}

.history-button strong {
  display: block;
  font-size: 1rem;
  line-height: 1.45;
}

.history-button span {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
}

.history-button:hover strong {
  color: var(--red-deep);
}

.empty-state {
  display: grid;
  flex: 1;
  min-height: 10rem;
  place-items: center;
  color: var(--muted);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 800;
}

.empty-state.is-hidden,
.text-action.is-hidden {
  display: none;
}

.page-foot {
  margin-top: 1.2rem;
  color: rgba(45, 52, 46, 0.7);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 5;
  min-width: 10rem;
  max-width: calc(100% - 2rem);
  padding: 0.8rem 1rem;
  color: #fffdf6;
  background: rgba(28, 33, 29, 0.92);
  border-radius: 7px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0.75rem);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 1.25rem, 42rem);
    padding-top: 1rem;
  }

  .topbar {
    align-items: flex-start;
    margin-bottom: 1rem;
  }

  .brand-mark {
    flex-basis: 2.7rem;
    width: 2.7rem;
    height: 2.7rem;
    margin-right: 0.7rem;
    font-size: 1.3rem;
  }

  .brand-title {
    white-space: normal;
    font-size: 1.18rem;
  }

  .date-chip {
    min-height: 2.15rem;
    padding: 0 0.7rem;
    font-size: 0.84rem;
  }

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

  .quote-reader,
  .side-panel {
    min-height: 0;
  }

  .quote-reader {
    padding: 1.25rem;
  }

  .quote-block {
    min-height: 16rem;
    margin: 1.75rem 0 1rem;
    padding-left: 1.8rem;
  }

  .quote-mark {
    top: -0.45rem;
    font-size: 5.4rem;
  }

  .quote-block p {
    font-size: 2.05rem;
    line-height: 1.45;
  }

  .has-prose-quote .quote-block p {
    font-size: 1.2rem;
    line-height: 1.78;
  }

  .has-long-quote .quote-block p {
    font-size: 1.12rem;
  }

  .reflection {
    font-size: 1rem;
  }

  .action-row {
    display: grid;
    grid-template-columns: 1fr auto;
    padding-top: 1.45rem;
  }

  .primary-action {
    grid-column: 1 / -1;
  }

  .ghost-action {
    justify-content: center;
  }
}

@media (max-width: 430px) {
  .topbar {
    display: grid;
    gap: 0.8rem;
  }

  .date-chip {
    justify-self: start;
  }

  .meta-row {
    align-items: flex-start;
  }

  .volume-chip {
    justify-content: flex-start;
    max-width: 100%;
    white-space: normal;
    text-align: left;
  }

  .quote-block {
    padding-left: 1.3rem;
  }

  .quote-block p {
    font-size: 1.72rem;
  }

  .has-prose-quote .quote-block p {
    font-size: 1.12rem;
  }

  .has-long-quote .quote-block p {
    font-size: 1.04rem;
  }

  .action-row {
    grid-template-columns: 1fr 3.1rem;
  }
}
