:root {
  --bg: #ffffff;
  --fg: #8a3f32;
  --line: #8a3f32;
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  --main-width: min(1100px, calc(100vw - 48px));
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: "Crimson Pro", "Times New Roman", serif;
  padding: 24px;
  overflow-x: hidden;
  position: relative;
}

body.home {
  --main-width: min(860px, calc(100vw - 48px));
  padding-top: 18px;
}

main {
  width: min(1100px, 100%);
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

body.home main {
  width: min(860px, 100%);
}

.home-search {
  margin-bottom: 22px;
  position: relative;
  z-index: 20;
}

.search-label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.2;
  padding: 8px 12px;
}

.search-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(138, 63, 50, 0.18);
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  max-width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  padding: 10px;
  z-index: 30;
}

.search-status {
  margin: 0;
  font-size: 0.96rem;
  opacity: 0.9;
}

.search-results {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  max-height: min(46vh, 360px);
  overflow-y: auto;
  padding-right: 2px;
}

.search-result {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.72);
  transition: background-color 160ms ease, color 160ms ease;
}

.search-result:hover {
  background: var(--fg);
  color: var(--bg);
}

.search-result-title {
  display: block;
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.2;
}

.search-result-meta {
  display: block;
  margin-top: 3px;
  font-size: 0.92rem;
  opacity: 0.9;
}

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

.side-art {
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: clamp(360px, 42vw, 760px);
  height: auto;
  z-index: 1;
  pointer-events: none;
  user-select: none;
  opacity: 0.14;
  mix-blend-mode: multiply;
  filter: saturate(0.7) contrast(0.95);
}

.side-art-left {
  left: max(72px, calc((100vw - var(--main-width)) / 4));
}

.side-art-right {
  left: min(
    calc(100vw - 72px),
    calc(100vw - ((100vw - var(--main-width)) / 4))
  );
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 50px;
}

.tile {
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  cursor: default;
  transition: background-color 180ms ease, color 180ms ease;
  user-select: none;
}

.tile-link {
  cursor: pointer;
}

.tile:hover {
  background: var(--fg);
  color: var(--bg);
}

.en {
  display: block;
  font-size: clamp(1.5rem, 1.8vw, 1.2rem);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 8px;
}

.zh {
  display: block;
  font-size: clamp(1.3rem, 1.5vw, 1.05rem);
  letter-spacing: 0.03em;
}

.page-header {
  margin-bottom: 22px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.8vw, 2.3rem);
  font-weight: 600;
  line-height: 1.15;
}

.subtitle-zh {
  font-size: 0.8em;
  font-weight: 500;
  opacity: 0.9;
  margin-left: 8px;
}

.subtle {
  margin: 8px 0 0;
  font-size: 1.05rem;
  opacity: 0.9;
}

.back-link {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  font-size: 1rem;
  transition: background-color 160ms ease, color 160ms ease;
}

.back-link:hover {
  background: var(--fg);
  color: var(--bg);
}

.entry-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.entry-card {
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
  transition: background-color 160ms ease, color 160ms ease;
}

.entry-card:hover {
  background: var(--fg);
  color: var(--bg);
}

.entry-en {
  display: block;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.22;
}

.entry-zh {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
}

.detail-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-card {
  border: 2px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  padding: 12px;
  min-height: 420px;
}

.detail-card h2 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.detail-head h2 {
  margin: 0;
}

.toggle-btn {
  border: 2px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

.toggle-btn:hover {
  background: var(--fg);
  color: var(--bg);
}

.text-block {
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 1.02rem;
}

.is-hidden {
  display: none;
}

.bottom-quote {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  margin: 0;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  text-align: center;
  color: var(--fg);
  z-index: 0;
  opacity: 0.7;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

.quote-text {
  font-style: italic;
}

.quote-credit {
  display: block;
  margin-top: 4px;
  font-size: clamp(0.85rem, 1.2vw, 1rem);
  opacity: 0.9;
}

@media (max-width: 1000px) {
  .entry-list {
    grid-template-columns: 1fr;
  }

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

  .detail-card {
    min-height: unset;
  }
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .home-search {
    margin-bottom: 16px;
  }

  .side-art {
    width: clamp(220px, 50vw, 420px);
    opacity: 0.1;
  }

  .bottom-quote {
    bottom: 18px;
    max-width: calc(100vw - 24px);
    white-space: normal;
  }
}
